diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 0a5ed83d..a8d55bab 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -4,6 +4,8 @@ api/openapi.yaml build.gradle build.sbt docs/AccountStatistics.md +docs/AdditionalDenialReason.md +docs/Address.md docs/AnswerCallback.md docs/BridgeCompleteCallback.md docs/BridgeTargetCompleteCallback.md @@ -31,6 +33,7 @@ docs/ConferenceRecordingMetadata.md docs/ConferenceRedirectCallback.md docs/ConferenceStateEnum.md docs/ConferencesApi.md +docs/Contact.md docs/CreateCall.md docs/CreateCallResponse.md docs/CreateLookupResponse.md @@ -39,10 +42,13 @@ docs/DeferredResult.md docs/DisconnectCallback.md docs/Diversion.md docs/DtmfCallback.md +docs/Error.md +docs/FailureWebhook.md docs/FieldError.md docs/FileFormatEnum.md docs/GatherCallback.md docs/InitiateCallback.md +docs/LinksObject.md docs/ListMessageDirectionEnum.md docs/ListMessageItem.md docs/LookupRequest.md @@ -70,6 +76,7 @@ docs/MfaApi.md docs/MfaForbiddenRequestError.md docs/MfaRequestError.md docs/MfaUnauthorizedRequestError.md +docs/OptInWorkflow.md docs/PageInfo.md docs/PhoneNumberLookupApi.md docs/PriorityEnum.md @@ -84,7 +91,16 @@ docs/RedirectMethodEnum.md docs/StatisticsApi.md docs/StirShaken.md docs/Tag.md +docs/TelephoneNumber.md +docs/TfvBasicAuthentication.md +docs/TfvCallbackStatusEnum.md +docs/TfvError.md +docs/TfvStatus.md +docs/TfvStatusEnum.md +docs/TfvSubmissionInfo.md +docs/TfvSubmissionWrapper.md docs/TnLookupRequestError.md +docs/TollFreeVerificationApi.md docs/TranscribeRecording.md docs/Transcription.md docs/TranscriptionAvailableCallback.md @@ -96,10 +112,19 @@ docs/UpdateCall.md docs/UpdateCallRecording.md docs/UpdateConference.md docs/UpdateConferenceMember.md +docs/VerificationDenialWebhook.md +docs/VerificationRequest.md +docs/VerificationUpdateRequest.md +docs/VerificationWebhook.md docs/VerifyCodeRequest.md docs/VerifyCodeResponse.md docs/VoiceApiError.md docs/VoiceCodeResponse.md +docs/WebhookSubscription.md +docs/WebhookSubscriptionBasicAuthentication.md +docs/WebhookSubscriptionRequestSchema.md +docs/WebhookSubscriptionTypeEnum.md +docs/WebhookSubscriptionsListBody.md git_push.sh gradle.properties gradle/wrapper/gradle-wrapper.jar @@ -130,6 +155,7 @@ src/main/java/com/bandwidth/sdk/api/MfaApi.java src/main/java/com/bandwidth/sdk/api/PhoneNumberLookupApi.java src/main/java/com/bandwidth/sdk/api/RecordingsApi.java src/main/java/com/bandwidth/sdk/api/StatisticsApi.java +src/main/java/com/bandwidth/sdk/api/TollFreeVerificationApi.java src/main/java/com/bandwidth/sdk/api/TranscriptionsApi.java src/main/java/com/bandwidth/sdk/auth/ApiKeyAuth.java src/main/java/com/bandwidth/sdk/auth/Authentication.java @@ -137,6 +163,8 @@ src/main/java/com/bandwidth/sdk/auth/HttpBasicAuth.java src/main/java/com/bandwidth/sdk/auth/HttpBearerAuth.java src/main/java/com/bandwidth/sdk/model/AbstractOpenApiSchema.java src/main/java/com/bandwidth/sdk/model/AccountStatistics.java +src/main/java/com/bandwidth/sdk/model/AdditionalDenialReason.java +src/main/java/com/bandwidth/sdk/model/Address.java src/main/java/com/bandwidth/sdk/model/AnswerCallback.java src/main/java/com/bandwidth/sdk/model/BridgeCompleteCallback.java src/main/java/com/bandwidth/sdk/model/BridgeTargetCompleteCallback.java @@ -162,6 +190,7 @@ src/main/java/com/bandwidth/sdk/model/ConferenceRecordingAvailableCallback.java src/main/java/com/bandwidth/sdk/model/ConferenceRecordingMetadata.java src/main/java/com/bandwidth/sdk/model/ConferenceRedirectCallback.java src/main/java/com/bandwidth/sdk/model/ConferenceStateEnum.java +src/main/java/com/bandwidth/sdk/model/Contact.java src/main/java/com/bandwidth/sdk/model/CreateCall.java src/main/java/com/bandwidth/sdk/model/CreateCallResponse.java src/main/java/com/bandwidth/sdk/model/CreateLookupResponse.java @@ -170,10 +199,13 @@ src/main/java/com/bandwidth/sdk/model/DeferredResult.java src/main/java/com/bandwidth/sdk/model/DisconnectCallback.java src/main/java/com/bandwidth/sdk/model/Diversion.java src/main/java/com/bandwidth/sdk/model/DtmfCallback.java +src/main/java/com/bandwidth/sdk/model/Error.java +src/main/java/com/bandwidth/sdk/model/FailureWebhook.java src/main/java/com/bandwidth/sdk/model/FieldError.java src/main/java/com/bandwidth/sdk/model/FileFormatEnum.java src/main/java/com/bandwidth/sdk/model/GatherCallback.java src/main/java/com/bandwidth/sdk/model/InitiateCallback.java +src/main/java/com/bandwidth/sdk/model/LinksObject.java src/main/java/com/bandwidth/sdk/model/ListMessageDirectionEnum.java src/main/java/com/bandwidth/sdk/model/ListMessageItem.java src/main/java/com/bandwidth/sdk/model/LookupRequest.java @@ -198,6 +230,7 @@ src/main/java/com/bandwidth/sdk/model/MessagingRequestError.java src/main/java/com/bandwidth/sdk/model/MfaForbiddenRequestError.java src/main/java/com/bandwidth/sdk/model/MfaRequestError.java src/main/java/com/bandwidth/sdk/model/MfaUnauthorizedRequestError.java +src/main/java/com/bandwidth/sdk/model/OptInWorkflow.java src/main/java/com/bandwidth/sdk/model/PageInfo.java src/main/java/com/bandwidth/sdk/model/PriorityEnum.java src/main/java/com/bandwidth/sdk/model/RecordingAvailableCallback.java @@ -209,6 +242,14 @@ src/main/java/com/bandwidth/sdk/model/RedirectCallback.java src/main/java/com/bandwidth/sdk/model/RedirectMethodEnum.java src/main/java/com/bandwidth/sdk/model/StirShaken.java src/main/java/com/bandwidth/sdk/model/Tag.java +src/main/java/com/bandwidth/sdk/model/TelephoneNumber.java +src/main/java/com/bandwidth/sdk/model/TfvBasicAuthentication.java +src/main/java/com/bandwidth/sdk/model/TfvCallbackStatusEnum.java +src/main/java/com/bandwidth/sdk/model/TfvError.java +src/main/java/com/bandwidth/sdk/model/TfvStatus.java +src/main/java/com/bandwidth/sdk/model/TfvStatusEnum.java +src/main/java/com/bandwidth/sdk/model/TfvSubmissionInfo.java +src/main/java/com/bandwidth/sdk/model/TfvSubmissionWrapper.java src/main/java/com/bandwidth/sdk/model/TnLookupRequestError.java src/main/java/com/bandwidth/sdk/model/TranscribeRecording.java src/main/java/com/bandwidth/sdk/model/Transcription.java @@ -220,7 +261,16 @@ src/main/java/com/bandwidth/sdk/model/UpdateCall.java src/main/java/com/bandwidth/sdk/model/UpdateCallRecording.java src/main/java/com/bandwidth/sdk/model/UpdateConference.java src/main/java/com/bandwidth/sdk/model/UpdateConferenceMember.java +src/main/java/com/bandwidth/sdk/model/VerificationDenialWebhook.java +src/main/java/com/bandwidth/sdk/model/VerificationRequest.java +src/main/java/com/bandwidth/sdk/model/VerificationUpdateRequest.java +src/main/java/com/bandwidth/sdk/model/VerificationWebhook.java src/main/java/com/bandwidth/sdk/model/VerifyCodeRequest.java src/main/java/com/bandwidth/sdk/model/VerifyCodeResponse.java src/main/java/com/bandwidth/sdk/model/VoiceApiError.java src/main/java/com/bandwidth/sdk/model/VoiceCodeResponse.java +src/main/java/com/bandwidth/sdk/model/WebhookSubscription.java +src/main/java/com/bandwidth/sdk/model/WebhookSubscriptionBasicAuthentication.java +src/main/java/com/bandwidth/sdk/model/WebhookSubscriptionRequestSchema.java +src/main/java/com/bandwidth/sdk/model/WebhookSubscriptionTypeEnum.java +src/main/java/com/bandwidth/sdk/model/WebhookSubscriptionsListBody.java diff --git a/README.md b/README.md index 4af7c59a..2cba1c56 100644 --- a/README.md +++ b/README.md @@ -158,6 +158,14 @@ Class | Method | HTTP request | Description *RecordingsApi* | [**transcribeCallRecording**](docs/RecordingsApi.md#transcribeCallRecording) | **POST** /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription | Create Transcription Request *RecordingsApi* | [**updateCallRecordingState**](docs/RecordingsApi.md#updateCallRecordingState) | **PUT** /accounts/{accountId}/calls/{callId}/recording | Update Recording *StatisticsApi* | [**getStatistics**](docs/StatisticsApi.md#getStatistics) | **GET** /accounts/{accountId}/statistics | Get Account Statistics +*TollFreeVerificationApi* | [**createWebhookSubscription**](docs/TollFreeVerificationApi.md#createWebhookSubscription) | **POST** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions | Create Webhook Subscription +*TollFreeVerificationApi* | [**deleteWebhookSubscription**](docs/TollFreeVerificationApi.md#deleteWebhookSubscription) | **DELETE** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id} | Delete Webhook Subscription +*TollFreeVerificationApi* | [**getTollFreeVerificationStatus**](docs/TollFreeVerificationApi.md#getTollFreeVerificationStatus) | **GET** /accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification | Get Toll-Free Verification Status +*TollFreeVerificationApi* | [**listTollFreeUseCases**](docs/TollFreeVerificationApi.md#listTollFreeUseCases) | **GET** /tollFreeVerification/useCases | List Toll-Free Use Cases +*TollFreeVerificationApi* | [**listWebhookSubscriptions**](docs/TollFreeVerificationApi.md#listWebhookSubscriptions) | **GET** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions | List Webhook Subscriptions +*TollFreeVerificationApi* | [**requestTollFreeVerification**](docs/TollFreeVerificationApi.md#requestTollFreeVerification) | **POST** /accounts/{accountId}/tollFreeVerification | Request Toll-Free Verification +*TollFreeVerificationApi* | [**updateTollFreeVerificationRequest**](docs/TollFreeVerificationApi.md#updateTollFreeVerificationRequest) | **PUT** /accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification | Update Toll-Free Verification Request +*TollFreeVerificationApi* | [**updateWebhookSubscription**](docs/TollFreeVerificationApi.md#updateWebhookSubscription) | **PUT** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id} | Update Webhook Subscription *TranscriptionsApi* | [**deleteRealTimeTranscription**](docs/TranscriptionsApi.md#deleteRealTimeTranscription) | **DELETE** /accounts/{accountId}/calls/{callId}/transcriptions/{transcriptionId} | Delete a specific transcription *TranscriptionsApi* | [**getRealTimeTranscription**](docs/TranscriptionsApi.md#getRealTimeTranscription) | **GET** /accounts/{accountId}/calls/{callId}/transcriptions/{transcriptionId} | Retrieve a specific transcription *TranscriptionsApi* | [**listRealTimeTranscriptions**](docs/TranscriptionsApi.md#listRealTimeTranscriptions) | **GET** /accounts/{accountId}/calls/{callId}/transcriptions | Enumerate transcriptions made with StartTranscription @@ -166,6 +174,8 @@ Class | Method | HTTP request | Description ## Documentation for Models - [AccountStatistics](docs/AccountStatistics.md) + - [AdditionalDenialReason](docs/AdditionalDenialReason.md) + - [Address](docs/Address.md) - [AnswerCallback](docs/AnswerCallback.md) - [BridgeCompleteCallback](docs/BridgeCompleteCallback.md) - [BridgeTargetCompleteCallback](docs/BridgeTargetCompleteCallback.md) @@ -191,6 +201,7 @@ Class | Method | HTTP request | Description - [ConferenceRecordingMetadata](docs/ConferenceRecordingMetadata.md) - [ConferenceRedirectCallback](docs/ConferenceRedirectCallback.md) - [ConferenceStateEnum](docs/ConferenceStateEnum.md) + - [Contact](docs/Contact.md) - [CreateCall](docs/CreateCall.md) - [CreateCallResponse](docs/CreateCallResponse.md) - [CreateLookupResponse](docs/CreateLookupResponse.md) @@ -199,10 +210,13 @@ Class | Method | HTTP request | Description - [DisconnectCallback](docs/DisconnectCallback.md) - [Diversion](docs/Diversion.md) - [DtmfCallback](docs/DtmfCallback.md) + - [Error](docs/Error.md) + - [FailureWebhook](docs/FailureWebhook.md) - [FieldError](docs/FieldError.md) - [FileFormatEnum](docs/FileFormatEnum.md) - [GatherCallback](docs/GatherCallback.md) - [InitiateCallback](docs/InitiateCallback.md) + - [LinksObject](docs/LinksObject.md) - [ListMessageDirectionEnum](docs/ListMessageDirectionEnum.md) - [ListMessageItem](docs/ListMessageItem.md) - [LookupRequest](docs/LookupRequest.md) @@ -227,6 +241,7 @@ Class | Method | HTTP request | Description - [MfaForbiddenRequestError](docs/MfaForbiddenRequestError.md) - [MfaRequestError](docs/MfaRequestError.md) - [MfaUnauthorizedRequestError](docs/MfaUnauthorizedRequestError.md) + - [OptInWorkflow](docs/OptInWorkflow.md) - [PageInfo](docs/PageInfo.md) - [PriorityEnum](docs/PriorityEnum.md) - [RecordingAvailableCallback](docs/RecordingAvailableCallback.md) @@ -238,6 +253,14 @@ Class | Method | HTTP request | Description - [RedirectMethodEnum](docs/RedirectMethodEnum.md) - [StirShaken](docs/StirShaken.md) - [Tag](docs/Tag.md) + - [TelephoneNumber](docs/TelephoneNumber.md) + - [TfvBasicAuthentication](docs/TfvBasicAuthentication.md) + - [TfvCallbackStatusEnum](docs/TfvCallbackStatusEnum.md) + - [TfvError](docs/TfvError.md) + - [TfvStatus](docs/TfvStatus.md) + - [TfvStatusEnum](docs/TfvStatusEnum.md) + - [TfvSubmissionInfo](docs/TfvSubmissionInfo.md) + - [TfvSubmissionWrapper](docs/TfvSubmissionWrapper.md) - [TnLookupRequestError](docs/TnLookupRequestError.md) - [TranscribeRecording](docs/TranscribeRecording.md) - [Transcription](docs/Transcription.md) @@ -249,10 +272,19 @@ Class | Method | HTTP request | Description - [UpdateCallRecording](docs/UpdateCallRecording.md) - [UpdateConference](docs/UpdateConference.md) - [UpdateConferenceMember](docs/UpdateConferenceMember.md) + - [VerificationDenialWebhook](docs/VerificationDenialWebhook.md) + - [VerificationRequest](docs/VerificationRequest.md) + - [VerificationUpdateRequest](docs/VerificationUpdateRequest.md) + - [VerificationWebhook](docs/VerificationWebhook.md) - [VerifyCodeRequest](docs/VerifyCodeRequest.md) - [VerifyCodeResponse](docs/VerifyCodeResponse.md) - [VoiceApiError](docs/VoiceApiError.md) - [VoiceCodeResponse](docs/VoiceCodeResponse.md) + - [WebhookSubscription](docs/WebhookSubscription.md) + - [WebhookSubscriptionBasicAuthentication](docs/WebhookSubscriptionBasicAuthentication.md) + - [WebhookSubscriptionRequestSchema](docs/WebhookSubscriptionRequestSchema.md) + - [WebhookSubscriptionTypeEnum](docs/WebhookSubscriptionTypeEnum.md) + - [WebhookSubscriptionsListBody](docs/WebhookSubscriptionsListBody.md) diff --git a/api/openapi.yaml b/api/openapi.yaml index 17670371..34b06e36 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -21,6 +21,7 @@ tags: - name: Transcriptions - name: MFA - name: Phone Number Lookup +- name: Toll-Free Verification paths: /users/{accountId}/media: get: @@ -4636,6 +4637,829 @@ paths: servers: - description: Production url: https://numbers.bandwidth.com/api/v1 + /accounts/{accountId}/tollFreeVerification: + post: + callbacks: + tfVerificationStatus: + $ref: '#/components/callbacks/tfVerificationStatus' + description: Submit a request for verification of a toll-free phone number. + operationId: requestTollFreeVerification + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + requestBody: + $ref: '#/components/requestBodies/requestTollFreeVerificationRequest' + responses: + "202": + description: Accepted + "400": + content: + application/json: + 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. + schema: + $ref: '#/components/schemas/tfvError' + description: Bad Request + "401": + content: + application/json: + example: + description: Client is providing incorrect or invalid credentials. + type: unauthorized + schema: + $ref: '#/components/schemas/tfvError' + description: Unauthorized + "403": + content: + application/json: + example: + description: Client is not authorized for the action. + type: forbidden + schema: + $ref: '#/components/schemas/tfvError' + description: Forbidden + "405": + content: + application/json: + example: + description: Method is not allowed. + type: Method Not Allowed + schema: + $ref: '#/components/schemas/tfvError' + description: Method Not Allowed + "429": + content: + application/json: + example: + description: Throttling error. Too many requests. + type: Too Many Requests + schema: + $ref: '#/components/schemas/tfvError' + description: Too Many Requests + "500": + content: + application/json: + example: + description: Internal Server Error. + type: Internal Server Error + schema: + $ref: '#/components/schemas/tfvError' + description: Internal Server Error + "503": + content: + application/json: + example: + description: Service Unavailable Error. + type: Service Unavailable + schema: + $ref: '#/components/schemas/tfvError' + description: Service Unavailable + summary: Request Toll-Free Verification + tags: + - Toll-Free Verification + x-content-type: application/json + x-accepts: + - application/json + servers: + - description: Production + url: https://api.bandwidth.com/api/v2 + /accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification: + get: + 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: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + - description: Valid Toll-Free telephone number in E.164 format. + example: "+18885555555" + explode: false + in: path + name: phoneNumber + required: true + schema: + $ref: '#/components/schemas/tfPhoneNumber' + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/tfvStatus' + description: OK + "400": + content: + application/json: + example: + description: Cannot process request. + type: bad request + schema: + $ref: '#/components/schemas/tfvError' + description: Bad Request + "401": + content: + application/json: + example: + description: Client is providing incorrect or invalid credentials. + type: unauthorized + schema: + $ref: '#/components/schemas/tfvError' + description: Unauthorized + "403": + content: + application/json: + example: + description: Client is not authorized for the action. + type: forbidden + schema: + $ref: '#/components/schemas/tfvError' + description: Forbidden + "404": + content: + application/json: + example: + description: Cannot find the requested resource. + type: Not Found + schema: + $ref: '#/components/schemas/tfvError' + description: Cannot find the requested resource. + "405": + content: + application/json: + example: + description: Method is not allowed. + type: Method Not Allowed + schema: + $ref: '#/components/schemas/tfvError' + description: Method Not Allowed + "429": + content: + application/json: + example: + description: Throttling error. Too many requests. + type: Too Many Requests + schema: + $ref: '#/components/schemas/tfvError' + description: Too Many Requests + "500": + content: + application/json: + example: + description: Internal Server Error. + type: Internal Server Error + schema: + $ref: '#/components/schemas/tfvError' + description: Internal Server Error + "503": + content: + application/json: + example: + description: Service Unavailable Error. + type: Service Unavailable + schema: + $ref: '#/components/schemas/tfvError' + description: Service Unavailable + summary: Get Toll-Free Verification Status + tags: + - Toll-Free Verification + x-accepts: + - application/json + put: + callbacks: + tfVerificationStatus: + $ref: '#/components/callbacks/tfVerificationStatus' + 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: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + - description: Valid Toll-Free telephone number in E.164 format. + example: "+18885555555" + explode: false + in: path + name: phoneNumber + required: true + schema: + $ref: '#/components/schemas/tfPhoneNumber' + style: simple + requestBody: + $ref: '#/components/requestBodies/updateTollFreeVerificationRequestRequest' + responses: + "202": + description: Accepted + "400": + content: + application/json: + 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. + schema: + $ref: '#/components/schemas/tfvError' + description: Bad Request + "401": + content: + application/json: + example: + description: Client is providing incorrect or invalid credentials. + type: unauthorized + schema: + $ref: '#/components/schemas/tfvError' + description: Unauthorized + "403": + content: + application/json: + example: + description: Client is not authorized for the action. + type: forbidden + schema: + $ref: '#/components/schemas/tfvError' + description: Forbidden + "405": + content: + application/json: + example: + description: Method is not allowed. + type: Method Not Allowed + schema: + $ref: '#/components/schemas/tfvError' + description: Method Not Allowed + "429": + content: + application/json: + example: + description: Throttling error. Too many requests. + type: Too Many Requests + schema: + $ref: '#/components/schemas/tfvError' + description: Too Many Requests + "500": + content: + application/json: + example: + description: Internal Server Error. + type: Internal Server Error + schema: + $ref: '#/components/schemas/tfvError' + description: Internal Server Error + "503": + content: + application/json: + example: + description: Service Unavailable Error. + type: Service Unavailable + schema: + $ref: '#/components/schemas/tfvError' + description: Service Unavailable + summary: Update Toll-Free Verification Request + tags: + - Toll-Free Verification + x-content-type: application/json + x-accepts: + - application/json + servers: + - description: Production + url: https://api.bandwidth.com/api/v2 + /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions: + get: + 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: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/webhookSubscriptionsListBody' + description: OK + "400": + content: + application/json: + 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. + schema: + $ref: '#/components/schemas/tfvError' + description: Bad Request + "401": + content: + application/json: + example: + description: Client is providing incorrect or invalid credentials. + type: unauthorized + schema: + $ref: '#/components/schemas/tfvError' + description: Unauthorized + "403": + content: + application/json: + example: + description: Client is not authorized for the action. + type: forbidden + schema: + $ref: '#/components/schemas/tfvError' + description: Forbidden + "405": + content: + application/json: + example: + description: Method is not allowed. + type: Method Not Allowed + schema: + $ref: '#/components/schemas/tfvError' + description: Method Not Allowed + "429": + content: + application/json: + example: + description: Throttling error. Too many requests. + type: Too Many Requests + schema: + $ref: '#/components/schemas/tfvError' + description: Too Many Requests + "500": + content: + application/json: + example: + description: Internal Server Error. + type: Internal Server Error + schema: + $ref: '#/components/schemas/tfvError' + description: Internal Server Error + "503": + content: + application/json: + example: + description: Service Unavailable Error. + type: Service Unavailable + schema: + $ref: '#/components/schemas/tfvError' + description: Service Unavailable + summary: List Webhook Subscriptions + tags: + - Toll-Free Verification + x-accepts: + - application/json + post: + 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: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + requestBody: + $ref: '#/components/requestBodies/webhookSubscriptionRequest' + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/webhookSubscription' + description: Created + "400": + content: + application/json: + example: + description: Cannot process request. + type: bad request + schema: + $ref: '#/components/schemas/tfvError' + description: Bad Request + "401": + content: + application/json: + example: + description: Client is providing incorrect or invalid credentials. + type: unauthorized + schema: + $ref: '#/components/schemas/tfvError' + description: Unauthorized + "403": + content: + application/json: + example: + description: Client is not authorized for the action. + type: forbidden + schema: + $ref: '#/components/schemas/tfvError' + description: Forbidden + "404": + content: + application/json: + example: + description: Cannot find the requested resource. + type: Not Found + schema: + $ref: '#/components/schemas/tfvError' + description: Cannot find the requested resource. + "405": + content: + application/json: + example: + description: Method is not allowed. + type: Method Not Allowed + schema: + $ref: '#/components/schemas/tfvError' + description: Method Not Allowed + "429": + content: + application/json: + example: + description: Throttling error. Too many requests. + type: Too Many Requests + schema: + $ref: '#/components/schemas/tfvError' + description: Too Many Requests + "500": + content: + application/json: + example: + description: Internal Server Error. + type: Internal Server Error + schema: + $ref: '#/components/schemas/tfvError' + description: Internal Server Error + "503": + content: + application/json: + example: + description: Service Unavailable Error. + type: Service Unavailable + schema: + $ref: '#/components/schemas/tfvError' + description: Service Unavailable + summary: Create Webhook Subscription + tags: + - Toll-Free Verification + x-content-type: application/json + x-accepts: + - application/json + servers: + - description: Production + url: https://api.bandwidth.com/api/v2 + /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id}: + delete: + description: Delete a webhook subscription by ID. + operationId: deleteWebhookSubscription + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + - description: Webhook subscription ID + example: 7bt57JcsVYJrN9K1OcV1Nu + explode: false + in: path + name: id + required: true + schema: + type: string + style: simple + responses: + "204": + description: No Content + "400": + content: + application/json: + example: + description: Cannot process request. + type: bad request + schema: + $ref: '#/components/schemas/tfvError' + description: Bad Request + "401": + content: + application/json: + example: + description: Client is providing incorrect or invalid credentials. + type: unauthorized + schema: + $ref: '#/components/schemas/tfvError' + description: Unauthorized + "403": + content: + application/json: + example: + description: Client is not authorized for the action. + type: forbidden + schema: + $ref: '#/components/schemas/tfvError' + description: Forbidden + "404": + content: + application/json: + example: + description: Cannot find the requested resource. + type: Not Found + schema: + $ref: '#/components/schemas/tfvError' + description: Cannot find the requested resource. + "405": + content: + application/json: + example: + description: Method is not allowed. + type: Method Not Allowed + schema: + $ref: '#/components/schemas/tfvError' + description: Method Not Allowed + "429": + content: + application/json: + example: + description: Throttling error. Too many requests. + type: Too Many Requests + schema: + $ref: '#/components/schemas/tfvError' + description: Too Many Requests + "500": + content: + application/json: + example: + description: Internal Server Error. + type: Internal Server Error + schema: + $ref: '#/components/schemas/tfvError' + description: Internal Server Error + "503": + content: + application/json: + example: + description: Service Unavailable Error. + type: Service Unavailable + schema: + $ref: '#/components/schemas/tfvError' + description: Service Unavailable + summary: Delete Webhook Subscription + tags: + - Toll-Free Verification + x-accepts: + - application/json + put: + description: Update an existing webhook subscription (`callbackUrl` and `basicAuthentication` + can be updated). + operationId: updateWebhookSubscription + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + - description: Webhook subscription ID + example: 7bt57JcsVYJrN9K1OcV1Nu + explode: false + in: path + name: id + required: true + schema: + type: string + style: simple + requestBody: + $ref: '#/components/requestBodies/webhookSubscriptionRequest' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/webhookSubscription' + description: OK + "400": + content: + application/json: + example: + description: Cannot process request. + type: bad request + schema: + $ref: '#/components/schemas/tfvError' + description: Bad Request + "401": + content: + application/json: + example: + description: Client is providing incorrect or invalid credentials. + type: unauthorized + schema: + $ref: '#/components/schemas/tfvError' + description: Unauthorized + "403": + content: + application/json: + example: + description: Client is not authorized for the action. + type: forbidden + schema: + $ref: '#/components/schemas/tfvError' + description: Forbidden + "404": + content: + application/json: + example: + description: Cannot find the requested resource. + type: Not Found + schema: + $ref: '#/components/schemas/tfvError' + description: Cannot find the requested resource. + "405": + content: + application/json: + example: + description: Method is not allowed. + type: Method Not Allowed + schema: + $ref: '#/components/schemas/tfvError' + description: Method Not Allowed + "429": + content: + application/json: + example: + description: Throttling error. Too many requests. + type: Too Many Requests + schema: + $ref: '#/components/schemas/tfvError' + description: Too Many Requests + "500": + content: + application/json: + example: + description: Internal Server Error. + type: Internal Server Error + schema: + $ref: '#/components/schemas/tfvError' + description: Internal Server Error + "503": + content: + application/json: + example: + description: Service Unavailable Error. + type: Service Unavailable + schema: + $ref: '#/components/schemas/tfvError' + description: Service Unavailable + summary: Update Webhook Subscription + tags: + - Toll-Free Verification + x-content-type: application/json + x-accepts: + - application/json + servers: + - description: Production + url: https://api.bandwidth.com/api/v2 + /tollFreeVerification/useCases: + get: + description: Lists valid toll-free use cases. + operationId: listTollFreeUseCases + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/useCases' + description: OK + "400": + content: + application/json: + example: + description: Cannot process request. + type: bad request + schema: + $ref: '#/components/schemas/tfvError' + description: Bad Request + "401": + content: + application/json: + example: + description: Client is providing incorrect or invalid credentials. + type: unauthorized + schema: + $ref: '#/components/schemas/tfvError' + description: Unauthorized + "403": + content: + application/json: + example: + description: Client is not authorized for the action. + type: forbidden + schema: + $ref: '#/components/schemas/tfvError' + description: Forbidden + "404": + content: + application/json: + example: + description: Cannot find the requested resource. + type: Not Found + schema: + $ref: '#/components/schemas/tfvError' + description: Cannot find the requested resource. + "405": + content: + application/json: + example: + description: Method is not allowed. + type: Method Not Allowed + schema: + $ref: '#/components/schemas/tfvError' + description: Method Not Allowed + "429": + content: + application/json: + example: + description: Throttling error. Too many requests. + type: Too Many Requests + schema: + $ref: '#/components/schemas/tfvError' + description: Too Many Requests + "500": + content: + application/json: + example: + description: Internal Server Error. + type: Internal Server Error + schema: + $ref: '#/components/schemas/tfvError' + description: Internal Server Error + "503": + content: + application/json: + example: + description: Service Unavailable Error. + type: Service Unavailable + schema: + $ref: '#/components/schemas/tfvError' + description: Service Unavailable + summary: List Toll-Free Use Cases + tags: + - Toll-Free Verification + x-accepts: + - application/json + servers: + - description: Production + url: https://api.bandwidth.com/api/v2 components: callbacks: inboundCallback: @@ -4684,6 +5508,102 @@ components: responses: "200": description: OK + tfVerificationStatus: + your_url.com/webhookService: + post: + 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 + explode: false + in: header + name: x-bandwidth-signature-hmac-sha256 + required: false + schema: + type: string + style: simple + requestBody: + $ref: '#/components/requestBodies/verificationWebhookRequest' + responses: + "204": + description: No Content + "400": + content: + application/json: + example: + description: Cannot process request. + type: bad request + schema: + $ref: '#/components/schemas/tfvError' + description: Bad Request + "401": + content: + application/json: + example: + description: Client is providing incorrect or invalid credentials. + type: unauthorized + schema: + $ref: '#/components/schemas/tfvError' + description: Unauthorized + "403": + content: + application/json: + example: + description: Client is not authorized for the action. + type: forbidden + schema: + $ref: '#/components/schemas/tfvError' + description: Forbidden + "404": + content: + application/json: + example: + description: Cannot find the requested resource. + type: Not Found + schema: + $ref: '#/components/schemas/tfvError' + description: Cannot find the requested resource. + "405": + content: + application/json: + example: + description: Method is not allowed. + type: Method Not Allowed + schema: + $ref: '#/components/schemas/tfvError' + description: Method Not Allowed + "429": + content: + application/json: + example: + description: Throttling error. Too many requests. + type: Too Many Requests + schema: + $ref: '#/components/schemas/tfvError' + description: Too Many Requests + "500": + content: + application/json: + example: + description: Internal Server Error. + type: Internal Server Error + schema: + $ref: '#/components/schemas/tfvError' + description: Internal Server Error + "503": + content: + application/json: + example: + description: Service Unavailable Error. + type: Service Unavailable + schema: + $ref: '#/components/schemas/tfvError' + description: Service Unavailable + summary: TFV status updates sent to customer's webhook URL. examples: smsMessageReceivedCallbackExample: summary: An example of a sms message-received callback body. @@ -5416,6 +6336,26 @@ components: schema: type: string style: simple + tfPhoneNumberPathParam: + description: Valid Toll-Free telephone number in E.164 format. + example: "+18885555555" + explode: false + in: path + name: phoneNumber + required: true + schema: + $ref: '#/components/schemas/tfPhoneNumber' + style: simple + webhookSubscriptionIdPathParam: + description: Webhook subscription ID + example: 7bt57JcsVYJrN9K1OcV1Nu + explode: false + in: path + name: id + required: true + schema: + type: string + style: simple requestBodies: createMessageRequest: content: @@ -5720,6 +6660,38 @@ components: $ref: '#/components/schemas/lookupRequest' description: Phone number lookup request. required: true + requestTollFreeVerificationRequest: + content: + application/json: + schema: + $ref: '#/components/schemas/verificationRequest' + description: Request for verification of a toll-free phone number. + required: true + updateTollFreeVerificationRequestRequest: + content: + application/json: + schema: + $ref: '#/components/schemas/tfvSubmissionWrapper' + description: Update a request for verification of a toll-free phone number. + required: true + verificationWebhookRequest: + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/verificationWebhook' + - $ref: '#/components/schemas/verificationDenialWebhook' + - $ref: '#/components/schemas/failureWebhook' + description: Verification callback status of a toll-free phone number. + required: true + webhookSubscriptionRequest: + content: + application/json: + schema: + $ref: '#/components/schemas/webhookSubscriptionRequestSchema' + description: Information about a webhook that Bandwidth should send upon the + completion of event customer is trying to subscribe to. + required: true responses: createMessageResponse: content: @@ -6121,53 +7093,167 @@ components: tnLookupForbiddenError: content: application/json: - examples: - forbidden: - summary: Example Forbidden Error - value: - message: Authorization header requires 'Credential' parameter. Authorization - header requires 'Signature' parameter. Authorization header requires - 'SignedHeaders' parameter. Authorization header requires existence - of either a 'X-Amz-Date' or a 'Date' header. Authorization=Basic - Y2tvZloPTGhHgywYIzGlcGVlcGvvcGovYTIGIt==' + examples: + forbidden: + summary: Example Forbidden Error + value: + message: Authorization header requires 'Credential' parameter. Authorization + header requires 'Signature' parameter. Authorization header requires + 'SignedHeaders' parameter. Authorization header requires existence + of either a 'X-Amz-Date' or a 'Date' header. Authorization=Basic + Y2tvZloPTGhHgywYIzGlcGVlcGvvcGovYTIGIt==' + schema: + $ref: '#/components/schemas/tnLookupRequestError' + description: Forbidden + tnLookupMediaTypeError: + content: + application/json: + examples: + mediaType: + summary: Example Unsupported Media Type Error + value: + message: Content-Type must be application/json. + schema: + $ref: '#/components/schemas/tnLookupRequestError' + description: Unsupported Media Type + tnLookupNotFoundError: + description: Not Found + tnLookupTooManyRequestsError: + content: + application/json: + examples: + mediaType: + summary: Example Too Many Requests Error + value: + message: Too many requests. + schema: + $ref: '#/components/schemas/tnLookupRequestError' + description: Too Many Requests + tnLookupInternalServerError: + content: + application/json: + examples: + mediaType: + summary: Example Internal Server Error Error + value: + message: Request has not been passed further. + schema: + $ref: '#/components/schemas/tnLookupRequestError' + description: Internal Server Error + getTollFreeVerificationStatusResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/tfvStatus' + description: OK + listWebhookSubscriptionsResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/webhookSubscriptionsListBody' + description: OK + createWebhookSubscriptionResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/webhookSubscription' + description: Created + updateWebhookSubscriptionResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/webhookSubscription' + description: OK + listTollFreeUseCasesResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/useCases' + description: OK + tfvBadRequestResponse: + content: + application/json: + example: + description: Cannot process request. + type: bad request + schema: + $ref: '#/components/schemas/tfvError' + description: Bad Request + tfvPostBadRequestResponse: + content: + application/json: + 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. + schema: + $ref: '#/components/schemas/tfvError' + description: Bad Request + tfvUnauthorizedResponse: + content: + application/json: + example: + description: Client is providing incorrect or invalid credentials. + type: unauthorized + schema: + $ref: '#/components/schemas/tfvError' + description: Unauthorized + tfvForbiddenResponse: + content: + application/json: + example: + description: Client is not authorized for the action. + type: forbidden + schema: + $ref: '#/components/schemas/tfvError' + description: Forbidden + tfvNotFoundResponse: + content: + application/json: + example: + description: Cannot find the requested resource. + type: Not Found schema: - $ref: '#/components/schemas/tnLookupRequestError' - description: Forbidden - tnLookupMediaTypeError: + $ref: '#/components/schemas/tfvError' + description: Cannot find the requested resource. + tfvNotAllowedResponse: content: application/json: - examples: - mediaType: - summary: Example Unsupported Media Type Error - value: - message: Content-Type must be application/json. + example: + description: Method is not allowed. + type: Method Not Allowed schema: - $ref: '#/components/schemas/tnLookupRequestError' - description: Unsupported Media Type - tnLookupNotFoundError: - description: Not Found - tnLookupTooManyRequestsError: + $ref: '#/components/schemas/tfvError' + description: Method Not Allowed + tfvTooManyRequestsResponse: content: application/json: - examples: - mediaType: - summary: Example Too Many Requests Error - value: - message: Too many requests. + example: + description: Throttling error. Too many requests. + type: Too Many Requests schema: - $ref: '#/components/schemas/tnLookupRequestError' + $ref: '#/components/schemas/tfvError' description: Too Many Requests - tnLookupInternalServerError: + tfvServerErrorResponse: content: application/json: - examples: - mediaType: - summary: Example Internal Server Error Error - value: - message: Request has not been passed further. + example: + description: Internal Server Error. + type: Internal Server Error schema: - $ref: '#/components/schemas/tnLookupRequestError' + $ref: '#/components/schemas/tfvError' description: Internal Server Error + tfvServiceUnavailableResponse: + content: + application/json: + example: + description: Service Unavailable Error. + type: Service Unavailable + schema: + $ref: '#/components/schemas/tfvError' + description: Service Unavailable schemas: callbackTypeEnum: description: | @@ -10333,6 +11419,928 @@ components: example: example error message type: string type: object + accountId1: + description: User's account ID. + example: "1234567" + type: string + tfPhoneNumber: + description: Toll-free telephone number in E.164 format. + example: "+18005555555" + maxLength: 12 + minLength: 12 + nullable: false + pattern: "^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$" + type: string + tfvWebhookErrors: + description: Details of the errors that were encountered when processing the + request. + items: + example: "optInWorkflowImageURLs: Entries must be a valid array of objects." + type: string + type: array + tfvCallbackStatusEnum: + enum: + - VERIFIED + - UNVERIFIED + example: VERIFIED + type: string + tfvUnverifiedStatus: + default: UNVERIFIED + example: UNVERIFIED + type: string + declineReasonDescription: + description: Explanation for why a verification request was declined. + example: Invalid Information - Can't Validate URL - Website is not accessible + / not available + nullable: false + type: string + denialStatusCode: + description: Reason code for denial. + example: 511 + type: integer + resubmitAllowed: + description: Whether a Toll-Free Verification request qualifies for resubmission + via PUT. + example: true + type: boolean + additionalDenialReason: + properties: + statusCode: + description: Reason code for denial. + example: 511 + type: integer + reason: + description: Explanation for why a verification request was declined. + example: Invalid Information - Can't Validate URL - Website is not accessible + / not available + nullable: false + type: string + resubmitAllowed: + description: Whether a Toll-Free Verification request qualifies for resubmission + via PUT. + example: true + type: boolean + required: + - reason + - resubmitAllowed + - statusCode + type: object + internalTicketNumber: + 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 + format: uuid + type: string + internalTicketNumberForWebhook: + 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 + format: uuid + type: string + businessContactPhoneNumber: + description: Contact telephone number + example: "+19192654500" + maxLength: 500 + minLength: 1 + nullable: false + type: string + verificationRequest: + properties: + businessAddress: + $ref: '#/components/schemas/address' + businessContact: + $ref: '#/components/schemas/contact' + messageVolume: + description: Estimated monthly volume of messages from the toll-free number. + example: 10000 + maximum: 10000000 + minimum: 10 + type: integer + phoneNumbers: + items: + $ref: '#/components/schemas/tfPhoneNumber' + maxItems: 10 + minItems: 1 + type: array + useCase: + description: The category of the use case. + example: 2FA + maxLength: 500 + minLength: 0 + type: string + useCaseSummary: + description: A general idea of the use case and customer. + maxLength: 500 + minLength: 1 + nullable: false + type: string + productionMessageContent: + description: Example of message content. + maxLength: 500 + minLength: 1 + nullable: false + type: string + optInWorkflow: + $ref: '#/components/schemas/optInWorkflow' + additionalInformation: + description: Any additional information. + maxLength: 500 + minLength: 0 + nullable: true + type: string + isvReseller: + description: ISV name. + example: Test ISV + maxLength: 500 + minLength: 0 + nullable: true + type: string + required: + - businessAddress + - businessContact + - messageVolume + - optInWorkflow + - phoneNumbers + - productionMessageContent + - useCase + - useCaseSummary + type: object + verificationUpdateRequest: + properties: + businessAddress: + $ref: '#/components/schemas/address' + businessContact: + $ref: '#/components/schemas/contact' + messageVolume: + description: Estimated monthly volume of messages from the toll-free number. + example: 10000 + maximum: 10000000 + minimum: 10 + type: integer + useCase: + description: The category of the use case. + example: 2FA + maxLength: 500 + minLength: 0 + type: string + useCaseSummary: + description: A general idea of the use case and customer. + maxLength: 500 + minLength: 0 + nullable: false + type: string + productionMessageContent: + description: Example of message content. + maxLength: 500 + minLength: 0 + nullable: false + type: string + optInWorkflow: + $ref: '#/components/schemas/optInWorkflow' + additionalInformation: + description: Any additional information. + maxLength: 500 + minLength: 0 + nullable: true + type: string + isvReseller: + description: ISV name. + example: Test ISV + maxLength: 500 + minLength: 0 + nullable: true + type: string + required: + - businessAddress + - businessContact + - messageVolume + - optInWorkflow + - productionMessageContent + - useCase + - useCaseSummary + type: object + tfvBasicAuthentication: + properties: + username: + maxLength: 100 + type: string + password: + maxLength: 200 + type: string + required: + - password + - username + type: object + webhookSubscriptionRequestSchema: + properties: + basicAuthentication: + $ref: '#/components/schemas/tfvBasicAuthentication' + callbackUrl: + 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." + example: https://www.example.com/path/to/resource + format: url + maxLength: 2000 + minLength: 0 + nullable: true + pattern: "^$|(https?:\\/\\/)?(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,253}\\.[a-z]{2,6}\\\ + b([-a-zA-Z0-9@:%_\\+.~#()?&//=]*)" + type: string + 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 + required: + - callbackUrl + type: object + failureWebhook: + properties: + accountId: + description: User's account ID. + example: "1234567" + type: string + phoneNumber: + description: Toll-free telephone number in E.164 format. + example: "+18005555555" + maxLength: 12 + minLength: 12 + nullable: false + pattern: "^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$" + type: string + errorCode: + 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" + type: string + errorDescription: + description: A description of the error that was encountered. + example: cannot process request. + type: string + errors: + description: Details of the errors that were encountered when processing + the request. + items: + example: "optInWorkflowImageURLs: Entries must be a valid array of objects." + type: string + type: array + internalTicketNumber: + 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 + format: uuid + type: string + type: object + verificationDenialWebhook: + properties: + accountId: + description: User's account ID. + example: "1234567" + type: string + additionalDenialReasons: + description: An optional list of denial reasons in addition to declineReasonDescription + when multiple reasons apply. + example: + - statusCode: 512 + reason: Reason A + resubmitAllowed: true + - statusCode: 513 + reason: Reason B + resubmitAllowed: true + items: + $ref: '#/components/schemas/additionalDenialReason' + type: array + declineReasonDescription: + description: Explanation for why a verification request was declined. + example: Invalid Information - Can't Validate URL - Website is not accessible + / not available + nullable: false + type: string + denialStatusCode: + description: Reason code for denial. + example: 511 + type: integer + internalTicketNumber: + 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 + format: uuid + type: string + phoneNumber: + description: Toll-free telephone number in E.164 format. + example: "+18005555555" + maxLength: 12 + minLength: 12 + nullable: false + pattern: "^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$" + type: string + resubmitAllowed: + description: Whether a Toll-Free Verification request qualifies for resubmission + via PUT. + example: true + type: boolean + status: + default: UNVERIFIED + example: UNVERIFIED + type: string + type: object + verificationWebhook: + properties: + accountId: + description: User's account ID. + example: "1234567" + type: string + phoneNumber: + description: Toll-free telephone number in E.164 format. + example: "+18005555555" + maxLength: 12 + minLength: 12 + nullable: false + pattern: "^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$" + type: string + status: + $ref: '#/components/schemas/tfvCallbackStatusEnum' + internalTicketNumber: + 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 + format: uuid + type: string + type: object + tfvSubmissionWrapper: + properties: + submission: + $ref: '#/components/schemas/verificationUpdateRequest' + type: object + address: + example: + zip: "27606" + addr2: addr2 + addr1: 2230 Bandmate Way + city: Raleigh + name: Bandwidth Inc. + state: NC + url: https://www.example.com/path/to/resource + nullable: false + properties: + name: + description: The name of the business using the toll-free number. + example: Bandwidth Inc. + maxLength: 500 + minLength: 1 + nullable: false + type: string + addr1: + description: The address of the business using the toll-free number. + example: 2230 Bandmate Way + maxLength: 500 + minLength: 1 + nullable: false + type: string + addr2: + description: The address of the business using the toll-free number. + maxLength: 500 + minLength: 0 + nullable: true + type: string + city: + description: The city of the business using the toll-free number. + example: Raleigh + maxLength: 500 + minLength: 1 + nullable: false + type: string + state: + description: The state of the business using the toll-free number. + example: NC + maxLength: 500 + minLength: 1 + nullable: false + type: string + zip: + description: The zip of the business using the toll-free number. + example: "27606" + nullable: false + pattern: "[- A-Za-z0-9]{0,500}" + type: string + url: + description: The website of the business using the toll-free number. + example: https://www.example.com/path/to/resource + format: url + maxLength: 500 + minLength: 1 + nullable: false + type: string + required: + - addr1 + - city + - name + - state + - url + - zip + type: object + optInWorkflow: + example: + imageUrls: + - https://www.example.com/path/to/resource + - https://www.example.com/path/to/resource + description: Opt In Flow + nullable: false + properties: + description: + example: Opt In Flow + maxLength: 500 + minLength: 1 + nullable: false + type: string + imageUrls: + items: + example: https://www.example.com/path/to/resource + maxLength: 500 + minLength: 1 + nullable: false + pattern: "^$|(https?:\\/\\/)?(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,253}\\\ + .[a-z]{2,6}\\b([-a-zA-Z0-9@:%_\\+.~#()?&//=]*)" + type: string + type: array + required: + - description + - imageUrls + type: object + isvReseller: + description: ISV name. + example: Test ISV + maxLength: 500 + minLength: 0 + nullable: true + type: string + contact: + example: + firstName: John + lastName: Doe + phoneNumber: "+19192654500" + email: foo@bar.com + nullable: false + properties: + firstName: + description: The first name of the business contact using the toll-free + number. + example: John + maxLength: 500 + minLength: 1 + nullable: false + type: string + lastName: + description: The last name of the business contact using the toll-free number. + example: Doe + maxLength: 500 + minLength: 1 + nullable: false + type: string + email: + example: foo@bar.com + format: email + maxLength: 500 + minLength: 0 + 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])+)\\])$" + type: string + phoneNumber: + description: Contact telephone number + example: "+19192654500" + maxLength: 500 + minLength: 1 + nullable: false + type: string + required: + - email + - firstName + - lastName + - phoneNumber + type: object + email: + example: foo@bar.com + format: email + maxLength: 500 + minLength: 0 + 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])+)\\])$" + type: string + useCases: + example: + - 2FA + - App Notifications + - Appointments + - Auctions + - Auto Repair Services + - Bank Transfers + - Billing + - Booking Confirmations + - Business Updates + - COVID-19 Alerts + items: + type: string + type: array + useCase: + description: The category of the use case. + example: 2FA + maxLength: 500 + minLength: 0 + type: string + webhookSubscriptionsListBody: + description: A list of all webhook subscriptions registered for this account + ID for this particular feature (unpaginated). + example: + data: + - accountId: "1234567" + createdDate: 2023-05-15T13:56:39.965Z + modifiedDate: 2023-05-15T13:56:39.965Z + callbackUrl: https://www.example.com/path/to/resource + id: 7hICGStfAfeGxEq3N0lQwO + type: TOLLFREE_VERIFICATION_STATUS + basicAuthentication: + password: password + username: username + - accountId: "1234567" + createdDate: 2023-05-15T13:56:39.965Z + modifiedDate: 2023-05-15T13:56:39.965Z + callbackUrl: https://www.example.com/path/to/resource + id: 7hICGStfAfeGxEq3N0lQwO + type: TOLLFREE_VERIFICATION_STATUS + basicAuthentication: + password: password + username: username + links: + next: next + previous: previous + last: last + first: first + errors: + - code: 0 + telephoneNumbers: + - telephoneNumber: telephoneNumber + - telephoneNumber: telephoneNumber + description: description + - code: 0 + telephoneNumbers: + - telephoneNumber: telephoneNumber + - telephoneNumber: telephoneNumber + description: description + properties: + links: + $ref: '#/components/schemas/linksObject' + errors: + items: + $ref: '#/components/schemas/error' + type: array + data: + items: + $ref: '#/components/schemas/webhookSubscription' + type: array + required: + - data + type: object + linksObject: + example: + next: next + previous: previous + last: last + first: first + 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 + type: object + error: + example: + code: 0 + telephoneNumbers: + - telephoneNumber: telephoneNumber + - telephoneNumber: telephoneNumber + description: description + properties: + code: + type: integer + description: + type: string + telephoneNumbers: + items: + $ref: '#/components/schemas/telephoneNumber' + type: array + type: object + telephoneNumber: + example: + telephoneNumber: telephoneNumber + properties: + telephoneNumber: + description: Simple Telephone Number. + type: string + type: object + webhookSubscriptionTypeEnum: + enum: + - TOLLFREE_VERIFICATION_STATUS + - MESSAGING_PORTOUT_APPROVAL_STATUS + example: TOLLFREE_VERIFICATION_STATUS + type: string + webhookSubscription: + description: Information about a webhook that Bandwidth should send upon the + completion of event customer has subscribed to. + example: + accountId: "1234567" + createdDate: 2023-05-15T13:56:39.965Z + modifiedDate: 2023-05-15T13:56:39.965Z + callbackUrl: https://www.example.com/path/to/resource + id: 7hICGStfAfeGxEq3N0lQwO + type: TOLLFREE_VERIFICATION_STATUS + basicAuthentication: + password: password + username: username + properties: + id: + example: 7hICGStfAfeGxEq3N0lQwO + type: string + accountId: + example: "1234567" + type: string + callbackUrl: + 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." + example: https://www.example.com/path/to/resource + format: url + maxLength: 2000 + minLength: 0 + nullable: true + pattern: "^$|(https?:\\/\\/)?(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,253}\\.[a-z]{2,6}\\\ + b([-a-zA-Z0-9@:%_\\+.~#()?&//=]*)" + type: string + type: + $ref: '#/components/schemas/webhookSubscriptionTypeEnum' + basicAuthentication: + $ref: '#/components/schemas/webhookSubscription_basicAuthentication' + createdDate: + example: 2023-05-15T13:56:39.965Z + format: date-time + type: string + modifiedDate: + example: 2023-05-15T13:56:39.965Z + format: date-time + type: string + required: + - callbackUrl + type: object + 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." + example: https://www.example.com/path/to/resource + format: url + maxLength: 2000 + minLength: 0 + nullable: true + pattern: "^$|(https?:\\/\\/)?(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,253}\\.[a-z]{2,6}\\\ + b([-a-zA-Z0-9@:%_\\+.~#()?&//=]*)" + type: string + tfvError: + description: A generic error object. + example: + description: Error Message + type: Error Type + errors: + field: error message + properties: + type: + example: Error Type + type: string + description: + example: Error Message + type: string + errors: + 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 + type: object + tfvStatus: + example: + internalTicketNumber: acde070d-8c4c-4f0d-9d8a-162843c10333 + phoneNumber: "+18005555555" + resubmitAllowed: true + createdDateTime: 2021-06-08T06:45:13Z + modifiedDateTime: 2021-06-08T06:45:13Z + submission: + additionalInformation: Any additional information + useCase: 2FA + isvReseller: Test ISV + businessContact: + firstName: John + lastName: Doe + phoneNumber: "+19192654500" + email: foo@bar.com + messageVolume: 10000 + productionMessageContent: Production message content + businessAddress: + zip: "27606" + addr2: addr2 + addr1: 2230 Bandmate Way + city: Raleigh + name: Bandwidth Inc. + state: NC + url: https://www.example.com/path/to/resource + useCaseSummary: Text summarizing the use case for the toll-free number + optInWorkflow: + imageUrls: + - https://www.example.com/path/to/resource + - https://www.example.com/path/to/resource + description: Opt In Flow + declineReasonDescription: Invalid Information - Can't Validate URL - Website + is not accessible / not available + status: VERIFIED + properties: + phoneNumber: + description: Toll-free telephone number in E.164 format. + example: "+18005555555" + maxLength: 12 + minLength: 12 + nullable: false + pattern: "^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$" + type: string + status: + $ref: '#/components/schemas/tfvStatusEnum' + internalTicketNumber: + 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 + format: uuid + type: string + declineReasonDescription: + description: Explanation for why a verification request was declined. + example: Invalid Information - Can't Validate URL - Website is not accessible + / not available + nullable: false + type: string + resubmitAllowed: + description: Whether a Toll-Free Verification request qualifies for resubmission + via PUT. + example: true + type: boolean + createdDateTime: + description: Date and time the verification request was created. + example: 2021-06-08T06:45:13Z + format: date-time + type: string + modifiedDateTime: + description: Date and time the verification request was last modified. + example: 2021-06-08T06:45:13Z + format: date-time + type: string + submission: + $ref: '#/components/schemas/tfvSubmissionInfo' + type: object + tfvSubmissionInfo: + example: + additionalInformation: Any additional information + useCase: 2FA + isvReseller: Test ISV + businessContact: + firstName: John + lastName: Doe + phoneNumber: "+19192654500" + email: foo@bar.com + messageVolume: 10000 + productionMessageContent: Production message content + businessAddress: + zip: "27606" + addr2: addr2 + addr1: 2230 Bandmate Way + city: Raleigh + name: Bandwidth Inc. + state: NC + url: https://www.example.com/path/to/resource + useCaseSummary: Text summarizing the use case for the toll-free number + optInWorkflow: + imageUrls: + - https://www.example.com/path/to/resource + - https://www.example.com/path/to/resource + description: Opt In Flow + properties: + businessAddress: + $ref: '#/components/schemas/address' + businessContact: + $ref: '#/components/schemas/contact' + messageVolume: + description: Estimated monthly volume of messages from the toll-free number. + example: 10000 + maximum: 10000000 + minimum: 10 + type: integer + useCase: + description: The category of the use case. + example: 2FA + maxLength: 500 + minLength: 0 + type: string + useCaseSummary: + description: A general idea of the use case and customer. + example: Text summarizing the use case for the toll-free number + maxLength: 500 + minLength: 0 + nullable: false + type: string + productionMessageContent: + description: Example of message content. + example: Production message content + maxLength: 500 + minLength: 0 + nullable: false + type: string + optInWorkflow: + $ref: '#/components/schemas/optInWorkflow' + additionalInformation: + description: Any additional information. + example: Any additional information + maxLength: 500 + minLength: 0 + nullable: true + type: string + isvReseller: + description: ISV name. + example: Test ISV + maxLength: 500 + minLength: 0 + nullable: true + type: string + type: object + tfvStatusEnum: + enum: + - VERIFIED + - UNVERIFIED + - PENDING + - PARTIALLY_VERIFIED + - INVALID_STATUS + example: VERIFIED + type: string + 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 + webhookSubscription_basicAuthentication: + description: "Basic authentication credentials are not required, but if present,\ + \ both username and password must be provided." + example: + password: password + username: username + properties: + username: + maxLength: 100 + type: string + password: + maxLength: 200 + type: string + required: + - password + - username + type: object securitySchemes: Basic: description: |- diff --git a/bandwidth.yml b/bandwidth.yml index 87921dfa..70ca20d3 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/docs/AdditionalDenialReason.md b/docs/AdditionalDenialReason.md new file mode 100644 index 00000000..dd781aa6 --- /dev/null +++ b/docs/AdditionalDenialReason.md @@ -0,0 +1,15 @@ + + +# AdditionalDenialReason + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**statusCode** | **Integer** | Reason code for denial. | | +|**reason** | **String** | Explanation for why a verification request was declined. | | +|**resubmitAllowed** | **Boolean** | Whether a Toll-Free Verification request qualifies for resubmission via PUT. | | + + + diff --git a/docs/Address.md b/docs/Address.md new file mode 100644 index 00000000..f3a2e51e --- /dev/null +++ b/docs/Address.md @@ -0,0 +1,19 @@ + + +# Address + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | The name of the business using the toll-free number. | | +|**addr1** | **String** | The address of the business using the toll-free number. | | +|**addr2** | **String** | The address of the business using the toll-free number. | [optional] | +|**city** | **String** | The city of the business using the toll-free number. | | +|**state** | **String** | The state of the business using the toll-free number. | | +|**zip** | **String** | The zip of the business using the toll-free number. | | +|**url** | **String** | The website of the business using the toll-free number. | | + + + diff --git a/docs/Contact.md b/docs/Contact.md new file mode 100644 index 00000000..eab12ddb --- /dev/null +++ b/docs/Contact.md @@ -0,0 +1,16 @@ + + +# Contact + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**firstName** | **String** | The first name of the business contact using the toll-free number. | | +|**lastName** | **String** | The last name of the business contact using the toll-free number. | | +|**email** | **String** | | | +|**phoneNumber** | **String** | Contact telephone number | | + + + diff --git a/docs/Error.md b/docs/Error.md new file mode 100644 index 00000000..cfd9d775 --- /dev/null +++ b/docs/Error.md @@ -0,0 +1,15 @@ + + +# Error + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **Integer** | | [optional] | +|**description** | **String** | | [optional] | +|**telephoneNumbers** | [**List<TelephoneNumber>**](TelephoneNumber.md) | | [optional] | + + + diff --git a/docs/FailureWebhook.md b/docs/FailureWebhook.md new file mode 100644 index 00000000..03c71e3f --- /dev/null +++ b/docs/FailureWebhook.md @@ -0,0 +1,18 @@ + + +# FailureWebhook + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**accountId** | **String** | User's account ID. | [optional] | +|**phoneNumber** | **String** | Toll-free telephone number in E.164 format. | [optional] | +|**errorCode** | **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. | [optional] | +|**errorDescription** | **String** | A description of the error that was encountered. | [optional] | +|**errors** | **List<String>** | Details of the errors that were encountered when processing the request. | [optional] | +|**internalTicketNumber** | **UUID** | Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number. | [optional] | + + + diff --git a/docs/GetTollFreeVerificationStatus200Response.md b/docs/GetTollFreeVerificationStatus200Response.md new file mode 100644 index 00000000..d1d760fa --- /dev/null +++ b/docs/GetTollFreeVerificationStatus200Response.md @@ -0,0 +1,20 @@ + + +# GetTollFreeVerificationStatus200Response + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**phoneNumber** | **String** | Toll-free telephone number in E.164 format. | [optional] | +|**status** | **TfvStatusEnum** | | [optional] | +|**internalTicketNumber** | **UUID** | Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number - included in all webhook payloads. | [optional] | +|**declineReasonDescription** | **String** | Explanation for why a verification request was declined. | [optional] | +|**resubmitAllowed** | **Boolean** | Whether a Toll-Free Verification request qualifies for resubmission via PUT. | [optional] | +|**createdDateTime** | **OffsetDateTime** | Date and time the verification request was created. | [optional] | +|**modifiedDateTime** | **OffsetDateTime** | Date and time the verification request was last modified. | [optional] | +|**submission** | [**TfvSubmissionInfo**](TfvSubmissionInfo.md) | | [optional] | + + + diff --git a/docs/Links.md b/docs/Links.md new file mode 100644 index 00000000..d0162d28 --- /dev/null +++ b/docs/Links.md @@ -0,0 +1,16 @@ + + +# Links + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**first** | **String** | The first (or only) page of results matching the query. | [optional] | +|**next** | **String** | If more results exist than specified by 'size', this link returns the next page of 'size' results. | [optional] | +|**previous** | **String** | If the results are more than one page, this link returns the previous page of 'size' results. | [optional] | +|**last** | **String** | If more results exist than specified by 'size', this link return the last page of result. | [optional] | + + + diff --git a/docs/LinksObject.md b/docs/LinksObject.md new file mode 100644 index 00000000..fc28c36f --- /dev/null +++ b/docs/LinksObject.md @@ -0,0 +1,16 @@ + + +# LinksObject + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**first** | **String** | The first (or only) page of results matching the query. | [optional] | +|**next** | **String** | If more results exist than specified by 'size', this link returns the next page of 'size' results. | [optional] | +|**previous** | **String** | If the results are more than one page, this link returns the previous page of 'size' results. | [optional] | +|**last** | **String** | If more results exist than specified by 'size', this link return the last page of result. | [optional] | + + + diff --git a/docs/OptInWorkflow.md b/docs/OptInWorkflow.md new file mode 100644 index 00000000..367b938b --- /dev/null +++ b/docs/OptInWorkflow.md @@ -0,0 +1,14 @@ + + +# OptInWorkflow + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**description** | **String** | | | +|**imageUrls** | **List<String>** | | | + + + diff --git a/docs/TelephoneNumber.md b/docs/TelephoneNumber.md new file mode 100644 index 00000000..b2bf18ce --- /dev/null +++ b/docs/TelephoneNumber.md @@ -0,0 +1,13 @@ + + +# TelephoneNumber + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**telephoneNumber** | **String** | Simple Telephone Number. | [optional] | + + + diff --git a/docs/TfvBasicAuthentication.md b/docs/TfvBasicAuthentication.md new file mode 100644 index 00000000..7e90717b --- /dev/null +++ b/docs/TfvBasicAuthentication.md @@ -0,0 +1,14 @@ + + +# TfvBasicAuthentication + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**username** | **String** | | | +|**password** | **String** | | | + + + diff --git a/docs/TfvCallbackStatusEnum.md b/docs/TfvCallbackStatusEnum.md new file mode 100644 index 00000000..5f7c0d47 --- /dev/null +++ b/docs/TfvCallbackStatusEnum.md @@ -0,0 +1,13 @@ + + +# TfvCallbackStatusEnum + +## Enum + + +* `VERIFIED` (value: `"VERIFIED"`) + +* `UNVERIFIED` (value: `"UNVERIFIED"`) + + + diff --git a/docs/TfvError.md b/docs/TfvError.md new file mode 100644 index 00000000..3a7f77bb --- /dev/null +++ b/docs/TfvError.md @@ -0,0 +1,16 @@ + + +# TfvError + +A generic error object. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**type** | **String** | | [optional] | +|**description** | **String** | | [optional] | +|**errors** | **Object** | 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. | [optional] | + + + diff --git a/docs/TfvStatus.md b/docs/TfvStatus.md new file mode 100644 index 00000000..c857d97c --- /dev/null +++ b/docs/TfvStatus.md @@ -0,0 +1,20 @@ + + +# TfvStatus + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**phoneNumber** | **String** | Toll-free telephone number in E.164 format. | [optional] | +|**status** | **TfvStatusEnum** | | [optional] | +|**internalTicketNumber** | **UUID** | Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number - included in all webhook payloads. | [optional] | +|**declineReasonDescription** | **String** | Explanation for why a verification request was declined. | [optional] | +|**resubmitAllowed** | **Boolean** | Whether a Toll-Free Verification request qualifies for resubmission via PUT. | [optional] | +|**createdDateTime** | **OffsetDateTime** | Date and time the verification request was created. | [optional] | +|**modifiedDateTime** | **OffsetDateTime** | Date and time the verification request was last modified. | [optional] | +|**submission** | [**TfvSubmissionInfo**](TfvSubmissionInfo.md) | | [optional] | + + + diff --git a/docs/TfvStatusEnum.md b/docs/TfvStatusEnum.md new file mode 100644 index 00000000..0d0e14e6 --- /dev/null +++ b/docs/TfvStatusEnum.md @@ -0,0 +1,19 @@ + + +# TfvStatusEnum + +## Enum + + +* `VERIFIED` (value: `"VERIFIED"`) + +* `UNVERIFIED` (value: `"UNVERIFIED"`) + +* `PENDING` (value: `"PENDING"`) + +* `PARTIALLY_VERIFIED` (value: `"PARTIALLY_VERIFIED"`) + +* `INVALID_STATUS` (value: `"INVALID_STATUS"`) + + + diff --git a/docs/TfvStatusWithNoSubmissionInfo.md b/docs/TfvStatusWithNoSubmissionInfo.md new file mode 100644 index 00000000..28d46044 --- /dev/null +++ b/docs/TfvStatusWithNoSubmissionInfo.md @@ -0,0 +1,19 @@ + + +# TfvStatusWithNoSubmissionInfo + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**phoneNumber** | **String** | Toll-free telephone number in E.164 format. | [optional] | +|**status** | **TfvStatusEnum** | | [optional] | +|**internalTicketNumber** | **UUID** | Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number - included in all webhook payloads. | [optional] | +|**declineReasonDescription** | **String** | Explanation for why a verification request was declined. | [optional] | +|**resubmitAllowed** | **Boolean** | Whether a Toll-Free Verification request qualifies for resubmission via PUT. | [optional] | +|**createdDateTime** | **OffsetDateTime** | Date and time the verification request was created. | [optional] | +|**modifiedDateTime** | **OffsetDateTime** | Date and time the verification request was last modified. | [optional] | + + + diff --git a/docs/TfvStatusWithSubmissionInfo.md b/docs/TfvStatusWithSubmissionInfo.md new file mode 100644 index 00000000..4f8ff296 --- /dev/null +++ b/docs/TfvStatusWithSubmissionInfo.md @@ -0,0 +1,20 @@ + + +# TfvStatusWithSubmissionInfo + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**phoneNumber** | **String** | Toll-free telephone number in E.164 format. | [optional] | +|**status** | **TfvStatusEnum** | | [optional] | +|**internalTicketNumber** | **UUID** | Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number - included in all webhook payloads. | [optional] | +|**declineReasonDescription** | **String** | Explanation for why a verification request was declined. | [optional] | +|**resubmitAllowed** | **Boolean** | Whether a Toll-Free Verification request qualifies for resubmission via PUT. | [optional] | +|**createdDateTime** | **OffsetDateTime** | Date and time the verification request was created. | [optional] | +|**modifiedDateTime** | **OffsetDateTime** | Date and time the verification request was last modified. | [optional] | +|**submission** | [**TfvSubmissionInfo**](TfvSubmissionInfo.md) | | [optional] | + + + diff --git a/docs/TfvSubmissionInfo.md b/docs/TfvSubmissionInfo.md new file mode 100644 index 00000000..4e9d6fe1 --- /dev/null +++ b/docs/TfvSubmissionInfo.md @@ -0,0 +1,21 @@ + + +# TfvSubmissionInfo + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**businessAddress** | [**Address**](Address.md) | | [optional] | +|**businessContact** | [**Contact**](Contact.md) | | [optional] | +|**messageVolume** | **Integer** | Estimated monthly volume of messages from the toll-free number. | [optional] | +|**useCase** | **String** | The category of the use case. | [optional] | +|**useCaseSummary** | **String** | A general idea of the use case and customer. | [optional] | +|**productionMessageContent** | **String** | Example of message content. | [optional] | +|**optInWorkflow** | [**OptInWorkflow**](OptInWorkflow.md) | | [optional] | +|**additionalInformation** | **String** | Any additional information. | [optional] | +|**isvReseller** | **String** | ISV name. | [optional] | + + + diff --git a/docs/TfvSubmissionWrapper.md b/docs/TfvSubmissionWrapper.md new file mode 100644 index 00000000..a5c26150 --- /dev/null +++ b/docs/TfvSubmissionWrapper.md @@ -0,0 +1,13 @@ + + +# TfvSubmissionWrapper + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**submission** | [**VerificationUpdateRequest**](VerificationUpdateRequest.md) | | [optional] | + + + diff --git a/docs/TollFreeVerificationApi.md b/docs/TollFreeVerificationApi.md new file mode 100644 index 00000000..ac7830cb --- /dev/null +++ b/docs/TollFreeVerificationApi.md @@ -0,0 +1,630 @@ +# TollFreeVerificationApi + +All URIs are relative to *http://localhost* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**createWebhookSubscription**](TollFreeVerificationApi.md#createWebhookSubscription) | **POST** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions | Create Webhook Subscription | +| [**deleteWebhookSubscription**](TollFreeVerificationApi.md#deleteWebhookSubscription) | **DELETE** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id} | Delete Webhook Subscription | +| [**getTollFreeVerificationStatus**](TollFreeVerificationApi.md#getTollFreeVerificationStatus) | **GET** /accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification | Get Toll-Free Verification Status | +| [**listTollFreeUseCases**](TollFreeVerificationApi.md#listTollFreeUseCases) | **GET** /tollFreeVerification/useCases | List Toll-Free Use Cases | +| [**listWebhookSubscriptions**](TollFreeVerificationApi.md#listWebhookSubscriptions) | **GET** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions | List Webhook Subscriptions | +| [**requestTollFreeVerification**](TollFreeVerificationApi.md#requestTollFreeVerification) | **POST** /accounts/{accountId}/tollFreeVerification | Request Toll-Free Verification | +| [**updateTollFreeVerificationRequest**](TollFreeVerificationApi.md#updateTollFreeVerificationRequest) | **PUT** /accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification | Update Toll-Free Verification Request | +| [**updateWebhookSubscription**](TollFreeVerificationApi.md#updateWebhookSubscription) | **PUT** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id} | Update Webhook Subscription | + + + +# **createWebhookSubscription** +> WebhookSubscription createWebhookSubscription(accountId, webhookSubscriptionRequestSchema) + +Create Webhook Subscription + +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. + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.TollFreeVerificationApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + TollFreeVerificationApi apiInstance = new TollFreeVerificationApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + WebhookSubscriptionRequestSchema webhookSubscriptionRequestSchema = new WebhookSubscriptionRequestSchema(); // WebhookSubscriptionRequestSchema | Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. + try { + WebhookSubscription result = apiInstance.createWebhookSubscription(accountId, webhookSubscriptionRequestSchema); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TollFreeVerificationApi#createWebhookSubscription"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **webhookSubscriptionRequestSchema** | [**WebhookSubscriptionRequestSchema**](WebhookSubscriptionRequestSchema.md)| Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. | | + +### Return type + +[**WebhookSubscription**](WebhookSubscription.md) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **201** | Created | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Cannot find the requested resource. | - | +| **405** | Method Not Allowed | - | +| **429** | Too Many Requests | - | +| **500** | Internal Server Error | - | +| **503** | Service Unavailable | - | + + +# **deleteWebhookSubscription** +> deleteWebhookSubscription(accountId, id) + +Delete Webhook Subscription + +Delete a webhook subscription by ID. + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.TollFreeVerificationApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + TollFreeVerificationApi apiInstance = new TollFreeVerificationApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String id = "7bt57JcsVYJrN9K1OcV1Nu"; // String | Webhook subscription ID + try { + apiInstance.deleteWebhookSubscription(accountId, id); + } catch (ApiException e) { + System.err.println("Exception when calling TollFreeVerificationApi#deleteWebhookSubscription"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **id** | **String**| Webhook subscription ID | | + +### Return type + +null (empty response body) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **204** | No Content | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Cannot find the requested resource. | - | +| **405** | Method Not Allowed | - | +| **429** | Too Many Requests | - | +| **500** | Internal Server Error | - | +| **503** | Service Unavailable | - | + + +# **getTollFreeVerificationStatus** +> TfvStatus getTollFreeVerificationStatus(accountId, phoneNumber) + +Get Toll-Free Verification Status + +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. + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.TollFreeVerificationApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + TollFreeVerificationApi apiInstance = new TollFreeVerificationApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String phoneNumber = "+18885555555"; // String | Valid Toll-Free telephone number in E.164 format. + try { + TfvStatus result = apiInstance.getTollFreeVerificationStatus(accountId, phoneNumber); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TollFreeVerificationApi#getTollFreeVerificationStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **phoneNumber** | **String**| Valid Toll-Free telephone number in E.164 format. | | + +### Return type + +[**TfvStatus**](TfvStatus.md) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Cannot find the requested resource. | - | +| **405** | Method Not Allowed | - | +| **429** | Too Many Requests | - | +| **500** | Internal Server Error | - | +| **503** | Service Unavailable | - | + + +# **listTollFreeUseCases** +> List<String> listTollFreeUseCases() + +List Toll-Free Use Cases + +Lists valid toll-free use cases. + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.TollFreeVerificationApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + TollFreeVerificationApi apiInstance = new TollFreeVerificationApi(defaultClient); + try { + List result = apiInstance.listTollFreeUseCases(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TollFreeVerificationApi#listTollFreeUseCases"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**List<String>** + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Cannot find the requested resource. | - | +| **405** | Method Not Allowed | - | +| **429** | Too Many Requests | - | +| **500** | Internal Server Error | - | +| **503** | Service Unavailable | - | + + +# **listWebhookSubscriptions** +> WebhookSubscriptionsListBody listWebhookSubscriptions(accountId) + +List Webhook Subscriptions + +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). + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.TollFreeVerificationApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + TollFreeVerificationApi apiInstance = new TollFreeVerificationApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + try { + WebhookSubscriptionsListBody result = apiInstance.listWebhookSubscriptions(accountId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TollFreeVerificationApi#listWebhookSubscriptions"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | + +### Return type + +[**WebhookSubscriptionsListBody**](WebhookSubscriptionsListBody.md) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **405** | Method Not Allowed | - | +| **429** | Too Many Requests | - | +| **500** | Internal Server Error | - | +| **503** | Service Unavailable | - | + + +# **requestTollFreeVerification** +> requestTollFreeVerification(accountId, verificationRequest) + +Request Toll-Free Verification + +Submit a request for verification of a toll-free phone number. + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.TollFreeVerificationApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + TollFreeVerificationApi apiInstance = new TollFreeVerificationApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + VerificationRequest verificationRequest = new VerificationRequest(); // VerificationRequest | Request for verification of a toll-free phone number. + try { + apiInstance.requestTollFreeVerification(accountId, verificationRequest); + } catch (ApiException e) { + System.err.println("Exception when calling TollFreeVerificationApi#requestTollFreeVerification"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **verificationRequest** | [**VerificationRequest**](VerificationRequest.md)| Request for verification of a toll-free phone number. | | + +### Return type + +null (empty response body) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **202** | Accepted | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **405** | Method Not Allowed | - | +| **429** | Too Many Requests | - | +| **500** | Internal Server Error | - | +| **503** | Service Unavailable | - | + + +# **updateTollFreeVerificationRequest** +> updateTollFreeVerificationRequest(accountId, phoneNumber, tfvSubmissionWrapper) + +Update Toll-Free Verification Request + +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). + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.TollFreeVerificationApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + TollFreeVerificationApi apiInstance = new TollFreeVerificationApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String phoneNumber = "+18885555555"; // String | Valid Toll-Free telephone number in E.164 format. + TfvSubmissionWrapper tfvSubmissionWrapper = new TfvSubmissionWrapper(); // TfvSubmissionWrapper | Update a request for verification of a toll-free phone number. + try { + apiInstance.updateTollFreeVerificationRequest(accountId, phoneNumber, tfvSubmissionWrapper); + } catch (ApiException e) { + System.err.println("Exception when calling TollFreeVerificationApi#updateTollFreeVerificationRequest"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **phoneNumber** | **String**| Valid Toll-Free telephone number in E.164 format. | | +| **tfvSubmissionWrapper** | [**TfvSubmissionWrapper**](TfvSubmissionWrapper.md)| Update a request for verification of a toll-free phone number. | | + +### Return type + +null (empty response body) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **202** | Accepted | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **405** | Method Not Allowed | - | +| **429** | Too Many Requests | - | +| **500** | Internal Server Error | - | +| **503** | Service Unavailable | - | + + +# **updateWebhookSubscription** +> WebhookSubscription updateWebhookSubscription(accountId, id, webhookSubscriptionRequestSchema) + +Update Webhook Subscription + +Update an existing webhook subscription (`callbackUrl` and `basicAuthentication` can be updated). + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.TollFreeVerificationApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + TollFreeVerificationApi apiInstance = new TollFreeVerificationApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String id = "7bt57JcsVYJrN9K1OcV1Nu"; // String | Webhook subscription ID + WebhookSubscriptionRequestSchema webhookSubscriptionRequestSchema = new WebhookSubscriptionRequestSchema(); // WebhookSubscriptionRequestSchema | Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. + try { + WebhookSubscription result = apiInstance.updateWebhookSubscription(accountId, id, webhookSubscriptionRequestSchema); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TollFreeVerificationApi#updateWebhookSubscription"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **id** | **String**| Webhook subscription ID | | +| **webhookSubscriptionRequestSchema** | [**WebhookSubscriptionRequestSchema**](WebhookSubscriptionRequestSchema.md)| Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. | | + +### Return type + +[**WebhookSubscription**](WebhookSubscription.md) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Cannot find the requested resource. | - | +| **405** | Method Not Allowed | - | +| **429** | Too Many Requests | - | +| **500** | Internal Server Error | - | +| **503** | Service Unavailable | - | + diff --git a/docs/VerificationDenialWebhook.md b/docs/VerificationDenialWebhook.md new file mode 100644 index 00000000..e75b5a6c --- /dev/null +++ b/docs/VerificationDenialWebhook.md @@ -0,0 +1,20 @@ + + +# VerificationDenialWebhook + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**accountId** | **String** | User's account ID. | [optional] | +|**additionalDenialReasons** | [**List<AdditionalDenialReason>**](AdditionalDenialReason.md) | An optional list of denial reasons in addition to declineReasonDescription when multiple reasons apply. | [optional] | +|**declineReasonDescription** | **String** | Explanation for why a verification request was declined. | [optional] | +|**denialStatusCode** | **Integer** | Reason code for denial. | [optional] | +|**internalTicketNumber** | **UUID** | Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number. | [optional] | +|**phoneNumber** | **String** | Toll-free telephone number in E.164 format. | [optional] | +|**resubmitAllowed** | **Boolean** | Whether a Toll-Free Verification request qualifies for resubmission via PUT. | [optional] | +|**status** | **String** | | [optional] | + + + diff --git a/docs/VerificationRequest.md b/docs/VerificationRequest.md new file mode 100644 index 00000000..a6f3ee5f --- /dev/null +++ b/docs/VerificationRequest.md @@ -0,0 +1,22 @@ + + +# VerificationRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**businessAddress** | [**Address**](Address.md) | | | +|**businessContact** | [**Contact**](Contact.md) | | | +|**messageVolume** | **Integer** | Estimated monthly volume of messages from the toll-free number. | | +|**phoneNumbers** | **List<String>** | | | +|**useCase** | **String** | The category of the use case. | | +|**useCaseSummary** | **String** | A general idea of the use case and customer. | | +|**productionMessageContent** | **String** | Example of message content. | | +|**optInWorkflow** | [**OptInWorkflow**](OptInWorkflow.md) | | | +|**additionalInformation** | **String** | Any additional information. | [optional] | +|**isvReseller** | **String** | ISV name. | [optional] | + + + diff --git a/docs/VerificationUpdateRequest.md b/docs/VerificationUpdateRequest.md new file mode 100644 index 00000000..baacb097 --- /dev/null +++ b/docs/VerificationUpdateRequest.md @@ -0,0 +1,21 @@ + + +# VerificationUpdateRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**businessAddress** | [**Address**](Address.md) | | | +|**businessContact** | [**Contact**](Contact.md) | | | +|**messageVolume** | **Integer** | Estimated monthly volume of messages from the toll-free number. | | +|**useCase** | **String** | The category of the use case. | | +|**useCaseSummary** | **String** | A general idea of the use case and customer. | | +|**productionMessageContent** | **String** | Example of message content. | | +|**optInWorkflow** | [**OptInWorkflow**](OptInWorkflow.md) | | | +|**additionalInformation** | **String** | Any additional information. | [optional] | +|**isvReseller** | **String** | ISV name. | [optional] | + + + diff --git a/docs/VerificationWebhook.md b/docs/VerificationWebhook.md new file mode 100644 index 00000000..db499f63 --- /dev/null +++ b/docs/VerificationWebhook.md @@ -0,0 +1,16 @@ + + +# VerificationWebhook + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**accountId** | **String** | User's account ID. | [optional] | +|**phoneNumber** | **String** | Toll-free telephone number in E.164 format. | [optional] | +|**status** | **TfvCallbackStatusEnum** | | [optional] | +|**internalTicketNumber** | **UUID** | Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number. | [optional] | + + + diff --git a/docs/WebhookSubscription.md b/docs/WebhookSubscription.md new file mode 100644 index 00000000..629761b7 --- /dev/null +++ b/docs/WebhookSubscription.md @@ -0,0 +1,20 @@ + + +# WebhookSubscription + +Information about a webhook that Bandwidth should send upon the completion of event customer has subscribed to. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **String** | | [optional] | +|**accountId** | **String** | | [optional] | +|**callbackUrl** | **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** | **WebhookSubscriptionTypeEnum** | | [optional] | +|**basicAuthentication** | [**WebhookSubscriptionBasicAuthentication**](WebhookSubscriptionBasicAuthentication.md) | | [optional] | +|**createdDate** | **OffsetDateTime** | | [optional] | +|**modifiedDate** | **OffsetDateTime** | | [optional] | + + + diff --git a/docs/WebhookSubscriptionBasicAuthentication.md b/docs/WebhookSubscriptionBasicAuthentication.md new file mode 100644 index 00000000..2f75eacc --- /dev/null +++ b/docs/WebhookSubscriptionBasicAuthentication.md @@ -0,0 +1,15 @@ + + +# WebhookSubscriptionBasicAuthentication + +Basic authentication credentials are not required, but if present, both username and password must be provided. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**username** | **String** | | | +|**password** | **String** | | | + + + diff --git a/docs/WebhookSubscriptionRequestSchema.md b/docs/WebhookSubscriptionRequestSchema.md new file mode 100644 index 00000000..13c82491 --- /dev/null +++ b/docs/WebhookSubscriptionRequestSchema.md @@ -0,0 +1,15 @@ + + +# WebhookSubscriptionRequestSchema + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**basicAuthentication** | [**TfvBasicAuthentication**](TfvBasicAuthentication.md) | | [optional] | +|**callbackUrl** | **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. | | +|**sharedSecretKey** | **String** | An ASCII string submitted by the user as a shared secret key for generating an HMAC header for callbacks. | [optional] | + + + diff --git a/docs/WebhookSubscriptionTypeEnum.md b/docs/WebhookSubscriptionTypeEnum.md new file mode 100644 index 00000000..44d86f88 --- /dev/null +++ b/docs/WebhookSubscriptionTypeEnum.md @@ -0,0 +1,13 @@ + + +# WebhookSubscriptionTypeEnum + +## Enum + + +* `TOLLFREE_VERIFICATION_STATUS` (value: `"TOLLFREE_VERIFICATION_STATUS"`) + +* `MESSAGING_PORTOUT_APPROVAL_STATUS` (value: `"MESSAGING_PORTOUT_APPROVAL_STATUS"`) + + + diff --git a/docs/WebhookSubscriptionsListBody.md b/docs/WebhookSubscriptionsListBody.md new file mode 100644 index 00000000..4390f0e2 --- /dev/null +++ b/docs/WebhookSubscriptionsListBody.md @@ -0,0 +1,16 @@ + + +# WebhookSubscriptionsListBody + +A list of all webhook subscriptions registered for this account ID for this particular feature (unpaginated). + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**links** | [**LinksObject**](LinksObject.md) | | [optional] | +|**errors** | [**List<Error>**](Error.md) | | [optional] | +|**data** | [**List<WebhookSubscription>**](WebhookSubscription.md) | | | + + + diff --git a/src/main/java/com/bandwidth/sdk/JSON.java b/src/main/java/com/bandwidth/sdk/JSON.java index b5958659..e34980af 100644 --- a/src/main/java/com/bandwidth/sdk/JSON.java +++ b/src/main/java/com/bandwidth/sdk/JSON.java @@ -94,6 +94,8 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); gsonBuilder.registerTypeAdapter(byte[].class, byteArrayAdapter); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.AccountStatistics.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.AdditionalDenialReason.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.Address.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.AnswerCallback.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.BridgeCompleteCallback.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.BridgeTargetCompleteCallback.CustomTypeAdapterFactory()); @@ -112,6 +114,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.ConferenceRecordingAvailableCallback.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.ConferenceRecordingMetadata.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.ConferenceRedirectCallback.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.Contact.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.CreateCall.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.CreateCallResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.CreateLookupResponse.CustomTypeAdapterFactory()); @@ -120,9 +123,12 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.DisconnectCallback.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.Diversion.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.DtmfCallback.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.Error.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.FailureWebhook.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.FieldError.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.GatherCallback.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.InitiateCallback.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.LinksObject.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.ListMessageItem.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.LookupRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.LookupResult.CustomTypeAdapterFactory()); @@ -141,6 +147,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MfaForbiddenRequestError.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MfaRequestError.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MfaUnauthorizedRequestError.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.OptInWorkflow.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.PageInfo.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RecordingAvailableCallback.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RecordingCompleteCallback.CustomTypeAdapterFactory()); @@ -149,6 +156,12 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RedirectCallback.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.StirShaken.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.Tag.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.TelephoneNumber.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.TfvBasicAuthentication.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.TfvError.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.TfvStatus.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.TfvSubmissionInfo.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.TfvSubmissionWrapper.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.TnLookupRequestError.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.TranscribeRecording.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.Transcription.CustomTypeAdapterFactory()); @@ -160,10 +173,18 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.UpdateCallRecording.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.UpdateConference.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.UpdateConferenceMember.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.VerificationDenialWebhook.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.VerificationRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.VerificationUpdateRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.VerificationWebhook.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.VerifyCodeRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.VerifyCodeResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.VoiceApiError.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.VoiceCodeResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.WebhookSubscription.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.WebhookSubscriptionBasicAuthentication.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.WebhookSubscriptionRequestSchema.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.WebhookSubscriptionsListBody.CustomTypeAdapterFactory()); gson = gsonBuilder.create(); } diff --git a/src/main/java/com/bandwidth/sdk/api/TollFreeVerificationApi.java b/src/main/java/com/bandwidth/sdk/api/TollFreeVerificationApi.java new file mode 100644 index 00000000..dc1a4c7a --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/api/TollFreeVerificationApi.java @@ -0,0 +1,1399 @@ +/* + * 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. + */ + + +package com.bandwidth.sdk.api; + +import com.bandwidth.sdk.ApiCallback; +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.ApiResponse; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.Pair; +import com.bandwidth.sdk.ProgressRequestBody; +import com.bandwidth.sdk.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.bandwidth.sdk.model.TfvError; +import com.bandwidth.sdk.model.TfvStatus; +import com.bandwidth.sdk.model.TfvSubmissionWrapper; +import com.bandwidth.sdk.model.VerificationRequest; +import com.bandwidth.sdk.model.WebhookSubscription; +import com.bandwidth.sdk.model.WebhookSubscriptionRequestSchema; +import com.bandwidth.sdk.model.WebhookSubscriptionsListBody; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class TollFreeVerificationApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public TollFreeVerificationApi() { + this(Configuration.getDefaultApiClient()); + } + + public TollFreeVerificationApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for createWebhookSubscription + * @param accountId Your Bandwidth Account ID. (required) + * @param webhookSubscriptionRequestSchema Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Created -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Cannot find the requested resource. -
405 Method Not Allowed -
429 Too Many Requests -
500 Internal Server Error -
503 Service Unavailable -
+ */ + public okhttp3.Call createWebhookSubscriptionCall(String accountId, WebhookSubscriptionRequestSchema webhookSubscriptionRequestSchema, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://api.bandwidth.com/api/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = webhookSubscriptionRequestSchema; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/tollFreeVerification/webhooks/subscriptions" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createWebhookSubscriptionValidateBeforeCall(String accountId, WebhookSubscriptionRequestSchema webhookSubscriptionRequestSchema, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling createWebhookSubscription(Async)"); + } + + // verify the required parameter 'webhookSubscriptionRequestSchema' is set + if (webhookSubscriptionRequestSchema == null) { + throw new ApiException("Missing the required parameter 'webhookSubscriptionRequestSchema' when calling createWebhookSubscription(Async)"); + } + + return createWebhookSubscriptionCall(accountId, webhookSubscriptionRequestSchema, _callback); + + } + + /** + * Create Webhook Subscription + * 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. + * @param accountId Your Bandwidth Account ID. (required) + * @param webhookSubscriptionRequestSchema Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. (required) + * @return WebhookSubscription + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Created -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Cannot find the requested resource. -
405 Method Not Allowed -
429 Too Many Requests -
500 Internal Server Error -
503 Service Unavailable -
+ */ + public WebhookSubscription createWebhookSubscription(String accountId, WebhookSubscriptionRequestSchema webhookSubscriptionRequestSchema) throws ApiException { + ApiResponse localVarResp = createWebhookSubscriptionWithHttpInfo(accountId, webhookSubscriptionRequestSchema); + return localVarResp.getData(); + } + + /** + * Create Webhook Subscription + * 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. + * @param accountId Your Bandwidth Account ID. (required) + * @param webhookSubscriptionRequestSchema Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. (required) + * @return ApiResponse<WebhookSubscription> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Created -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Cannot find the requested resource. -
405 Method Not Allowed -
429 Too Many Requests -
500 Internal Server Error -
503 Service Unavailable -
+ */ + public ApiResponse createWebhookSubscriptionWithHttpInfo(String accountId, WebhookSubscriptionRequestSchema webhookSubscriptionRequestSchema) throws ApiException { + okhttp3.Call localVarCall = createWebhookSubscriptionValidateBeforeCall(accountId, webhookSubscriptionRequestSchema, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create Webhook Subscription (asynchronously) + * 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. + * @param accountId Your Bandwidth Account ID. (required) + * @param webhookSubscriptionRequestSchema Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Created -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Cannot find the requested resource. -
405 Method Not Allowed -
429 Too Many Requests -
500 Internal Server Error -
503 Service Unavailable -
+ */ + public okhttp3.Call createWebhookSubscriptionAsync(String accountId, WebhookSubscriptionRequestSchema webhookSubscriptionRequestSchema, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createWebhookSubscriptionValidateBeforeCall(accountId, webhookSubscriptionRequestSchema, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for deleteWebhookSubscription + * @param accountId Your Bandwidth Account ID. (required) + * @param id Webhook subscription ID (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
204 No Content -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Cannot find the requested resource. -
405 Method Not Allowed -
429 Too Many Requests -
500 Internal Server Error -
503 Service Unavailable -
+ */ + public okhttp3.Call deleteWebhookSubscriptionCall(String accountId, String id, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://api.bandwidth.com/api/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id}" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())) + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteWebhookSubscriptionValidateBeforeCall(String accountId, String id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling deleteWebhookSubscription(Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling deleteWebhookSubscription(Async)"); + } + + return deleteWebhookSubscriptionCall(accountId, id, _callback); + + } + + /** + * Delete Webhook Subscription + * Delete a webhook subscription by ID. + * @param accountId Your Bandwidth Account ID. (required) + * @param id Webhook subscription ID (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
204 No Content -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Cannot find the requested resource. -
405 Method Not Allowed -
429 Too Many Requests -
500 Internal Server Error -
503 Service Unavailable -
+ */ + public void deleteWebhookSubscription(String accountId, String id) throws ApiException { + deleteWebhookSubscriptionWithHttpInfo(accountId, id); + } + + /** + * Delete Webhook Subscription + * Delete a webhook subscription by ID. + * @param accountId Your Bandwidth Account ID. (required) + * @param id Webhook subscription ID (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
204 No Content -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Cannot find the requested resource. -
405 Method Not Allowed -
429 Too Many Requests -
500 Internal Server Error -
503 Service Unavailable -
+ */ + public ApiResponse deleteWebhookSubscriptionWithHttpInfo(String accountId, String id) throws ApiException { + okhttp3.Call localVarCall = deleteWebhookSubscriptionValidateBeforeCall(accountId, id, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete Webhook Subscription (asynchronously) + * Delete a webhook subscription by ID. + * @param accountId Your Bandwidth Account ID. (required) + * @param id Webhook subscription ID (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
204 No Content -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Cannot find the requested resource. -
405 Method Not Allowed -
429 Too Many Requests -
500 Internal Server Error -
503 Service Unavailable -
+ */ + public okhttp3.Call deleteWebhookSubscriptionAsync(String accountId, String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteWebhookSubscriptionValidateBeforeCall(accountId, id, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getTollFreeVerificationStatus + * @param accountId Your Bandwidth Account ID. (required) + * @param phoneNumber Valid Toll-Free telephone number in E.164 format. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Cannot find the requested resource. -
405 Method Not Allowed -
429 Too Many Requests -
500 Internal Server Error -
503 Service Unavailable -
+ */ + public okhttp3.Call getTollFreeVerificationStatusCall(String accountId, String phoneNumber, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://api.bandwidth.com/api/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())) + .replace("{" + "phoneNumber" + "}", localVarApiClient.escapeString(phoneNumber.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getTollFreeVerificationStatusValidateBeforeCall(String accountId, String phoneNumber, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling getTollFreeVerificationStatus(Async)"); + } + + // verify the required parameter 'phoneNumber' is set + if (phoneNumber == null) { + throw new ApiException("Missing the required parameter 'phoneNumber' when calling getTollFreeVerificationStatus(Async)"); + } + + return getTollFreeVerificationStatusCall(accountId, phoneNumber, _callback); + + } + + /** + * Get Toll-Free Verification Status + * 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. + * @param accountId Your Bandwidth Account ID. (required) + * @param phoneNumber Valid Toll-Free telephone number in E.164 format. (required) + * @return TfvStatus + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Cannot find the requested resource. -
405 Method Not Allowed -
429 Too Many Requests -
500 Internal Server Error -
503 Service Unavailable -
+ */ + public TfvStatus getTollFreeVerificationStatus(String accountId, String phoneNumber) throws ApiException { + ApiResponse localVarResp = getTollFreeVerificationStatusWithHttpInfo(accountId, phoneNumber); + return localVarResp.getData(); + } + + /** + * Get Toll-Free Verification Status + * 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. + * @param accountId Your Bandwidth Account ID. (required) + * @param phoneNumber Valid Toll-Free telephone number in E.164 format. (required) + * @return ApiResponse<TfvStatus> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Cannot find the requested resource. -
405 Method Not Allowed -
429 Too Many Requests -
500 Internal Server Error -
503 Service Unavailable -
+ */ + public ApiResponse getTollFreeVerificationStatusWithHttpInfo(String accountId, String phoneNumber) throws ApiException { + okhttp3.Call localVarCall = getTollFreeVerificationStatusValidateBeforeCall(accountId, phoneNumber, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Toll-Free Verification Status (asynchronously) + * 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. + * @param accountId Your Bandwidth Account ID. (required) + * @param phoneNumber Valid Toll-Free telephone number in E.164 format. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Cannot find the requested resource. -
405 Method Not Allowed -
429 Too Many Requests -
500 Internal Server Error -
503 Service Unavailable -
+ */ + public okhttp3.Call getTollFreeVerificationStatusAsync(String accountId, String phoneNumber, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getTollFreeVerificationStatusValidateBeforeCall(accountId, phoneNumber, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for listTollFreeUseCases + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Cannot find the requested resource. -
405 Method Not Allowed -
429 Too Many Requests -
500 Internal Server Error -
503 Service Unavailable -
+ */ + public okhttp3.Call listTollFreeUseCasesCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://api.bandwidth.com/api/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/tollFreeVerification/useCases"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listTollFreeUseCasesValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return listTollFreeUseCasesCall(_callback); + + } + + /** + * List Toll-Free Use Cases + * Lists valid toll-free use cases. + * @return List<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Cannot find the requested resource. -
405 Method Not Allowed -
429 Too Many Requests -
500 Internal Server Error -
503 Service Unavailable -
+ */ + public List listTollFreeUseCases() throws ApiException { + ApiResponse> localVarResp = listTollFreeUseCasesWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * List Toll-Free Use Cases + * Lists valid toll-free use cases. + * @return ApiResponse<List<String>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Cannot find the requested resource. -
405 Method Not Allowed -
429 Too Many Requests -
500 Internal Server Error -
503 Service Unavailable -
+ */ + public ApiResponse> listTollFreeUseCasesWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = listTollFreeUseCasesValidateBeforeCall(null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List Toll-Free Use Cases (asynchronously) + * Lists valid toll-free use cases. + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Cannot find the requested resource. -
405 Method Not Allowed -
429 Too Many Requests -
500 Internal Server Error -
503 Service Unavailable -
+ */ + public okhttp3.Call listTollFreeUseCasesAsync(final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = listTollFreeUseCasesValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for listWebhookSubscriptions + * @param accountId Your Bandwidth Account ID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
405 Method Not Allowed -
429 Too Many Requests -
500 Internal Server Error -
503 Service Unavailable -
+ */ + public okhttp3.Call listWebhookSubscriptionsCall(String accountId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://api.bandwidth.com/api/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/tollFreeVerification/webhooks/subscriptions" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listWebhookSubscriptionsValidateBeforeCall(String accountId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling listWebhookSubscriptions(Async)"); + } + + return listWebhookSubscriptionsCall(accountId, _callback); + + } + + /** + * List Webhook Subscriptions + * 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). + * @param accountId Your Bandwidth Account ID. (required) + * @return WebhookSubscriptionsListBody + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
405 Method Not Allowed -
429 Too Many Requests -
500 Internal Server Error -
503 Service Unavailable -
+ */ + public WebhookSubscriptionsListBody listWebhookSubscriptions(String accountId) throws ApiException { + ApiResponse localVarResp = listWebhookSubscriptionsWithHttpInfo(accountId); + return localVarResp.getData(); + } + + /** + * List Webhook Subscriptions + * 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). + * @param accountId Your Bandwidth Account ID. (required) + * @return ApiResponse<WebhookSubscriptionsListBody> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
405 Method Not Allowed -
429 Too Many Requests -
500 Internal Server Error -
503 Service Unavailable -
+ */ + public ApiResponse listWebhookSubscriptionsWithHttpInfo(String accountId) throws ApiException { + okhttp3.Call localVarCall = listWebhookSubscriptionsValidateBeforeCall(accountId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List Webhook Subscriptions (asynchronously) + * 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). + * @param accountId Your Bandwidth Account ID. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
405 Method Not Allowed -
429 Too Many Requests -
500 Internal Server Error -
503 Service Unavailable -
+ */ + public okhttp3.Call listWebhookSubscriptionsAsync(String accountId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = listWebhookSubscriptionsValidateBeforeCall(accountId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for requestTollFreeVerification + * @param accountId Your Bandwidth Account ID. (required) + * @param verificationRequest Request for verification of a toll-free phone number. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
202 Accepted -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
405 Method Not Allowed -
429 Too Many Requests -
500 Internal Server Error -
503 Service Unavailable -
+ */ + public okhttp3.Call requestTollFreeVerificationCall(String accountId, VerificationRequest verificationRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://api.bandwidth.com/api/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = verificationRequest; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/tollFreeVerification" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call requestTollFreeVerificationValidateBeforeCall(String accountId, VerificationRequest verificationRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling requestTollFreeVerification(Async)"); + } + + // verify the required parameter 'verificationRequest' is set + if (verificationRequest == null) { + throw new ApiException("Missing the required parameter 'verificationRequest' when calling requestTollFreeVerification(Async)"); + } + + return requestTollFreeVerificationCall(accountId, verificationRequest, _callback); + + } + + /** + * Request Toll-Free Verification + * Submit a request for verification of a toll-free phone number. + * @param accountId Your Bandwidth Account ID. (required) + * @param verificationRequest Request for verification of a toll-free phone number. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
202 Accepted -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
405 Method Not Allowed -
429 Too Many Requests -
500 Internal Server Error -
503 Service Unavailable -
+ */ + public void requestTollFreeVerification(String accountId, VerificationRequest verificationRequest) throws ApiException { + requestTollFreeVerificationWithHttpInfo(accountId, verificationRequest); + } + + /** + * Request Toll-Free Verification + * Submit a request for verification of a toll-free phone number. + * @param accountId Your Bandwidth Account ID. (required) + * @param verificationRequest Request for verification of a toll-free phone number. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
202 Accepted -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
405 Method Not Allowed -
429 Too Many Requests -
500 Internal Server Error -
503 Service Unavailable -
+ */ + public ApiResponse requestTollFreeVerificationWithHttpInfo(String accountId, VerificationRequest verificationRequest) throws ApiException { + okhttp3.Call localVarCall = requestTollFreeVerificationValidateBeforeCall(accountId, verificationRequest, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Request Toll-Free Verification (asynchronously) + * Submit a request for verification of a toll-free phone number. + * @param accountId Your Bandwidth Account ID. (required) + * @param verificationRequest Request for verification of a toll-free phone number. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
202 Accepted -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
405 Method Not Allowed -
429 Too Many Requests -
500 Internal Server Error -
503 Service Unavailable -
+ */ + public okhttp3.Call requestTollFreeVerificationAsync(String accountId, VerificationRequest verificationRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = requestTollFreeVerificationValidateBeforeCall(accountId, verificationRequest, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for updateTollFreeVerificationRequest + * @param accountId Your Bandwidth Account ID. (required) + * @param phoneNumber Valid Toll-Free telephone number in E.164 format. (required) + * @param tfvSubmissionWrapper Update a request for verification of a toll-free phone number. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
202 Accepted -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
405 Method Not Allowed -
429 Too Many Requests -
500 Internal Server Error -
503 Service Unavailable -
+ */ + public okhttp3.Call updateTollFreeVerificationRequestCall(String accountId, String phoneNumber, TfvSubmissionWrapper tfvSubmissionWrapper, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://api.bandwidth.com/api/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = tfvSubmissionWrapper; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())) + .replace("{" + "phoneNumber" + "}", localVarApiClient.escapeString(phoneNumber.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateTollFreeVerificationRequestValidateBeforeCall(String accountId, String phoneNumber, TfvSubmissionWrapper tfvSubmissionWrapper, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling updateTollFreeVerificationRequest(Async)"); + } + + // verify the required parameter 'phoneNumber' is set + if (phoneNumber == null) { + throw new ApiException("Missing the required parameter 'phoneNumber' when calling updateTollFreeVerificationRequest(Async)"); + } + + // verify the required parameter 'tfvSubmissionWrapper' is set + if (tfvSubmissionWrapper == null) { + throw new ApiException("Missing the required parameter 'tfvSubmissionWrapper' when calling updateTollFreeVerificationRequest(Async)"); + } + + return updateTollFreeVerificationRequestCall(accountId, phoneNumber, tfvSubmissionWrapper, _callback); + + } + + /** + * Update Toll-Free Verification Request + * 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). + * @param accountId Your Bandwidth Account ID. (required) + * @param phoneNumber Valid Toll-Free telephone number in E.164 format. (required) + * @param tfvSubmissionWrapper Update a request for verification of a toll-free phone number. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
202 Accepted -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
405 Method Not Allowed -
429 Too Many Requests -
500 Internal Server Error -
503 Service Unavailable -
+ */ + public void updateTollFreeVerificationRequest(String accountId, String phoneNumber, TfvSubmissionWrapper tfvSubmissionWrapper) throws ApiException { + updateTollFreeVerificationRequestWithHttpInfo(accountId, phoneNumber, tfvSubmissionWrapper); + } + + /** + * Update Toll-Free Verification Request + * 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). + * @param accountId Your Bandwidth Account ID. (required) + * @param phoneNumber Valid Toll-Free telephone number in E.164 format. (required) + * @param tfvSubmissionWrapper Update a request for verification of a toll-free phone number. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
202 Accepted -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
405 Method Not Allowed -
429 Too Many Requests -
500 Internal Server Error -
503 Service Unavailable -
+ */ + public ApiResponse updateTollFreeVerificationRequestWithHttpInfo(String accountId, String phoneNumber, TfvSubmissionWrapper tfvSubmissionWrapper) throws ApiException { + okhttp3.Call localVarCall = updateTollFreeVerificationRequestValidateBeforeCall(accountId, phoneNumber, tfvSubmissionWrapper, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Update Toll-Free Verification Request (asynchronously) + * 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). + * @param accountId Your Bandwidth Account ID. (required) + * @param phoneNumber Valid Toll-Free telephone number in E.164 format. (required) + * @param tfvSubmissionWrapper Update a request for verification of a toll-free phone number. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
202 Accepted -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
405 Method Not Allowed -
429 Too Many Requests -
500 Internal Server Error -
503 Service Unavailable -
+ */ + public okhttp3.Call updateTollFreeVerificationRequestAsync(String accountId, String phoneNumber, TfvSubmissionWrapper tfvSubmissionWrapper, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateTollFreeVerificationRequestValidateBeforeCall(accountId, phoneNumber, tfvSubmissionWrapper, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for updateWebhookSubscription + * @param accountId Your Bandwidth Account ID. (required) + * @param id Webhook subscription ID (required) + * @param webhookSubscriptionRequestSchema Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Cannot find the requested resource. -
405 Method Not Allowed -
429 Too Many Requests -
500 Internal Server Error -
503 Service Unavailable -
+ */ + public okhttp3.Call updateWebhookSubscriptionCall(String accountId, String id, WebhookSubscriptionRequestSchema webhookSubscriptionRequestSchema, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://api.bandwidth.com/api/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = webhookSubscriptionRequestSchema; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id}" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())) + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateWebhookSubscriptionValidateBeforeCall(String accountId, String id, WebhookSubscriptionRequestSchema webhookSubscriptionRequestSchema, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling updateWebhookSubscription(Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling updateWebhookSubscription(Async)"); + } + + // verify the required parameter 'webhookSubscriptionRequestSchema' is set + if (webhookSubscriptionRequestSchema == null) { + throw new ApiException("Missing the required parameter 'webhookSubscriptionRequestSchema' when calling updateWebhookSubscription(Async)"); + } + + return updateWebhookSubscriptionCall(accountId, id, webhookSubscriptionRequestSchema, _callback); + + } + + /** + * Update Webhook Subscription + * Update an existing webhook subscription (`callbackUrl` and `basicAuthentication` can be updated). + * @param accountId Your Bandwidth Account ID. (required) + * @param id Webhook subscription ID (required) + * @param webhookSubscriptionRequestSchema Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. (required) + * @return WebhookSubscription + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Cannot find the requested resource. -
405 Method Not Allowed -
429 Too Many Requests -
500 Internal Server Error -
503 Service Unavailable -
+ */ + public WebhookSubscription updateWebhookSubscription(String accountId, String id, WebhookSubscriptionRequestSchema webhookSubscriptionRequestSchema) throws ApiException { + ApiResponse localVarResp = updateWebhookSubscriptionWithHttpInfo(accountId, id, webhookSubscriptionRequestSchema); + return localVarResp.getData(); + } + + /** + * Update Webhook Subscription + * Update an existing webhook subscription (`callbackUrl` and `basicAuthentication` can be updated). + * @param accountId Your Bandwidth Account ID. (required) + * @param id Webhook subscription ID (required) + * @param webhookSubscriptionRequestSchema Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. (required) + * @return ApiResponse<WebhookSubscription> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Cannot find the requested resource. -
405 Method Not Allowed -
429 Too Many Requests -
500 Internal Server Error -
503 Service Unavailable -
+ */ + public ApiResponse updateWebhookSubscriptionWithHttpInfo(String accountId, String id, WebhookSubscriptionRequestSchema webhookSubscriptionRequestSchema) throws ApiException { + okhttp3.Call localVarCall = updateWebhookSubscriptionValidateBeforeCall(accountId, id, webhookSubscriptionRequestSchema, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update Webhook Subscription (asynchronously) + * Update an existing webhook subscription (`callbackUrl` and `basicAuthentication` can be updated). + * @param accountId Your Bandwidth Account ID. (required) + * @param id Webhook subscription ID (required) + * @param webhookSubscriptionRequestSchema Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Cannot find the requested resource. -
405 Method Not Allowed -
429 Too Many Requests -
500 Internal Server Error -
503 Service Unavailable -
+ */ + public okhttp3.Call updateWebhookSubscriptionAsync(String accountId, String id, WebhookSubscriptionRequestSchema webhookSubscriptionRequestSchema, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateWebhookSubscriptionValidateBeforeCall(accountId, id, webhookSubscriptionRequestSchema, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/com/bandwidth/sdk/model/AdditionalDenialReason.java b/src/main/java/com/bandwidth/sdk/model/AdditionalDenialReason.java new file mode 100644 index 00000000..e9c708b5 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/AdditionalDenialReason.java @@ -0,0 +1,351 @@ +/* + * 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. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * AdditionalDenialReason + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") +public class AdditionalDenialReason { + public static final String SERIALIZED_NAME_STATUS_CODE = "statusCode"; + @SerializedName(SERIALIZED_NAME_STATUS_CODE) + @javax.annotation.Nonnull + private Integer statusCode; + + public static final String SERIALIZED_NAME_REASON = "reason"; + @SerializedName(SERIALIZED_NAME_REASON) + @javax.annotation.Nonnull + private String reason; + + public static final String SERIALIZED_NAME_RESUBMIT_ALLOWED = "resubmitAllowed"; + @SerializedName(SERIALIZED_NAME_RESUBMIT_ALLOWED) + @javax.annotation.Nonnull + private Boolean resubmitAllowed; + + public AdditionalDenialReason() { + } + + public AdditionalDenialReason statusCode(@javax.annotation.Nonnull Integer statusCode) { + this.statusCode = statusCode; + return this; + } + + /** + * Reason code for denial. + * @return statusCode + */ + @javax.annotation.Nonnull + public Integer getStatusCode() { + return statusCode; + } + + public void setStatusCode(@javax.annotation.Nonnull Integer statusCode) { + this.statusCode = statusCode; + } + + + public AdditionalDenialReason reason(@javax.annotation.Nonnull String reason) { + this.reason = reason; + return this; + } + + /** + * Explanation for why a verification request was declined. + * @return reason + */ + @javax.annotation.Nonnull + public String getReason() { + return reason; + } + + public void setReason(@javax.annotation.Nonnull String reason) { + this.reason = reason; + } + + + public AdditionalDenialReason resubmitAllowed(@javax.annotation.Nonnull Boolean resubmitAllowed) { + this.resubmitAllowed = resubmitAllowed; + return this; + } + + /** + * Whether a Toll-Free Verification request qualifies for resubmission via PUT. + * @return resubmitAllowed + */ + @javax.annotation.Nonnull + public Boolean getResubmitAllowed() { + return resubmitAllowed; + } + + public void setResubmitAllowed(@javax.annotation.Nonnull Boolean resubmitAllowed) { + this.resubmitAllowed = resubmitAllowed; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AdditionalDenialReason instance itself + */ + public AdditionalDenialReason putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalDenialReason additionalDenialReason = (AdditionalDenialReason) o; + return Objects.equals(this.statusCode, additionalDenialReason.statusCode) && + Objects.equals(this.reason, additionalDenialReason.reason) && + Objects.equals(this.resubmitAllowed, additionalDenialReason.resubmitAllowed)&& + Objects.equals(this.additionalProperties, additionalDenialReason.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(statusCode, reason, resubmitAllowed, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalDenialReason {\n"); + sb.append(" statusCode: ").append(toIndentedString(statusCode)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" resubmitAllowed: ").append(toIndentedString(resubmitAllowed)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("statusCode"); + openapiFields.add("reason"); + openapiFields.add("resubmitAllowed"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("statusCode"); + openapiRequiredFields.add("reason"); + openapiRequiredFields.add("resubmitAllowed"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalDenialReason + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalDenialReason.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalDenialReason is not found in the empty JSON string", AdditionalDenialReason.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AdditionalDenialReason.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("reason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `reason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reason").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalDenialReason.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalDenialReason' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalDenialReason.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalDenialReason value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AdditionalDenialReason read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AdditionalDenialReason instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalDenialReason given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalDenialReason + * @throws IOException if the JSON string is invalid with respect to AdditionalDenialReason + */ + public static AdditionalDenialReason fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalDenialReason.class); + } + + /** + * Convert an instance of AdditionalDenialReason to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/Address.java b/src/main/java/com/bandwidth/sdk/model/Address.java new file mode 100644 index 00000000..198c29b9 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/Address.java @@ -0,0 +1,492 @@ +/* + * 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. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * Address + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") +public class Address { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_ADDR1 = "addr1"; + @SerializedName(SERIALIZED_NAME_ADDR1) + @javax.annotation.Nonnull + private String addr1; + + public static final String SERIALIZED_NAME_ADDR2 = "addr2"; + @SerializedName(SERIALIZED_NAME_ADDR2) + @javax.annotation.Nullable + private String addr2; + + public static final String SERIALIZED_NAME_CITY = "city"; + @SerializedName(SERIALIZED_NAME_CITY) + @javax.annotation.Nonnull + private String city; + + public static final String SERIALIZED_NAME_STATE = "state"; + @SerializedName(SERIALIZED_NAME_STATE) + @javax.annotation.Nonnull + private String state; + + public static final String SERIALIZED_NAME_ZIP = "zip"; + @SerializedName(SERIALIZED_NAME_ZIP) + @javax.annotation.Nonnull + private String zip; + + public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) + @javax.annotation.Nonnull + private String url; + + public Address() { + } + + public Address name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * The name of the business using the toll-free number. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public Address addr1(@javax.annotation.Nonnull String addr1) { + this.addr1 = addr1; + return this; + } + + /** + * The address of the business using the toll-free number. + * @return addr1 + */ + @javax.annotation.Nonnull + public String getAddr1() { + return addr1; + } + + public void setAddr1(@javax.annotation.Nonnull String addr1) { + this.addr1 = addr1; + } + + + public Address addr2(@javax.annotation.Nullable String addr2) { + this.addr2 = addr2; + return this; + } + + /** + * The address of the business using the toll-free number. + * @return addr2 + */ + @javax.annotation.Nullable + public String getAddr2() { + return addr2; + } + + public void setAddr2(@javax.annotation.Nullable String addr2) { + this.addr2 = addr2; + } + + + public Address city(@javax.annotation.Nonnull String city) { + this.city = city; + return this; + } + + /** + * The city of the business using the toll-free number. + * @return city + */ + @javax.annotation.Nonnull + public String getCity() { + return city; + } + + public void setCity(@javax.annotation.Nonnull String city) { + this.city = city; + } + + + public Address state(@javax.annotation.Nonnull String state) { + this.state = state; + return this; + } + + /** + * The state of the business using the toll-free number. + * @return state + */ + @javax.annotation.Nonnull + public String getState() { + return state; + } + + public void setState(@javax.annotation.Nonnull String state) { + this.state = state; + } + + + public Address zip(@javax.annotation.Nonnull String zip) { + this.zip = zip; + return this; + } + + /** + * The zip of the business using the toll-free number. + * @return zip + */ + @javax.annotation.Nonnull + public String getZip() { + return zip; + } + + public void setZip(@javax.annotation.Nonnull String zip) { + this.zip = zip; + } + + + public Address url(@javax.annotation.Nonnull String url) { + this.url = url; + return this; + } + + /** + * The website of the business using the toll-free number. + * @return url + */ + @javax.annotation.Nonnull + public String getUrl() { + return url; + } + + public void setUrl(@javax.annotation.Nonnull String url) { + this.url = url; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Address instance itself + */ + public Address putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Address address = (Address) o; + return Objects.equals(this.name, address.name) && + Objects.equals(this.addr1, address.addr1) && + Objects.equals(this.addr2, address.addr2) && + Objects.equals(this.city, address.city) && + Objects.equals(this.state, address.state) && + Objects.equals(this.zip, address.zip) && + Objects.equals(this.url, address.url)&& + Objects.equals(this.additionalProperties, address.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(name, addr1, addr2, city, state, zip, url, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Address {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" addr1: ").append(toIndentedString(addr1)).append("\n"); + sb.append(" addr2: ").append(toIndentedString(addr2)).append("\n"); + sb.append(" city: ").append(toIndentedString(city)).append("\n"); + sb.append(" state: ").append(toIndentedString(state)).append("\n"); + sb.append(" zip: ").append(toIndentedString(zip)).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("addr1"); + openapiFields.add("addr2"); + openapiFields.add("city"); + openapiFields.add("state"); + openapiFields.add("zip"); + openapiFields.add("url"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("addr1"); + openapiRequiredFields.add("city"); + openapiRequiredFields.add("state"); + openapiRequiredFields.add("zip"); + openapiRequiredFields.add("url"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Address + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Address.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Address is not found in the empty JSON string", Address.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Address.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (!jsonObj.get("addr1").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `addr1` to be a primitive type in the JSON string but got `%s`", jsonObj.get("addr1").toString())); + } + if ((jsonObj.get("addr2") != null && !jsonObj.get("addr2").isJsonNull()) && !jsonObj.get("addr2").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `addr2` to be a primitive type in the JSON string but got `%s`", jsonObj.get("addr2").toString())); + } + if (!jsonObj.get("city").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `city` to be a primitive type in the JSON string but got `%s`", jsonObj.get("city").toString())); + } + if (!jsonObj.get("state").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `state` to be a primitive type in the JSON string but got `%s`", jsonObj.get("state").toString())); + } + if (!jsonObj.get("zip").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `zip` to be a primitive type in the JSON string but got `%s`", jsonObj.get("zip").toString())); + } + if (!jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("url").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Address.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Address' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter
thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Address.class)); + + return (TypeAdapter) new TypeAdapter
() { + @Override + public void write(JsonWriter out, Address value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Address read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Address instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Address given an JSON string + * + * @param jsonString JSON string + * @return An instance of Address + * @throws IOException if the JSON string is invalid with respect to Address + */ + public static Address fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Address.class); + } + + /** + * Convert an instance of Address to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/Contact.java b/src/main/java/com/bandwidth/sdk/model/Contact.java new file mode 100644 index 00000000..bf293874 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/Contact.java @@ -0,0 +1,388 @@ +/* + * 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. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * Contact + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") +public class Contact { + public static final String SERIALIZED_NAME_FIRST_NAME = "firstName"; + @SerializedName(SERIALIZED_NAME_FIRST_NAME) + @javax.annotation.Nonnull + private String firstName; + + public static final String SERIALIZED_NAME_LAST_NAME = "lastName"; + @SerializedName(SERIALIZED_NAME_LAST_NAME) + @javax.annotation.Nonnull + private String lastName; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + @javax.annotation.Nonnull + private String email; + + public static final String SERIALIZED_NAME_PHONE_NUMBER = "phoneNumber"; + @SerializedName(SERIALIZED_NAME_PHONE_NUMBER) + @javax.annotation.Nonnull + private String phoneNumber; + + public Contact() { + } + + public Contact firstName(@javax.annotation.Nonnull String firstName) { + this.firstName = firstName; + return this; + } + + /** + * The first name of the business contact using the toll-free number. + * @return firstName + */ + @javax.annotation.Nonnull + public String getFirstName() { + return firstName; + } + + public void setFirstName(@javax.annotation.Nonnull String firstName) { + this.firstName = firstName; + } + + + public Contact lastName(@javax.annotation.Nonnull String lastName) { + this.lastName = lastName; + return this; + } + + /** + * The last name of the business contact using the toll-free number. + * @return lastName + */ + @javax.annotation.Nonnull + public String getLastName() { + return lastName; + } + + public void setLastName(@javax.annotation.Nonnull String lastName) { + this.lastName = lastName; + } + + + public Contact email(@javax.annotation.Nonnull String email) { + this.email = email; + return this; + } + + /** + * Get email + * @return email + */ + @javax.annotation.Nonnull + public String getEmail() { + return email; + } + + public void setEmail(@javax.annotation.Nonnull String email) { + this.email = email; + } + + + public Contact phoneNumber(@javax.annotation.Nonnull String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Contact telephone number + * @return phoneNumber + */ + @javax.annotation.Nonnull + public String getPhoneNumber() { + return phoneNumber; + } + + public void setPhoneNumber(@javax.annotation.Nonnull String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Contact instance itself + */ + public Contact putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Contact contact = (Contact) o; + return Objects.equals(this.firstName, contact.firstName) && + Objects.equals(this.lastName, contact.lastName) && + Objects.equals(this.email, contact.email) && + Objects.equals(this.phoneNumber, contact.phoneNumber)&& + Objects.equals(this.additionalProperties, contact.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(firstName, lastName, email, phoneNumber, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Contact {\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("firstName"); + openapiFields.add("lastName"); + openapiFields.add("email"); + openapiFields.add("phoneNumber"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("firstName"); + openapiRequiredFields.add("lastName"); + openapiRequiredFields.add("email"); + openapiRequiredFields.add("phoneNumber"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Contact + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Contact.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Contact is not found in the empty JSON string", Contact.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Contact.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("firstName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `firstName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("firstName").toString())); + } + if (!jsonObj.get("lastName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lastName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastName").toString())); + } + if (!jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if (!jsonObj.get("phoneNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `phoneNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("phoneNumber").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Contact.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Contact' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Contact.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Contact value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Contact read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Contact instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Contact given an JSON string + * + * @param jsonString JSON string + * @return An instance of Contact + * @throws IOException if the JSON string is invalid with respect to Contact + */ + public static Contact fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Contact.class); + } + + /** + * Convert an instance of Contact to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/Error.java b/src/main/java/com/bandwidth/sdk/model/Error.java new file mode 100644 index 00000000..a6c081dc --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/Error.java @@ -0,0 +1,366 @@ +/* + * 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. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.TelephoneNumber; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * Error + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") +public class Error { + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nullable + private Integer code; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable + private String description; + + public static final String SERIALIZED_NAME_TELEPHONE_NUMBERS = "telephoneNumbers"; + @SerializedName(SERIALIZED_NAME_TELEPHONE_NUMBERS) + @javax.annotation.Nullable + private List telephoneNumbers = new ArrayList<>(); + + public Error() { + } + + public Error code(@javax.annotation.Nullable Integer code) { + this.code = code; + return this; + } + + /** + * Get code + * @return code + */ + @javax.annotation.Nullable + public Integer getCode() { + return code; + } + + public void setCode(@javax.annotation.Nullable Integer code) { + this.code = code; + } + + + public Error description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + + public Error telephoneNumbers(@javax.annotation.Nullable List telephoneNumbers) { + this.telephoneNumbers = telephoneNumbers; + return this; + } + + public Error addTelephoneNumbersItem(TelephoneNumber telephoneNumbersItem) { + if (this.telephoneNumbers == null) { + this.telephoneNumbers = new ArrayList<>(); + } + this.telephoneNumbers.add(telephoneNumbersItem); + return this; + } + + /** + * Get telephoneNumbers + * @return telephoneNumbers + */ + @javax.annotation.Nullable + public List getTelephoneNumbers() { + return telephoneNumbers; + } + + public void setTelephoneNumbers(@javax.annotation.Nullable List telephoneNumbers) { + this.telephoneNumbers = telephoneNumbers; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Error instance itself + */ + public Error putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Error error = (Error) o; + return Objects.equals(this.code, error.code) && + Objects.equals(this.description, error.description) && + Objects.equals(this.telephoneNumbers, error.telephoneNumbers)&& + Objects.equals(this.additionalProperties, error.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(code, description, telephoneNumbers, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Error {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" telephoneNumbers: ").append(toIndentedString(telephoneNumbers)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + openapiFields.add("description"); + openapiFields.add("telephoneNumbers"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Error + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Error.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Error is not found in the empty JSON string", Error.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if (jsonObj.get("telephoneNumbers") != null && !jsonObj.get("telephoneNumbers").isJsonNull()) { + JsonArray jsonArraytelephoneNumbers = jsonObj.getAsJsonArray("telephoneNumbers"); + if (jsonArraytelephoneNumbers != null) { + // ensure the json data is an array + if (!jsonObj.get("telephoneNumbers").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `telephoneNumbers` to be an array in the JSON string but got `%s`", jsonObj.get("telephoneNumbers").toString())); + } + + // validate the optional field `telephoneNumbers` (array) + for (int i = 0; i < jsonArraytelephoneNumbers.size(); i++) { + TelephoneNumber.validateJsonElement(jsonArraytelephoneNumbers.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Error.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Error' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Error.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Error value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Error read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Error instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Error given an JSON string + * + * @param jsonString JSON string + * @return An instance of Error + * @throws IOException if the JSON string is invalid with respect to Error + */ + public static Error fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Error.class); + } + + /** + * Convert an instance of Error to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/FailureWebhook.java b/src/main/java/com/bandwidth/sdk/model/FailureWebhook.java new file mode 100644 index 00000000..bb5b1691 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/FailureWebhook.java @@ -0,0 +1,449 @@ +/* + * 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. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * FailureWebhook + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") +public class FailureWebhook { + public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + @javax.annotation.Nullable + private String accountId; + + public static final String SERIALIZED_NAME_PHONE_NUMBER = "phoneNumber"; + @SerializedName(SERIALIZED_NAME_PHONE_NUMBER) + @javax.annotation.Nullable + private String phoneNumber; + + public static final String SERIALIZED_NAME_ERROR_CODE = "errorCode"; + @SerializedName(SERIALIZED_NAME_ERROR_CODE) + @javax.annotation.Nullable + private String errorCode; + + public static final String SERIALIZED_NAME_ERROR_DESCRIPTION = "errorDescription"; + @SerializedName(SERIALIZED_NAME_ERROR_DESCRIPTION) + @javax.annotation.Nullable + private String errorDescription; + + public static final String SERIALIZED_NAME_ERRORS = "errors"; + @SerializedName(SERIALIZED_NAME_ERRORS) + @javax.annotation.Nullable + private List errors = new ArrayList<>(); + + public static final String SERIALIZED_NAME_INTERNAL_TICKET_NUMBER = "internalTicketNumber"; + @SerializedName(SERIALIZED_NAME_INTERNAL_TICKET_NUMBER) + @javax.annotation.Nullable + private UUID internalTicketNumber; + + public FailureWebhook() { + } + + public FailureWebhook accountId(@javax.annotation.Nullable String accountId) { + this.accountId = accountId; + return this; + } + + /** + * User's account ID. + * @return accountId + */ + @javax.annotation.Nullable + public String getAccountId() { + return accountId; + } + + public void setAccountId(@javax.annotation.Nullable String accountId) { + this.accountId = accountId; + } + + + public FailureWebhook phoneNumber(@javax.annotation.Nullable String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Toll-free telephone number in E.164 format. + * @return phoneNumber + */ + @javax.annotation.Nullable + public String getPhoneNumber() { + return phoneNumber; + } + + public void setPhoneNumber(@javax.annotation.Nullable String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + + public FailureWebhook errorCode(@javax.annotation.Nullable String errorCode) { + this.errorCode = errorCode; + return this; + } + + /** + * 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. + * @return errorCode + */ + @javax.annotation.Nullable + public String getErrorCode() { + return errorCode; + } + + public void setErrorCode(@javax.annotation.Nullable String errorCode) { + this.errorCode = errorCode; + } + + + public FailureWebhook errorDescription(@javax.annotation.Nullable String errorDescription) { + this.errorDescription = errorDescription; + return this; + } + + /** + * A description of the error that was encountered. + * @return errorDescription + */ + @javax.annotation.Nullable + public String getErrorDescription() { + return errorDescription; + } + + public void setErrorDescription(@javax.annotation.Nullable String errorDescription) { + this.errorDescription = errorDescription; + } + + + public FailureWebhook errors(@javax.annotation.Nullable List errors) { + this.errors = errors; + return this; + } + + public FailureWebhook addErrorsItem(String errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + + /** + * Details of the errors that were encountered when processing the request. + * @return errors + */ + @javax.annotation.Nullable + public List getErrors() { + return errors; + } + + public void setErrors(@javax.annotation.Nullable List errors) { + this.errors = errors; + } + + + public FailureWebhook internalTicketNumber(@javax.annotation.Nullable UUID internalTicketNumber) { + this.internalTicketNumber = internalTicketNumber; + return this; + } + + /** + * Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number. + * @return internalTicketNumber + */ + @javax.annotation.Nullable + public UUID getInternalTicketNumber() { + return internalTicketNumber; + } + + public void setInternalTicketNumber(@javax.annotation.Nullable UUID internalTicketNumber) { + this.internalTicketNumber = internalTicketNumber; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the FailureWebhook instance itself + */ + public FailureWebhook putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FailureWebhook failureWebhook = (FailureWebhook) o; + return Objects.equals(this.accountId, failureWebhook.accountId) && + Objects.equals(this.phoneNumber, failureWebhook.phoneNumber) && + Objects.equals(this.errorCode, failureWebhook.errorCode) && + Objects.equals(this.errorDescription, failureWebhook.errorDescription) && + Objects.equals(this.errors, failureWebhook.errors) && + Objects.equals(this.internalTicketNumber, failureWebhook.internalTicketNumber)&& + Objects.equals(this.additionalProperties, failureWebhook.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(accountId, phoneNumber, errorCode, errorDescription, errors, internalTicketNumber, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FailureWebhook {\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).append("\n"); + sb.append(" errorCode: ").append(toIndentedString(errorCode)).append("\n"); + sb.append(" errorDescription: ").append(toIndentedString(errorDescription)).append("\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append(" internalTicketNumber: ").append(toIndentedString(internalTicketNumber)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("accountId"); + openapiFields.add("phoneNumber"); + openapiFields.add("errorCode"); + openapiFields.add("errorDescription"); + openapiFields.add("errors"); + openapiFields.add("internalTicketNumber"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FailureWebhook + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FailureWebhook.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in FailureWebhook is not found in the empty JSON string", FailureWebhook.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("accountId") != null && !jsonObj.get("accountId").isJsonNull()) && !jsonObj.get("accountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountId").toString())); + } + if ((jsonObj.get("phoneNumber") != null && !jsonObj.get("phoneNumber").isJsonNull()) && !jsonObj.get("phoneNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `phoneNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("phoneNumber").toString())); + } + if ((jsonObj.get("errorCode") != null && !jsonObj.get("errorCode").isJsonNull()) && !jsonObj.get("errorCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `errorCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("errorCode").toString())); + } + if ((jsonObj.get("errorDescription") != null && !jsonObj.get("errorDescription").isJsonNull()) && !jsonObj.get("errorDescription").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `errorDescription` to be a primitive type in the JSON string but got `%s`", jsonObj.get("errorDescription").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("errors") != null && !jsonObj.get("errors").isJsonNull() && !jsonObj.get("errors").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `errors` to be an array in the JSON string but got `%s`", jsonObj.get("errors").toString())); + } + if ((jsonObj.get("internalTicketNumber") != null && !jsonObj.get("internalTicketNumber").isJsonNull()) && !jsonObj.get("internalTicketNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `internalTicketNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("internalTicketNumber").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FailureWebhook.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FailureWebhook' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FailureWebhook.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FailureWebhook value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public FailureWebhook read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + FailureWebhook instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FailureWebhook given an JSON string + * + * @param jsonString JSON string + * @return An instance of FailureWebhook + * @throws IOException if the JSON string is invalid with respect to FailureWebhook + */ + public static FailureWebhook fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FailureWebhook.class); + } + + /** + * Convert an instance of FailureWebhook to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/LinksObject.java b/src/main/java/com/bandwidth/sdk/model/LinksObject.java new file mode 100644 index 00000000..630fec92 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/LinksObject.java @@ -0,0 +1,377 @@ +/* + * 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. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * LinksObject + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") +public class LinksObject { + public static final String SERIALIZED_NAME_FIRST = "first"; + @SerializedName(SERIALIZED_NAME_FIRST) + @javax.annotation.Nullable + private String first; + + public static final String SERIALIZED_NAME_NEXT = "next"; + @SerializedName(SERIALIZED_NAME_NEXT) + @javax.annotation.Nullable + private String next; + + public static final String SERIALIZED_NAME_PREVIOUS = "previous"; + @SerializedName(SERIALIZED_NAME_PREVIOUS) + @javax.annotation.Nullable + private String previous; + + public static final String SERIALIZED_NAME_LAST = "last"; + @SerializedName(SERIALIZED_NAME_LAST) + @javax.annotation.Nullable + private String last; + + public LinksObject() { + } + + public LinksObject first(@javax.annotation.Nullable String first) { + this.first = first; + return this; + } + + /** + * The first (or only) page of results matching the query. + * @return first + */ + @javax.annotation.Nullable + public String getFirst() { + return first; + } + + public void setFirst(@javax.annotation.Nullable String first) { + this.first = first; + } + + + public LinksObject next(@javax.annotation.Nullable String next) { + this.next = next; + return this; + } + + /** + * If more results exist than specified by 'size', this link returns the next page of 'size' results. + * @return next + */ + @javax.annotation.Nullable + public String getNext() { + return next; + } + + public void setNext(@javax.annotation.Nullable String next) { + this.next = next; + } + + + public LinksObject previous(@javax.annotation.Nullable String previous) { + this.previous = previous; + return this; + } + + /** + * If the results are more than one page, this link returns the previous page of 'size' results. + * @return previous + */ + @javax.annotation.Nullable + public String getPrevious() { + return previous; + } + + public void setPrevious(@javax.annotation.Nullable String previous) { + this.previous = previous; + } + + + public LinksObject last(@javax.annotation.Nullable String last) { + this.last = last; + return this; + } + + /** + * If more results exist than specified by 'size', this link return the last page of result. + * @return last + */ + @javax.annotation.Nullable + public String getLast() { + return last; + } + + public void setLast(@javax.annotation.Nullable String last) { + this.last = last; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the LinksObject instance itself + */ + public LinksObject putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LinksObject linksObject = (LinksObject) o; + return Objects.equals(this.first, linksObject.first) && + Objects.equals(this.next, linksObject.next) && + Objects.equals(this.previous, linksObject.previous) && + Objects.equals(this.last, linksObject.last)&& + Objects.equals(this.additionalProperties, linksObject.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(first, next, previous, last, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LinksObject {\n"); + sb.append(" first: ").append(toIndentedString(first)).append("\n"); + sb.append(" next: ").append(toIndentedString(next)).append("\n"); + sb.append(" previous: ").append(toIndentedString(previous)).append("\n"); + sb.append(" last: ").append(toIndentedString(last)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("first"); + openapiFields.add("next"); + openapiFields.add("previous"); + openapiFields.add("last"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to LinksObject + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!LinksObject.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in LinksObject is not found in the empty JSON string", LinksObject.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("first") != null && !jsonObj.get("first").isJsonNull()) && !jsonObj.get("first").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `first` to be a primitive type in the JSON string but got `%s`", jsonObj.get("first").toString())); + } + if ((jsonObj.get("next") != null && !jsonObj.get("next").isJsonNull()) && !jsonObj.get("next").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `next` to be a primitive type in the JSON string but got `%s`", jsonObj.get("next").toString())); + } + if ((jsonObj.get("previous") != null && !jsonObj.get("previous").isJsonNull()) && !jsonObj.get("previous").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `previous` to be a primitive type in the JSON string but got `%s`", jsonObj.get("previous").toString())); + } + if ((jsonObj.get("last") != null && !jsonObj.get("last").isJsonNull()) && !jsonObj.get("last").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `last` to be a primitive type in the JSON string but got `%s`", jsonObj.get("last").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!LinksObject.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'LinksObject' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(LinksObject.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, LinksObject value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public LinksObject read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + LinksObject instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of LinksObject given an JSON string + * + * @param jsonString JSON string + * @return An instance of LinksObject + * @throws IOException if the JSON string is invalid with respect to LinksObject + */ + public static LinksObject fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, LinksObject.class); + } + + /** + * Convert an instance of LinksObject to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/OptInWorkflow.java b/src/main/java/com/bandwidth/sdk/model/OptInWorkflow.java new file mode 100644 index 00000000..42812f95 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/OptInWorkflow.java @@ -0,0 +1,339 @@ +/* + * 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. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * OptInWorkflow + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") +public class OptInWorkflow { + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nonnull + private String description; + + public static final String SERIALIZED_NAME_IMAGE_URLS = "imageUrls"; + @SerializedName(SERIALIZED_NAME_IMAGE_URLS) + @javax.annotation.Nonnull + private List imageUrls = new ArrayList<>(); + + public OptInWorkflow() { + } + + public OptInWorkflow description(@javax.annotation.Nonnull String description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + */ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nonnull String description) { + this.description = description; + } + + + public OptInWorkflow imageUrls(@javax.annotation.Nonnull List imageUrls) { + this.imageUrls = imageUrls; + return this; + } + + public OptInWorkflow addImageUrlsItem(String imageUrlsItem) { + if (this.imageUrls == null) { + this.imageUrls = new ArrayList<>(); + } + this.imageUrls.add(imageUrlsItem); + return this; + } + + /** + * Get imageUrls + * @return imageUrls + */ + @javax.annotation.Nonnull + public List getImageUrls() { + return imageUrls; + } + + public void setImageUrls(@javax.annotation.Nonnull List imageUrls) { + this.imageUrls = imageUrls; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the OptInWorkflow instance itself + */ + public OptInWorkflow putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OptInWorkflow optInWorkflow = (OptInWorkflow) o; + return Objects.equals(this.description, optInWorkflow.description) && + Objects.equals(this.imageUrls, optInWorkflow.imageUrls)&& + Objects.equals(this.additionalProperties, optInWorkflow.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(description, imageUrls, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OptInWorkflow {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" imageUrls: ").append(toIndentedString(imageUrls)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("description"); + openapiFields.add("imageUrls"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("imageUrls"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OptInWorkflow + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OptInWorkflow.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OptInWorkflow is not found in the empty JSON string", OptInWorkflow.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OptInWorkflow.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + // ensure the required json array is present + if (jsonObj.get("imageUrls") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("imageUrls").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `imageUrls` to be an array in the JSON string but got `%s`", jsonObj.get("imageUrls").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OptInWorkflow.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OptInWorkflow' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OptInWorkflow.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OptInWorkflow value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public OptInWorkflow read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + OptInWorkflow instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OptInWorkflow given an JSON string + * + * @param jsonString JSON string + * @return An instance of OptInWorkflow + * @throws IOException if the JSON string is invalid with respect to OptInWorkflow + */ + public static OptInWorkflow fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OptInWorkflow.class); + } + + /** + * Convert an instance of OptInWorkflow to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/TelephoneNumber.java b/src/main/java/com/bandwidth/sdk/model/TelephoneNumber.java new file mode 100644 index 00000000..13af88b4 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/TelephoneNumber.java @@ -0,0 +1,287 @@ +/* + * 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. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * TelephoneNumber + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") +public class TelephoneNumber { + public static final String SERIALIZED_NAME_TELEPHONE_NUMBER = "telephoneNumber"; + @SerializedName(SERIALIZED_NAME_TELEPHONE_NUMBER) + @javax.annotation.Nullable + private String telephoneNumber; + + public TelephoneNumber() { + } + + public TelephoneNumber telephoneNumber(@javax.annotation.Nullable String telephoneNumber) { + this.telephoneNumber = telephoneNumber; + return this; + } + + /** + * Simple Telephone Number. + * @return telephoneNumber + */ + @javax.annotation.Nullable + public String getTelephoneNumber() { + return telephoneNumber; + } + + public void setTelephoneNumber(@javax.annotation.Nullable String telephoneNumber) { + this.telephoneNumber = telephoneNumber; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TelephoneNumber instance itself + */ + public TelephoneNumber putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TelephoneNumber telephoneNumber = (TelephoneNumber) o; + return Objects.equals(this.telephoneNumber, telephoneNumber.telephoneNumber)&& + Objects.equals(this.additionalProperties, telephoneNumber.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(telephoneNumber, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TelephoneNumber {\n"); + sb.append(" telephoneNumber: ").append(toIndentedString(telephoneNumber)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("telephoneNumber"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TelephoneNumber + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TelephoneNumber.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TelephoneNumber is not found in the empty JSON string", TelephoneNumber.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("telephoneNumber") != null && !jsonObj.get("telephoneNumber").isJsonNull()) && !jsonObj.get("telephoneNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `telephoneNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("telephoneNumber").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TelephoneNumber.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TelephoneNumber' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TelephoneNumber.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TelephoneNumber value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public TelephoneNumber read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TelephoneNumber instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TelephoneNumber given an JSON string + * + * @param jsonString JSON string + * @return An instance of TelephoneNumber + * @throws IOException if the JSON string is invalid with respect to TelephoneNumber + */ + public static TelephoneNumber fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TelephoneNumber.class); + } + + /** + * Convert an instance of TelephoneNumber to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/TfvBasicAuthentication.java b/src/main/java/com/bandwidth/sdk/model/TfvBasicAuthentication.java new file mode 100644 index 00000000..00d5bada --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/TfvBasicAuthentication.java @@ -0,0 +1,326 @@ +/* + * 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. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * TfvBasicAuthentication + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") +public class TfvBasicAuthentication { + public static final String SERIALIZED_NAME_USERNAME = "username"; + @SerializedName(SERIALIZED_NAME_USERNAME) + @javax.annotation.Nonnull + private String username; + + public static final String SERIALIZED_NAME_PASSWORD = "password"; + @SerializedName(SERIALIZED_NAME_PASSWORD) + @javax.annotation.Nonnull + private String password; + + public TfvBasicAuthentication() { + } + + public TfvBasicAuthentication username(@javax.annotation.Nonnull String username) { + this.username = username; + return this; + } + + /** + * Get username + * @return username + */ + @javax.annotation.Nonnull + public String getUsername() { + return username; + } + + public void setUsername(@javax.annotation.Nonnull String username) { + this.username = username; + } + + + public TfvBasicAuthentication password(@javax.annotation.Nonnull String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + */ + @javax.annotation.Nonnull + public String getPassword() { + return password; + } + + public void setPassword(@javax.annotation.Nonnull String password) { + this.password = password; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TfvBasicAuthentication instance itself + */ + public TfvBasicAuthentication putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TfvBasicAuthentication tfvBasicAuthentication = (TfvBasicAuthentication) o; + return Objects.equals(this.username, tfvBasicAuthentication.username) && + Objects.equals(this.password, tfvBasicAuthentication.password)&& + Objects.equals(this.additionalProperties, tfvBasicAuthentication.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(username, password, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TfvBasicAuthentication {\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("username"); + openapiFields.add("password"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("username"); + openapiRequiredFields.add("password"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TfvBasicAuthentication + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TfvBasicAuthentication.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TfvBasicAuthentication is not found in the empty JSON string", TfvBasicAuthentication.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TfvBasicAuthentication.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("username").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString())); + } + if (!jsonObj.get("password").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TfvBasicAuthentication.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TfvBasicAuthentication' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TfvBasicAuthentication.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TfvBasicAuthentication value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public TfvBasicAuthentication read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TfvBasicAuthentication instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TfvBasicAuthentication given an JSON string + * + * @param jsonString JSON string + * @return An instance of TfvBasicAuthentication + * @throws IOException if the JSON string is invalid with respect to TfvBasicAuthentication + */ + public static TfvBasicAuthentication fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TfvBasicAuthentication.class); + } + + /** + * Convert an instance of TfvBasicAuthentication to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/TfvCallbackStatusEnum.java b/src/main/java/com/bandwidth/sdk/model/TfvCallbackStatusEnum.java new file mode 100644 index 00000000..7e21b73b --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/TfvCallbackStatusEnum.java @@ -0,0 +1,78 @@ +/* + * 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. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets tfvCallbackStatusEnum + */ +@JsonAdapter(TfvCallbackStatusEnum.Adapter.class) +public enum TfvCallbackStatusEnum { + + VERIFIED("VERIFIED"), + + UNVERIFIED("UNVERIFIED"); + + private String value; + + TfvCallbackStatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TfvCallbackStatusEnum fromValue(String value) { + for (TfvCallbackStatusEnum b : TfvCallbackStatusEnum.values()) { + if (b.value.equalsIgnoreCase(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TfvCallbackStatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TfvCallbackStatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TfvCallbackStatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TfvCallbackStatusEnum.fromValue(value); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/TfvError.java b/src/main/java/com/bandwidth/sdk/model/TfvError.java new file mode 100644 index 00000000..ef4056a2 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/TfvError.java @@ -0,0 +1,344 @@ +/* + * 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. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * A generic error object. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") +public class TfvError { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable + private String description; + + public static final String SERIALIZED_NAME_ERRORS = "errors"; + @SerializedName(SERIALIZED_NAME_ERRORS) + @javax.annotation.Nullable + private Object errors; + + public TfvError() { + } + + public TfvError type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public TfvError description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + + public TfvError errors(@javax.annotation.Nullable Object errors) { + this.errors = errors; + return this; + } + + /** + * 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. + * @return errors + */ + @javax.annotation.Nullable + public Object getErrors() { + return errors; + } + + public void setErrors(@javax.annotation.Nullable Object errors) { + this.errors = errors; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TfvError instance itself + */ + public TfvError putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TfvError tfvError = (TfvError) o; + return Objects.equals(this.type, tfvError.type) && + Objects.equals(this.description, tfvError.description) && + Objects.equals(this.errors, tfvError.errors)&& + Objects.equals(this.additionalProperties, tfvError.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(type, description, errors, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TfvError {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("description"); + openapiFields.add("errors"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TfvError + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TfvError.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TfvError is not found in the empty JSON string", TfvError.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TfvError.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TfvError' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TfvError.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TfvError value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public TfvError read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TfvError instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TfvError given an JSON string + * + * @param jsonString JSON string + * @return An instance of TfvError + * @throws IOException if the JSON string is invalid with respect to TfvError + */ + public static TfvError fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TfvError.class); + } + + /** + * Convert an instance of TfvError to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/TfvStatus.java b/src/main/java/com/bandwidth/sdk/model/TfvStatus.java new file mode 100644 index 00000000..3f849f7c --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/TfvStatus.java @@ -0,0 +1,494 @@ +/* + * 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. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.TfvStatusEnum; +import com.bandwidth.sdk.model.TfvSubmissionInfo; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * TfvStatus + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") +public class TfvStatus { + public static final String SERIALIZED_NAME_PHONE_NUMBER = "phoneNumber"; + @SerializedName(SERIALIZED_NAME_PHONE_NUMBER) + @javax.annotation.Nullable + private String phoneNumber; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private TfvStatusEnum status; + + public static final String SERIALIZED_NAME_INTERNAL_TICKET_NUMBER = "internalTicketNumber"; + @SerializedName(SERIALIZED_NAME_INTERNAL_TICKET_NUMBER) + @javax.annotation.Nullable + private UUID internalTicketNumber; + + public static final String SERIALIZED_NAME_DECLINE_REASON_DESCRIPTION = "declineReasonDescription"; + @SerializedName(SERIALIZED_NAME_DECLINE_REASON_DESCRIPTION) + @javax.annotation.Nullable + private String declineReasonDescription; + + public static final String SERIALIZED_NAME_RESUBMIT_ALLOWED = "resubmitAllowed"; + @SerializedName(SERIALIZED_NAME_RESUBMIT_ALLOWED) + @javax.annotation.Nullable + private Boolean resubmitAllowed; + + public static final String SERIALIZED_NAME_CREATED_DATE_TIME = "createdDateTime"; + @SerializedName(SERIALIZED_NAME_CREATED_DATE_TIME) + @javax.annotation.Nullable + private OffsetDateTime createdDateTime; + + public static final String SERIALIZED_NAME_MODIFIED_DATE_TIME = "modifiedDateTime"; + @SerializedName(SERIALIZED_NAME_MODIFIED_DATE_TIME) + @javax.annotation.Nullable + private OffsetDateTime modifiedDateTime; + + public static final String SERIALIZED_NAME_SUBMISSION = "submission"; + @SerializedName(SERIALIZED_NAME_SUBMISSION) + @javax.annotation.Nullable + private TfvSubmissionInfo submission; + + public TfvStatus() { + } + + public TfvStatus phoneNumber(@javax.annotation.Nullable String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Toll-free telephone number in E.164 format. + * @return phoneNumber + */ + @javax.annotation.Nullable + public String getPhoneNumber() { + return phoneNumber; + } + + public void setPhoneNumber(@javax.annotation.Nullable String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + + public TfvStatus status(@javax.annotation.Nullable TfvStatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nullable + public TfvStatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable TfvStatusEnum status) { + this.status = status; + } + + + public TfvStatus internalTicketNumber(@javax.annotation.Nullable UUID internalTicketNumber) { + this.internalTicketNumber = internalTicketNumber; + return this; + } + + /** + * Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number - included in all webhook payloads. + * @return internalTicketNumber + */ + @javax.annotation.Nullable + public UUID getInternalTicketNumber() { + return internalTicketNumber; + } + + public void setInternalTicketNumber(@javax.annotation.Nullable UUID internalTicketNumber) { + this.internalTicketNumber = internalTicketNumber; + } + + + public TfvStatus declineReasonDescription(@javax.annotation.Nullable String declineReasonDescription) { + this.declineReasonDescription = declineReasonDescription; + return this; + } + + /** + * Explanation for why a verification request was declined. + * @return declineReasonDescription + */ + @javax.annotation.Nullable + public String getDeclineReasonDescription() { + return declineReasonDescription; + } + + public void setDeclineReasonDescription(@javax.annotation.Nullable String declineReasonDescription) { + this.declineReasonDescription = declineReasonDescription; + } + + + public TfvStatus resubmitAllowed(@javax.annotation.Nullable Boolean resubmitAllowed) { + this.resubmitAllowed = resubmitAllowed; + return this; + } + + /** + * Whether a Toll-Free Verification request qualifies for resubmission via PUT. + * @return resubmitAllowed + */ + @javax.annotation.Nullable + public Boolean getResubmitAllowed() { + return resubmitAllowed; + } + + public void setResubmitAllowed(@javax.annotation.Nullable Boolean resubmitAllowed) { + this.resubmitAllowed = resubmitAllowed; + } + + + public TfvStatus createdDateTime(@javax.annotation.Nullable OffsetDateTime createdDateTime) { + this.createdDateTime = createdDateTime; + return this; + } + + /** + * Date and time the verification request was created. + * @return createdDateTime + */ + @javax.annotation.Nullable + public OffsetDateTime getCreatedDateTime() { + return createdDateTime; + } + + public void setCreatedDateTime(@javax.annotation.Nullable OffsetDateTime createdDateTime) { + this.createdDateTime = createdDateTime; + } + + + public TfvStatus modifiedDateTime(@javax.annotation.Nullable OffsetDateTime modifiedDateTime) { + this.modifiedDateTime = modifiedDateTime; + return this; + } + + /** + * Date and time the verification request was last modified. + * @return modifiedDateTime + */ + @javax.annotation.Nullable + public OffsetDateTime getModifiedDateTime() { + return modifiedDateTime; + } + + public void setModifiedDateTime(@javax.annotation.Nullable OffsetDateTime modifiedDateTime) { + this.modifiedDateTime = modifiedDateTime; + } + + + public TfvStatus submission(@javax.annotation.Nullable TfvSubmissionInfo submission) { + this.submission = submission; + return this; + } + + /** + * Get submission + * @return submission + */ + @javax.annotation.Nullable + public TfvSubmissionInfo getSubmission() { + return submission; + } + + public void setSubmission(@javax.annotation.Nullable TfvSubmissionInfo submission) { + this.submission = submission; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TfvStatus instance itself + */ + public TfvStatus putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TfvStatus tfvStatus = (TfvStatus) o; + return Objects.equals(this.phoneNumber, tfvStatus.phoneNumber) && + Objects.equals(this.status, tfvStatus.status) && + Objects.equals(this.internalTicketNumber, tfvStatus.internalTicketNumber) && + Objects.equals(this.declineReasonDescription, tfvStatus.declineReasonDescription) && + Objects.equals(this.resubmitAllowed, tfvStatus.resubmitAllowed) && + Objects.equals(this.createdDateTime, tfvStatus.createdDateTime) && + Objects.equals(this.modifiedDateTime, tfvStatus.modifiedDateTime) && + Objects.equals(this.submission, tfvStatus.submission)&& + Objects.equals(this.additionalProperties, tfvStatus.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(phoneNumber, status, internalTicketNumber, declineReasonDescription, resubmitAllowed, createdDateTime, modifiedDateTime, submission, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TfvStatus {\n"); + sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" internalTicketNumber: ").append(toIndentedString(internalTicketNumber)).append("\n"); + sb.append(" declineReasonDescription: ").append(toIndentedString(declineReasonDescription)).append("\n"); + sb.append(" resubmitAllowed: ").append(toIndentedString(resubmitAllowed)).append("\n"); + sb.append(" createdDateTime: ").append(toIndentedString(createdDateTime)).append("\n"); + sb.append(" modifiedDateTime: ").append(toIndentedString(modifiedDateTime)).append("\n"); + sb.append(" submission: ").append(toIndentedString(submission)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("phoneNumber"); + openapiFields.add("status"); + openapiFields.add("internalTicketNumber"); + openapiFields.add("declineReasonDescription"); + openapiFields.add("resubmitAllowed"); + openapiFields.add("createdDateTime"); + openapiFields.add("modifiedDateTime"); + openapiFields.add("submission"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TfvStatus + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TfvStatus.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TfvStatus is not found in the empty JSON string", TfvStatus.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("phoneNumber") != null && !jsonObj.get("phoneNumber").isJsonNull()) && !jsonObj.get("phoneNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `phoneNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("phoneNumber").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + TfvStatusEnum.validateJsonElement(jsonObj.get("status")); + } + if ((jsonObj.get("internalTicketNumber") != null && !jsonObj.get("internalTicketNumber").isJsonNull()) && !jsonObj.get("internalTicketNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `internalTicketNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("internalTicketNumber").toString())); + } + if ((jsonObj.get("declineReasonDescription") != null && !jsonObj.get("declineReasonDescription").isJsonNull()) && !jsonObj.get("declineReasonDescription").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `declineReasonDescription` to be a primitive type in the JSON string but got `%s`", jsonObj.get("declineReasonDescription").toString())); + } + // validate the optional field `submission` + if (jsonObj.get("submission") != null && !jsonObj.get("submission").isJsonNull()) { + TfvSubmissionInfo.validateJsonElement(jsonObj.get("submission")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TfvStatus.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TfvStatus' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TfvStatus.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TfvStatus value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public TfvStatus read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TfvStatus instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TfvStatus given an JSON string + * + * @param jsonString JSON string + * @return An instance of TfvStatus + * @throws IOException if the JSON string is invalid with respect to TfvStatus + */ + public static TfvStatus fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TfvStatus.class); + } + + /** + * Convert an instance of TfvStatus to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/TfvStatusEnum.java b/src/main/java/com/bandwidth/sdk/model/TfvStatusEnum.java new file mode 100644 index 00000000..fc021fb4 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/TfvStatusEnum.java @@ -0,0 +1,84 @@ +/* + * 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. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets tfvStatusEnum + */ +@JsonAdapter(TfvStatusEnum.Adapter.class) +public enum TfvStatusEnum { + + VERIFIED("VERIFIED"), + + UNVERIFIED("UNVERIFIED"), + + PENDING("PENDING"), + + PARTIALLY_VERIFIED("PARTIALLY_VERIFIED"), + + INVALID_STATUS("INVALID_STATUS"); + + private String value; + + TfvStatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TfvStatusEnum fromValue(String value) { + for (TfvStatusEnum b : TfvStatusEnum.values()) { + if (b.value.equalsIgnoreCase(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TfvStatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TfvStatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TfvStatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TfvStatusEnum.fromValue(value); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/TfvSubmissionInfo.java b/src/main/java/com/bandwidth/sdk/model/TfvSubmissionInfo.java new file mode 100644 index 00000000..37bfcbf2 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/TfvSubmissionInfo.java @@ -0,0 +1,544 @@ +/* + * 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. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.Address; +import com.bandwidth.sdk.model.Contact; +import com.bandwidth.sdk.model.OptInWorkflow; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * TfvSubmissionInfo + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") +public class TfvSubmissionInfo { + public static final String SERIALIZED_NAME_BUSINESS_ADDRESS = "businessAddress"; + @SerializedName(SERIALIZED_NAME_BUSINESS_ADDRESS) + @javax.annotation.Nullable + private Address businessAddress; + + public static final String SERIALIZED_NAME_BUSINESS_CONTACT = "businessContact"; + @SerializedName(SERIALIZED_NAME_BUSINESS_CONTACT) + @javax.annotation.Nullable + private Contact businessContact; + + public static final String SERIALIZED_NAME_MESSAGE_VOLUME = "messageVolume"; + @SerializedName(SERIALIZED_NAME_MESSAGE_VOLUME) + @javax.annotation.Nullable + private Integer messageVolume; + + public static final String SERIALIZED_NAME_USE_CASE = "useCase"; + @SerializedName(SERIALIZED_NAME_USE_CASE) + @javax.annotation.Nullable + private String useCase; + + public static final String SERIALIZED_NAME_USE_CASE_SUMMARY = "useCaseSummary"; + @SerializedName(SERIALIZED_NAME_USE_CASE_SUMMARY) + @javax.annotation.Nullable + private String useCaseSummary; + + public static final String SERIALIZED_NAME_PRODUCTION_MESSAGE_CONTENT = "productionMessageContent"; + @SerializedName(SERIALIZED_NAME_PRODUCTION_MESSAGE_CONTENT) + @javax.annotation.Nullable + private String productionMessageContent; + + public static final String SERIALIZED_NAME_OPT_IN_WORKFLOW = "optInWorkflow"; + @SerializedName(SERIALIZED_NAME_OPT_IN_WORKFLOW) + @javax.annotation.Nullable + private OptInWorkflow optInWorkflow; + + public static final String SERIALIZED_NAME_ADDITIONAL_INFORMATION = "additionalInformation"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_INFORMATION) + @javax.annotation.Nullable + private String additionalInformation; + + public static final String SERIALIZED_NAME_ISV_RESELLER = "isvReseller"; + @SerializedName(SERIALIZED_NAME_ISV_RESELLER) + @javax.annotation.Nullable + private String isvReseller; + + public TfvSubmissionInfo() { + } + + public TfvSubmissionInfo businessAddress(@javax.annotation.Nullable Address businessAddress) { + this.businessAddress = businessAddress; + return this; + } + + /** + * Get businessAddress + * @return businessAddress + */ + @javax.annotation.Nullable + public Address getBusinessAddress() { + return businessAddress; + } + + public void setBusinessAddress(@javax.annotation.Nullable Address businessAddress) { + this.businessAddress = businessAddress; + } + + + public TfvSubmissionInfo businessContact(@javax.annotation.Nullable Contact businessContact) { + this.businessContact = businessContact; + return this; + } + + /** + * Get businessContact + * @return businessContact + */ + @javax.annotation.Nullable + public Contact getBusinessContact() { + return businessContact; + } + + public void setBusinessContact(@javax.annotation.Nullable Contact businessContact) { + this.businessContact = businessContact; + } + + + public TfvSubmissionInfo messageVolume(@javax.annotation.Nullable Integer messageVolume) { + this.messageVolume = messageVolume; + return this; + } + + /** + * Estimated monthly volume of messages from the toll-free number. + * minimum: 10 + * maximum: 10000000 + * @return messageVolume + */ + @javax.annotation.Nullable + public Integer getMessageVolume() { + return messageVolume; + } + + public void setMessageVolume(@javax.annotation.Nullable Integer messageVolume) { + this.messageVolume = messageVolume; + } + + + public TfvSubmissionInfo useCase(@javax.annotation.Nullable String useCase) { + this.useCase = useCase; + return this; + } + + /** + * The category of the use case. + * @return useCase + */ + @javax.annotation.Nullable + public String getUseCase() { + return useCase; + } + + public void setUseCase(@javax.annotation.Nullable String useCase) { + this.useCase = useCase; + } + + + public TfvSubmissionInfo useCaseSummary(@javax.annotation.Nullable String useCaseSummary) { + this.useCaseSummary = useCaseSummary; + return this; + } + + /** + * A general idea of the use case and customer. + * @return useCaseSummary + */ + @javax.annotation.Nullable + public String getUseCaseSummary() { + return useCaseSummary; + } + + public void setUseCaseSummary(@javax.annotation.Nullable String useCaseSummary) { + this.useCaseSummary = useCaseSummary; + } + + + public TfvSubmissionInfo productionMessageContent(@javax.annotation.Nullable String productionMessageContent) { + this.productionMessageContent = productionMessageContent; + return this; + } + + /** + * Example of message content. + * @return productionMessageContent + */ + @javax.annotation.Nullable + public String getProductionMessageContent() { + return productionMessageContent; + } + + public void setProductionMessageContent(@javax.annotation.Nullable String productionMessageContent) { + this.productionMessageContent = productionMessageContent; + } + + + public TfvSubmissionInfo optInWorkflow(@javax.annotation.Nullable OptInWorkflow optInWorkflow) { + this.optInWorkflow = optInWorkflow; + return this; + } + + /** + * Get optInWorkflow + * @return optInWorkflow + */ + @javax.annotation.Nullable + public OptInWorkflow getOptInWorkflow() { + return optInWorkflow; + } + + public void setOptInWorkflow(@javax.annotation.Nullable OptInWorkflow optInWorkflow) { + this.optInWorkflow = optInWorkflow; + } + + + public TfvSubmissionInfo additionalInformation(@javax.annotation.Nullable String additionalInformation) { + this.additionalInformation = additionalInformation; + return this; + } + + /** + * Any additional information. + * @return additionalInformation + */ + @javax.annotation.Nullable + public String getAdditionalInformation() { + return additionalInformation; + } + + public void setAdditionalInformation(@javax.annotation.Nullable String additionalInformation) { + this.additionalInformation = additionalInformation; + } + + + public TfvSubmissionInfo isvReseller(@javax.annotation.Nullable String isvReseller) { + this.isvReseller = isvReseller; + return this; + } + + /** + * ISV name. + * @return isvReseller + */ + @javax.annotation.Nullable + public String getIsvReseller() { + return isvReseller; + } + + public void setIsvReseller(@javax.annotation.Nullable String isvReseller) { + this.isvReseller = isvReseller; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TfvSubmissionInfo instance itself + */ + public TfvSubmissionInfo putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TfvSubmissionInfo tfvSubmissionInfo = (TfvSubmissionInfo) o; + return Objects.equals(this.businessAddress, tfvSubmissionInfo.businessAddress) && + Objects.equals(this.businessContact, tfvSubmissionInfo.businessContact) && + Objects.equals(this.messageVolume, tfvSubmissionInfo.messageVolume) && + Objects.equals(this.useCase, tfvSubmissionInfo.useCase) && + Objects.equals(this.useCaseSummary, tfvSubmissionInfo.useCaseSummary) && + Objects.equals(this.productionMessageContent, tfvSubmissionInfo.productionMessageContent) && + Objects.equals(this.optInWorkflow, tfvSubmissionInfo.optInWorkflow) && + Objects.equals(this.additionalInformation, tfvSubmissionInfo.additionalInformation) && + Objects.equals(this.isvReseller, tfvSubmissionInfo.isvReseller)&& + Objects.equals(this.additionalProperties, tfvSubmissionInfo.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(businessAddress, businessContact, messageVolume, useCase, useCaseSummary, productionMessageContent, optInWorkflow, additionalInformation, isvReseller, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TfvSubmissionInfo {\n"); + sb.append(" businessAddress: ").append(toIndentedString(businessAddress)).append("\n"); + sb.append(" businessContact: ").append(toIndentedString(businessContact)).append("\n"); + sb.append(" messageVolume: ").append(toIndentedString(messageVolume)).append("\n"); + sb.append(" useCase: ").append(toIndentedString(useCase)).append("\n"); + sb.append(" useCaseSummary: ").append(toIndentedString(useCaseSummary)).append("\n"); + sb.append(" productionMessageContent: ").append(toIndentedString(productionMessageContent)).append("\n"); + sb.append(" optInWorkflow: ").append(toIndentedString(optInWorkflow)).append("\n"); + sb.append(" additionalInformation: ").append(toIndentedString(additionalInformation)).append("\n"); + sb.append(" isvReseller: ").append(toIndentedString(isvReseller)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("businessAddress"); + openapiFields.add("businessContact"); + openapiFields.add("messageVolume"); + openapiFields.add("useCase"); + openapiFields.add("useCaseSummary"); + openapiFields.add("productionMessageContent"); + openapiFields.add("optInWorkflow"); + openapiFields.add("additionalInformation"); + openapiFields.add("isvReseller"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TfvSubmissionInfo + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TfvSubmissionInfo.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TfvSubmissionInfo is not found in the empty JSON string", TfvSubmissionInfo.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `businessAddress` + if (jsonObj.get("businessAddress") != null && !jsonObj.get("businessAddress").isJsonNull()) { + Address.validateJsonElement(jsonObj.get("businessAddress")); + } + // validate the optional field `businessContact` + if (jsonObj.get("businessContact") != null && !jsonObj.get("businessContact").isJsonNull()) { + Contact.validateJsonElement(jsonObj.get("businessContact")); + } + if ((jsonObj.get("useCase") != null && !jsonObj.get("useCase").isJsonNull()) && !jsonObj.get("useCase").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `useCase` to be a primitive type in the JSON string but got `%s`", jsonObj.get("useCase").toString())); + } + if ((jsonObj.get("useCaseSummary") != null && !jsonObj.get("useCaseSummary").isJsonNull()) && !jsonObj.get("useCaseSummary").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `useCaseSummary` to be a primitive type in the JSON string but got `%s`", jsonObj.get("useCaseSummary").toString())); + } + if ((jsonObj.get("productionMessageContent") != null && !jsonObj.get("productionMessageContent").isJsonNull()) && !jsonObj.get("productionMessageContent").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `productionMessageContent` to be a primitive type in the JSON string but got `%s`", jsonObj.get("productionMessageContent").toString())); + } + // validate the optional field `optInWorkflow` + if (jsonObj.get("optInWorkflow") != null && !jsonObj.get("optInWorkflow").isJsonNull()) { + OptInWorkflow.validateJsonElement(jsonObj.get("optInWorkflow")); + } + if ((jsonObj.get("additionalInformation") != null && !jsonObj.get("additionalInformation").isJsonNull()) && !jsonObj.get("additionalInformation").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `additionalInformation` to be a primitive type in the JSON string but got `%s`", jsonObj.get("additionalInformation").toString())); + } + if ((jsonObj.get("isvReseller") != null && !jsonObj.get("isvReseller").isJsonNull()) && !jsonObj.get("isvReseller").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `isvReseller` to be a primitive type in the JSON string but got `%s`", jsonObj.get("isvReseller").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TfvSubmissionInfo.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TfvSubmissionInfo' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TfvSubmissionInfo.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TfvSubmissionInfo value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public TfvSubmissionInfo read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TfvSubmissionInfo instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TfvSubmissionInfo given an JSON string + * + * @param jsonString JSON string + * @return An instance of TfvSubmissionInfo + * @throws IOException if the JSON string is invalid with respect to TfvSubmissionInfo + */ + public static TfvSubmissionInfo fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TfvSubmissionInfo.class); + } + + /** + * Convert an instance of TfvSubmissionInfo to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/TfvSubmissionWrapper.java b/src/main/java/com/bandwidth/sdk/model/TfvSubmissionWrapper.java new file mode 100644 index 00000000..8abdd125 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/TfvSubmissionWrapper.java @@ -0,0 +1,289 @@ +/* + * 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. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.VerificationUpdateRequest; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * TfvSubmissionWrapper + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") +public class TfvSubmissionWrapper { + public static final String SERIALIZED_NAME_SUBMISSION = "submission"; + @SerializedName(SERIALIZED_NAME_SUBMISSION) + @javax.annotation.Nullable + private VerificationUpdateRequest submission; + + public TfvSubmissionWrapper() { + } + + public TfvSubmissionWrapper submission(@javax.annotation.Nullable VerificationUpdateRequest submission) { + this.submission = submission; + return this; + } + + /** + * Get submission + * @return submission + */ + @javax.annotation.Nullable + public VerificationUpdateRequest getSubmission() { + return submission; + } + + public void setSubmission(@javax.annotation.Nullable VerificationUpdateRequest submission) { + this.submission = submission; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TfvSubmissionWrapper instance itself + */ + public TfvSubmissionWrapper putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TfvSubmissionWrapper tfvSubmissionWrapper = (TfvSubmissionWrapper) o; + return Objects.equals(this.submission, tfvSubmissionWrapper.submission)&& + Objects.equals(this.additionalProperties, tfvSubmissionWrapper.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(submission, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TfvSubmissionWrapper {\n"); + sb.append(" submission: ").append(toIndentedString(submission)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("submission"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TfvSubmissionWrapper + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TfvSubmissionWrapper.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TfvSubmissionWrapper is not found in the empty JSON string", TfvSubmissionWrapper.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `submission` + if (jsonObj.get("submission") != null && !jsonObj.get("submission").isJsonNull()) { + VerificationUpdateRequest.validateJsonElement(jsonObj.get("submission")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TfvSubmissionWrapper.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TfvSubmissionWrapper' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TfvSubmissionWrapper.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TfvSubmissionWrapper value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public TfvSubmissionWrapper read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TfvSubmissionWrapper instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TfvSubmissionWrapper given an JSON string + * + * @param jsonString JSON string + * @return An instance of TfvSubmissionWrapper + * @throws IOException if the JSON string is invalid with respect to TfvSubmissionWrapper + */ + public static TfvSubmissionWrapper fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TfvSubmissionWrapper.class); + } + + /** + * Convert an instance of TfvSubmissionWrapper to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/VerificationDenialWebhook.java b/src/main/java/com/bandwidth/sdk/model/VerificationDenialWebhook.java new file mode 100644 index 00000000..9bc03222 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/VerificationDenialWebhook.java @@ -0,0 +1,514 @@ +/* + * 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. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.AdditionalDenialReason; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * VerificationDenialWebhook + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") +public class VerificationDenialWebhook { + public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + @javax.annotation.Nullable + private String accountId; + + public static final String SERIALIZED_NAME_ADDITIONAL_DENIAL_REASONS = "additionalDenialReasons"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_DENIAL_REASONS) + @javax.annotation.Nullable + private List additionalDenialReasons = new ArrayList<>(); + + public static final String SERIALIZED_NAME_DECLINE_REASON_DESCRIPTION = "declineReasonDescription"; + @SerializedName(SERIALIZED_NAME_DECLINE_REASON_DESCRIPTION) + @javax.annotation.Nullable + private String declineReasonDescription; + + public static final String SERIALIZED_NAME_DENIAL_STATUS_CODE = "denialStatusCode"; + @SerializedName(SERIALIZED_NAME_DENIAL_STATUS_CODE) + @javax.annotation.Nullable + private Integer denialStatusCode; + + public static final String SERIALIZED_NAME_INTERNAL_TICKET_NUMBER = "internalTicketNumber"; + @SerializedName(SERIALIZED_NAME_INTERNAL_TICKET_NUMBER) + @javax.annotation.Nullable + private UUID internalTicketNumber; + + public static final String SERIALIZED_NAME_PHONE_NUMBER = "phoneNumber"; + @SerializedName(SERIALIZED_NAME_PHONE_NUMBER) + @javax.annotation.Nullable + private String phoneNumber; + + public static final String SERIALIZED_NAME_RESUBMIT_ALLOWED = "resubmitAllowed"; + @SerializedName(SERIALIZED_NAME_RESUBMIT_ALLOWED) + @javax.annotation.Nullable + private Boolean resubmitAllowed; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private String status = "UNVERIFIED"; + + public VerificationDenialWebhook() { + } + + public VerificationDenialWebhook accountId(@javax.annotation.Nullable String accountId) { + this.accountId = accountId; + return this; + } + + /** + * User's account ID. + * @return accountId + */ + @javax.annotation.Nullable + public String getAccountId() { + return accountId; + } + + public void setAccountId(@javax.annotation.Nullable String accountId) { + this.accountId = accountId; + } + + + public VerificationDenialWebhook additionalDenialReasons(@javax.annotation.Nullable List additionalDenialReasons) { + this.additionalDenialReasons = additionalDenialReasons; + return this; + } + + public VerificationDenialWebhook addAdditionalDenialReasonsItem(AdditionalDenialReason additionalDenialReasonsItem) { + if (this.additionalDenialReasons == null) { + this.additionalDenialReasons = new ArrayList<>(); + } + this.additionalDenialReasons.add(additionalDenialReasonsItem); + return this; + } + + /** + * An optional list of denial reasons in addition to declineReasonDescription when multiple reasons apply. + * @return additionalDenialReasons + */ + @javax.annotation.Nullable + public List getAdditionalDenialReasons() { + return additionalDenialReasons; + } + + public void setAdditionalDenialReasons(@javax.annotation.Nullable List additionalDenialReasons) { + this.additionalDenialReasons = additionalDenialReasons; + } + + + public VerificationDenialWebhook declineReasonDescription(@javax.annotation.Nullable String declineReasonDescription) { + this.declineReasonDescription = declineReasonDescription; + return this; + } + + /** + * Explanation for why a verification request was declined. + * @return declineReasonDescription + */ + @javax.annotation.Nullable + public String getDeclineReasonDescription() { + return declineReasonDescription; + } + + public void setDeclineReasonDescription(@javax.annotation.Nullable String declineReasonDescription) { + this.declineReasonDescription = declineReasonDescription; + } + + + public VerificationDenialWebhook denialStatusCode(@javax.annotation.Nullable Integer denialStatusCode) { + this.denialStatusCode = denialStatusCode; + return this; + } + + /** + * Reason code for denial. + * @return denialStatusCode + */ + @javax.annotation.Nullable + public Integer getDenialStatusCode() { + return denialStatusCode; + } + + public void setDenialStatusCode(@javax.annotation.Nullable Integer denialStatusCode) { + this.denialStatusCode = denialStatusCode; + } + + + public VerificationDenialWebhook internalTicketNumber(@javax.annotation.Nullable UUID internalTicketNumber) { + this.internalTicketNumber = internalTicketNumber; + return this; + } + + /** + * Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number. + * @return internalTicketNumber + */ + @javax.annotation.Nullable + public UUID getInternalTicketNumber() { + return internalTicketNumber; + } + + public void setInternalTicketNumber(@javax.annotation.Nullable UUID internalTicketNumber) { + this.internalTicketNumber = internalTicketNumber; + } + + + public VerificationDenialWebhook phoneNumber(@javax.annotation.Nullable String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Toll-free telephone number in E.164 format. + * @return phoneNumber + */ + @javax.annotation.Nullable + public String getPhoneNumber() { + return phoneNumber; + } + + public void setPhoneNumber(@javax.annotation.Nullable String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + + public VerificationDenialWebhook resubmitAllowed(@javax.annotation.Nullable Boolean resubmitAllowed) { + this.resubmitAllowed = resubmitAllowed; + return this; + } + + /** + * Whether a Toll-Free Verification request qualifies for resubmission via PUT. + * @return resubmitAllowed + */ + @javax.annotation.Nullable + public Boolean getResubmitAllowed() { + return resubmitAllowed; + } + + public void setResubmitAllowed(@javax.annotation.Nullable Boolean resubmitAllowed) { + this.resubmitAllowed = resubmitAllowed; + } + + + public VerificationDenialWebhook status(@javax.annotation.Nullable String status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nullable + public String getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable String status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the VerificationDenialWebhook instance itself + */ + public VerificationDenialWebhook putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerificationDenialWebhook verificationDenialWebhook = (VerificationDenialWebhook) o; + return Objects.equals(this.accountId, verificationDenialWebhook.accountId) && + Objects.equals(this.additionalDenialReasons, verificationDenialWebhook.additionalDenialReasons) && + Objects.equals(this.declineReasonDescription, verificationDenialWebhook.declineReasonDescription) && + Objects.equals(this.denialStatusCode, verificationDenialWebhook.denialStatusCode) && + Objects.equals(this.internalTicketNumber, verificationDenialWebhook.internalTicketNumber) && + Objects.equals(this.phoneNumber, verificationDenialWebhook.phoneNumber) && + Objects.equals(this.resubmitAllowed, verificationDenialWebhook.resubmitAllowed) && + Objects.equals(this.status, verificationDenialWebhook.status)&& + Objects.equals(this.additionalProperties, verificationDenialWebhook.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(accountId, additionalDenialReasons, declineReasonDescription, denialStatusCode, internalTicketNumber, phoneNumber, resubmitAllowed, status, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerificationDenialWebhook {\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" additionalDenialReasons: ").append(toIndentedString(additionalDenialReasons)).append("\n"); + sb.append(" declineReasonDescription: ").append(toIndentedString(declineReasonDescription)).append("\n"); + sb.append(" denialStatusCode: ").append(toIndentedString(denialStatusCode)).append("\n"); + sb.append(" internalTicketNumber: ").append(toIndentedString(internalTicketNumber)).append("\n"); + sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).append("\n"); + sb.append(" resubmitAllowed: ").append(toIndentedString(resubmitAllowed)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("accountId"); + openapiFields.add("additionalDenialReasons"); + openapiFields.add("declineReasonDescription"); + openapiFields.add("denialStatusCode"); + openapiFields.add("internalTicketNumber"); + openapiFields.add("phoneNumber"); + openapiFields.add("resubmitAllowed"); + openapiFields.add("status"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to VerificationDenialWebhook + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VerificationDenialWebhook.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in VerificationDenialWebhook is not found in the empty JSON string", VerificationDenialWebhook.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("accountId") != null && !jsonObj.get("accountId").isJsonNull()) && !jsonObj.get("accountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountId").toString())); + } + if (jsonObj.get("additionalDenialReasons") != null && !jsonObj.get("additionalDenialReasons").isJsonNull()) { + JsonArray jsonArrayadditionalDenialReasons = jsonObj.getAsJsonArray("additionalDenialReasons"); + if (jsonArrayadditionalDenialReasons != null) { + // ensure the json data is an array + if (!jsonObj.get("additionalDenialReasons").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `additionalDenialReasons` to be an array in the JSON string but got `%s`", jsonObj.get("additionalDenialReasons").toString())); + } + + // validate the optional field `additionalDenialReasons` (array) + for (int i = 0; i < jsonArrayadditionalDenialReasons.size(); i++) { + AdditionalDenialReason.validateJsonElement(jsonArrayadditionalDenialReasons.get(i)); + }; + } + } + if ((jsonObj.get("declineReasonDescription") != null && !jsonObj.get("declineReasonDescription").isJsonNull()) && !jsonObj.get("declineReasonDescription").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `declineReasonDescription` to be a primitive type in the JSON string but got `%s`", jsonObj.get("declineReasonDescription").toString())); + } + if ((jsonObj.get("internalTicketNumber") != null && !jsonObj.get("internalTicketNumber").isJsonNull()) && !jsonObj.get("internalTicketNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `internalTicketNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("internalTicketNumber").toString())); + } + if ((jsonObj.get("phoneNumber") != null && !jsonObj.get("phoneNumber").isJsonNull()) && !jsonObj.get("phoneNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `phoneNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("phoneNumber").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VerificationDenialWebhook.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VerificationDenialWebhook' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(VerificationDenialWebhook.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, VerificationDenialWebhook value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public VerificationDenialWebhook read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + VerificationDenialWebhook instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of VerificationDenialWebhook given an JSON string + * + * @param jsonString JSON string + * @return An instance of VerificationDenialWebhook + * @throws IOException if the JSON string is invalid with respect to VerificationDenialWebhook + */ + public static VerificationDenialWebhook fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VerificationDenialWebhook.class); + } + + /** + * Convert an instance of VerificationDenialWebhook to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/VerificationRequest.java b/src/main/java/com/bandwidth/sdk/model/VerificationRequest.java new file mode 100644 index 00000000..99c07c6b --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/VerificationRequest.java @@ -0,0 +1,596 @@ +/* + * 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. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.Address; +import com.bandwidth.sdk.model.Contact; +import com.bandwidth.sdk.model.OptInWorkflow; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * VerificationRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") +public class VerificationRequest { + public static final String SERIALIZED_NAME_BUSINESS_ADDRESS = "businessAddress"; + @SerializedName(SERIALIZED_NAME_BUSINESS_ADDRESS) + @javax.annotation.Nonnull + private Address businessAddress; + + public static final String SERIALIZED_NAME_BUSINESS_CONTACT = "businessContact"; + @SerializedName(SERIALIZED_NAME_BUSINESS_CONTACT) + @javax.annotation.Nonnull + private Contact businessContact; + + public static final String SERIALIZED_NAME_MESSAGE_VOLUME = "messageVolume"; + @SerializedName(SERIALIZED_NAME_MESSAGE_VOLUME) + @javax.annotation.Nonnull + private Integer messageVolume; + + public static final String SERIALIZED_NAME_PHONE_NUMBERS = "phoneNumbers"; + @SerializedName(SERIALIZED_NAME_PHONE_NUMBERS) + @javax.annotation.Nonnull + private List phoneNumbers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_USE_CASE = "useCase"; + @SerializedName(SERIALIZED_NAME_USE_CASE) + @javax.annotation.Nonnull + private String useCase; + + public static final String SERIALIZED_NAME_USE_CASE_SUMMARY = "useCaseSummary"; + @SerializedName(SERIALIZED_NAME_USE_CASE_SUMMARY) + @javax.annotation.Nonnull + private String useCaseSummary; + + public static final String SERIALIZED_NAME_PRODUCTION_MESSAGE_CONTENT = "productionMessageContent"; + @SerializedName(SERIALIZED_NAME_PRODUCTION_MESSAGE_CONTENT) + @javax.annotation.Nonnull + private String productionMessageContent; + + public static final String SERIALIZED_NAME_OPT_IN_WORKFLOW = "optInWorkflow"; + @SerializedName(SERIALIZED_NAME_OPT_IN_WORKFLOW) + @javax.annotation.Nonnull + private OptInWorkflow optInWorkflow; + + public static final String SERIALIZED_NAME_ADDITIONAL_INFORMATION = "additionalInformation"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_INFORMATION) + @javax.annotation.Nullable + private String additionalInformation; + + public static final String SERIALIZED_NAME_ISV_RESELLER = "isvReseller"; + @SerializedName(SERIALIZED_NAME_ISV_RESELLER) + @javax.annotation.Nullable + private String isvReseller; + + public VerificationRequest() { + } + + public VerificationRequest businessAddress(@javax.annotation.Nonnull Address businessAddress) { + this.businessAddress = businessAddress; + return this; + } + + /** + * Get businessAddress + * @return businessAddress + */ + @javax.annotation.Nonnull + public Address getBusinessAddress() { + return businessAddress; + } + + public void setBusinessAddress(@javax.annotation.Nonnull Address businessAddress) { + this.businessAddress = businessAddress; + } + + + public VerificationRequest businessContact(@javax.annotation.Nonnull Contact businessContact) { + this.businessContact = businessContact; + return this; + } + + /** + * Get businessContact + * @return businessContact + */ + @javax.annotation.Nonnull + public Contact getBusinessContact() { + return businessContact; + } + + public void setBusinessContact(@javax.annotation.Nonnull Contact businessContact) { + this.businessContact = businessContact; + } + + + public VerificationRequest messageVolume(@javax.annotation.Nonnull Integer messageVolume) { + this.messageVolume = messageVolume; + return this; + } + + /** + * Estimated monthly volume of messages from the toll-free number. + * minimum: 10 + * maximum: 10000000 + * @return messageVolume + */ + @javax.annotation.Nonnull + public Integer getMessageVolume() { + return messageVolume; + } + + public void setMessageVolume(@javax.annotation.Nonnull Integer messageVolume) { + this.messageVolume = messageVolume; + } + + + public VerificationRequest phoneNumbers(@javax.annotation.Nonnull List phoneNumbers) { + this.phoneNumbers = phoneNumbers; + return this; + } + + public VerificationRequest addPhoneNumbersItem(String phoneNumbersItem) { + if (this.phoneNumbers == null) { + this.phoneNumbers = new ArrayList<>(); + } + this.phoneNumbers.add(phoneNumbersItem); + return this; + } + + /** + * Get phoneNumbers + * @return phoneNumbers + */ + @javax.annotation.Nonnull + public List getPhoneNumbers() { + return phoneNumbers; + } + + public void setPhoneNumbers(@javax.annotation.Nonnull List phoneNumbers) { + this.phoneNumbers = phoneNumbers; + } + + + public VerificationRequest useCase(@javax.annotation.Nonnull String useCase) { + this.useCase = useCase; + return this; + } + + /** + * The category of the use case. + * @return useCase + */ + @javax.annotation.Nonnull + public String getUseCase() { + return useCase; + } + + public void setUseCase(@javax.annotation.Nonnull String useCase) { + this.useCase = useCase; + } + + + public VerificationRequest useCaseSummary(@javax.annotation.Nonnull String useCaseSummary) { + this.useCaseSummary = useCaseSummary; + return this; + } + + /** + * A general idea of the use case and customer. + * @return useCaseSummary + */ + @javax.annotation.Nonnull + public String getUseCaseSummary() { + return useCaseSummary; + } + + public void setUseCaseSummary(@javax.annotation.Nonnull String useCaseSummary) { + this.useCaseSummary = useCaseSummary; + } + + + public VerificationRequest productionMessageContent(@javax.annotation.Nonnull String productionMessageContent) { + this.productionMessageContent = productionMessageContent; + return this; + } + + /** + * Example of message content. + * @return productionMessageContent + */ + @javax.annotation.Nonnull + public String getProductionMessageContent() { + return productionMessageContent; + } + + public void setProductionMessageContent(@javax.annotation.Nonnull String productionMessageContent) { + this.productionMessageContent = productionMessageContent; + } + + + public VerificationRequest optInWorkflow(@javax.annotation.Nonnull OptInWorkflow optInWorkflow) { + this.optInWorkflow = optInWorkflow; + return this; + } + + /** + * Get optInWorkflow + * @return optInWorkflow + */ + @javax.annotation.Nonnull + public OptInWorkflow getOptInWorkflow() { + return optInWorkflow; + } + + public void setOptInWorkflow(@javax.annotation.Nonnull OptInWorkflow optInWorkflow) { + this.optInWorkflow = optInWorkflow; + } + + + public VerificationRequest additionalInformation(@javax.annotation.Nullable String additionalInformation) { + this.additionalInformation = additionalInformation; + return this; + } + + /** + * Any additional information. + * @return additionalInformation + */ + @javax.annotation.Nullable + public String getAdditionalInformation() { + return additionalInformation; + } + + public void setAdditionalInformation(@javax.annotation.Nullable String additionalInformation) { + this.additionalInformation = additionalInformation; + } + + + public VerificationRequest isvReseller(@javax.annotation.Nullable String isvReseller) { + this.isvReseller = isvReseller; + return this; + } + + /** + * ISV name. + * @return isvReseller + */ + @javax.annotation.Nullable + public String getIsvReseller() { + return isvReseller; + } + + public void setIsvReseller(@javax.annotation.Nullable String isvReseller) { + this.isvReseller = isvReseller; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the VerificationRequest instance itself + */ + public VerificationRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerificationRequest verificationRequest = (VerificationRequest) o; + return Objects.equals(this.businessAddress, verificationRequest.businessAddress) && + Objects.equals(this.businessContact, verificationRequest.businessContact) && + Objects.equals(this.messageVolume, verificationRequest.messageVolume) && + Objects.equals(this.phoneNumbers, verificationRequest.phoneNumbers) && + Objects.equals(this.useCase, verificationRequest.useCase) && + Objects.equals(this.useCaseSummary, verificationRequest.useCaseSummary) && + Objects.equals(this.productionMessageContent, verificationRequest.productionMessageContent) && + Objects.equals(this.optInWorkflow, verificationRequest.optInWorkflow) && + Objects.equals(this.additionalInformation, verificationRequest.additionalInformation) && + Objects.equals(this.isvReseller, verificationRequest.isvReseller)&& + Objects.equals(this.additionalProperties, verificationRequest.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(businessAddress, businessContact, messageVolume, phoneNumbers, useCase, useCaseSummary, productionMessageContent, optInWorkflow, additionalInformation, isvReseller, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerificationRequest {\n"); + sb.append(" businessAddress: ").append(toIndentedString(businessAddress)).append("\n"); + sb.append(" businessContact: ").append(toIndentedString(businessContact)).append("\n"); + sb.append(" messageVolume: ").append(toIndentedString(messageVolume)).append("\n"); + sb.append(" phoneNumbers: ").append(toIndentedString(phoneNumbers)).append("\n"); + sb.append(" useCase: ").append(toIndentedString(useCase)).append("\n"); + sb.append(" useCaseSummary: ").append(toIndentedString(useCaseSummary)).append("\n"); + sb.append(" productionMessageContent: ").append(toIndentedString(productionMessageContent)).append("\n"); + sb.append(" optInWorkflow: ").append(toIndentedString(optInWorkflow)).append("\n"); + sb.append(" additionalInformation: ").append(toIndentedString(additionalInformation)).append("\n"); + sb.append(" isvReseller: ").append(toIndentedString(isvReseller)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("businessAddress"); + openapiFields.add("businessContact"); + openapiFields.add("messageVolume"); + openapiFields.add("phoneNumbers"); + openapiFields.add("useCase"); + openapiFields.add("useCaseSummary"); + openapiFields.add("productionMessageContent"); + openapiFields.add("optInWorkflow"); + openapiFields.add("additionalInformation"); + openapiFields.add("isvReseller"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("businessAddress"); + openapiRequiredFields.add("businessContact"); + openapiRequiredFields.add("messageVolume"); + openapiRequiredFields.add("phoneNumbers"); + openapiRequiredFields.add("useCase"); + openapiRequiredFields.add("useCaseSummary"); + openapiRequiredFields.add("productionMessageContent"); + openapiRequiredFields.add("optInWorkflow"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to VerificationRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VerificationRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in VerificationRequest is not found in the empty JSON string", VerificationRequest.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : VerificationRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `businessAddress` + Address.validateJsonElement(jsonObj.get("businessAddress")); + // validate the required field `businessContact` + Contact.validateJsonElement(jsonObj.get("businessContact")); + // ensure the required json array is present + if (jsonObj.get("phoneNumbers") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("phoneNumbers").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `phoneNumbers` to be an array in the JSON string but got `%s`", jsonObj.get("phoneNumbers").toString())); + } + if (!jsonObj.get("useCase").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `useCase` to be a primitive type in the JSON string but got `%s`", jsonObj.get("useCase").toString())); + } + if (!jsonObj.get("useCaseSummary").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `useCaseSummary` to be a primitive type in the JSON string but got `%s`", jsonObj.get("useCaseSummary").toString())); + } + if (!jsonObj.get("productionMessageContent").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `productionMessageContent` to be a primitive type in the JSON string but got `%s`", jsonObj.get("productionMessageContent").toString())); + } + // validate the required field `optInWorkflow` + OptInWorkflow.validateJsonElement(jsonObj.get("optInWorkflow")); + if ((jsonObj.get("additionalInformation") != null && !jsonObj.get("additionalInformation").isJsonNull()) && !jsonObj.get("additionalInformation").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `additionalInformation` to be a primitive type in the JSON string but got `%s`", jsonObj.get("additionalInformation").toString())); + } + if ((jsonObj.get("isvReseller") != null && !jsonObj.get("isvReseller").isJsonNull()) && !jsonObj.get("isvReseller").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `isvReseller` to be a primitive type in the JSON string but got `%s`", jsonObj.get("isvReseller").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VerificationRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VerificationRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(VerificationRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, VerificationRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public VerificationRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + VerificationRequest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of VerificationRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of VerificationRequest + * @throws IOException if the JSON string is invalid with respect to VerificationRequest + */ + public static VerificationRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VerificationRequest.class); + } + + /** + * Convert an instance of VerificationRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/VerificationUpdateRequest.java b/src/main/java/com/bandwidth/sdk/model/VerificationUpdateRequest.java new file mode 100644 index 00000000..d150b84e --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/VerificationUpdateRequest.java @@ -0,0 +1,552 @@ +/* + * 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. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.Address; +import com.bandwidth.sdk.model.Contact; +import com.bandwidth.sdk.model.OptInWorkflow; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * VerificationUpdateRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") +public class VerificationUpdateRequest { + public static final String SERIALIZED_NAME_BUSINESS_ADDRESS = "businessAddress"; + @SerializedName(SERIALIZED_NAME_BUSINESS_ADDRESS) + @javax.annotation.Nonnull + private Address businessAddress; + + public static final String SERIALIZED_NAME_BUSINESS_CONTACT = "businessContact"; + @SerializedName(SERIALIZED_NAME_BUSINESS_CONTACT) + @javax.annotation.Nonnull + private Contact businessContact; + + public static final String SERIALIZED_NAME_MESSAGE_VOLUME = "messageVolume"; + @SerializedName(SERIALIZED_NAME_MESSAGE_VOLUME) + @javax.annotation.Nonnull + private Integer messageVolume; + + public static final String SERIALIZED_NAME_USE_CASE = "useCase"; + @SerializedName(SERIALIZED_NAME_USE_CASE) + @javax.annotation.Nonnull + private String useCase; + + public static final String SERIALIZED_NAME_USE_CASE_SUMMARY = "useCaseSummary"; + @SerializedName(SERIALIZED_NAME_USE_CASE_SUMMARY) + @javax.annotation.Nonnull + private String useCaseSummary; + + public static final String SERIALIZED_NAME_PRODUCTION_MESSAGE_CONTENT = "productionMessageContent"; + @SerializedName(SERIALIZED_NAME_PRODUCTION_MESSAGE_CONTENT) + @javax.annotation.Nonnull + private String productionMessageContent; + + public static final String SERIALIZED_NAME_OPT_IN_WORKFLOW = "optInWorkflow"; + @SerializedName(SERIALIZED_NAME_OPT_IN_WORKFLOW) + @javax.annotation.Nonnull + private OptInWorkflow optInWorkflow; + + public static final String SERIALIZED_NAME_ADDITIONAL_INFORMATION = "additionalInformation"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_INFORMATION) + @javax.annotation.Nullable + private String additionalInformation; + + public static final String SERIALIZED_NAME_ISV_RESELLER = "isvReseller"; + @SerializedName(SERIALIZED_NAME_ISV_RESELLER) + @javax.annotation.Nullable + private String isvReseller; + + public VerificationUpdateRequest() { + } + + public VerificationUpdateRequest businessAddress(@javax.annotation.Nonnull Address businessAddress) { + this.businessAddress = businessAddress; + return this; + } + + /** + * Get businessAddress + * @return businessAddress + */ + @javax.annotation.Nonnull + public Address getBusinessAddress() { + return businessAddress; + } + + public void setBusinessAddress(@javax.annotation.Nonnull Address businessAddress) { + this.businessAddress = businessAddress; + } + + + public VerificationUpdateRequest businessContact(@javax.annotation.Nonnull Contact businessContact) { + this.businessContact = businessContact; + return this; + } + + /** + * Get businessContact + * @return businessContact + */ + @javax.annotation.Nonnull + public Contact getBusinessContact() { + return businessContact; + } + + public void setBusinessContact(@javax.annotation.Nonnull Contact businessContact) { + this.businessContact = businessContact; + } + + + public VerificationUpdateRequest messageVolume(@javax.annotation.Nonnull Integer messageVolume) { + this.messageVolume = messageVolume; + return this; + } + + /** + * Estimated monthly volume of messages from the toll-free number. + * minimum: 10 + * maximum: 10000000 + * @return messageVolume + */ + @javax.annotation.Nonnull + public Integer getMessageVolume() { + return messageVolume; + } + + public void setMessageVolume(@javax.annotation.Nonnull Integer messageVolume) { + this.messageVolume = messageVolume; + } + + + public VerificationUpdateRequest useCase(@javax.annotation.Nonnull String useCase) { + this.useCase = useCase; + return this; + } + + /** + * The category of the use case. + * @return useCase + */ + @javax.annotation.Nonnull + public String getUseCase() { + return useCase; + } + + public void setUseCase(@javax.annotation.Nonnull String useCase) { + this.useCase = useCase; + } + + + public VerificationUpdateRequest useCaseSummary(@javax.annotation.Nonnull String useCaseSummary) { + this.useCaseSummary = useCaseSummary; + return this; + } + + /** + * A general idea of the use case and customer. + * @return useCaseSummary + */ + @javax.annotation.Nonnull + public String getUseCaseSummary() { + return useCaseSummary; + } + + public void setUseCaseSummary(@javax.annotation.Nonnull String useCaseSummary) { + this.useCaseSummary = useCaseSummary; + } + + + public VerificationUpdateRequest productionMessageContent(@javax.annotation.Nonnull String productionMessageContent) { + this.productionMessageContent = productionMessageContent; + return this; + } + + /** + * Example of message content. + * @return productionMessageContent + */ + @javax.annotation.Nonnull + public String getProductionMessageContent() { + return productionMessageContent; + } + + public void setProductionMessageContent(@javax.annotation.Nonnull String productionMessageContent) { + this.productionMessageContent = productionMessageContent; + } + + + public VerificationUpdateRequest optInWorkflow(@javax.annotation.Nonnull OptInWorkflow optInWorkflow) { + this.optInWorkflow = optInWorkflow; + return this; + } + + /** + * Get optInWorkflow + * @return optInWorkflow + */ + @javax.annotation.Nonnull + public OptInWorkflow getOptInWorkflow() { + return optInWorkflow; + } + + public void setOptInWorkflow(@javax.annotation.Nonnull OptInWorkflow optInWorkflow) { + this.optInWorkflow = optInWorkflow; + } + + + public VerificationUpdateRequest additionalInformation(@javax.annotation.Nullable String additionalInformation) { + this.additionalInformation = additionalInformation; + return this; + } + + /** + * Any additional information. + * @return additionalInformation + */ + @javax.annotation.Nullable + public String getAdditionalInformation() { + return additionalInformation; + } + + public void setAdditionalInformation(@javax.annotation.Nullable String additionalInformation) { + this.additionalInformation = additionalInformation; + } + + + public VerificationUpdateRequest isvReseller(@javax.annotation.Nullable String isvReseller) { + this.isvReseller = isvReseller; + return this; + } + + /** + * ISV name. + * @return isvReseller + */ + @javax.annotation.Nullable + public String getIsvReseller() { + return isvReseller; + } + + public void setIsvReseller(@javax.annotation.Nullable String isvReseller) { + this.isvReseller = isvReseller; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the VerificationUpdateRequest instance itself + */ + public VerificationUpdateRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerificationUpdateRequest verificationUpdateRequest = (VerificationUpdateRequest) o; + return Objects.equals(this.businessAddress, verificationUpdateRequest.businessAddress) && + Objects.equals(this.businessContact, verificationUpdateRequest.businessContact) && + Objects.equals(this.messageVolume, verificationUpdateRequest.messageVolume) && + Objects.equals(this.useCase, verificationUpdateRequest.useCase) && + Objects.equals(this.useCaseSummary, verificationUpdateRequest.useCaseSummary) && + Objects.equals(this.productionMessageContent, verificationUpdateRequest.productionMessageContent) && + Objects.equals(this.optInWorkflow, verificationUpdateRequest.optInWorkflow) && + Objects.equals(this.additionalInformation, verificationUpdateRequest.additionalInformation) && + Objects.equals(this.isvReseller, verificationUpdateRequest.isvReseller)&& + Objects.equals(this.additionalProperties, verificationUpdateRequest.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(businessAddress, businessContact, messageVolume, useCase, useCaseSummary, productionMessageContent, optInWorkflow, additionalInformation, isvReseller, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerificationUpdateRequest {\n"); + sb.append(" businessAddress: ").append(toIndentedString(businessAddress)).append("\n"); + sb.append(" businessContact: ").append(toIndentedString(businessContact)).append("\n"); + sb.append(" messageVolume: ").append(toIndentedString(messageVolume)).append("\n"); + sb.append(" useCase: ").append(toIndentedString(useCase)).append("\n"); + sb.append(" useCaseSummary: ").append(toIndentedString(useCaseSummary)).append("\n"); + sb.append(" productionMessageContent: ").append(toIndentedString(productionMessageContent)).append("\n"); + sb.append(" optInWorkflow: ").append(toIndentedString(optInWorkflow)).append("\n"); + sb.append(" additionalInformation: ").append(toIndentedString(additionalInformation)).append("\n"); + sb.append(" isvReseller: ").append(toIndentedString(isvReseller)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("businessAddress"); + openapiFields.add("businessContact"); + openapiFields.add("messageVolume"); + openapiFields.add("useCase"); + openapiFields.add("useCaseSummary"); + openapiFields.add("productionMessageContent"); + openapiFields.add("optInWorkflow"); + openapiFields.add("additionalInformation"); + openapiFields.add("isvReseller"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("businessAddress"); + openapiRequiredFields.add("businessContact"); + openapiRequiredFields.add("messageVolume"); + openapiRequiredFields.add("useCase"); + openapiRequiredFields.add("useCaseSummary"); + openapiRequiredFields.add("productionMessageContent"); + openapiRequiredFields.add("optInWorkflow"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to VerificationUpdateRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VerificationUpdateRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in VerificationUpdateRequest is not found in the empty JSON string", VerificationUpdateRequest.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : VerificationUpdateRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `businessAddress` + Address.validateJsonElement(jsonObj.get("businessAddress")); + // validate the required field `businessContact` + Contact.validateJsonElement(jsonObj.get("businessContact")); + if (!jsonObj.get("useCase").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `useCase` to be a primitive type in the JSON string but got `%s`", jsonObj.get("useCase").toString())); + } + if (!jsonObj.get("useCaseSummary").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `useCaseSummary` to be a primitive type in the JSON string but got `%s`", jsonObj.get("useCaseSummary").toString())); + } + if (!jsonObj.get("productionMessageContent").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `productionMessageContent` to be a primitive type in the JSON string but got `%s`", jsonObj.get("productionMessageContent").toString())); + } + // validate the required field `optInWorkflow` + OptInWorkflow.validateJsonElement(jsonObj.get("optInWorkflow")); + if ((jsonObj.get("additionalInformation") != null && !jsonObj.get("additionalInformation").isJsonNull()) && !jsonObj.get("additionalInformation").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `additionalInformation` to be a primitive type in the JSON string but got `%s`", jsonObj.get("additionalInformation").toString())); + } + if ((jsonObj.get("isvReseller") != null && !jsonObj.get("isvReseller").isJsonNull()) && !jsonObj.get("isvReseller").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `isvReseller` to be a primitive type in the JSON string but got `%s`", jsonObj.get("isvReseller").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VerificationUpdateRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VerificationUpdateRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(VerificationUpdateRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, VerificationUpdateRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public VerificationUpdateRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + VerificationUpdateRequest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of VerificationUpdateRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of VerificationUpdateRequest + * @throws IOException if the JSON string is invalid with respect to VerificationUpdateRequest + */ + public static VerificationUpdateRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VerificationUpdateRequest.class); + } + + /** + * Convert an instance of VerificationUpdateRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/VerificationWebhook.java b/src/main/java/com/bandwidth/sdk/model/VerificationWebhook.java new file mode 100644 index 00000000..22ce9d79 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/VerificationWebhook.java @@ -0,0 +1,380 @@ +/* + * 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. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.TfvCallbackStatusEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * VerificationWebhook + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") +public class VerificationWebhook { + public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + @javax.annotation.Nullable + private String accountId; + + public static final String SERIALIZED_NAME_PHONE_NUMBER = "phoneNumber"; + @SerializedName(SERIALIZED_NAME_PHONE_NUMBER) + @javax.annotation.Nullable + private String phoneNumber; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private TfvCallbackStatusEnum status; + + public static final String SERIALIZED_NAME_INTERNAL_TICKET_NUMBER = "internalTicketNumber"; + @SerializedName(SERIALIZED_NAME_INTERNAL_TICKET_NUMBER) + @javax.annotation.Nullable + private UUID internalTicketNumber; + + public VerificationWebhook() { + } + + public VerificationWebhook accountId(@javax.annotation.Nullable String accountId) { + this.accountId = accountId; + return this; + } + + /** + * User's account ID. + * @return accountId + */ + @javax.annotation.Nullable + public String getAccountId() { + return accountId; + } + + public void setAccountId(@javax.annotation.Nullable String accountId) { + this.accountId = accountId; + } + + + public VerificationWebhook phoneNumber(@javax.annotation.Nullable String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Toll-free telephone number in E.164 format. + * @return phoneNumber + */ + @javax.annotation.Nullable + public String getPhoneNumber() { + return phoneNumber; + } + + public void setPhoneNumber(@javax.annotation.Nullable String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + + public VerificationWebhook status(@javax.annotation.Nullable TfvCallbackStatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nullable + public TfvCallbackStatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable TfvCallbackStatusEnum status) { + this.status = status; + } + + + public VerificationWebhook internalTicketNumber(@javax.annotation.Nullable UUID internalTicketNumber) { + this.internalTicketNumber = internalTicketNumber; + return this; + } + + /** + * Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number. + * @return internalTicketNumber + */ + @javax.annotation.Nullable + public UUID getInternalTicketNumber() { + return internalTicketNumber; + } + + public void setInternalTicketNumber(@javax.annotation.Nullable UUID internalTicketNumber) { + this.internalTicketNumber = internalTicketNumber; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the VerificationWebhook instance itself + */ + public VerificationWebhook putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerificationWebhook verificationWebhook = (VerificationWebhook) o; + return Objects.equals(this.accountId, verificationWebhook.accountId) && + Objects.equals(this.phoneNumber, verificationWebhook.phoneNumber) && + Objects.equals(this.status, verificationWebhook.status) && + Objects.equals(this.internalTicketNumber, verificationWebhook.internalTicketNumber)&& + Objects.equals(this.additionalProperties, verificationWebhook.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(accountId, phoneNumber, status, internalTicketNumber, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerificationWebhook {\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" internalTicketNumber: ").append(toIndentedString(internalTicketNumber)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("accountId"); + openapiFields.add("phoneNumber"); + openapiFields.add("status"); + openapiFields.add("internalTicketNumber"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to VerificationWebhook + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VerificationWebhook.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in VerificationWebhook is not found in the empty JSON string", VerificationWebhook.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("accountId") != null && !jsonObj.get("accountId").isJsonNull()) && !jsonObj.get("accountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountId").toString())); + } + if ((jsonObj.get("phoneNumber") != null && !jsonObj.get("phoneNumber").isJsonNull()) && !jsonObj.get("phoneNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `phoneNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("phoneNumber").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + TfvCallbackStatusEnum.validateJsonElement(jsonObj.get("status")); + } + if ((jsonObj.get("internalTicketNumber") != null && !jsonObj.get("internalTicketNumber").isJsonNull()) && !jsonObj.get("internalTicketNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `internalTicketNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("internalTicketNumber").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VerificationWebhook.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VerificationWebhook' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(VerificationWebhook.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, VerificationWebhook value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public VerificationWebhook read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + VerificationWebhook instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of VerificationWebhook given an JSON string + * + * @param jsonString JSON string + * @return An instance of VerificationWebhook + * @throws IOException if the JSON string is invalid with respect to VerificationWebhook + */ + public static VerificationWebhook fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VerificationWebhook.class); + } + + /** + * Convert an instance of VerificationWebhook to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/WebhookSubscription.java b/src/main/java/com/bandwidth/sdk/model/WebhookSubscription.java new file mode 100644 index 00000000..9521bc5d --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/WebhookSubscription.java @@ -0,0 +1,474 @@ +/* + * 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. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.WebhookSubscriptionBasicAuthentication; +import com.bandwidth.sdk.model.WebhookSubscriptionTypeEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * Information about a webhook that Bandwidth should send upon the completion of event customer has subscribed to. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") +public class WebhookSubscription { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + @javax.annotation.Nullable + private String accountId; + + public static final String SERIALIZED_NAME_CALLBACK_URL = "callbackUrl"; + @SerializedName(SERIALIZED_NAME_CALLBACK_URL) + @javax.annotation.Nullable + private String callbackUrl; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private WebhookSubscriptionTypeEnum type; + + public static final String SERIALIZED_NAME_BASIC_AUTHENTICATION = "basicAuthentication"; + @SerializedName(SERIALIZED_NAME_BASIC_AUTHENTICATION) + @javax.annotation.Nullable + private WebhookSubscriptionBasicAuthentication basicAuthentication; + + public static final String SERIALIZED_NAME_CREATED_DATE = "createdDate"; + @SerializedName(SERIALIZED_NAME_CREATED_DATE) + @javax.annotation.Nullable + private OffsetDateTime createdDate; + + public static final String SERIALIZED_NAME_MODIFIED_DATE = "modifiedDate"; + @SerializedName(SERIALIZED_NAME_MODIFIED_DATE) + @javax.annotation.Nullable + private OffsetDateTime modifiedDate; + + public WebhookSubscription() { + } + + public WebhookSubscription id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public WebhookSubscription accountId(@javax.annotation.Nullable String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Get accountId + * @return accountId + */ + @javax.annotation.Nullable + public String getAccountId() { + return accountId; + } + + public void setAccountId(@javax.annotation.Nullable String accountId) { + this.accountId = accountId; + } + + + public WebhookSubscription callbackUrl(@javax.annotation.Nullable String callbackUrl) { + this.callbackUrl = callbackUrl; + return this; + } + + /** + * 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. + * @return callbackUrl + */ + @javax.annotation.Nullable + public String getCallbackUrl() { + return callbackUrl; + } + + public void setCallbackUrl(@javax.annotation.Nullable String callbackUrl) { + this.callbackUrl = callbackUrl; + } + + + public WebhookSubscription type(@javax.annotation.Nullable WebhookSubscriptionTypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public WebhookSubscriptionTypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nullable WebhookSubscriptionTypeEnum type) { + this.type = type; + } + + + public WebhookSubscription basicAuthentication(@javax.annotation.Nullable WebhookSubscriptionBasicAuthentication basicAuthentication) { + this.basicAuthentication = basicAuthentication; + return this; + } + + /** + * Get basicAuthentication + * @return basicAuthentication + */ + @javax.annotation.Nullable + public WebhookSubscriptionBasicAuthentication getBasicAuthentication() { + return basicAuthentication; + } + + public void setBasicAuthentication(@javax.annotation.Nullable WebhookSubscriptionBasicAuthentication basicAuthentication) { + this.basicAuthentication = basicAuthentication; + } + + + public WebhookSubscription createdDate(@javax.annotation.Nullable OffsetDateTime createdDate) { + this.createdDate = createdDate; + return this; + } + + /** + * Get createdDate + * @return createdDate + */ + @javax.annotation.Nullable + public OffsetDateTime getCreatedDate() { + return createdDate; + } + + public void setCreatedDate(@javax.annotation.Nullable OffsetDateTime createdDate) { + this.createdDate = createdDate; + } + + + public WebhookSubscription modifiedDate(@javax.annotation.Nullable OffsetDateTime modifiedDate) { + this.modifiedDate = modifiedDate; + return this; + } + + /** + * Get modifiedDate + * @return modifiedDate + */ + @javax.annotation.Nullable + public OffsetDateTime getModifiedDate() { + return modifiedDate; + } + + public void setModifiedDate(@javax.annotation.Nullable OffsetDateTime modifiedDate) { + this.modifiedDate = modifiedDate; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the WebhookSubscription instance itself + */ + public WebhookSubscription putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhookSubscription webhookSubscription = (WebhookSubscription) o; + return Objects.equals(this.id, webhookSubscription.id) && + Objects.equals(this.accountId, webhookSubscription.accountId) && + Objects.equals(this.callbackUrl, webhookSubscription.callbackUrl) && + Objects.equals(this.type, webhookSubscription.type) && + Objects.equals(this.basicAuthentication, webhookSubscription.basicAuthentication) && + Objects.equals(this.createdDate, webhookSubscription.createdDate) && + Objects.equals(this.modifiedDate, webhookSubscription.modifiedDate)&& + Objects.equals(this.additionalProperties, webhookSubscription.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, accountId, callbackUrl, type, basicAuthentication, createdDate, modifiedDate, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhookSubscription {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" callbackUrl: ").append(toIndentedString(callbackUrl)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" basicAuthentication: ").append(toIndentedString(basicAuthentication)).append("\n"); + sb.append(" createdDate: ").append(toIndentedString(createdDate)).append("\n"); + sb.append(" modifiedDate: ").append(toIndentedString(modifiedDate)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("accountId"); + openapiFields.add("callbackUrl"); + openapiFields.add("type"); + openapiFields.add("basicAuthentication"); + openapiFields.add("createdDate"); + openapiFields.add("modifiedDate"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("callbackUrl"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WebhookSubscription + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WebhookSubscription.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WebhookSubscription is not found in the empty JSON string", WebhookSubscription.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WebhookSubscription.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("accountId") != null && !jsonObj.get("accountId").isJsonNull()) && !jsonObj.get("accountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountId").toString())); + } + if ((jsonObj.get("callbackUrl") != null && !jsonObj.get("callbackUrl").isJsonNull()) && !jsonObj.get("callbackUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callbackUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callbackUrl").toString())); + } + // validate the optional field `type` + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) { + WebhookSubscriptionTypeEnum.validateJsonElement(jsonObj.get("type")); + } + // validate the optional field `basicAuthentication` + if (jsonObj.get("basicAuthentication") != null && !jsonObj.get("basicAuthentication").isJsonNull()) { + WebhookSubscriptionBasicAuthentication.validateJsonElement(jsonObj.get("basicAuthentication")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WebhookSubscription.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WebhookSubscription' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WebhookSubscription.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WebhookSubscription value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public WebhookSubscription read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + WebhookSubscription instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WebhookSubscription given an JSON string + * + * @param jsonString JSON string + * @return An instance of WebhookSubscription + * @throws IOException if the JSON string is invalid with respect to WebhookSubscription + */ + public static WebhookSubscription fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WebhookSubscription.class); + } + + /** + * Convert an instance of WebhookSubscription to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/WebhookSubscriptionBasicAuthentication.java b/src/main/java/com/bandwidth/sdk/model/WebhookSubscriptionBasicAuthentication.java new file mode 100644 index 00000000..a95b0707 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/WebhookSubscriptionBasicAuthentication.java @@ -0,0 +1,326 @@ +/* + * 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. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * Basic authentication credentials are not required, but if present, both username and password must be provided. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") +public class WebhookSubscriptionBasicAuthentication { + public static final String SERIALIZED_NAME_USERNAME = "username"; + @SerializedName(SERIALIZED_NAME_USERNAME) + @javax.annotation.Nonnull + private String username; + + public static final String SERIALIZED_NAME_PASSWORD = "password"; + @SerializedName(SERIALIZED_NAME_PASSWORD) + @javax.annotation.Nonnull + private String password; + + public WebhookSubscriptionBasicAuthentication() { + } + + public WebhookSubscriptionBasicAuthentication username(@javax.annotation.Nonnull String username) { + this.username = username; + return this; + } + + /** + * Get username + * @return username + */ + @javax.annotation.Nonnull + public String getUsername() { + return username; + } + + public void setUsername(@javax.annotation.Nonnull String username) { + this.username = username; + } + + + public WebhookSubscriptionBasicAuthentication password(@javax.annotation.Nonnull String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + */ + @javax.annotation.Nonnull + public String getPassword() { + return password; + } + + public void setPassword(@javax.annotation.Nonnull String password) { + this.password = password; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the WebhookSubscriptionBasicAuthentication instance itself + */ + public WebhookSubscriptionBasicAuthentication putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhookSubscriptionBasicAuthentication webhookSubscriptionBasicAuthentication = (WebhookSubscriptionBasicAuthentication) o; + return Objects.equals(this.username, webhookSubscriptionBasicAuthentication.username) && + Objects.equals(this.password, webhookSubscriptionBasicAuthentication.password)&& + Objects.equals(this.additionalProperties, webhookSubscriptionBasicAuthentication.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(username, password, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhookSubscriptionBasicAuthentication {\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("username"); + openapiFields.add("password"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("username"); + openapiRequiredFields.add("password"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WebhookSubscriptionBasicAuthentication + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WebhookSubscriptionBasicAuthentication.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WebhookSubscriptionBasicAuthentication is not found in the empty JSON string", WebhookSubscriptionBasicAuthentication.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WebhookSubscriptionBasicAuthentication.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("username").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString())); + } + if (!jsonObj.get("password").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WebhookSubscriptionBasicAuthentication.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WebhookSubscriptionBasicAuthentication' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WebhookSubscriptionBasicAuthentication.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WebhookSubscriptionBasicAuthentication value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public WebhookSubscriptionBasicAuthentication read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + WebhookSubscriptionBasicAuthentication instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WebhookSubscriptionBasicAuthentication given an JSON string + * + * @param jsonString JSON string + * @return An instance of WebhookSubscriptionBasicAuthentication + * @throws IOException if the JSON string is invalid with respect to WebhookSubscriptionBasicAuthentication + */ + public static WebhookSubscriptionBasicAuthentication fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WebhookSubscriptionBasicAuthentication.class); + } + + /** + * Convert an instance of WebhookSubscriptionBasicAuthentication to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/WebhookSubscriptionRequestSchema.java b/src/main/java/com/bandwidth/sdk/model/WebhookSubscriptionRequestSchema.java new file mode 100644 index 00000000..fd354bc8 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/WebhookSubscriptionRequestSchema.java @@ -0,0 +1,369 @@ +/* + * 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. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.TfvBasicAuthentication; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * WebhookSubscriptionRequestSchema + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") +public class WebhookSubscriptionRequestSchema { + public static final String SERIALIZED_NAME_BASIC_AUTHENTICATION = "basicAuthentication"; + @SerializedName(SERIALIZED_NAME_BASIC_AUTHENTICATION) + @javax.annotation.Nullable + private TfvBasicAuthentication basicAuthentication; + + public static final String SERIALIZED_NAME_CALLBACK_URL = "callbackUrl"; + @SerializedName(SERIALIZED_NAME_CALLBACK_URL) + @javax.annotation.Nullable + private String callbackUrl; + + public static final String SERIALIZED_NAME_SHARED_SECRET_KEY = "sharedSecretKey"; + @SerializedName(SERIALIZED_NAME_SHARED_SECRET_KEY) + @javax.annotation.Nullable + private String sharedSecretKey; + + public WebhookSubscriptionRequestSchema() { + } + + public WebhookSubscriptionRequestSchema basicAuthentication(@javax.annotation.Nullable TfvBasicAuthentication basicAuthentication) { + this.basicAuthentication = basicAuthentication; + return this; + } + + /** + * Get basicAuthentication + * @return basicAuthentication + */ + @javax.annotation.Nullable + public TfvBasicAuthentication getBasicAuthentication() { + return basicAuthentication; + } + + public void setBasicAuthentication(@javax.annotation.Nullable TfvBasicAuthentication basicAuthentication) { + this.basicAuthentication = basicAuthentication; + } + + + public WebhookSubscriptionRequestSchema callbackUrl(@javax.annotation.Nullable String callbackUrl) { + this.callbackUrl = callbackUrl; + return this; + } + + /** + * 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. + * @return callbackUrl + */ + @javax.annotation.Nullable + public String getCallbackUrl() { + return callbackUrl; + } + + public void setCallbackUrl(@javax.annotation.Nullable String callbackUrl) { + this.callbackUrl = callbackUrl; + } + + + public WebhookSubscriptionRequestSchema sharedSecretKey(@javax.annotation.Nullable String sharedSecretKey) { + this.sharedSecretKey = sharedSecretKey; + return this; + } + + /** + * An ASCII string submitted by the user as a shared secret key for generating an HMAC header for callbacks. + * @return sharedSecretKey + */ + @javax.annotation.Nullable + public String getSharedSecretKey() { + return sharedSecretKey; + } + + public void setSharedSecretKey(@javax.annotation.Nullable String sharedSecretKey) { + this.sharedSecretKey = sharedSecretKey; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the WebhookSubscriptionRequestSchema instance itself + */ + public WebhookSubscriptionRequestSchema putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhookSubscriptionRequestSchema webhookSubscriptionRequestSchema = (WebhookSubscriptionRequestSchema) o; + return Objects.equals(this.basicAuthentication, webhookSubscriptionRequestSchema.basicAuthentication) && + Objects.equals(this.callbackUrl, webhookSubscriptionRequestSchema.callbackUrl) && + Objects.equals(this.sharedSecretKey, webhookSubscriptionRequestSchema.sharedSecretKey)&& + Objects.equals(this.additionalProperties, webhookSubscriptionRequestSchema.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(basicAuthentication, callbackUrl, sharedSecretKey, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhookSubscriptionRequestSchema {\n"); + sb.append(" basicAuthentication: ").append(toIndentedString(basicAuthentication)).append("\n"); + sb.append(" callbackUrl: ").append(toIndentedString(callbackUrl)).append("\n"); + sb.append(" sharedSecretKey: ").append(toIndentedString(sharedSecretKey)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("basicAuthentication"); + openapiFields.add("callbackUrl"); + openapiFields.add("sharedSecretKey"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("callbackUrl"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WebhookSubscriptionRequestSchema + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WebhookSubscriptionRequestSchema.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WebhookSubscriptionRequestSchema is not found in the empty JSON string", WebhookSubscriptionRequestSchema.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WebhookSubscriptionRequestSchema.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `basicAuthentication` + if (jsonObj.get("basicAuthentication") != null && !jsonObj.get("basicAuthentication").isJsonNull()) { + TfvBasicAuthentication.validateJsonElement(jsonObj.get("basicAuthentication")); + } + if ((jsonObj.get("callbackUrl") != null && !jsonObj.get("callbackUrl").isJsonNull()) && !jsonObj.get("callbackUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callbackUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callbackUrl").toString())); + } + if ((jsonObj.get("sharedSecretKey") != null && !jsonObj.get("sharedSecretKey").isJsonNull()) && !jsonObj.get("sharedSecretKey").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `sharedSecretKey` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sharedSecretKey").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WebhookSubscriptionRequestSchema.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WebhookSubscriptionRequestSchema' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WebhookSubscriptionRequestSchema.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WebhookSubscriptionRequestSchema value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public WebhookSubscriptionRequestSchema read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + WebhookSubscriptionRequestSchema instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WebhookSubscriptionRequestSchema given an JSON string + * + * @param jsonString JSON string + * @return An instance of WebhookSubscriptionRequestSchema + * @throws IOException if the JSON string is invalid with respect to WebhookSubscriptionRequestSchema + */ + public static WebhookSubscriptionRequestSchema fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WebhookSubscriptionRequestSchema.class); + } + + /** + * Convert an instance of WebhookSubscriptionRequestSchema to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/WebhookSubscriptionTypeEnum.java b/src/main/java/com/bandwidth/sdk/model/WebhookSubscriptionTypeEnum.java new file mode 100644 index 00000000..e3688c9a --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/WebhookSubscriptionTypeEnum.java @@ -0,0 +1,78 @@ +/* + * 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. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets webhookSubscriptionTypeEnum + */ +@JsonAdapter(WebhookSubscriptionTypeEnum.Adapter.class) +public enum WebhookSubscriptionTypeEnum { + + TOLLFREE_VERIFICATION_STATUS("TOLLFREE_VERIFICATION_STATUS"), + + MESSAGING_PORTOUT_APPROVAL_STATUS("MESSAGING_PORTOUT_APPROVAL_STATUS"); + + private String value; + + WebhookSubscriptionTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static WebhookSubscriptionTypeEnum fromValue(String value) { + for (WebhookSubscriptionTypeEnum b : WebhookSubscriptionTypeEnum.values()) { + if (b.value.equalsIgnoreCase(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final WebhookSubscriptionTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public WebhookSubscriptionTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return WebhookSubscriptionTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + WebhookSubscriptionTypeEnum.fromValue(value); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/WebhookSubscriptionsListBody.java b/src/main/java/com/bandwidth/sdk/model/WebhookSubscriptionsListBody.java new file mode 100644 index 00000000..9cde6bac --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/WebhookSubscriptionsListBody.java @@ -0,0 +1,395 @@ +/* + * 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. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.Error; +import com.bandwidth.sdk.model.LinksObject; +import com.bandwidth.sdk.model.WebhookSubscription; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * A list of all webhook subscriptions registered for this account ID for this particular feature (unpaginated). + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") +public class WebhookSubscriptionsListBody { + public static final String SERIALIZED_NAME_LINKS = "links"; + @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nullable + private LinksObject links; + + public static final String SERIALIZED_NAME_ERRORS = "errors"; + @SerializedName(SERIALIZED_NAME_ERRORS) + @javax.annotation.Nullable + private List errors = new ArrayList<>(); + + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull + private List data = new ArrayList<>(); + + public WebhookSubscriptionsListBody() { + } + + public WebhookSubscriptionsListBody links(@javax.annotation.Nullable LinksObject links) { + this.links = links; + return this; + } + + /** + * Get links + * @return links + */ + @javax.annotation.Nullable + public LinksObject getLinks() { + return links; + } + + public void setLinks(@javax.annotation.Nullable LinksObject links) { + this.links = links; + } + + + public WebhookSubscriptionsListBody errors(@javax.annotation.Nullable List errors) { + this.errors = errors; + return this; + } + + public WebhookSubscriptionsListBody addErrorsItem(Error errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + + /** + * Get errors + * @return errors + */ + @javax.annotation.Nullable + public List getErrors() { + return errors; + } + + public void setErrors(@javax.annotation.Nullable List errors) { + this.errors = errors; + } + + + public WebhookSubscriptionsListBody data(@javax.annotation.Nonnull List data) { + this.data = data; + return this; + } + + public WebhookSubscriptionsListBody addDataItem(WebhookSubscription dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + public List getData() { + return data; + } + + public void setData(@javax.annotation.Nonnull List data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the WebhookSubscriptionsListBody instance itself + */ + public WebhookSubscriptionsListBody putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhookSubscriptionsListBody webhookSubscriptionsListBody = (WebhookSubscriptionsListBody) o; + return Objects.equals(this.links, webhookSubscriptionsListBody.links) && + Objects.equals(this.errors, webhookSubscriptionsListBody.errors) && + Objects.equals(this.data, webhookSubscriptionsListBody.data)&& + Objects.equals(this.additionalProperties, webhookSubscriptionsListBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(links, errors, data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhookSubscriptionsListBody {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("links"); + openapiFields.add("errors"); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WebhookSubscriptionsListBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WebhookSubscriptionsListBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WebhookSubscriptionsListBody is not found in the empty JSON string", WebhookSubscriptionsListBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WebhookSubscriptionsListBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `links` + if (jsonObj.get("links") != null && !jsonObj.get("links").isJsonNull()) { + LinksObject.validateJsonElement(jsonObj.get("links")); + } + if (jsonObj.get("errors") != null && !jsonObj.get("errors").isJsonNull()) { + JsonArray jsonArrayerrors = jsonObj.getAsJsonArray("errors"); + if (jsonArrayerrors != null) { + // ensure the json data is an array + if (!jsonObj.get("errors").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `errors` to be an array in the JSON string but got `%s`", jsonObj.get("errors").toString())); + } + + // validate the optional field `errors` (array) + for (int i = 0; i < jsonArrayerrors.size(); i++) { + Error.validateJsonElement(jsonArrayerrors.get(i)); + }; + } + } + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + // validate the required field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + WebhookSubscription.validateJsonElement(jsonArraydata.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WebhookSubscriptionsListBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WebhookSubscriptionsListBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WebhookSubscriptionsListBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WebhookSubscriptionsListBody value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public WebhookSubscriptionsListBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + WebhookSubscriptionsListBody instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WebhookSubscriptionsListBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of WebhookSubscriptionsListBody + * @throws IOException if the JSON string is invalid with respect to WebhookSubscriptionsListBody + */ + public static WebhookSubscriptionsListBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WebhookSubscriptionsListBody.class); + } + + /** + * Convert an instance of WebhookSubscriptionsListBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/test/java/com/bandwidth/sdk/unit/api/TollFreeVerificationApiTest.java b/src/test/java/com/bandwidth/sdk/unit/api/TollFreeVerificationApiTest.java new file mode 100644 index 00000000..ee227edc --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/api/TollFreeVerificationApiTest.java @@ -0,0 +1,226 @@ +/* + * 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. + */ + +package com.bandwidth.sdk.unit.api; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.ApiResponse; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.api.TollFreeVerificationApi; +import com.bandwidth.sdk.auth.HttpBasicAuth; +import com.bandwidth.sdk.model.Address; +import com.bandwidth.sdk.model.Contact; +import com.bandwidth.sdk.model.LinksObject; +import com.bandwidth.sdk.model.OptInWorkflow; +import com.bandwidth.sdk.model.TelephoneNumber; +import com.bandwidth.sdk.model.TfvBasicAuthentication; +import com.bandwidth.sdk.model.TfvStatus; +import com.bandwidth.sdk.model.TfvStatusEnum; +import com.bandwidth.sdk.model.TfvSubmissionWrapper; +import com.bandwidth.sdk.model.VerificationRequest; +import com.bandwidth.sdk.model.WebhookSubscription; +import com.bandwidth.sdk.model.WebhookSubscriptionBasicAuthentication; +import com.bandwidth.sdk.model.WebhookSubscriptionRequestSchema; +import com.bandwidth.sdk.model.WebhookSubscriptionTypeEnum; +import com.bandwidth.sdk.model.WebhookSubscriptionsListBody; + +import static com.bandwidth.sdk.utils.TestingEnvironmentVariables.*; +import static org.hamcrest.MatcherAssert.assertThat; + +import java.time.OffsetDateTime; +import java.util.List; +import java.util.UUID; + +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.CoreMatchers.is; + +@SuppressWarnings("null") +public class TollFreeVerificationApiTest { + private static ApiClient defaultClient = Configuration.getDefaultApiClient(); + private static HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + private static TollFreeVerificationApi api = new TollFreeVerificationApi(defaultClient); + + private static WebhookSubscriptionRequestSchema webhookSubscriptionRequestSchema = new WebhookSubscriptionRequestSchema() + .basicAuthentication(new TfvBasicAuthentication() + .username("username") + .password("password")) + .callbackUrl("https://example.com") + .sharedSecretKey("shared-secret-key"); + + @BeforeAll + public static void setUp() { + Basic.setUsername(BW_USERNAME); + Basic.setPassword(BW_PASSWORD); + api.setCustomBaseUrl("http://127.0.0.1:4010"); + } + + @Test + public void createWebhookSubscriptionTest() throws ApiException { + ApiResponse response = api.createWebhookSubscriptionWithHttpInfo(BW_ACCOUNT_ID, + webhookSubscriptionRequestSchema); + + assertThat(response.getStatusCode(), is(201)); + assertThat(response.getData(), instanceOf(WebhookSubscription.class)); + assertThat(response.getData().getId(), instanceOf(String.class)); + assertThat(response.getData().getAccountId(), instanceOf(String.class)); + assertThat(response.getData().getCallbackUrl(), instanceOf(String.class)); + assertThat(response.getData().getType(), instanceOf(WebhookSubscriptionTypeEnum.class)); + assertThat(response.getData().getBasicAuthentication(), + instanceOf(WebhookSubscriptionBasicAuthentication.class)); + assertThat(response.getData().getBasicAuthentication().getUsername(), instanceOf(String.class)); + assertThat(response.getData().getBasicAuthentication().getPassword(), instanceOf(String.class)); + assertThat(response.getData().getCreatedDate(), instanceOf(OffsetDateTime.class)); + assertThat(response.getData().getModifiedDate(), instanceOf(OffsetDateTime.class)); + } + + @Test + public void deleteWebhookSubscriptionTest() throws ApiException { + ApiResponse response = api.deleteWebhookSubscriptionWithHttpInfo(BW_ACCOUNT_ID, "test-id-1234"); + assertThat(response.getStatusCode(), is(204)); + } + + @Test + public void getTollFreeVerificationStatusTest() throws ApiException { + ApiResponse response = api + .getTollFreeVerificationStatusWithHttpInfo(BW_ACCOUNT_ID, "+18005551234"); + + assertThat(response.getStatusCode(), is(200)); + assertThat(response.getData(), instanceOf(TfvStatus.class)); + assertThat(response.getData().getPhoneNumber(), instanceOf(String.class)); + assertThat(response.getData().getStatus(), instanceOf(TfvStatusEnum.class)); + assertThat(response.getData().getInternalTicketNumber(), instanceOf(UUID.class)); + assertThat(response.getData().getDeclineReasonDescription(), instanceOf(String.class)); + assertThat(response.getData().getResubmitAllowed(), instanceOf(Boolean.class)); + assertThat(response.getData().getCreatedDateTime(), instanceOf(OffsetDateTime.class)); + assertThat(response.getData().getModifiedDateTime(), instanceOf(OffsetDateTime.class)); + } + + @Test + public void listTollFreeUseCasesTest() throws ApiException { + ApiResponse> response = api.listTollFreeUseCasesWithHttpInfo(); + + assertThat(response.getStatusCode(), is(200)); + assertThat(response.getData(), instanceOf(List.class)); + } + + @Test + public void listWebhookSubscriptionsTest() throws ApiException { + ApiResponse response = api.listWebhookSubscriptionsWithHttpInfo(BW_ACCOUNT_ID); + + assertThat(response.getStatusCode(), is(200)); + assertThat(response.getData(), instanceOf(WebhookSubscriptionsListBody.class)); + assertThat(response.getData().getLinks(), instanceOf(LinksObject.class)); + assertThat(response.getData().getLinks().getFirst(), instanceOf(String.class)); + assertThat(response.getData().getLinks().getNext(), instanceOf(String.class)); + assertThat(response.getData().getLinks().getPrevious(), instanceOf(String.class)); + assertThat(response.getData().getLinks().getLast(), instanceOf(String.class)); + assertThat(response.getData().getErrors(), instanceOf(List.class)); + assertThat(response.getData().getErrors().get(0).getCode(), instanceOf(Integer.class)); + assertThat(response.getData().getErrors().get(0).getDescription(), instanceOf(String.class)); + assertThat(response.getData().getErrors().get(0).getTelephoneNumbers(), instanceOf(List.class)); + assertThat(response.getData().getErrors().get(0).getTelephoneNumbers().get(0), + instanceOf(TelephoneNumber.class)); + assertThat(response.getData().getErrors().get(0).getTelephoneNumbers().get(0).getTelephoneNumber(), + instanceOf(String.class)); + assertThat(response.getData().getData(), instanceOf(List.class)); + assertThat(response.getData().getData().get(0), instanceOf(WebhookSubscription.class)); + assertThat(response.getData().getData().get(0).getId(), instanceOf(String.class)); + assertThat(response.getData().getData().get(0).getAccountId(), instanceOf(String.class)); + assertThat(response.getData().getData().get(0).getCallbackUrl(), instanceOf(String.class)); + assertThat(response.getData().getData().get(0).getType(), instanceOf(WebhookSubscriptionTypeEnum.class)); + assertThat(response.getData().getData().get(0).getBasicAuthentication(), + instanceOf(WebhookSubscriptionBasicAuthentication.class)); + assertThat(response.getData().getData().get(0).getBasicAuthentication().getUsername(), + instanceOf(String.class)); + assertThat(response.getData().getData().get(0).getBasicAuthentication().getPassword(), + instanceOf(String.class)); + assertThat(response.getData().getData().get(0).getCreatedDate(), instanceOf(OffsetDateTime.class)); + assertThat(response.getData().getData().get(0).getModifiedDate(), instanceOf(OffsetDateTime.class)); + } + + @Test + public void requestTollFreeVerificationTest() throws ApiException { + VerificationRequest verificationRequest = new VerificationRequest() + .businessAddress(new Address() + .name("name") + .addr1("addr1") + .addr2("addr2") + .city("city") + .state("state") + .zip("zip") + .url("https://example.com")) + .businessContact(new Contact() + .firstName("first-name") + .lastName("last-name") + .email("email@email.com") + .phoneNumber("+19195551234")) + .messageVolume(12) + .phoneNumbers(List.of("+18005551234")) + .useCase("useCase") + .useCaseSummary("useCaseSummary") + .productionMessageContent("productionMessageContent") + .optInWorkflow(new OptInWorkflow() + .description("description") + .imageUrls(List.of("https://example.com"))) + .additionalInformation("additionalInformation") + .isvReseller("isvReseller"); + + ApiResponse response = api.requestTollFreeVerificationWithHttpInfo(BW_ACCOUNT_ID, verificationRequest); + + assertThat(response.getStatusCode(), is(202)); + } + + @Test + public void updateTollFreeVerificationRequestTest() throws ApiException { + TfvSubmissionWrapper tfvSubmissionWrapper = new TfvSubmissionWrapper() + .submission(null); + ApiResponse response = api.updateTollFreeVerificationRequestWithHttpInfo(BW_ACCOUNT_ID, "+18005551234", + tfvSubmissionWrapper); + + assertThat(response.getStatusCode(), is(202)); + } + + @Test + @Disabled /* + * For some reason this returns a 500 due to: + * "Invalid reference token: callbackUrl" + */ + public void updateWebhookSubscriptionTest() throws ApiException { + ApiResponse response = api.updateWebhookSubscriptionWithHttpInfo(BW_ACCOUNT_ID, + "test-id-1234", + webhookSubscriptionRequestSchema); + + assertThat(response.getStatusCode(), is(200)); + assertThat(response.getData(), instanceOf(WebhookSubscription.class)); + assertThat(response.getData().getId(), instanceOf(String.class)); + assertThat(response.getData().getAccountId(), instanceOf(String.class)); + assertThat(response.getData().getCallbackUrl(), instanceOf(String.class)); + assertThat(response.getData().getType(), + instanceOf(WebhookSubscriptionTypeEnum.class)); + assertThat(response.getData().getBasicAuthentication(), + instanceOf(WebhookSubscriptionBasicAuthentication.class)); + assertThat(response.getData().getBasicAuthentication().getUsername(), + instanceOf(String.class)); + assertThat(response.getData().getBasicAuthentication().getPassword(), + instanceOf(String.class)); + assertThat(response.getData().getCreatedDate(), + instanceOf(OffsetDateTime.class)); + assertThat(response.getData().getModifiedDate(), + instanceOf(OffsetDateTime.class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/AdditionalDenialReasonTest.java b/src/test/java/com/bandwidth/sdk/unit/models/AdditionalDenialReasonTest.java new file mode 100644 index 00000000..d4154234 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/AdditionalDenialReasonTest.java @@ -0,0 +1,63 @@ +/* + * 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. + */ + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import com.bandwidth.sdk.model.AdditionalDenialReason; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.instanceOf; + +/** + * Model tests for AdditionalDenialReason + */ +public class AdditionalDenialReasonTest { + private final AdditionalDenialReason model = new AdditionalDenialReason() + .statusCode(403) + .reason("Forbidden") + .resubmitAllowed(true); + + /** + * Model tests for AdditionalDenialReason + */ + @Test + public void testAdditionalDenialReason() { + assertThat(model, instanceOf(AdditionalDenialReason.class)); + } + + /** + * Test the property 'statusCode' + */ + @Test + public void statusCodeTest() { + assertThat(model.getStatusCode(), instanceOf(Integer.class)); + } + + /** + * Test the property 'reason' + */ + @Test + public void reasonTest() { + assertThat(model.getReason(), instanceOf(String.class)); + } + + /** + * Test the property 'resubmitAllowed' + */ + @Test + public void resubmitAllowedTest() { + assertThat(model.getResubmitAllowed(), instanceOf(Boolean.class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/AddressTest.java b/src/test/java/com/bandwidth/sdk/unit/models/AddressTest.java new file mode 100644 index 00000000..7f8eced7 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/AddressTest.java @@ -0,0 +1,99 @@ +/* + * 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. + */ + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import com.bandwidth.sdk.model.Address; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.instanceOf; + +/** + * Model tests for Address + */ +public class AddressTest { + private final Address model = new Address() + .name("name") + .addr1("addr1") + .addr2("addr2") + .city("city") + .state("state") + .zip("zip") + .url("url"); + + /** + * Model tests for Address + */ + @Test + public void testAddress() { + assertThat(model, instanceOf(Address.class)); + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + assertThat(model.getName(), instanceOf(String.class)); + } + + /** + * Test the property 'addr1' + */ + @Test + public void addr1Test() { + assertThat(model.getAddr1(), instanceOf(String.class)); + } + + /** + * Test the property 'addr2' + */ + @Test + public void addr2Test() { + assertThat(model.getAddr2(), instanceOf(String.class)); + } + + /** + * Test the property 'city' + */ + @Test + public void cityTest() { + assertThat(model.getCity(), instanceOf(String.class)); + } + + /** + * Test the property 'state' + */ + @Test + public void stateTest() { + assertThat(model.getState(), instanceOf(String.class)); + } + + /** + * Test the property 'zip' + */ + @Test + public void zipTest() { + assertThat(model.getZip(), instanceOf(String.class)); + } + + /** + * Test the property 'url' + */ + @Test + public void urlTest() { + assertThat(model.getUrl(), instanceOf(String.class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/ContactTest.java b/src/test/java/com/bandwidth/sdk/unit/models/ContactTest.java new file mode 100644 index 00000000..ecf9ef91 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/ContactTest.java @@ -0,0 +1,72 @@ +/* + * 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. + */ + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import com.bandwidth.sdk.model.Contact; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.instanceOf; + +/** + * Model tests for Contact + */ +public class ContactTest { + private final Contact model = new Contact() + .firstName("firstName") + .lastName("lastName") + .email("email") + .phoneNumber("phoneNumber"); + + /** + * Model tests for Contact + */ + @Test + public void testContact() { + assertThat(model, instanceOf(Contact.class)); + } + + /** + * Test the property 'firstName' + */ + @Test + public void firstNameTest() { + assertThat(model.getFirstName(), instanceOf(String.class)); + } + + /** + * Test the property 'lastName' + */ + @Test + public void lastNameTest() { + assertThat(model.getLastName(), instanceOf(String.class)); + } + + /** + * Test the property 'email' + */ + @Test + public void emailTest() { + assertThat(model.getEmail(), instanceOf(String.class)); + } + + /** + * Test the property 'phoneNumber' + */ + @Test + public void phoneNumberTest() { + assertThat(model.getPhoneNumber(), instanceOf(String.class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/ErrorTest.java b/src/test/java/com/bandwidth/sdk/unit/models/ErrorTest.java new file mode 100644 index 00000000..dcaf5ec6 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/ErrorTest.java @@ -0,0 +1,67 @@ +/* + * 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. + */ + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import java.util.List; +import java.util.Arrays; +import java.util.ArrayList; +import com.bandwidth.sdk.model.Error; +import com.bandwidth.sdk.model.TelephoneNumber; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.instanceOf; + +/** + * Model tests for Error + */ +public class ErrorTest { + private final Error model = new Error() + .code(1234) + .description("description") + .telephoneNumbers(new ArrayList(Arrays.asList(new TelephoneNumber()))); + + /** + * Model tests for Error + */ + @Test + public void testError() { + assertThat(model, instanceOf(Error.class)); + } + + /** + * Test the property 'code' + */ + @Test + public void codeTest() { + assertThat(model.getCode(), instanceOf(Integer.class)); + } + + /** + * Test the property 'description' + */ + @Test + public void descriptionTest() { + assertThat(model.getDescription(), instanceOf(String.class)); + } + + /** + * Test the property 'telephoneNumbers' + */ + @Test + public void telephoneNumbersTest() { + assertThat(model.getTelephoneNumbers(), instanceOf(List.class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/FailureWebhookTest.java b/src/test/java/com/bandwidth/sdk/unit/models/FailureWebhookTest.java new file mode 100644 index 00000000..a79a5bb5 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/FailureWebhookTest.java @@ -0,0 +1,95 @@ +/* + * 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. + */ + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import java.util.UUID; +import java.util.List; +import java.util.Arrays; +import java.util.ArrayList; +import com.bandwidth.sdk.model.FailureWebhook; +import com.bandwidth.sdk.model.TelephoneNumber; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.instanceOf; + +/** + * Model tests for FailureWebhook + */ +public class FailureWebhookTest { + private final FailureWebhook model = new FailureWebhook() + .accountId("accountId") + .phoneNumber("phoneNumber") + .errorCode("errorCode") + .errorDescription("errorDescription") + .errors(new ArrayList(Arrays.asList("errors"))) + .internalTicketNumber(UUID.randomUUID()); + + /** + * Model tests for FailureWebhook + */ + @Test + public void testFailureWebhook() { + assertThat(model, instanceOf(FailureWebhook.class)); + } + + /** + * Test the property 'accountId' + */ + @Test + public void accountIdTest() { + assertThat(model.getAccountId(), instanceOf(String.class)); + } + + /** + * Test the property 'phoneNumber' + */ + @Test + public void phoneNumberTest() { + assertThat(model.getPhoneNumber(), instanceOf(String.class)); + } + + /** + * Test the property 'errorCode' + */ + @Test + public void errorCodeTest() { + assertThat(model.getErrorCode(), instanceOf(String.class)); + } + + /** + * Test the property 'errorDescription' + */ + @Test + public void errorDescriptionTest() { + assertThat(model.getErrorDescription(), instanceOf(String.class)); + } + + /** + * Test the property 'errors' + */ + @Test + public void errorsTest() { + assertThat(model.getErrors(), instanceOf(List.class)); + } + + /** + * Test the property 'internalTicketNumber' + */ + @Test + public void internalTicketNumberTest() { + assertThat(model.getInternalTicketNumber(), instanceOf(UUID.class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/LinksObjectTest.java b/src/test/java/com/bandwidth/sdk/unit/models/LinksObjectTest.java new file mode 100644 index 00000000..d8c9bf2d --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/LinksObjectTest.java @@ -0,0 +1,72 @@ +/* + * 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. + */ + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import com.bandwidth.sdk.model.LinksObject; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.instanceOf; + +/** + * Model tests for LinksObject + */ +public class LinksObjectTest { + private final LinksObject model = new LinksObject() + .first("first") + .next("next") + .previous("previous") + .last("last"); + + /** + * Model tests for LinksObject + */ + @Test + public void testLinksObject() { + assertThat(model, instanceOf(LinksObject.class)); + } + + /** + * Test the property 'first' + */ + @Test + public void firstTest() { + assertThat(model.getFirst(), instanceOf(String.class)); + } + + /** + * Test the property 'next' + */ + @Test + public void nextTest() { + assertThat(model.getNext(), instanceOf(String.class)); + } + + /** + * Test the property 'previous' + */ + @Test + public void previousTest() { + assertThat(model.getPrevious(), instanceOf(String.class)); + } + + /** + * Test the property 'last' + */ + @Test + public void lastTest() { + assertThat(model.getLast(), instanceOf(String.class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/OptInWorkflowTest.java b/src/test/java/com/bandwidth/sdk/unit/models/OptInWorkflowTest.java new file mode 100644 index 00000000..72138803 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/OptInWorkflowTest.java @@ -0,0 +1,57 @@ +/* + * 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. + */ + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import java.util.List; +import java.util.Arrays; +import java.util.ArrayList; +import com.bandwidth.sdk.model.OptInWorkflow; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.instanceOf; + +/** + * Model tests for OptInWorkflow + */ +public class OptInWorkflowTest { + private final OptInWorkflow model = new OptInWorkflow() + .description("description") + .imageUrls(new ArrayList(Arrays.asList("imageUrl"))); + + /** + * Model tests for OptInWorkflow + */ + @Test + public void testOptInWorkflow() { + assertThat(model, instanceOf(OptInWorkflow.class)); + } + + /** + * Test the property 'description' + */ + @Test + public void descriptionTest() { + assertThat(model.getDescription(), instanceOf(String.class)); + } + + /** + * Test the property 'imageUrls' + */ + @Test + public void imageUrlsTest() { + assertThat(model.getImageUrls(), instanceOf(List.class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/RecordingAvailableCallbackTest.java b/src/test/java/com/bandwidth/sdk/unit/models/RecordingAvailableCallbackTest.java index 8676243f..a1e23fd1 100644 --- a/src/test/java/com/bandwidth/sdk/unit/models/RecordingAvailableCallbackTest.java +++ b/src/test/java/com/bandwidth/sdk/unit/models/RecordingAvailableCallbackTest.java @@ -14,7 +14,6 @@ import org.junit.jupiter.api.Test; -import java.net.URI; import java.net.URI; import java.time.OffsetDateTime; import com.bandwidth.sdk.model.RecordingAvailableCallback; diff --git a/src/test/java/com/bandwidth/sdk/unit/models/TelephoneNumberTest.java b/src/test/java/com/bandwidth/sdk/unit/models/TelephoneNumberTest.java new file mode 100644 index 00000000..e0df7620 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/TelephoneNumberTest.java @@ -0,0 +1,45 @@ +/* + * 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. + */ + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import com.bandwidth.sdk.model.TelephoneNumber; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.instanceOf; + +/** + * Model tests for TelephoneNumber + */ +public class TelephoneNumberTest { + private final TelephoneNumber model = new TelephoneNumber() + .telephoneNumber("telephoneNumber"); + + /** + * Model tests for TelephoneNumber + */ + @Test + public void testTelephoneNumber() { + assertThat(model, instanceOf(TelephoneNumber.class)); + } + + /** + * Test the property 'telephoneNumber' + */ + @Test + public void telephoneNumberTest() { + assertThat(model.getTelephoneNumber(), instanceOf(String.class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/TfvBasicAuthenticationTest.java b/src/test/java/com/bandwidth/sdk/unit/models/TfvBasicAuthenticationTest.java new file mode 100644 index 00000000..70f36ff2 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/TfvBasicAuthenticationTest.java @@ -0,0 +1,54 @@ +/* + * 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. + */ + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import com.bandwidth.sdk.model.TfvBasicAuthentication; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.instanceOf; + +/** + * Model tests for TfvBasicAuthentication + */ +public class TfvBasicAuthenticationTest { + private final TfvBasicAuthentication model = new TfvBasicAuthentication() + .username("username") + .password("password"); + + /** + * Model tests for TfvBasicAuthentication + */ + @Test + public void testTfvBasicAuthentication() { + assertThat(model, instanceOf(TfvBasicAuthentication.class)); + } + + /** + * Test the property 'username' + */ + @Test + public void usernameTest() { + assertThat(model.getUsername(), instanceOf(String.class)); + } + + /** + * Test the property 'password' + */ + @Test + public void passwordTest() { + assertThat(model.getPassword(), instanceOf(String.class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/TfvCallbackStatusEnumTest.java b/src/test/java/com/bandwidth/sdk/unit/models/TfvCallbackStatusEnumTest.java new file mode 100644 index 00000000..4a943ab4 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/TfvCallbackStatusEnumTest.java @@ -0,0 +1,35 @@ +/* + * 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. + */ + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import com.bandwidth.sdk.model.TfvCallbackStatusEnum; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.equalTo; + +/** + * Model tests for TfvCallbackStatusEnum + */ +public class TfvCallbackStatusEnumTest { + /** + * Model tests for TfvCallbackStatusEnum + */ + @Test + public void testTfvCallbackStatusEnum() { + assertThat(TfvCallbackStatusEnum.VERIFIED.toString(), equalTo("VERIFIED")); + assertThat(TfvCallbackStatusEnum.UNVERIFIED.toString(), equalTo("UNVERIFIED")); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/TfvErrorTest.java b/src/test/java/com/bandwidth/sdk/unit/models/TfvErrorTest.java new file mode 100644 index 00000000..bc78cb12 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/TfvErrorTest.java @@ -0,0 +1,63 @@ +/* + * 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. + */ + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import com.bandwidth.sdk.model.TfvError; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.instanceOf; + +/** + * Model tests for TfvError + */ +public class TfvErrorTest { + private final TfvError model = new TfvError() + .type("type") + .description("description") + .errors(new Object()); + + /** + * Model tests for TfvError + */ + @Test + public void testTfvError() { + assertThat(model, instanceOf(TfvError.class)); + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + assertThat(model.getType(), instanceOf(String.class)); + } + + /** + * Test the property 'description' + */ + @Test + public void descriptionTest() { + assertThat(model.getDescription(), instanceOf(String.class)); + } + + /** + * Test the property 'errors' + */ + @Test + public void errorsTest() { + assertThat(model.getErrors(), instanceOf(Object.class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/TfvStatusEnumTest.java b/src/test/java/com/bandwidth/sdk/unit/models/TfvStatusEnumTest.java new file mode 100644 index 00000000..ada6887c --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/TfvStatusEnumTest.java @@ -0,0 +1,38 @@ +/* + * 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. + */ + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import com.bandwidth.sdk.model.TfvStatusEnum; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.equalTo; + +/** + * Model tests for TfvStatusEnum + */ +public class TfvStatusEnumTest { + /** + * Model tests for TfvStatusEnum + */ + @Test + public void testTfvStatusEnum() { + assertThat(TfvStatusEnum.VERIFIED.toString(), equalTo("VERIFIED")); + assertThat(TfvStatusEnum.UNVERIFIED.toString(), equalTo("UNVERIFIED")); + assertThat(TfvStatusEnum.PENDING.toString(), equalTo("PENDING")); + assertThat(TfvStatusEnum.PARTIALLY_VERIFIED.toString(), equalTo("PARTIALLY_VERIFIED")); + assertThat(TfvStatusEnum.INVALID_STATUS.toString(), equalTo("INVALID_STATUS")); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/TfvStatusTest.java b/src/test/java/com/bandwidth/sdk/unit/models/TfvStatusTest.java new file mode 100644 index 00000000..aa933644 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/TfvStatusTest.java @@ -0,0 +1,113 @@ +/* + * 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. + */ + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import java.time.OffsetDateTime; +import java.util.UUID; + +import com.bandwidth.sdk.model.TfvStatus; +import com.bandwidth.sdk.model.TfvStatusEnum; +import com.bandwidth.sdk.model.TfvSubmissionInfo; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.instanceOf; + +/** + * Model tests for TfvStatus + */ +public class TfvStatusTest { + private final TfvStatus model = new TfvStatus() + .phoneNumber("phoneNumber") + .status(TfvStatusEnum.PENDING) + .internalTicketNumber(UUID.randomUUID()) + .declineReasonDescription("declineReasonDescription") + .resubmitAllowed(true) + .createdDateTime(OffsetDateTime.now()) + .modifiedDateTime(OffsetDateTime.now()) + .submission(new TfvSubmissionInfo()); + + /** + * Model tests for TfvStatus + */ + @Test + public void testTfvStatus() { + assertThat(model, instanceOf(TfvStatus.class)); + } + + /** + * Test the property 'phoneNumber' + */ + @Test + public void phoneNumberTest() { + assertThat(model.getPhoneNumber(), instanceOf(String.class)); + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + assertThat(model.getStatus(), instanceOf(TfvStatusEnum.class)); + } + + /** + * Test the property 'internalTicketNumber' + */ + @Test + public void internalTicketNumberTest() { + assertThat(model.getInternalTicketNumber(), instanceOf(UUID.class)); + } + + /** + * Test the property 'declineReasonDescription' + */ + @Test + public void declineReasonDescriptionTest() { + assertThat(model.getDeclineReasonDescription(), instanceOf(String.class)); + } + + /** + * Test the property 'resubmitAllowed' + */ + @Test + public void resubmitAllowedTest() { + assertThat(model.getResubmitAllowed(), instanceOf(Boolean.class)); + } + + /** + * Test the property 'createdDateTime' + */ + @Test + public void createdDateTimeTest() { + assertThat(model.getCreatedDateTime(), instanceOf(OffsetDateTime.class)); + } + + /** + * Test the property 'modifiedDateTime' + */ + @Test + public void modifiedDateTimeTest() { + assertThat(model.getModifiedDateTime(), instanceOf(OffsetDateTime.class)); + } + + /** + * Test the property 'submission' + */ + @Test + public void submissionTest() { + assertThat(model.getSubmission(), instanceOf(TfvSubmissionInfo.class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/TfvSubmissionInfoTest.java b/src/test/java/com/bandwidth/sdk/unit/models/TfvSubmissionInfoTest.java new file mode 100644 index 00000000..e9f8d03f --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/TfvSubmissionInfoTest.java @@ -0,0 +1,120 @@ +/* + * 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. + */ + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import com.bandwidth.sdk.model.TfvSubmissionInfo; +import com.bandwidth.sdk.model.Address; +import com.bandwidth.sdk.model.Contact; +import com.bandwidth.sdk.model.OptInWorkflow; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.instanceOf; + +/** + * Model tests for TfvSubmissionInfo + */ +public class TfvSubmissionInfoTest { + private final TfvSubmissionInfo model = new TfvSubmissionInfo() + .businessAddress(new Address()) + .businessContact(new Contact()) + .messageVolume(8) + .useCase("useCase") + .useCaseSummary("useCaseSummary") + .productionMessageContent("productionMessageContent") + .optInWorkflow(new OptInWorkflow()) + .additionalInformation("additionalInformation") + .isvReseller("isvReseller"); + + /** + * Model tests for TfvSubmissionInfo + */ + @Test + public void testTfvSubmissionInfo() { + assertThat(model, instanceOf(TfvSubmissionInfo.class)); + } + + /** + * Test the property 'businessAddress' + */ + @Test + public void businessAddressTest() { + assertThat(model.getBusinessAddress(), instanceOf(Address.class)); + } + + /** + * Test the property 'businessContact' + */ + @Test + public void businessContactTest() { + assertThat(model.getBusinessContact(), instanceOf(Contact.class)); + } + + /** + * Test the property 'messageVolume' + */ + @Test + public void messageVolumeTest() { + assertThat(model.getMessageVolume(), instanceOf(Integer.class)); + } + + /** + * Test the property 'useCase' + */ + @Test + public void useCaseTest() { + assertThat(model.getUseCase(), instanceOf(String.class)); + } + + /** + * Test the property 'useCaseSummary' + */ + @Test + public void useCaseSummaryTest() { + assertThat(model.getUseCaseSummary(), instanceOf(String.class)); + } + + /** + * Test the property 'productionMessageContent' + */ + @Test + public void productionMessageContentTest() { + assertThat(model.getProductionMessageContent(), instanceOf(String.class)); + } + + /** + * Test the property 'optInWorkflow' + */ + @Test + public void optInWorkflowTest() { + assertThat(model.getOptInWorkflow(), instanceOf(OptInWorkflow.class)); + } + + /** + * Test the property 'additionalInformation' + */ + @Test + public void additionalInformationTest() { + assertThat(model.getAdditionalInformation(), instanceOf(String.class)); + } + + /** + * Test the property 'isvReseller' + */ + @Test + public void isvResellerTest() { + assertThat(model.getIsvReseller(), instanceOf(String.class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/TfvSubmissionWrapperTest.java b/src/test/java/com/bandwidth/sdk/unit/models/TfvSubmissionWrapperTest.java new file mode 100644 index 00000000..bb7809e4 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/TfvSubmissionWrapperTest.java @@ -0,0 +1,46 @@ +/* + * 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. + */ + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import com.bandwidth.sdk.model.TfvSubmissionWrapper; +import com.bandwidth.sdk.model.VerificationUpdateRequest; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.instanceOf; + +/** + * Model tests for TfvSubmissionWrapper + */ +public class TfvSubmissionWrapperTest { + private final TfvSubmissionWrapper model = new TfvSubmissionWrapper() + .submission(new VerificationUpdateRequest()); + + /** + * Model tests for TfvSubmissionWrapper + */ + @Test + public void testTfvSubmissionWrapper() { + assertThat(model, instanceOf(TfvSubmissionWrapper.class)); + } + + /** + * Test the property 'submission' + */ + @Test + public void submissionTest() { + assertThat(model.getSubmission(), instanceOf(VerificationUpdateRequest.class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/VerificationDenialWebhookTest.java b/src/test/java/com/bandwidth/sdk/unit/models/VerificationDenialWebhookTest.java new file mode 100644 index 00000000..0927a3ea --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/VerificationDenialWebhookTest.java @@ -0,0 +1,115 @@ +/* + * 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. + */ + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import com.bandwidth.sdk.model.VerificationDenialWebhook; +import com.bandwidth.sdk.model.AdditionalDenialReason; + +import static org.hamcrest.MatcherAssert.assertThat; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; + +import static org.hamcrest.CoreMatchers.instanceOf; + +/** + * Model tests for VerificationDenialWebhook + */ +public class VerificationDenialWebhookTest { + private final VerificationDenialWebhook model = new VerificationDenialWebhook() + .accountId("accountId") + .additionalDenialReasons(new ArrayList(Arrays.asList(new AdditionalDenialReason()))) + .declineReasonDescription("declineReasonDescription") + .denialStatusCode(1234) + .internalTicketNumber(UUID.randomUUID()) + .phoneNumber("phoneNumber") + .resubmitAllowed(true) + .status("status"); + + /** + * Model tests for VerificationDenialWebhook + */ + @Test + public void testVerificationDenialWebhook() { + assertThat(model, instanceOf(VerificationDenialWebhook.class)); + } + + /** + * Test the property 'accountId' + */ + @Test + public void accountIdTest() { + assertThat(model.getAccountId(), instanceOf(String.class)); + } + + /** + * Test the property 'additionalDenialReasons' + */ + @Test + public void additionalDenialReasonsTest() { + assertThat(model.getAdditionalDenialReasons(), instanceOf(List.class)); + } + + /** + * Test the property 'declineReasonDescription' + */ + @Test + public void declineReasonDescriptionTest() { + assertThat(model.getDeclineReasonDescription(), instanceOf(String.class)); + } + + /** + * Test the property 'denialStatusCode' + */ + @Test + public void denialStatusCodeTest() { + assertThat(model.getDenialStatusCode(), instanceOf(Integer.class)); + } + + /** + * Test the property 'internalTicketNumber' + */ + @Test + public void internalTicketNumberTest() { + assertThat(model.getInternalTicketNumber(), instanceOf(UUID.class)); + } + + /** + * Test the property 'phoneNumber' + */ + @Test + public void phoneNumberTest() { + assertThat(model.getPhoneNumber(), instanceOf(String.class)); + } + + /** + * Test the property 'resubmitAllowed' + */ + @Test + public void resubmitAllowedTest() { + assertThat(model.getResubmitAllowed(), instanceOf(Boolean.class)); + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + assertThat(model.getStatus(), instanceOf(String.class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/VerificationRequestTest.java b/src/test/java/com/bandwidth/sdk/unit/models/VerificationRequestTest.java new file mode 100644 index 00000000..779ae01b --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/VerificationRequestTest.java @@ -0,0 +1,131 @@ +/* + * 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. + */ + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import java.util.Arrays; +import java.util.ArrayList; +import com.bandwidth.sdk.model.VerificationRequest; +import com.bandwidth.sdk.model.Address; +import com.bandwidth.sdk.model.Contact; +import com.bandwidth.sdk.model.OptInWorkflow; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.instanceOf; + +/** + * Model tests for VerificationRequest + */ +public class VerificationRequestTest { + private final VerificationRequest model = new VerificationRequest() + .businessAddress(new Address()) + .businessContact(new Contact()) + .messageVolume(8) + .phoneNumbers(new ArrayList(Arrays.asList("phoneNumber"))) + .useCase("useCase") + .useCaseSummary("useCaseSummary") + .productionMessageContent("productionMessageContent") + .optInWorkflow(new OptInWorkflow()) + .additionalInformation("additionalInformation") + .isvReseller("isvReseller"); + + /** + * Model tests for VerificationRequest + */ + @Test + public void testVerificationRequest() { + assertThat(model, instanceOf(VerificationRequest.class)); + } + + /** + * Test the property 'businessAddress' + */ + @Test + public void businessAddressTest() { + assertThat(model.getBusinessAddress(), instanceOf(Address.class)); + } + + /** + * Test the property 'businessContact' + */ + @Test + public void businessContactTest() { + assertThat(model.getBusinessContact(), instanceOf(Contact.class)); + } + + /** + * Test the property 'messageVolume' + */ + @Test + public void messageVolumeTest() { + assertThat(model.getMessageVolume(), instanceOf(Integer.class)); + } + + /** + * Test the property 'phoneNumbers' + */ + @Test + public void phoneNumbersTest() { + assertThat(model.getPhoneNumbers(), instanceOf(ArrayList.class)); + } + + /** + * Test the property 'useCase' + */ + @Test + public void useCaseTest() { + assertThat(model.getUseCase(), instanceOf(String.class)); + } + + /** + * Test the property 'useCaseSummary' + */ + @Test + public void useCaseSummaryTest() { + assertThat(model.getUseCaseSummary(), instanceOf(String.class)); + } + + /** + * Test the property 'productionMessageContent' + */ + @Test + public void productionMessageContentTest() { + assertThat(model.getProductionMessageContent(), instanceOf(String.class)); + } + + /** + * Test the property 'optInWorkflow' + */ + @Test + public void optInWorkflowTest() { + assertThat(model.getOptInWorkflow(), instanceOf(OptInWorkflow.class)); + } + + /** + * Test the property 'additionalInformation' + */ + @Test + public void additionalInformationTest() { + assertThat(model.getAdditionalInformation(), instanceOf(String.class)); + } + + /** + * Test the property 'isvReseller' + */ + @Test + public void isvResellerTest() { + assertThat(model.getIsvReseller(), instanceOf(String.class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/VerificationUpdateRequestTest.java b/src/test/java/com/bandwidth/sdk/unit/models/VerificationUpdateRequestTest.java new file mode 100644 index 00000000..1a33511f --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/VerificationUpdateRequestTest.java @@ -0,0 +1,120 @@ +/* + * 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. + */ + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import com.bandwidth.sdk.model.VerificationUpdateRequest; +import com.bandwidth.sdk.model.Address; +import com.bandwidth.sdk.model.Contact; +import com.bandwidth.sdk.model.OptInWorkflow; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.instanceOf; + +/** + * Model tests for VerificationUpdateRequest + */ +public class VerificationUpdateRequestTest { + private final VerificationUpdateRequest model = new VerificationUpdateRequest() + .businessAddress(new Address()) + .businessContact(new Contact()) + .messageVolume(1) + .useCase("useCase") + .useCaseSummary("useCaseSummary") + .productionMessageContent("productionMessageContent") + .optInWorkflow(new OptInWorkflow()) + .additionalInformation("additionalInformation") + .isvReseller("isvReseller"); + + /** + * Model tests for VerificationUpdateRequest + */ + @Test + public void testVerificationUpdateRequest() { + assertThat(model, instanceOf(VerificationUpdateRequest.class)); + } + + /** + * Test the property 'businessAddress' + */ + @Test + public void businessAddressTest() { + assertThat(model.getBusinessAddress(), instanceOf(Address.class)); + } + + /** + * Test the property 'businessContact' + */ + @Test + public void businessContactTest() { + assertThat(model.getBusinessContact(), instanceOf(Contact.class)); + } + + /** + * Test the property 'messageVolume' + */ + @Test + public void messageVolumeTest() { + assertThat(model.getMessageVolume(), instanceOf(Integer.class)); + } + + /** + * Test the property 'useCase' + */ + @Test + public void useCaseTest() { + assertThat(model.getUseCase(), instanceOf(String.class)); + } + + /** + * Test the property 'useCaseSummary' + */ + @Test + public void useCaseSummaryTest() { + assertThat(model.getUseCaseSummary(), instanceOf(String.class)); + } + + /** + * Test the property 'productionMessageContent' + */ + @Test + public void productionMessageContentTest() { + assertThat(model.getProductionMessageContent(), instanceOf(String.class)); + } + + /** + * Test the property 'optInWorkflow' + */ + @Test + public void optInWorkflowTest() { + assertThat(model.getOptInWorkflow(), instanceOf(OptInWorkflow.class)); + } + + /** + * Test the property 'additionalInformation' + */ + @Test + public void additionalInformationTest() { + assertThat(model.getAdditionalInformation(), instanceOf(String.class)); + } + + /** + * Test the property 'isvReseller' + */ + @Test + public void isvResellerTest() { + assertThat(model.getIsvReseller(), instanceOf(String.class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/VerificationWebhookTest.java b/src/test/java/com/bandwidth/sdk/unit/models/VerificationWebhookTest.java new file mode 100644 index 00000000..7bb0cd58 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/VerificationWebhookTest.java @@ -0,0 +1,76 @@ +/* + * 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. + */ + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import com.bandwidth.sdk.model.VerificationWebhook; +import com.bandwidth.sdk.model.TfvCallbackStatusEnum; + +import static org.hamcrest.MatcherAssert.assertThat; + +import java.util.UUID; + +import static org.hamcrest.CoreMatchers.instanceOf; + +/** + * Model tests for VerificationWebhook + */ +public class VerificationWebhookTest { + private final VerificationWebhook model = new VerificationWebhook() + .accountId("accountId") + .phoneNumber("phoneNumber") + .status(TfvCallbackStatusEnum.VERIFIED) + .internalTicketNumber(UUID.randomUUID()); + + /** + * Model tests for VerificationWebhook + */ + @Test + public void testVerificationWebhook() { + assertThat(model, instanceOf(VerificationWebhook.class)); + } + + /** + * Test the property 'accountId' + */ + @Test + public void accountIdTest() { + assertThat(model.getAccountId(), instanceOf(String.class)); + } + + /** + * Test the property 'phoneNumber' + */ + @Test + public void phoneNumberTest() { + assertThat(model.getPhoneNumber(), instanceOf(String.class)); + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + assertThat(model.getStatus(), instanceOf(TfvCallbackStatusEnum.class)); + } + + /** + * Test the property 'internalTicketNumber' + */ + @Test + public void internalTicketNumberTest() { + assertThat(model.getInternalTicketNumber(), instanceOf(UUID.class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/WebhookSubscriptionBasicAuthenticationTest.java b/src/test/java/com/bandwidth/sdk/unit/models/WebhookSubscriptionBasicAuthenticationTest.java new file mode 100644 index 00000000..6970f6be --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/WebhookSubscriptionBasicAuthenticationTest.java @@ -0,0 +1,54 @@ +/* + * 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. + */ + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import com.bandwidth.sdk.model.WebhookSubscriptionBasicAuthentication; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.instanceOf; + +/** + * Model tests for WebhookSubscriptionBasicAuthentication + */ +public class WebhookSubscriptionBasicAuthenticationTest { + private final WebhookSubscriptionBasicAuthentication model = new WebhookSubscriptionBasicAuthentication() + .username("username") + .password("password"); + + /** + * Model tests for WebhookSubscriptionBasicAuthentication + */ + @Test + public void testWebhookSubscriptionBasicAuthentication() { + assertThat(model, instanceOf(WebhookSubscriptionBasicAuthentication.class)); + } + + /** + * Test the property 'username' + */ + @Test + public void usernameTest() { + assertThat(model.getUsername(), instanceOf(String.class)); + } + + /** + * Test the property 'password' + */ + @Test + public void passwordTest() { + assertThat(model.getPassword(), instanceOf(String.class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/WebhookSubscriptionRequestSchemaTest.java b/src/test/java/com/bandwidth/sdk/unit/models/WebhookSubscriptionRequestSchemaTest.java new file mode 100644 index 00000000..f038c9f6 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/WebhookSubscriptionRequestSchemaTest.java @@ -0,0 +1,64 @@ +/* + * 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. + */ + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import com.bandwidth.sdk.model.WebhookSubscriptionRequestSchema; +import com.bandwidth.sdk.model.TfvBasicAuthentication; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.instanceOf; + +/** + * Model tests for WebhookSubscriptionRequestSchema + */ +public class WebhookSubscriptionRequestSchemaTest { + private final WebhookSubscriptionRequestSchema model = new WebhookSubscriptionRequestSchema() + .basicAuthentication(new TfvBasicAuthentication()) + .callbackUrl("callbackUrl") + .sharedSecretKey("sharedSecretKey"); + + /** + * Model tests for WebhookSubscriptionRequestSchema + */ + @Test + public void testWebhookSubscriptionRequestSchema() { + assertThat(model, instanceOf(WebhookSubscriptionRequestSchema.class)); + } + + /** + * Test the property 'basicAuthentication' + */ + @Test + public void basicAuthenticationTest() { + assertThat(model.getBasicAuthentication(), instanceOf(TfvBasicAuthentication.class)); + } + + /** + * Test the property 'callbackUrl' + */ + @Test + public void callbackUrlTest() { + assertThat(model.getCallbackUrl(), instanceOf(String.class)); + } + + /** + * Test the property 'sharedSecretKey' + */ + @Test + public void sharedSecretKeyTest() { + assertThat(model.getSharedSecretKey(), instanceOf(String.class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/WebhookSubscriptionTest.java b/src/test/java/com/bandwidth/sdk/unit/models/WebhookSubscriptionTest.java new file mode 100644 index 00000000..d7f75332 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/WebhookSubscriptionTest.java @@ -0,0 +1,104 @@ +/* + * 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. + */ + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import com.bandwidth.sdk.model.WebhookSubscription; +import com.bandwidth.sdk.model.WebhookSubscriptionBasicAuthentication; +import com.bandwidth.sdk.model.WebhookSubscriptionTypeEnum; + +import static org.hamcrest.MatcherAssert.assertThat; + +import java.time.OffsetDateTime; + +import static org.hamcrest.CoreMatchers.instanceOf; + +/** + * Model tests for WebhookSubscription + */ +public class WebhookSubscriptionTest { + private final WebhookSubscription model = new WebhookSubscription() + .id("id") + .accountId("accountId") + .callbackUrl("callbackUrl") + .type(WebhookSubscriptionTypeEnum.TOLLFREE_VERIFICATION_STATUS) + .basicAuthentication(new WebhookSubscriptionBasicAuthentication()) + .createdDate(OffsetDateTime.now()) + .modifiedDate(OffsetDateTime.now()); + + /** + * Model tests for WebhookSubscription + */ + @Test + public void testWebhookSubscription() { + assertThat(model, instanceOf(WebhookSubscription.class)); + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + assertThat(model.getId(), instanceOf(String.class)); + } + + /** + * Test the property 'accountId' + */ + @Test + public void accountIdTest() { + assertThat(model.getAccountId(), instanceOf(String.class)); + } + + /** + * Test the property 'callbackUrl' + */ + @Test + public void callbackUrlTest() { + assertThat(model.getCallbackUrl(), instanceOf(String.class)); + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + assertThat(model.getType(), instanceOf(WebhookSubscriptionTypeEnum.class)); + } + + /** + * Test the property 'basicAuthentication' + */ + @Test + public void basicAuthenticationTest() { + assertThat(model.getBasicAuthentication(), instanceOf(WebhookSubscriptionBasicAuthentication.class)); + } + + /** + * Test the property 'createdDate' + */ + @Test + public void createdDateTest() { + assertThat(model.getCreatedDate(), instanceOf(OffsetDateTime.class)); + } + + /** + * Test the property 'modifiedDate' + */ + @Test + public void modifiedDateTest() { + assertThat(model.getModifiedDate(), instanceOf(OffsetDateTime.class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/WebhookSubscriptionTypeEnumTest.java b/src/test/java/com/bandwidth/sdk/unit/models/WebhookSubscriptionTypeEnumTest.java new file mode 100644 index 00000000..72f2aa6f --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/WebhookSubscriptionTypeEnumTest.java @@ -0,0 +1,37 @@ +/* + * 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. + */ + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import com.bandwidth.sdk.model.WebhookSubscriptionTypeEnum; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.equalTo; + +/** + * Model tests for WebhookSubscriptionTypeEnum + */ +public class WebhookSubscriptionTypeEnumTest { + /** + * Model tests for WebhookSubscriptionTypeEnum + */ + @Test + public void testWebhookSubscriptionTypeEnum() { + assertThat(WebhookSubscriptionTypeEnum.TOLLFREE_VERIFICATION_STATUS.toString(), + equalTo("TOLLFREE_VERIFICATION_STATUS")); + assertThat(WebhookSubscriptionTypeEnum.MESSAGING_PORTOUT_APPROVAL_STATUS.toString(), + equalTo("MESSAGING_PORTOUT_APPROVAL_STATUS")); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/WebhookSubscriptionsListBodyTest.java b/src/test/java/com/bandwidth/sdk/unit/models/WebhookSubscriptionsListBodyTest.java new file mode 100644 index 00000000..a80baef6 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/WebhookSubscriptionsListBodyTest.java @@ -0,0 +1,69 @@ +/* + * 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. + */ + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import java.util.List; +import java.util.Arrays; +import java.util.ArrayList; +import com.bandwidth.sdk.model.WebhookSubscriptionsListBody; +import com.bandwidth.sdk.model.Error; +import com.bandwidth.sdk.model.LinksObject; +import com.bandwidth.sdk.model.WebhookSubscription; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.instanceOf; + +/** + * Model tests for WebhookSubscriptionsListBody + */ +public class WebhookSubscriptionsListBodyTest { + private final WebhookSubscriptionsListBody model = new WebhookSubscriptionsListBody() + .links(new LinksObject()) + .errors(new ArrayList(Arrays.asList(new Error()))) + .data(new ArrayList(Arrays.asList(new WebhookSubscription()))); + + /** + * Model tests for WebhookSubscriptionsListBody + */ + @Test + public void testWebhookSubscriptionsListBody() { + assertThat(model, instanceOf(WebhookSubscriptionsListBody.class)); + } + + /** + * Test the property 'links' + */ + @Test + public void linksTest() { + assertThat(model.getLinks(), instanceOf(LinksObject.class)); + } + + /** + * Test the property 'errors' + */ + @Test + public void errorsTest() { + assertThat(model.getErrors(), instanceOf(List.class)); + } + + /** + * Test the property 'data' + */ + @Test + public void dataTest() { + assertThat(model.getData(), instanceOf(List.class)); + } + +}