diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index fad6f8c5..ab8d54cd 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -19,8 +19,8 @@ docs/CallTranscriptionDetectedLanguageEnum.md docs/CallTranscriptionMetadata.md docs/CallTranscriptionResponse.md docs/CallTranscriptionTrackEnum.md +docs/Callback.md docs/CallbackMethodEnum.md -docs/CallbackTypeEnum.md docs/CallsApi.md docs/CardWidthEnum.md docs/CodeRequest.md @@ -41,16 +41,19 @@ docs/CreateCallResponse.md docs/CreateLookupResponse.md docs/CreateMessageRequestError.md docs/CreateMultiChannelMessageResponse.md -docs/DeferredResult.md docs/DisconnectCallback.md docs/Diversion.md docs/DtmfCallback.md docs/Error.md docs/ErrorObject.md +docs/ErrorSource.md docs/FailureWebhook.md docs/FieldError.md docs/FileFormatEnum.md docs/GatherCallback.md +docs/InboundCallback.md +docs/InboundCallbackMessage.md +docs/InboundCallbackTypeEnum.md docs/InitiateCallback.md docs/Link.md docs/LinksObject.md @@ -67,8 +70,6 @@ docs/MachineDetectionResult.md docs/Media.md docs/MediaApi.md docs/Message.md -docs/MessageCallback.md -docs/MessageCallbackMessage.md docs/MessageDirectionEnum.md docs/MessageRequest.md docs/MessageStatusEnum.md @@ -82,18 +83,18 @@ docs/MfaForbiddenRequestError.md docs/MfaRequestError.md docs/MfaUnauthorizedRequestError.md docs/MmsMessageContent.md +docs/MmsMessageContentFile.md docs/MultiChannelAction.md docs/MultiChannelActionCalendarEvent.md docs/MultiChannelApi.md -docs/MultiChannelCallbackData.md docs/MultiChannelChannelListObject.md docs/MultiChannelChannelListObjectContent.md -docs/MultiChannelMessageCallbackData.md +docs/MultiChannelError.md docs/MultiChannelMessageChannelEnum.md -docs/MultiChannelMessageData.md -docs/MultiChannelMessageDirectionEnum.md +docs/MultiChannelMessageContent.md docs/MultiChannelMessageRequest.md -docs/MultiChannelStatusEnum.md +docs/MultiChannelMessageResponseData.md +docs/MultiChannelMessageResponseDataChannelListInner.md docs/OptInWorkflow.md docs/PageInfo.md docs/PhoneNumberLookupApi.md @@ -105,6 +106,7 @@ docs/RbmActionTypeEnum.md docs/RbmActionViewLocation.md docs/RbmCardContent.md docs/RbmCardContentMedia.md +docs/RbmLocationResponse.md docs/RbmMediaHeightEnum.md docs/RbmMessageCarouselCard.md docs/RbmMessageContentFile.md @@ -112,6 +114,7 @@ docs/RbmMessageContentRichCard.md docs/RbmMessageContentText.md docs/RbmMessageMedia.md docs/RbmStandaloneCard.md +docs/RbmSuggestionResponse.md docs/RecordingAvailableCallback.md docs/RecordingCompleteCallback.md docs/RecordingStateEnum.md @@ -123,6 +126,9 @@ docs/RedirectMethodEnum.md docs/SmsMessageContent.md docs/StandaloneCardOrientationEnum.md docs/StatisticsApi.md +docs/StatusCallback.md +docs/StatusCallbackMessage.md +docs/StatusCallbackTypeEnum.md docs/StirShaken.md docs/TelephoneNumber.md docs/TfvBasicAuthentication.md @@ -213,8 +219,8 @@ src/main/java/com/bandwidth/sdk/model/CallTranscriptionDetectedLanguageEnum.java src/main/java/com/bandwidth/sdk/model/CallTranscriptionMetadata.java src/main/java/com/bandwidth/sdk/model/CallTranscriptionResponse.java src/main/java/com/bandwidth/sdk/model/CallTranscriptionTrackEnum.java +src/main/java/com/bandwidth/sdk/model/Callback.java src/main/java/com/bandwidth/sdk/model/CallbackMethodEnum.java -src/main/java/com/bandwidth/sdk/model/CallbackTypeEnum.java src/main/java/com/bandwidth/sdk/model/CardWidthEnum.java src/main/java/com/bandwidth/sdk/model/CodeRequest.java src/main/java/com/bandwidth/sdk/model/Conference.java @@ -233,16 +239,19 @@ src/main/java/com/bandwidth/sdk/model/CreateCallResponse.java src/main/java/com/bandwidth/sdk/model/CreateLookupResponse.java src/main/java/com/bandwidth/sdk/model/CreateMessageRequestError.java src/main/java/com/bandwidth/sdk/model/CreateMultiChannelMessageResponse.java -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/ErrorObject.java +src/main/java/com/bandwidth/sdk/model/ErrorSource.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/InboundCallback.java +src/main/java/com/bandwidth/sdk/model/InboundCallbackMessage.java +src/main/java/com/bandwidth/sdk/model/InboundCallbackTypeEnum.java src/main/java/com/bandwidth/sdk/model/InitiateCallback.java src/main/java/com/bandwidth/sdk/model/Link.java src/main/java/com/bandwidth/sdk/model/LinksObject.java @@ -258,8 +267,6 @@ src/main/java/com/bandwidth/sdk/model/MachineDetectionModeEnum.java src/main/java/com/bandwidth/sdk/model/MachineDetectionResult.java src/main/java/com/bandwidth/sdk/model/Media.java src/main/java/com/bandwidth/sdk/model/Message.java -src/main/java/com/bandwidth/sdk/model/MessageCallback.java -src/main/java/com/bandwidth/sdk/model/MessageCallbackMessage.java src/main/java/com/bandwidth/sdk/model/MessageDirectionEnum.java src/main/java/com/bandwidth/sdk/model/MessageRequest.java src/main/java/com/bandwidth/sdk/model/MessageStatusEnum.java @@ -271,17 +278,17 @@ 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/MmsMessageContent.java +src/main/java/com/bandwidth/sdk/model/MmsMessageContentFile.java src/main/java/com/bandwidth/sdk/model/MultiChannelAction.java src/main/java/com/bandwidth/sdk/model/MultiChannelActionCalendarEvent.java -src/main/java/com/bandwidth/sdk/model/MultiChannelCallbackData.java src/main/java/com/bandwidth/sdk/model/MultiChannelChannelListObject.java src/main/java/com/bandwidth/sdk/model/MultiChannelChannelListObjectContent.java -src/main/java/com/bandwidth/sdk/model/MultiChannelMessageCallbackData.java +src/main/java/com/bandwidth/sdk/model/MultiChannelError.java src/main/java/com/bandwidth/sdk/model/MultiChannelMessageChannelEnum.java -src/main/java/com/bandwidth/sdk/model/MultiChannelMessageData.java -src/main/java/com/bandwidth/sdk/model/MultiChannelMessageDirectionEnum.java +src/main/java/com/bandwidth/sdk/model/MultiChannelMessageContent.java src/main/java/com/bandwidth/sdk/model/MultiChannelMessageRequest.java -src/main/java/com/bandwidth/sdk/model/MultiChannelStatusEnum.java +src/main/java/com/bandwidth/sdk/model/MultiChannelMessageResponseData.java +src/main/java/com/bandwidth/sdk/model/MultiChannelMessageResponseDataChannelListInner.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 @@ -292,6 +299,7 @@ src/main/java/com/bandwidth/sdk/model/RbmActionTypeEnum.java src/main/java/com/bandwidth/sdk/model/RbmActionViewLocation.java src/main/java/com/bandwidth/sdk/model/RbmCardContent.java src/main/java/com/bandwidth/sdk/model/RbmCardContentMedia.java +src/main/java/com/bandwidth/sdk/model/RbmLocationResponse.java src/main/java/com/bandwidth/sdk/model/RbmMediaHeightEnum.java src/main/java/com/bandwidth/sdk/model/RbmMessageCarouselCard.java src/main/java/com/bandwidth/sdk/model/RbmMessageContentFile.java @@ -299,6 +307,7 @@ src/main/java/com/bandwidth/sdk/model/RbmMessageContentRichCard.java src/main/java/com/bandwidth/sdk/model/RbmMessageContentText.java src/main/java/com/bandwidth/sdk/model/RbmMessageMedia.java src/main/java/com/bandwidth/sdk/model/RbmStandaloneCard.java +src/main/java/com/bandwidth/sdk/model/RbmSuggestionResponse.java src/main/java/com/bandwidth/sdk/model/RecordingAvailableCallback.java src/main/java/com/bandwidth/sdk/model/RecordingCompleteCallback.java src/main/java/com/bandwidth/sdk/model/RecordingStateEnum.java @@ -308,6 +317,9 @@ 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/SmsMessageContent.java src/main/java/com/bandwidth/sdk/model/StandaloneCardOrientationEnum.java +src/main/java/com/bandwidth/sdk/model/StatusCallback.java +src/main/java/com/bandwidth/sdk/model/StatusCallbackMessage.java +src/main/java/com/bandwidth/sdk/model/StatusCallbackTypeEnum.java src/main/java/com/bandwidth/sdk/model/StirShaken.java src/main/java/com/bandwidth/sdk/model/TelephoneNumber.java src/main/java/com/bandwidth/sdk/model/TfvBasicAuthentication.java diff --git a/README.md b/README.md index e5dc51ce..826d40b1 100644 --- a/README.md +++ b/README.md @@ -160,6 +160,7 @@ Class | Method | HTTP request | Description *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* | [**deleteVerificationRequest**](docs/TollFreeVerificationApi.md#deleteVerificationRequest) | **DELETE** /accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification | Delete a Toll-Free Verification Submission *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 @@ -190,8 +191,8 @@ Class | Method | HTTP request | Description - [CallTranscriptionMetadata](docs/CallTranscriptionMetadata.md) - [CallTranscriptionResponse](docs/CallTranscriptionResponse.md) - [CallTranscriptionTrackEnum](docs/CallTranscriptionTrackEnum.md) + - [Callback](docs/Callback.md) - [CallbackMethodEnum](docs/CallbackMethodEnum.md) - - [CallbackTypeEnum](docs/CallbackTypeEnum.md) - [CardWidthEnum](docs/CardWidthEnum.md) - [CodeRequest](docs/CodeRequest.md) - [Conference](docs/Conference.md) @@ -210,16 +211,19 @@ Class | Method | HTTP request | Description - [CreateLookupResponse](docs/CreateLookupResponse.md) - [CreateMessageRequestError](docs/CreateMessageRequestError.md) - [CreateMultiChannelMessageResponse](docs/CreateMultiChannelMessageResponse.md) - - [DeferredResult](docs/DeferredResult.md) - [DisconnectCallback](docs/DisconnectCallback.md) - [Diversion](docs/Diversion.md) - [DtmfCallback](docs/DtmfCallback.md) - [Error](docs/Error.md) - [ErrorObject](docs/ErrorObject.md) + - [ErrorSource](docs/ErrorSource.md) - [FailureWebhook](docs/FailureWebhook.md) - [FieldError](docs/FieldError.md) - [FileFormatEnum](docs/FileFormatEnum.md) - [GatherCallback](docs/GatherCallback.md) + - [InboundCallback](docs/InboundCallback.md) + - [InboundCallbackMessage](docs/InboundCallbackMessage.md) + - [InboundCallbackTypeEnum](docs/InboundCallbackTypeEnum.md) - [InitiateCallback](docs/InitiateCallback.md) - [Link](docs/Link.md) - [LinksObject](docs/LinksObject.md) @@ -235,8 +239,6 @@ Class | Method | HTTP request | Description - [MachineDetectionResult](docs/MachineDetectionResult.md) - [Media](docs/Media.md) - [Message](docs/Message.md) - - [MessageCallback](docs/MessageCallback.md) - - [MessageCallbackMessage](docs/MessageCallbackMessage.md) - [MessageDirectionEnum](docs/MessageDirectionEnum.md) - [MessageRequest](docs/MessageRequest.md) - [MessageStatusEnum](docs/MessageStatusEnum.md) @@ -248,17 +250,17 @@ Class | Method | HTTP request | Description - [MfaRequestError](docs/MfaRequestError.md) - [MfaUnauthorizedRequestError](docs/MfaUnauthorizedRequestError.md) - [MmsMessageContent](docs/MmsMessageContent.md) + - [MmsMessageContentFile](docs/MmsMessageContentFile.md) - [MultiChannelAction](docs/MultiChannelAction.md) - [MultiChannelActionCalendarEvent](docs/MultiChannelActionCalendarEvent.md) - - [MultiChannelCallbackData](docs/MultiChannelCallbackData.md) - [MultiChannelChannelListObject](docs/MultiChannelChannelListObject.md) - [MultiChannelChannelListObjectContent](docs/MultiChannelChannelListObjectContent.md) - - [MultiChannelMessageCallbackData](docs/MultiChannelMessageCallbackData.md) + - [MultiChannelError](docs/MultiChannelError.md) - [MultiChannelMessageChannelEnum](docs/MultiChannelMessageChannelEnum.md) - - [MultiChannelMessageData](docs/MultiChannelMessageData.md) - - [MultiChannelMessageDirectionEnum](docs/MultiChannelMessageDirectionEnum.md) + - [MultiChannelMessageContent](docs/MultiChannelMessageContent.md) - [MultiChannelMessageRequest](docs/MultiChannelMessageRequest.md) - - [MultiChannelStatusEnum](docs/MultiChannelStatusEnum.md) + - [MultiChannelMessageResponseData](docs/MultiChannelMessageResponseData.md) + - [MultiChannelMessageResponseDataChannelListInner](docs/MultiChannelMessageResponseDataChannelListInner.md) - [OptInWorkflow](docs/OptInWorkflow.md) - [PageInfo](docs/PageInfo.md) - [PriorityEnum](docs/PriorityEnum.md) @@ -269,6 +271,7 @@ Class | Method | HTTP request | Description - [RbmActionViewLocation](docs/RbmActionViewLocation.md) - [RbmCardContent](docs/RbmCardContent.md) - [RbmCardContentMedia](docs/RbmCardContentMedia.md) + - [RbmLocationResponse](docs/RbmLocationResponse.md) - [RbmMediaHeightEnum](docs/RbmMediaHeightEnum.md) - [RbmMessageCarouselCard](docs/RbmMessageCarouselCard.md) - [RbmMessageContentFile](docs/RbmMessageContentFile.md) @@ -276,6 +279,7 @@ Class | Method | HTTP request | Description - [RbmMessageContentText](docs/RbmMessageContentText.md) - [RbmMessageMedia](docs/RbmMessageMedia.md) - [RbmStandaloneCard](docs/RbmStandaloneCard.md) + - [RbmSuggestionResponse](docs/RbmSuggestionResponse.md) - [RecordingAvailableCallback](docs/RecordingAvailableCallback.md) - [RecordingCompleteCallback](docs/RecordingCompleteCallback.md) - [RecordingStateEnum](docs/RecordingStateEnum.md) @@ -285,6 +289,9 @@ Class | Method | HTTP request | Description - [RedirectMethodEnum](docs/RedirectMethodEnum.md) - [SmsMessageContent](docs/SmsMessageContent.md) - [StandaloneCardOrientationEnum](docs/StandaloneCardOrientationEnum.md) + - [StatusCallback](docs/StatusCallback.md) + - [StatusCallbackMessage](docs/StatusCallbackMessage.md) + - [StatusCallbackTypeEnum](docs/StatusCallbackTypeEnum.md) - [StirShaken](docs/StirShaken.md) - [TelephoneNumber](docs/TelephoneNumber.md) - [TfvBasicAuthentication](docs/TfvBasicAuthentication.md) diff --git a/api/openapi.yaml b/api/openapi.yaml index 05309da9..7b15df9f 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -667,6 +667,12 @@ paths: schema: $ref: '#/components/schemas/messagingRequestError' description: Not Found + "405": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Method Not Allowed "406": content: application/json: @@ -703,8 +709,8 @@ paths: /users/{accountId}/messages/multiChannel: post: callbacks: - multiChannelCallback: - $ref: '#/components/callbacks/multiChannelMessageCallback' + statusCallback: + $ref: '#/components/callbacks/statusCallback' description: Endpoint for sending Multi-Channel messages. operationId: createMultiChannelMessage parameters: @@ -729,50 +735,113 @@ paths: "400": content: application/json: + example: + links: [] + data: null + errors: + - type: request-validation + description: "The 'channelList[0].from' field must contain exactly\ + \ one telephone number" + source: + field: "channelList[0].from" schema: - $ref: '#/components/schemas/createMessageRequestError' + $ref: '#/components/schemas/multiChannelError' description: Bad Request "401": content: application/json: + example: + links: [] + data: null + errors: + - type: unauthorized + description: Authentication Failed + source: {} schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: '#/components/schemas/multiChannelError' description: Unauthorized "403": content: application/json: + example: + links: [] + data: null + errors: + - type: forbidden + description: Access Denied + source: {} schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: '#/components/schemas/multiChannelError' description: Forbidden "404": content: application/json: + example: + links: [] + data: null + errors: + - type: forbidden + description: Resource not found. + source: {} schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: '#/components/schemas/multiChannelError' description: Not Found - "406": + "405": content: application/json: + example: + links: [] + data: null + errors: + - type: method-not-allowed + description: Method 'PUT' not supported for this resource. + source: {} schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: '#/components/schemas/multiChannelError' + description: Method Not Allowed + "406": description: Not Acceptable "415": content: application/json: + example: + links: [] + data: null + errors: + - type: unsupported-content-type + description: Content-Type 'application/xml;charset=UTF-8' is not + supported. Please use 'application/json' + source: + header: Content-Type schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: '#/components/schemas/multiChannelError' description: Unsupported Media Type "429": content: application/json: + example: + links: [] + data: null + errors: + - type: rate-limit-exceeded + description: You have exceeded your rate limit for this endpoint. + Please retry later. + source: {} schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: '#/components/schemas/multiChannelError' description: Too Many Requests "500": content: application/json: + example: + links: [] + data: null + errors: + - type: internal-server-error + description: Internal server error. No further information available + source: {} schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: '#/components/schemas/multiChannelError' description: Internal Server Error summary: Create Multi-Channel Message tags: @@ -4825,6 +4894,108 @@ paths: - description: Production url: https://api.bandwidth.com/api/v2 /accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification: + delete: + description: Delete a toll-free verification submission for a toll-free number. + operationId: deleteVerificationRequest + 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: + "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 a Toll-Free Verification Submission + tags: + - Toll-Free Verification + x-accepts: + - application/json get: description: |- Gets the verification status for a phone number that is provisioned to your account. @@ -5563,14 +5734,22 @@ components: mmsMessageReceivedCallback: $ref: '#/components/examples/mmsMessageReceivedCallbackExample' schema: - $ref: '#/components/schemas/messageCallback' - description: | -

This Inbound Message Webhook is an envelope containing a received (MO) message to your message-enabled Bandwidth telephone number. The payload type will always indicate "message-received". -

Please visit Webhooks

+ $ref: '#/components/schemas/inboundCallback' + description: "

This Inbound Message Webhook is an envelope containing\ + \ either a received (MO) message to your \nmessage-enabled Bandwidth\ + \ telephone number or a multichannel client's response to a suggestion\ + \ response \nor location request. \n

The payload type will be one\ + \ of message-received, suggestion-response,\ + \ or location-request-response.\n

Note that suggestion-response\ + \ and location-request-response callback types are pertinent\ + \ only for RBM messages sent from the /messages/multiChannel\ + \ endpoint.\n

Please visit Webhooks

" required: true responses: "200": description: OK + "202": + description: Accepted statusCallback: '{statusCallbackUrl}': post: @@ -5589,27 +5768,19 @@ components: messageFailedCallback: $ref: '#/components/examples/messageFailedCallbackExample' schema: - $ref: '#/components/schemas/messageCallback' - description: | -

This Outbound Message Webhook is an envelope containing status information regarding a message sent (MT) from your message-enabled Bandwidth telephone number. The payload type will be one of "message-sending", "message-delivered", or "message-failed". + $ref: '#/components/schemas/statusCallback' + description: |- +

This Outbound Message Webhook is an envelope containing status information regarding a message sent (MT) + from your message-enabled Bandwidth telephone number. +

The payload type will be one of message-sending, message-delivered, message-failed or message-read. +

Note that message-read callbacks are pertinent only for RBM messages sent from the /messages/multiChannel endpoint.

Please visit Webhooks

required: true responses: "200": description: OK - multiChannelMessageCallback: - '{multiChannelMessageCallbackUrl}': - post: - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/multiChannelCallbackData' - description: Status Callback Payload - required: true - responses: - "204": - description: No Content + "202": + description: Accepted tfVerificationStatus: your_url.com/webhookService: post: @@ -6880,6 +7051,12 @@ components: schema: $ref: '#/components/schemas/messagingRequestError' description: Not Found + messagingMethodNotAllowedError: + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Method Not Allowed messagingInvalidMediaTypeError: content: application/json: @@ -6898,6 +7075,117 @@ components: schema: $ref: '#/components/schemas/messagingRequestError' description: Internal Server Error + multiChannelBadRequestError: + content: + application/json: + example: + links: [] + data: null + errors: + - type: request-validation + description: "The 'channelList[0].from' field must contain exactly one\ + \ telephone number" + source: + field: "channelList[0].from" + schema: + $ref: '#/components/schemas/multiChannelError' + description: Bad Request + multiChannelNotAcceptableError: + description: Not Acceptable + multiChannelUnauthorizedError: + content: + application/json: + example: + links: [] + data: null + errors: + - type: unauthorized + description: Authentication Failed + source: {} + schema: + $ref: '#/components/schemas/multiChannelError' + description: Unauthorized + multiChannelForbiddenError: + content: + application/json: + example: + links: [] + data: null + errors: + - type: forbidden + description: Access Denied + source: {} + schema: + $ref: '#/components/schemas/multiChannelError' + description: Forbidden + multiChannelNotFoundError: + content: + application/json: + example: + links: [] + data: null + errors: + - type: forbidden + description: Resource not found. + source: {} + schema: + $ref: '#/components/schemas/multiChannelError' + description: Not Found + multiChannelMethodNotAllowedError: + content: + application/json: + example: + links: [] + data: null + errors: + - type: method-not-allowed + description: Method 'PUT' not supported for this resource. + source: {} + schema: + $ref: '#/components/schemas/multiChannelError' + description: Method Not Allowed + multiChannelInvalidMediaTypeError: + content: + application/json: + example: + links: [] + data: null + errors: + - type: unsupported-content-type + description: Content-Type 'application/xml;charset=UTF-8' is not supported. + Please use 'application/json' + source: + header: Content-Type + schema: + $ref: '#/components/schemas/multiChannelError' + description: Unsupported Media Type + multiChannelTooManyRequestsError: + content: + application/json: + example: + links: [] + data: null + errors: + - type: rate-limit-exceeded + description: You have exceeded your rate limit for this endpoint. Please + retry later. + source: {} + schema: + $ref: '#/components/schemas/multiChannelError' + description: Too Many Requests + multiChannelInternalServerError: + content: + application/json: + example: + links: [] + data: null + errors: + - type: internal-server-error + description: Internal server error. No further information available + source: {} + schema: + $ref: '#/components/schemas/multiChannelError' + description: Internal Server Error createCallResponse: content: application/json: @@ -7295,6 +7583,8 @@ components: schema: $ref: '#/components/schemas/tfvError' description: Bad Request + noContentResponse: + description: No Content tfvPostBadRequestResponse: content: application/json: @@ -7376,20 +7666,10 @@ components: with in the Bandwidth Phone Number Dashboard. example: 93de2206-9669-4e07-948d-329f4b722ee2 type: string - callbackTypeEnum: - description: | - Indicates the type of the callback: - - `message-received` for inbound callbacks. - - One of `message-sending`, `message-delivered`, `message-failed` for status callbacks. - enum: - - message-received - - message-sending - - message-delivered - - message-failed - example: message-delivered - type: string priorityEnum: - description: The priority specified by the user. + description: "Specifies the message's sending priority with respect to other\ + \ messages in your account. For best results and optimal throughput, reserve\ + \ the 'high' priority setting for critical messages only." enum: - default - high @@ -7546,7 +7826,8 @@ components: messageType: $ref: '#/components/schemas/messageTypeEnum' segmentCount: - description: The number of segments the message was sent as. + description: The number of segments the user's message is broken into before + sending over carrier networks. example: 1 type: integer errorCode: @@ -7677,20 +7958,17 @@ components: type: string title: Media type: object + segmentCount: + description: The number of segments the user's message is broken into before + sending over carrier networks. + example: 1 + type: integer tag: description: A custom string that will be included in callback events of the message. Max 1024 characters. example: custom string title: Tag type: string - deferredResult: - properties: - result: - type: object - setOrExpired: - type: boolean - title: DeferredResult - type: object expiration: description: "A string with the date/time value that the message will automatically\ \ expire by. This must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z\ @@ -7698,13 +7976,19 @@ components: example: 2021-02-01T11:29:18-05:00 format: date-time type: string + carrierName: + description: "The name of the Authorized Message Provider (AMP) that handled\ + \ this message. \nIn the US, this is the carrier that the message was sent\ + \ to.\nThis field is present only when this account feature has been enabled." + example: AT&T + type: string message: example: owner: "+15554443333" media: - https://dev.bandwidth.com/images/bandwidth-logo.png priority: default - segmentCount: 2 + segmentCount: 1 from: "+15553332222" expiration: 2021-02-01T11:29:18-05:00 id: 1589228074636lm4k2je7j7jklbn2 @@ -7712,7 +7996,7 @@ components: to: - "+15552223333" text: Hello world - tag: custom tag + tag: custom string applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 direction: in properties: @@ -7725,7 +8009,8 @@ components: example: "+15554443333" type: string applicationId: - description: The application ID associated with the message. + description: The ID of the Application your from number or senderId is associated + with in the Bandwidth Phone Number Dashboard. example: 93de2206-9669-4e07-948d-329f4b722ee2 type: string time: @@ -7734,9 +8019,9 @@ components: format: date-time type: string segmentCount: - description: The number of segments the original message from the user is - broken into before sending over to carrier networks. - example: 2 + description: The number of segments the user's message is broken into before + sending over carrier networks. + example: 1 type: integer direction: $ref: '#/components/schemas/messageDirectionEnum' @@ -7768,8 +8053,10 @@ components: example: Hello world type: string tag: - description: The custom string set by the user. - example: custom tag + description: A custom string that will be included in callback events of + the message. Max 1024 characters. + example: custom string + title: Tag type: string priority: $ref: '#/components/schemas/priorityEnum' @@ -7785,8 +8072,8 @@ components: messageRequest: properties: applicationId: - description: The ID of the Application your from number is associated with - in the Bandwidth Phone Number Dashboard. + description: The ID of the Application your from number or senderId is associated + with in the Bandwidth Phone Number Dashboard. example: 93de2206-9669-4e07-948d-329f4b722ee2 type: string to: @@ -7867,51 +8154,233 @@ components: createMultiChannelMessageResponse: example: data: - channel: RBM + channelList: + - owner: owner + channel: RBM + from: BandwidthRBM + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + content: + suggestions: + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + text: Hello world + - owner: owner + channel: RBM + from: BandwidthRBM + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + content: + suggestions: + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + text: Hello world + - owner: owner + channel: RBM + from: BandwidthRBM + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + content: + suggestions: + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + text: Hello world + - owner: owner + channel: RBM + from: BandwidthRBM + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + content: + suggestions: + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + text: Hello world messageId: 1589228074636lm4k2je7j7jklbn2 - from: BandwidthRBM + expiration: 2021-02-01T11:29:18-05:00 time: 2025-01-01T18:20:16Z - to: "+15552223333" + to: + - "+15554443333" tag: custom string - applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 - status: DELIVERED - direction: OUTBOUND + priority: default + direction: in + links: [] + errors: [] + properties: links: - - rel: rel - href: href - - rel: rel - href: href + example: [] + items: + $ref: '#/components/schemas/link' + type: array + data: + $ref: '#/components/schemas/multiChannelMessageResponseData' + errors: + example: [] + items: + $ref: '#/components/schemas/errorObject' + type: array + type: object + multiChannelError: + example: + data: "{}" + links: [] errors: - - code: code - message: message - - code: code - message: message + - description: description + source: + reference: reference + field: field + parameter: parameter + header: header + type: type + - description: description + source: + reference: reference + field: field + parameter: parameter + header: header + type: type properties: links: + example: [] items: $ref: '#/components/schemas/link' type: array data: - $ref: '#/components/schemas/multiChannelMessageData' + nullable: true + type: object + example: null errors: items: $ref: '#/components/schemas/errorObject' type: array type: object - multiChannelMessageChannelEnum: - description: The channel of the multi-channel message. - enum: - - RBM - - SMS + link: + properties: + rel: + type: string + href: + type: string + type: object + errorObject: + example: + description: description + source: + reference: reference + field: field + parameter: parameter + header: header + type: type + properties: + type: + description: A concise summary of the error used for categorization. + type: string + description: + description: A detailed explanation of the error. + type: string + source: + $ref: '#/components/schemas/errorSource' + required: + - description + - source + - type + type: object + errorSource: + description: "Specifies relevant sources of the error, if any." + example: + reference: reference + field: field + parameter: parameter + header: header + properties: + parameter: + description: The relevant URI query parameter causing the error + type: string + field: + description: The request body field that led to the error + type: string + header: + description: The header field that contributed to the error + type: string + reference: + description: A resource ID or path linked to the error + type: string + title: Error Source + type: object + multiChannelMessageChannelEnum: + description: The channel of the multi-channel message. + enum: + - RBM + - SMS - MMS example: RBM type: string - multiChannelMessageDirectionEnum: - enum: - - INBOUND - - OUTBOUND - example: OUTBOUND - type: string multiChannelSenderId: description: The sender ID of the message. This could be an alphanumeric sender ID. @@ -7921,7 +8390,38 @@ components: description: The phone number the message should be sent to in E164 format. example: "+15552223333" type: string + multiChannelDestinations: + description: "The destination phone number(s) of the message, in E164 format." + example: + - "+15554443333" + items: + type: string + type: array + uniqueItems: true rbmMessageContentText: + example: + suggestions: + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + text: Hello world properties: text: description: The text associated with the message. Must be 3270 characters @@ -7966,6 +8466,21 @@ components: - fileUrl title: RBM Rich Media File type: object + mmsMessageContentFile: + properties: + fileUrl: + description: |- + The URL of a media attachment. + + For MMS, the API limits file size to 3.5MB. Specific carriers and channels may have a smaller limit that could cause a large file to fail, see [here](https://support.bandwidth.com/hc/en-us/articles/360014235473-What-are-the-MMS-file-size-limits) for more details. + example: https://dev.bandwidth.com/images/bandwidth-logo.png + format: uri + maxLength: 1000 + type: string + required: + - fileUrl + title: MMS Media File + type: object rbmMessageMedia: properties: media: @@ -8083,16 +8598,8 @@ components: maxLength: 2048 type: string media: - description: |- - A list of URLs to include as media attachments as part of the message. - Each URL can be at most 4096 characters. - example: - - https://dev.bandwidth.com/images/bandwidth-logo.png - - https://dev.bandwidth.com/images/github_logo.png items: - format: uri - maxLength: 4096 - type: string + $ref: '#/components/schemas/mmsMessageContentFile' type: array title: MMS Message type: object @@ -8117,7 +8624,7 @@ components: maxLength: 25 title: Text type: string - rbmActionPostBackData: + rbmActionPostbackData: description: Base64 payload the customer receives when the reply is clicked. example: !!binary |- U0dWc2JHOGdkMjl5YkdRPQ== @@ -8126,6 +8633,11 @@ components: title: Post Back Data type: string rbmActionBase: + example: + postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY properties: type: $ref: '#/components/schemas/rbmActionTypeEnum' @@ -8135,7 +8647,7 @@ components: maxLength: 25 title: Text type: string - postBackData: + postbackData: description: Base64 payload the customer receives when the reply is clicked. example: !!binary |- U0dWc2JHOGdkMjl5YkdRPQ== @@ -8144,7 +8656,7 @@ components: title: Post Back Data type: string required: - - postBackData + - postbackData - text - type type: object @@ -8250,14 +8762,6 @@ components: - $ref: '#/components/schemas/rbmActionViewLocation' - $ref: '#/components/schemas/multiChannelActionCalendarEvent' - $ref: '#/components/schemas/rbmActionOpenUrl' - multiChannelStatusEnum: - enum: - - QUEUED - - SENDING - - DELIVERED - - FAILED - example: DELIVERED - type: string multiChannelChannelListObject: properties: from: @@ -8314,155 +8818,304 @@ components: - channelList - to type: object - multiChannelMessageCallbackData: - properties: - messageId: - description: The ID of the message. - example: 1589228074636lm4k2je7j7jklbn2 - type: string - status: - $ref: '#/components/schemas/multiChannelStatusEnum' - direction: - $ref: '#/components/schemas/multiChannelMessageDirectionEnum' - from: - description: The sender ID of the message. This could be an alphanumeric - sender ID. - example: BandwidthRBM - type: string - to: - description: The phone number the message should be sent to in E164 format. - example: "+15552223333" - type: string - applicationId: - description: The ID of the Application your from number or senderId is associated - with in the Bandwidth Phone Number Dashboard. - example: 93de2206-9669-4e07-948d-329f4b722ee2 - type: string - channel: - $ref: '#/components/schemas/multiChannelMessageChannelEnum' - tag: - description: A custom string that will be included in callback events of - the message. Max 1024 characters. - example: custom string - title: Tag - type: string - type: object - multiChannelMessageData: + multiChannelMessageResponseData: + description: The data returned in a multichannel message response. example: - channel: RBM + channelList: + - owner: owner + channel: RBM + from: BandwidthRBM + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + content: + suggestions: + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + text: Hello world + - owner: owner + channel: RBM + from: BandwidthRBM + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + content: + suggestions: + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + text: Hello world + - owner: owner + channel: RBM + from: BandwidthRBM + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + content: + suggestions: + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + text: Hello world + - owner: owner + channel: RBM + from: BandwidthRBM + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + content: + suggestions: + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + text: Hello world messageId: 1589228074636lm4k2je7j7jklbn2 - from: BandwidthRBM + expiration: 2021-02-01T11:29:18-05:00 time: 2025-01-01T18:20:16Z - to: "+15552223333" + to: + - "+15554443333" tag: custom string - applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 - status: DELIVERED - direction: OUTBOUND + priority: default + direction: in properties: messageId: description: The ID of the message. example: 1589228074636lm4k2je7j7jklbn2 type: string - status: - $ref: '#/components/schemas/multiChannelStatusEnum' time: description: The time the message was received by the Bandwidth API. example: 2025-01-01T18:20:16Z format: date-time type: string direction: - $ref: '#/components/schemas/multiChannelMessageDirectionEnum' - from: - description: The sender ID of the message. This could be an alphanumeric - sender ID. - example: BandwidthRBM - type: string + $ref: '#/components/schemas/messageDirectionEnum' to: - description: The phone number the message should be sent to in E164 format. - example: "+15552223333" - type: string - applicationId: - description: The ID of the Application your from number or senderId is associated - with in the Bandwidth Phone Number Dashboard. - example: 93de2206-9669-4e07-948d-329f4b722ee2 - type: string - channel: - $ref: '#/components/schemas/multiChannelMessageChannelEnum' + description: "The destination phone number(s) of the message, in E164 format." + example: + - "+15554443333" + items: + type: string + type: array + uniqueItems: true + channelList: + description: "A list of message bodies. The messages will be attempted in\ + \ the order they are listed. Once a message sends successfully, the others\ + \ will be ignored." + items: + $ref: '#/components/schemas/multiChannelMessageResponseData_channelList_inner' + maxItems: 4 + type: array tag: description: A custom string that will be included in callback events of the message. Max 1024 characters. example: custom string title: Tag type: string - type: object - multiChannelCallbackData: - properties: - time: - description: The time of the callback event. - example: 2025-01-01T18:20:16Z + priority: + $ref: '#/components/schemas/priorityEnum' + expiration: + description: "A string with the date/time value that the message will automatically\ + \ expire by. This must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z\ + \ or 2021-03-13T20:59:26-05:00. Must be a date-time in the future." + example: 2021-02-01T11:29:18-05:00 format: date-time type: string - type: - $ref: '#/components/schemas/multiChannelStatusEnum' - to: - description: The phone number the message should be sent to in E164 format. - example: "+15552223333" - type: string - description: - example: Incoming message received + required: + - channelList + - direction + - messageId + - time + - to + type: object + multiChannelMessageContent: + description: The structure of the content field of a multichannel message. + properties: + text: type: string - message: - $ref: '#/components/schemas/multiChannelMessageCallbackData' + media: + $ref: '#/components/schemas/rbmMessageContentFile' type: object - link: - example: - rel: rel - href: href + rbmSuggestionResponse: properties: - rel: + text: + description: The text associated with the suggestion response. + example: "Yes, I would like to proceed" type: string - href: + postbackData: + description: Base64 payload the customer receives when the reply is clicked. + example: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + format: byte + maxLength: 2048 + title: Post Back Data type: string type: object - errorObject: - example: - code: code - message: message + rbmLocationResponse: properties: - code: + latitude: + description: The latitude of the client's location. + example: "37.7749" + format: double type: string - message: + longitude: + description: The longitude of the client's location. + example: "-122.4194" + format: double type: string type: object - messageCallback: - description: Message Callback Schema + callback: + description: |- + Callbacks are divided into two types based on direction of the related message: + - `statusCallback` indicates status of an outbound MT SMS, MMS, or RBM message. + - `inboundCallback` indicates an inbound MO message or a multichannel message client's response to a suggestion or location request. + discriminator: + mapping: + message-sent: '#/components/schemas/statusCallback' + message-delivered: '#/components/schemas/statusCallback' + message-failed: '#/components/schemas/statusCallback' + message-read: '#/components/schemas/statusCallback' + message-received: '#/components/schemas/inboundCallback' + request-location-response: '#/components/schemas/inboundCallback' + suggestion-response: '#/components/schemas/inboundCallback' + propertyName: type + oneOf: + - $ref: '#/components/schemas/statusCallback' + - $ref: '#/components/schemas/inboundCallback' + type: object + statusCallback: + description: Represents a status callback for an outbound MT SMS or MMS or RBM + message. properties: time: example: 2024-12-02T20:15:57.278Z format: date-time type: string + eventTime: + description: "Represents the time at which the message was read, for `message-read`\ + \ callbacks." + example: 2024-12-02T20:15:58.278Z + format: date-time + type: string type: - $ref: '#/components/schemas/callbackTypeEnum' + $ref: '#/components/schemas/statusCallbackTypeEnum' to: + description: |- + The destination phone number the message was sent to. + For status callbacks, this the the Bandwidth user's client phone number. example: "+15552223333" type: string description: description: A detailed description of the event described by the callback. - example: rejected-unallocated-from-number + example: Message delivered to carrier. type: string message: - $ref: '#/components/schemas/messageCallbackMessage' + $ref: '#/components/schemas/statusCallbackMessage' errorCode: description: "Optional error code, applicable only when type is `message-failed`." example: 4405 - nullable: true type: integer carrierName: description: "The name of the Authorized Message Provider (AMP) that handled\ - \ this message. In the US, this is the carrier that the message was sent\ - \ to." + \ this message. \nIn the US, this is the carrier that the message was\ + \ sent to.\nThis field is present only when this account feature has been\ + \ enabled." + example: AT&T + type: string + required: + - description + - message + - time + - to + - type + type: object + inboundCallback: + description: Represents an inbound callback. + properties: + time: + example: 2024-12-02T20:15:57.278Z + format: date-time + type: string + type: + $ref: '#/components/schemas/inboundCallbackTypeEnum' + to: + description: "The destination phone number the message was sent to. \nFor\ + \ inbound callbacks, this is the Bandwidth number or alphanumeric identifier\ + \ that received the message.\n" + example: "+15552223333" + type: string + description: + description: A detailed description of the event described by the callback. + example: Incoming message received + type: string + message: + $ref: '#/components/schemas/inboundCallbackMessage' + carrierName: + description: "The name of the Authorized Message Provider (AMP) that handled\ + \ this message. \nIn the US, this is the carrier that the message was\ + \ sent to.\nThis field is present only when this account feature has been\ + \ enabled." example: AT&T - nullable: true type: string required: - description @@ -8471,16 +9124,49 @@ components: - to - type type: object - messageCallbackMessage: - description: Message payload schema within a MessageCallback + statusCallbackTypeEnum: + description: |- + The possible status callbacks when sending an MT SMS or MMS or RBM message: + - `message-sending` indicates that Bandwidth is sending the message to the upstream provider. + - `message-delivered` indicates that the message was successfully sent. + - `message-failed` indicates that the message could not be sent to the intended recipient. + - `message-read` indicates that the RBM message was read by the recipient. + enum: + - message-sending + - message-delivered + - message-failed + - message-read + example: message-delivered + type: string + inboundCallbackTypeEnum: + description: "The possible inbound callback types originating from MO messages\ + \ or multichannel message client responses:\n- `message-received` indicates\ + \ an MO message from a Bandwidth user's client to a Bandwidth number.\n- `request-location-response`\ + \ indicates a response to a location request sent by the Bandwidth user's\ + \ client after receiving an RBM message. \n- `suggestion-response` indicates\ + \ a response to a suggestion sent by the Bandwidth user's client after receiving\ + \ an RBM message." + enum: + - message-received + - request-location-response + - suggestion-response + example: message-received + type: string + statusCallbackMessage: + description: Message payload schema within a callback properties: id: + description: A unique identifier of the message. example: 1661365814859loidf7mcwd4qacn7 type: string owner: + description: The Bandwidth phone number or alphanumeric identifier associated + with the message. example: "+15553332222" type: string applicationId: + description: The ID of the Application your from number or senderId is associated + with in the Bandwidth Phone Number Dashboard. example: 93de2206-9669-4e07-948d-329f4b722ee2 type: string time: @@ -8488,11 +9174,14 @@ components: format: date-time type: string segmentCount: + description: The number of segments the user's message is broken into before + sending over carrier networks. example: 1 type: integer direction: $ref: '#/components/schemas/messageDirectionEnum' to: + description: The phone number recipients of the message. example: - "+15552223333" items: @@ -8500,26 +9189,32 @@ components: type: array uniqueItems: true from: + description: The Bandwidth phone number or alphanumeric identifier the message + was sent from. example: "+15553332222" type: string text: example: Hello world type: string tag: + description: A custom string that will be included in callback events of + the message. Max 1024 characters. example: custom string + title: Tag type: string media: - description: "Optional media, applicable only for mms" + description: "Optional media, not applicable for sms" example: - https://dev.bandwidth.com/images/bandwidth-logo.png - https://dev.bandwidth.com/images/github_logo.png items: format: uri type: string - nullable: true type: array priority: $ref: '#/components/schemas/priorityEnum' + channel: + $ref: '#/components/schemas/multiChannelMessageChannelEnum' required: - applicationId - direction @@ -8527,10 +9222,29 @@ components: - id - owner - segmentCount - - text - time - to type: object + inboundCallbackMessage: + allOf: + - $ref: '#/components/schemas/statusCallbackMessage' + - properties: + content: + $ref: '#/components/schemas/multiChannelMessageContent' + suggestionResponse: + $ref: '#/components/schemas/rbmSuggestionResponse' + locationResponse: + $ref: '#/components/schemas/rbmLocationResponse' + type: object + required: + - applicationId + - direction + - from + - id + - owner + - segmentCount + - time + - to callbackMethodEnum: default: POST description: The HTTP method to use to deliver the callback. GET or POST. Default @@ -13234,6 +13948,45 @@ components: - $ref: '#/components/schemas/rbmMessageContentRichCard' - $ref: '#/components/schemas/smsMessageContent' - $ref: '#/components/schemas/mmsMessageContent' + multiChannelMessageResponseData_channelList_inner: + allOf: + - $ref: '#/components/schemas/multiChannelChannelListObject' + - properties: + owner: + description: The Bandwidth senderId associated with the message. Identical + to 'from'. + type: string + required: + - owner + type: object + example: + owner: owner + channel: RBM + from: BandwidthRBM + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + content: + suggestions: + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + - postbackData: !!binary |- + U0dWc2JHOGdkMjl5YkdRPQ== + text: Hello world + type: REPLY + text: Hello world webhookSubscription_basicAuthentication: description: "Basic authentication credentials are not required, but if present,\ \ both username and password must be provided." diff --git a/bandwidth.yml b/bandwidth.yml index 03769645..4b3681cb 100644 --- a/bandwidth.yml +++ b/bandwidth.yml @@ -223,6 +223,8 @@ paths: $ref: '#/components/responses/messagingForbiddenError' '404': $ref: '#/components/responses/messagingNotFoundError' + '405': + $ref: '#/components/responses/messagingMethodNotAllowedError' '406': $ref: '#/components/responses/messagingNotAcceptableError' '415': @@ -250,24 +252,26 @@ paths: '202': $ref: '#/components/responses/createMultiChannelMessageResponse' '400': - $ref: '#/components/responses/createMessageBadRequestError' + $ref: '#/components/responses/multiChannelBadRequestError' '401': - $ref: '#/components/responses/messagingUnauthorizedError' + $ref: '#/components/responses/multiChannelUnauthorizedError' '403': - $ref: '#/components/responses/messagingForbiddenError' + $ref: '#/components/responses/multiChannelForbiddenError' '404': - $ref: '#/components/responses/messagingNotFoundError' + $ref: '#/components/responses/multiChannelNotFoundError' + '405': + $ref: '#/components/responses/multiChannelMethodNotAllowedError' '406': - $ref: '#/components/responses/messagingNotAcceptableError' + $ref: '#/components/responses/multiChannelNotAcceptableError' '415': - $ref: '#/components/responses/messagingInvalidMediaTypeError' + $ref: '#/components/responses/multiChannelInvalidMediaTypeError' '429': - $ref: '#/components/responses/messagingTooManyRequestsError' + $ref: '#/components/responses/multiChannelTooManyRequestsError' '500': - $ref: '#/components/responses/messagingInternalServerError' + $ref: '#/components/responses/multiChannelInternalServerError' callbacks: - multiChannelCallback: - $ref: '#/components/callbacks/multiChannelMessageCallback' + statusCallback: + $ref: '#/components/callbacks/statusCallback' x-badges: - name: Beta color: '#076EA8' @@ -1471,6 +1475,34 @@ paths: callbacks: tfVerificationStatus: $ref: '#/components/callbacks/tfVerificationStatus' + delete: + description: Delete a toll-free verification submission for a toll-free number. + operationId: deleteVerificationRequest + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/tfPhoneNumberPathParam' + responses: + '204': + $ref: '#/components/responses/noContentResponse' + '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' + summary: Delete a Toll-Free Verification Submission + tags: + - Toll-Free Verification servers: *ref_4 /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions: get: @@ -1554,7 +1586,7 @@ paths: - $ref: '#/components/parameters/webhookSubscriptionIdPathParam' responses: '204': - description: No Content + $ref: '#/components/responses/noContentResponse' '400': $ref: '#/components/responses/tfvBadRequestResponse' '401': @@ -1639,24 +1671,12 @@ components: The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard. example: 93de2206-9669-4e07-948d-329f4b722ee2 - callbackTypeEnum: - type: string - enum: - - message-received - - message-sending - - message-delivered - - message-failed - description: > - Indicates the type of the callback: - - - `message-received` for inbound callbacks. - - - One of `message-sending`, `message-delivered`, `message-failed` for - status callbacks. - example: message-delivered priorityEnum: type: string - description: The priority specified by the user. + description: >- + Specifies the message's sending priority with respect to other messages + in your account. For best results and optimal throughput, reserve the + 'high' priority setting for critical messages only. enum: - default - high @@ -1753,9 +1773,7 @@ components: messageType: $ref: '#/components/schemas/messageTypeEnum' segmentCount: - type: integer - description: The number of segments the message was sent as. - example: 1 + $ref: '#/components/schemas/segmentCount' errorCode: type: integer description: The numeric error code of the message. @@ -1863,6 +1881,12 @@ components: type: integer mediaName: type: string + segmentCount: + type: integer + description: >- + The number of segments the user's message is broken into before sending + over carrier networks. + example: 1 tag: title: Tag type: string @@ -1870,14 +1894,6 @@ components: A custom string that will be included in callback events of the message. Max 1024 characters. example: custom string - deferredResult: - title: DeferredResult - type: object - properties: - result: - type: object - setOrExpired: - type: boolean expiration: type: string format: date-time @@ -1887,6 +1903,16 @@ components: 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. Must be a date-time in the future. example: '2021-02-01T11:29:18-05:00' + carrierName: + type: string + description: >- + The name of the Authorized Message Provider (AMP) that handled this + message. + + In the US, this is the carrier that the message was sent to. + + This field is present only when this account feature has been enabled. + example: AT&T message: title: Message type: object @@ -1900,20 +1926,14 @@ components: description: The Bandwidth phone number associated with the message. example: '+15554443333' applicationId: - type: string - description: The application ID associated with the message. - example: 93de2206-9669-4e07-948d-329f4b722ee2 + $ref: '#/components/schemas/applicationId' time: type: string format: date-time description: The datetime stamp of the message in ISO 8601 example: 2024-12-02T20:15:57.278Z segmentCount: - type: integer - description: >- - The number of segments the original message from the user is broken - into before sending over to carrier networks. - example: 2 + $ref: '#/components/schemas/segmentCount' direction: $ref: '#/components/schemas/messageDirectionEnum' to: @@ -1945,9 +1965,7 @@ components: description: The contents of the message. example: Hello world tag: - type: string - description: The custom string set by the user. - example: custom tag + $ref: '#/components/schemas/tag' priority: $ref: '#/components/schemas/priorityEnum' expiration: @@ -1961,11 +1979,7 @@ components: - from properties: applicationId: - type: string - description: >- - The ID of the Application your from number is associated with in the - Bandwidth Phone Number Dashboard. - example: 93de2206-9669-4e07-948d-329f4b722ee2 + $ref: '#/components/schemas/applicationId' to: uniqueItems: true type: array @@ -2021,12 +2035,69 @@ components: type: array items: $ref: '#/components/schemas/link' + example: [] + data: + $ref: '#/components/schemas/multiChannelMessageResponseData' + errors: + type: array + items: + $ref: '#/components/schemas/errorObject' + example: [] + multiChannelError: + type: object + properties: + links: + type: array + items: + $ref: '#/components/schemas/link' + example: [] data: - $ref: '#/components/schemas/multiChannelMessageData' + type: object + nullable: true + example: null errors: type: array items: $ref: '#/components/schemas/errorObject' + link: + type: object + properties: + rel: + type: string + href: + type: string + errorObject: + type: object + properties: + type: + description: A concise summary of the error used for categorization. + type: string + description: + description: A detailed explanation of the error. + type: string + source: + $ref: '#/components/schemas/errorSource' + required: + - type + - description + - source + errorSource: + title: Error Source + type: object + description: Specifies relevant sources of the error, if any. + properties: + parameter: + type: string + description: The relevant URI query parameter causing the error + field: + type: string + description: The request body field that led to the error + header: + type: string + description: The header field that contributed to the error + reference: + type: string + description: A resource ID or path linked to the error multiChannelMessageChannelEnum: description: The channel of the multi-channel message. type: string @@ -2035,12 +2106,6 @@ components: - SMS - MMS example: RBM - multiChannelMessageDirectionEnum: - type: string - enum: - - INBOUND - - OUTBOUND - example: OUTBOUND multiChannelSenderId: type: string description: The sender ID of the message. This could be an alphanumeric sender ID. @@ -2049,6 +2114,14 @@ components: type: string description: The phone number the message should be sent to in E164 format. example: '+15552223333' + multiChannelDestinations: + uniqueItems: true + type: array + description: The destination phone number(s) of the message, in E164 format. + example: + - '+15554443333' + items: + type: string rbmMessageContentText: title: RBM Text type: object @@ -2090,6 +2163,26 @@ components: maxLength: 1000 required: - fileUrl + mmsMessageContentFile: + title: MMS Media File + type: object + properties: + fileUrl: + type: string + format: uri + description: >- + The URL of a media attachment. + + + For MMS, the API limits file size to 3.5MB. Specific carriers and + channels may have a smaller limit that could cause a large file to + fail, see + [here](https://support.bandwidth.com/hc/en-us/articles/360014235473-What-are-the-MMS-file-size-limits) + for more details. + example: https://dev.bandwidth.com/images/bandwidth-logo.png + maxLength: 1000 + required: + - fileUrl rbmMessageMedia: title: RBM Media type: object @@ -2198,7 +2291,9 @@ components: text: $ref: '#/components/schemas/messageText' media: - $ref: '#/components/schemas/messageMedia' + type: array + items: + $ref: '#/components/schemas/mmsMessageContentFile' rbmMessageContentRichCard: title: RBM Rich Card oneOf: @@ -2220,7 +2315,7 @@ components: description: Displayed text for user to click maxLength: 25 example: Hello world - rbmActionPostBackData: + rbmActionPostbackData: title: Post Back Data type: string format: byte @@ -2234,11 +2329,11 @@ components: $ref: '#/components/schemas/rbmActionTypeEnum' text: $ref: '#/components/schemas/rbmActionText' - postBackData: - $ref: '#/components/schemas/rbmActionPostBackData' + postbackData: + $ref: '#/components/schemas/rbmActionPostbackData' required: - text - - postBackData + - postbackData - type rbmActionDial: allOf: @@ -2342,14 +2437,6 @@ components: CREATE_CALENDAR_EVENT: '#/components/schemas/multiChannelActionCalendarEvent' OPEN_URL: '#/components/schemas/rbmActionOpenUrl' REQUEST_LOCATION: '#/components/schemas/rbmActionBase' - multiChannelStatusEnum: - type: string - enum: - - QUEUED - - SENDING - - DELIVERED - - FAILED - example: DELIVERED multiChannelChannelListObject: type: object properties: @@ -2396,141 +2483,250 @@ components: required: - to - channelList - multiChannelMessageCallbackData: - type: object - properties: - messageId: - $ref: '#/components/schemas/messageId' - status: - $ref: '#/components/schemas/multiChannelStatusEnum' - direction: - $ref: '#/components/schemas/multiChannelMessageDirectionEnum' - from: - $ref: '#/components/schemas/multiChannelSenderId' - to: - $ref: '#/components/schemas/multiChannelDestination' - applicationId: - $ref: '#/components/schemas/applicationId' - channel: - $ref: '#/components/schemas/multiChannelMessageChannelEnum' - tag: - $ref: '#/components/schemas/tag' - multiChannelMessageData: + multiChannelMessageResponseData: + description: The data returned in a multichannel message response. type: object properties: messageId: $ref: '#/components/schemas/messageId' - status: - $ref: '#/components/schemas/multiChannelStatusEnum' time: description: The time the message was received by the Bandwidth API. type: string format: date-time example: 2025-01-01T18:20:16.000Z direction: - $ref: '#/components/schemas/multiChannelMessageDirectionEnum' - from: - $ref: '#/components/schemas/multiChannelSenderId' + $ref: '#/components/schemas/messageDirectionEnum' to: - $ref: '#/components/schemas/multiChannelDestination' - applicationId: - $ref: '#/components/schemas/applicationId' - channel: - $ref: '#/components/schemas/multiChannelMessageChannelEnum' + $ref: '#/components/schemas/multiChannelDestinations' + channelList: + type: array + description: >- + A list of message bodies. The messages will be attempted in the + order they are listed. Once a message sends successfully, the others + will be ignored. + items: + allOf: + - $ref: '#/components/schemas/multiChannelChannelListObject' + - type: object + properties: + owner: + type: string + description: >- + The Bandwidth senderId associated with the message. + Identical to 'from'. + required: + - owner + maxItems: 4 tag: $ref: '#/components/schemas/tag' - multiChannelCallbackData: + priority: + $ref: '#/components/schemas/priorityEnum' + expiration: + $ref: '#/components/schemas/expiration' + required: + - messageId + - time + - direction + - to + - channelList + multiChannelMessageContent: + description: The structure of the content field of a multichannel message. type: object properties: - time: - description: The time of the callback event. - type: string - format: date-time - example: 2025-01-01T18:20:16.000Z - type: - $ref: '#/components/schemas/multiChannelStatusEnum' - to: - $ref: '#/components/schemas/multiChannelDestination' - description: + text: type: string - example: Incoming message received - message: - $ref: '#/components/schemas/multiChannelMessageCallbackData' - link: + media: + $ref: '#/components/schemas/rbmMessageContentFile' + rbmSuggestionResponse: type: object properties: - rel: - type: string - href: + text: type: string - errorObject: + description: The text associated with the suggestion response. + example: Yes, I would like to proceed + postbackData: + $ref: '#/components/schemas/rbmActionPostbackData' + rbmLocationResponse: type: object properties: - code: + latitude: type: string - message: + format: double + description: The latitude of the client's location. + example: '37.7749' + longitude: type: string - messageCallback: - description: Message Callback Schema + format: double + description: The longitude of the client's location. + example: '-122.4194' + callback: + description: >- + Callbacks are divided into two types based on direction of the related + message: + + - `statusCallback` indicates status of an outbound MT SMS, MMS, or RBM + message. + + - `inboundCallback` indicates an inbound MO message or a multichannel + message client's response to a suggestion or location request. + type: object + oneOf: + - $ref: '#/components/schemas/statusCallback' + - $ref: '#/components/schemas/inboundCallback' + discriminator: + propertyName: type + mapping: + message-sent: '#/components/schemas/statusCallback' + message-delivered: '#/components/schemas/statusCallback' + message-failed: '#/components/schemas/statusCallback' + message-read: '#/components/schemas/statusCallback' + message-received: '#/components/schemas/inboundCallback' + request-location-response: '#/components/schemas/inboundCallback' + suggestion-response: '#/components/schemas/inboundCallback' + statusCallback: type: object + description: >- + Represents a status callback for an outbound MT SMS or MMS or RBM + message. properties: time: type: string format: date-time example: 2024-12-02T20:15:57.278Z + eventTime: + type: string + description: >- + Represents the time at which the message was read, for + `message-read` callbacks. + format: date-time + example: 2024-12-02T20:15:58.278Z type: - $ref: '#/components/schemas/callbackTypeEnum' + $ref: '#/components/schemas/statusCallbackTypeEnum' to: type: string + description: >- + The destination phone number the message was sent to. + + For status callbacks, this the the Bandwidth user's client phone + number. example: '+15552223333' description: type: string description: A detailed description of the event described by the callback. - example: rejected-unallocated-from-number + example: Message delivered to carrier. message: - $ref: '#/components/schemas/messageCallbackMessage' + $ref: '#/components/schemas/statusCallbackMessage' errorCode: type: integer description: Optional error code, applicable only when type is `message-failed`. - nullable: true example: 4405 carrierName: + $ref: '#/components/schemas/carrierName' + required: + - time + - type + - to + - description + - message + inboundCallback: + type: object + description: Represents an inbound callback. + properties: + time: type: string - description: >- - The name of the Authorized Message Provider (AMP) that handled this - message. In the US, this is the carrier that the message was sent - to. - nullable: true - example: AT&T + format: date-time + example: 2024-12-02T20:15:57.278Z + type: + $ref: '#/components/schemas/inboundCallbackTypeEnum' + to: + type: string + description: > + The destination phone number the message was sent to. + + For inbound callbacks, this is the Bandwidth number or alphanumeric + identifier that received the message. + example: '+15552223333' + description: + type: string + description: A detailed description of the event described by the callback. + example: Incoming message received + message: + $ref: '#/components/schemas/inboundCallbackMessage' + carrierName: + $ref: '#/components/schemas/carrierName' required: - time - type - to - description - message - messageCallbackMessage: - description: Message payload schema within a MessageCallback + statusCallbackTypeEnum: + type: string + description: >- + The possible status callbacks when sending an MT SMS or MMS or RBM + message: + + - `message-sending` indicates that Bandwidth is sending the message to + the upstream provider. + + - `message-delivered` indicates that the message was successfully sent. + + - `message-failed` indicates that the message could not be sent to the + intended recipient. + + - `message-read` indicates that the RBM message was read by the + recipient. + enum: + - message-sending + - message-delivered + - message-failed + - message-read + example: message-delivered + inboundCallbackTypeEnum: + type: string + description: >- + The possible inbound callback types originating from MO messages or + multichannel message client responses: + + - `message-received` indicates an MO message from a Bandwidth user's + client to a Bandwidth number. + + - `request-location-response` indicates a response to a location request + sent by the Bandwidth user's client after receiving an RBM message. + + - `suggestion-response` indicates a response to a suggestion sent by the + Bandwidth user's client after receiving an RBM message. + enum: + - message-received + - request-location-response + - suggestion-response + example: message-received + statusCallbackMessage: + description: Message payload schema within a callback type: object properties: id: type: string + description: A unique identifier of the message. example: 1661365814859loidf7mcwd4qacn7 owner: type: string + description: >- + The Bandwidth phone number or alphanumeric identifier associated + with the message. example: '+15553332222' applicationId: - type: string - example: 93de2206-9669-4e07-948d-329f4b722ee2 + $ref: '#/components/schemas/applicationId' time: type: string format: date-time example: 2024-12-02T20:15:57.666Z segmentCount: - type: integer - example: 1 + $ref: '#/components/schemas/segmentCount' direction: $ref: '#/components/schemas/messageDirectionEnum' to: + description: The phone number recipients of the message. uniqueItems: true type: array items: @@ -2539,17 +2735,18 @@ components: - '+15552223333' from: type: string + description: >- + The Bandwidth phone number or alphanumeric identifier the message + was sent from. example: '+15553332222' text: type: string example: Hello world tag: - type: string - example: custom string + $ref: '#/components/schemas/tag' media: type: array - description: Optional media, applicable only for mms - nullable: true + description: Optional media, not applicable for sms items: type: string format: uri @@ -2558,6 +2755,28 @@ components: - https://dev.bandwidth.com/images/github_logo.png priority: $ref: '#/components/schemas/priorityEnum' + channel: + $ref: '#/components/schemas/multiChannelMessageChannelEnum' + required: + - id + - owner + - applicationId + - time + - segmentCount + - direction + - to + - from + inboundCallbackMessage: + allOf: + - $ref: '#/components/schemas/statusCallbackMessage' + - type: object + properties: + content: + $ref: '#/components/schemas/multiChannelMessageContent' + suggestionResponse: + $ref: '#/components/schemas/rbmSuggestionResponse' + locationResponse: + $ref: '#/components/schemas/rbmLocationResponse' required: - id - owner @@ -2567,7 +2786,6 @@ components: - direction - to - from - - text callbackMethodEnum: type: string nullable: true @@ -5954,6 +6172,12 @@ components: application/json: schema: $ref: '#/components/schemas/messagingRequestError' + messagingMethodNotAllowedError: + description: Method Not Allowed + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' messagingInvalidMediaTypeError: description: Unsupported Media Type content: @@ -5972,6 +6196,120 @@ components: application/json: schema: $ref: '#/components/schemas/messagingRequestError' + multiChannelBadRequestError: + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/multiChannelError' + example: + links: [] + data: null + errors: + - type: request-validation + description: >- + The 'channelList[0].from' field must contain exactly one + telephone number + source: + field: channelList[0].from + multiChannelNotAcceptableError: + description: Not Acceptable + multiChannelUnauthorizedError: + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/multiChannelError' + example: + links: [] + data: null + errors: + - type: unauthorized + description: Authentication Failed + source: {} + multiChannelForbiddenError: + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/multiChannelError' + example: + links: [] + data: null + errors: + - type: forbidden + description: Access Denied + source: {} + multiChannelNotFoundError: + description: Not Found + content: + application/json: + schema: + $ref: '#/components/schemas/multiChannelError' + example: + links: [] + data: null + errors: + - type: forbidden + description: Resource not found. + source: {} + multiChannelMethodNotAllowedError: + description: Method Not Allowed + content: + application/json: + schema: + $ref: '#/components/schemas/multiChannelError' + example: + links: [] + data: null + errors: + - type: method-not-allowed + description: Method 'PUT' not supported for this resource. + source: {} + multiChannelInvalidMediaTypeError: + description: Unsupported Media Type + content: + application/json: + schema: + $ref: '#/components/schemas/multiChannelError' + example: + links: [] + data: null + errors: + - type: unsupported-content-type + description: >- + Content-Type 'application/xml;charset=UTF-8' is not supported. + Please use 'application/json' + source: + header: Content-Type + multiChannelTooManyRequestsError: + description: Too Many Requests + content: + application/json: + schema: + $ref: '#/components/schemas/multiChannelError' + example: + links: [] + data: null + errors: + - type: rate-limit-exceeded + description: >- + You have exceeded your rate limit for this endpoint. Please + retry later. + source: {} + multiChannelInternalServerError: + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/multiChannelError' + example: + links: [] + data: null + errors: + - type: internal-server-error + description: Internal server error. No further information available + source: {} createCallResponse: description: Created headers: @@ -6373,6 +6711,8 @@ components: example: description: Cannot process request. type: bad request + noContentResponse: + description: No Content tfvPostBadRequestResponse: description: Bad Request content: @@ -7506,17 +7846,30 @@ components: post: requestBody: required: true - description: > -

This Inbound Message Webhook is an envelope containing a - received (MO) message to your message-enabled Bandwidth telephone - number. The payload type will always indicate "message-received". + description: >- +

This Inbound Message Webhook is an envelope containing either a + received (MO) message to your + + message-enabled Bandwidth telephone number or a multichannel + client's response to a suggestion response + + or location request. + +

The payload type will be one of message-received, + suggestion-response, or + location-request-response. + +

Note that suggestion-response and + location-request-response callback types are + pertinent only for RBM messages sent from the + /messages/multiChannel endpoint.

Please visit Webhooks

content: application/json: schema: - $ref: '#/components/schemas/messageCallback' + $ref: '#/components/schemas/inboundCallback' examples: smsMessageReceivedCallback: $ref: '#/components/examples/smsMessageReceivedCallbackExample' @@ -7525,24 +7878,26 @@ components: responses: '200': description: OK + '202': + description: Accepted statusCallback: '{statusCallbackUrl}': post: requestBody: required: true - description: > + description: >-

This Outbound Message Webhook is an envelope containing status - information regarding a message sent (MT) from your - message-enabled Bandwidth telephone number. The payload type will - be one of "message-sending", "message-delivered", or - "message-failed". + information regarding a message sent (MT) + from your message-enabled Bandwidth telephone number. +

The payload type will be one of message-sending, message-delivered, message-failed or message-read. +

Note that message-read callbacks are pertinent only for RBM messages sent from the /messages/multiChannel endpoint.

Please visit Webhooks

content: application/json: schema: - $ref: '#/components/schemas/messageCallback' + $ref: '#/components/schemas/statusCallback' examples: messageSendingCallback: $ref: '#/components/examples/messageSendingCallbackExample' @@ -7558,19 +7913,8 @@ components: responses: '200': description: OK - multiChannelMessageCallback: - '{multiChannelMessageCallbackUrl}': - post: - requestBody: - required: true - description: Status Callback Payload - content: - application/json: - schema: - $ref: '#/components/schemas/multiChannelCallbackData' - responses: - '204': - description: No Content + '202': + description: Accepted tfVerificationStatus: your_url.com/webhookService: post: @@ -7594,7 +7938,7 @@ components: $ref: '#/components/requestBodies/verificationWebhookRequest' responses: '204': - description: No Content + $ref: '#/components/responses/noContentResponse' '400': $ref: '#/components/responses/tfvBadRequestResponse' '401': diff --git a/docs/Callback.md b/docs/Callback.md new file mode 100644 index 00000000..56428470 --- /dev/null +++ b/docs/Callback.md @@ -0,0 +1,21 @@ + + +# Callback + +Callbacks are divided into two types based on direction of the related message: - `statusCallback` indicates status of an outbound MT SMS, MMS, or RBM message. - `inboundCallback` indicates an inbound MO message or a multichannel message client's response to a suggestion or location request. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**time** | **OffsetDateTime** | | | +|**eventTime** | **OffsetDateTime** | Represents the time at which the message was read, for `message-read` callbacks. | [optional] | +|**type** | **InboundCallbackTypeEnum** | | | +|**to** | **String** | The destination phone number the message was sent to. For inbound callbacks, this is the Bandwidth number or alphanumeric identifier that received the message. | | +|**description** | **String** | A detailed description of the event described by the callback. | | +|**message** | [**InboundCallbackMessage**](InboundCallbackMessage.md) | | | +|**errorCode** | **Integer** | Optional error code, applicable only when type is `message-failed`. | [optional] | +|**carrierName** | **String** | The name of the Authorized Message Provider (AMP) that handled this message. In the US, this is the carrier that the message was sent to. This field is present only when this account feature has been enabled. | [optional] | + + + diff --git a/docs/CreateMultiChannelMessageResponse.md b/docs/CreateMultiChannelMessageResponse.md index 8f47b054..f1b50ef2 100644 --- a/docs/CreateMultiChannelMessageResponse.md +++ b/docs/CreateMultiChannelMessageResponse.md @@ -8,7 +8,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| |**links** | [**List<Link>**](Link.md) | | [optional] | -|**data** | [**MultiChannelMessageData**](MultiChannelMessageData.md) | | [optional] | +|**data** | [**MultiChannelMessageResponseData**](MultiChannelMessageResponseData.md) | | [optional] | |**errors** | [**List<ErrorObject>**](ErrorObject.md) | | [optional] | diff --git a/docs/DeferredResult.md b/docs/DeferredResult.md deleted file mode 100644 index 89bd997f..00000000 --- a/docs/DeferredResult.md +++ /dev/null @@ -1,14 +0,0 @@ - - -# DeferredResult - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**result** | **Object** | | [optional] | -|**setOrExpired** | **Boolean** | | [optional] | - - - diff --git a/docs/DeviceApiVersionEnum.md b/docs/DeviceApiVersionEnum.md deleted file mode 100644 index 4b282835..00000000 --- a/docs/DeviceApiVersionEnum.md +++ /dev/null @@ -1,11 +0,0 @@ - - -# DeviceApiVersionEnum - -## Enum - - -* `V3` (value: `"V3"`) - - - diff --git a/docs/DisconenctCallback.md b/docs/DisconenctCallback.md deleted file mode 100644 index f7a47d6f..00000000 --- a/docs/DisconenctCallback.md +++ /dev/null @@ -1,30 +0,0 @@ - - -# DisconenctCallback - -The Disconnect event is fired when a call ends, for any reason. - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**eventType** | **String** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional] | -|**eventTime** | **String** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional] | -|**accountId** | **String** | The user account associated with the call. | [optional] | -|**applicationId** | **String** | The id of the application associated with the call. | [optional] | -|**from** | **String** | The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous. | [optional] | -|**to** | **String** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional] | -|**callId** | **String** | The call id associated with the event. | [optional] | -|**direction** | **CallDirectionEnum** | | [optional] | -|**callUrl** | **String** | The URL of the call associated with the event. | [optional] | -|**enqueuedTime** | **OffsetDateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional] | -|**startTime** | **OffsetDateTime** | Time the call was started, in ISO 8601 format. | [optional] | -|**answerTime** | **OffsetDateTime** | Time the call was answered, in ISO 8601 format. | [optional] | -|**endTime** | **OffsetDateTime** | The time that the recording ended in ISO-8601 format | [optional] | -|**cause** | **String** | Reason the call failed - hangup, busy, timeout, cancel, rejected, callback-error, invalid-bxml, application-error, account-limit, node-capacity-exceeded, error, or unknown. | [optional] | -|**errorMessage** | **String** | Text explaining the reason that caused the call to fail in case of errors. | [optional] | -|**errorId** | **String** | Bandwidth's internal id that references the error event. | [optional] | -|**tag** | **String** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional] | - - - diff --git a/docs/ErrorObject.md b/docs/ErrorObject.md index 96683d54..8025ab8f 100644 --- a/docs/ErrorObject.md +++ b/docs/ErrorObject.md @@ -7,8 +7,9 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| -|**code** | **String** | | [optional] | -|**message** | **String** | | [optional] | +|**type** | **String** | A concise summary of the error used for categorization. | | +|**description** | **String** | A detailed explanation of the error. | | +|**source** | [**ErrorSource**](ErrorSource.md) | | | diff --git a/docs/ErrorSource.md b/docs/ErrorSource.md new file mode 100644 index 00000000..0f3efeb9 --- /dev/null +++ b/docs/ErrorSource.md @@ -0,0 +1,17 @@ + + +# ErrorSource + +Specifies relevant sources of the error, if any. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**parameter** | **String** | The relevant URI query parameter causing the error | [optional] | +|**field** | **String** | The request body field that led to the error | [optional] | +|**header** | **String** | The header field that contributed to the error | [optional] | +|**reference** | **String** | A resource ID or path linked to the error | [optional] | + + + diff --git a/docs/GetTollFreeVerificationStatus200Response.md b/docs/GetTollFreeVerificationStatus200Response.md deleted file mode 100644 index d1d760fa..00000000 --- a/docs/GetTollFreeVerificationStatus200Response.md +++ /dev/null @@ -1,20 +0,0 @@ - - -# 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/InboundCallback.md b/docs/InboundCallback.md new file mode 100644 index 00000000..5a1993cb --- /dev/null +++ b/docs/InboundCallback.md @@ -0,0 +1,19 @@ + + +# InboundCallback + +Represents an inbound callback. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**time** | **OffsetDateTime** | | | +|**type** | **InboundCallbackTypeEnum** | | | +|**to** | **String** | The destination phone number the message was sent to. For inbound callbacks, this is the Bandwidth number or alphanumeric identifier that received the message. | | +|**description** | **String** | A detailed description of the event described by the callback. | | +|**message** | [**InboundCallbackMessage**](InboundCallbackMessage.md) | | | +|**carrierName** | **String** | The name of the Authorized Message Provider (AMP) that handled this message. In the US, this is the carrier that the message was sent to. This field is present only when this account feature has been enabled. | [optional] | + + + diff --git a/docs/InboundCallbackMessage.md b/docs/InboundCallbackMessage.md new file mode 100644 index 00000000..0f6fc882 --- /dev/null +++ b/docs/InboundCallbackMessage.md @@ -0,0 +1,28 @@ + + +# InboundCallbackMessage + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **String** | A unique identifier of the message. | | +|**owner** | **String** | The Bandwidth phone number or alphanumeric identifier associated with the message. | | +|**applicationId** | **String** | The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard. | | +|**time** | **OffsetDateTime** | | | +|**segmentCount** | **Integer** | The number of segments the user's message is broken into before sending over carrier networks. | | +|**direction** | **MessageDirectionEnum** | | | +|**to** | **Set<String>** | The phone number recipients of the message. | | +|**from** | **String** | The Bandwidth phone number or alphanumeric identifier the message was sent from. | | +|**text** | **String** | | [optional] | +|**tag** | **String** | A custom string that will be included in callback events of the message. Max 1024 characters. | [optional] | +|**media** | **List<URI>** | Optional media, not applicable for sms | [optional] | +|**priority** | **PriorityEnum** | | [optional] | +|**channel** | **MultiChannelMessageChannelEnum** | | [optional] | +|**content** | [**MultiChannelMessageContent**](MultiChannelMessageContent.md) | | [optional] | +|**suggestionResponse** | [**RbmSuggestionResponse**](RbmSuggestionResponse.md) | | [optional] | +|**locationResponse** | [**RbmLocationResponse**](RbmLocationResponse.md) | | [optional] | + + + diff --git a/docs/InboundCallbackTypeEnum.md b/docs/InboundCallbackTypeEnum.md new file mode 100644 index 00000000..d2577d84 --- /dev/null +++ b/docs/InboundCallbackTypeEnum.md @@ -0,0 +1,15 @@ + + +# InboundCallbackTypeEnum + +## Enum + + +* `MESSAGE_RECEIVED` (value: `"message-received"`) + +* `REQUEST_LOCATION_RESPONSE` (value: `"request-location-response"`) + +* `SUGGESTION_RESPONSE` (value: `"suggestion-response"`) + + + diff --git a/docs/InboundMessageCallback.md b/docs/InboundMessageCallback.md deleted file mode 100644 index e0b84c8e..00000000 --- a/docs/InboundMessageCallback.md +++ /dev/null @@ -1,18 +0,0 @@ - - -# InboundMessageCallback - -Inbound Message Callback - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**time** | **OffsetDateTime** | | | -|**type** | **String** | | | -|**to** | **String** | | | -|**description** | **String** | | | -|**message** | [**InboundMessageCallbackMessage**](InboundMessageCallbackMessage.md) | | | - - - diff --git a/docs/InboundMessageCallbackMessage.md b/docs/InboundMessageCallbackMessage.md deleted file mode 100644 index 2f45fd05..00000000 --- a/docs/InboundMessageCallbackMessage.md +++ /dev/null @@ -1,25 +0,0 @@ - - -# InboundMessageCallbackMessage - -Inbound Message Callback Message Schema - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**id** | **String** | | | -|**owner** | **String** | | | -|**applicationId** | **String** | | | -|**time** | **OffsetDateTime** | | | -|**segmentCount** | **Integer** | | | -|**direction** | **MessageDirectionEnum** | | | -|**to** | **Set<String>** | | | -|**from** | **String** | | | -|**text** | **String** | | | -|**tag** | **String** | | [optional] | -|**media** | **List<URI>** | | [optional] | -|**priority** | **PriorityEnum** | | [optional] | - - - diff --git a/docs/Links.md b/docs/Links.md deleted file mode 100644 index d0162d28..00000000 --- a/docs/Links.md +++ /dev/null @@ -1,16 +0,0 @@ - - -# 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/ListMessageItem.md b/docs/ListMessageItem.md index 0829baf8..96b870fe 100644 --- a/docs/ListMessageItem.md +++ b/docs/ListMessageItem.md @@ -14,7 +14,7 @@ |**messageStatus** | **MessageStatusEnum** | | [optional] | |**messageDirection** | **ListMessageDirectionEnum** | | [optional] | |**messageType** | **MessageTypeEnum** | | [optional] | -|**segmentCount** | **Integer** | The number of segments the message was sent as. | [optional] | +|**segmentCount** | **Integer** | The number of segments the user's message is broken into before sending over carrier networks. | [optional] | |**errorCode** | **Integer** | The numeric error code of the message. | [optional] | |**receiveTime** | **OffsetDateTime** | The ISO 8601 datetime of the message. | [optional] | |**carrierName** | **String** | The name of the carrier. Not currently supported for MMS coming soon. | [optional] | diff --git a/docs/Message.md b/docs/Message.md index dcdfc80a..bc2e17c3 100644 --- a/docs/Message.md +++ b/docs/Message.md @@ -9,15 +9,15 @@ |------------ | ------------- | ------------- | -------------| |**id** | **String** | The id of the message. | [optional] | |**owner** | **String** | The Bandwidth phone number associated with the message. | [optional] | -|**applicationId** | **String** | The application ID associated with the message. | [optional] | +|**applicationId** | **String** | The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard. | [optional] | |**time** | **OffsetDateTime** | The datetime stamp of the message in ISO 8601 | [optional] | -|**segmentCount** | **Integer** | The number of segments the original message from the user is broken into before sending over to carrier networks. | [optional] | +|**segmentCount** | **Integer** | The number of segments the user's message is broken into before sending over carrier networks. | [optional] | |**direction** | **MessageDirectionEnum** | | [optional] | |**to** | **Set<String>** | The phone number recipients of the message. | [optional] | |**from** | **String** | The phone number the message was sent from. | [optional] | |**media** | **Set<String>** | The list of media URLs sent in the message. Including a `filename` field in the `Content-Disposition` header of the media linked with a URL will set the displayed file name. This is a best practice to ensure that your media has a readable file name. | [optional] | |**text** | **String** | The contents of the message. | [optional] | -|**tag** | **String** | The custom string set by the user. | [optional] | +|**tag** | **String** | A custom string that will be included in callback events of the message. Max 1024 characters. | [optional] | |**priority** | **PriorityEnum** | | [optional] | |**expiration** | **OffsetDateTime** | A string with the date/time value that the message will automatically expire by. This must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. Must be a date-time in the future. | [optional] | diff --git a/docs/MessageCallback.md b/docs/MessageCallback.md deleted file mode 100644 index 6cb0487b..00000000 --- a/docs/MessageCallback.md +++ /dev/null @@ -1,20 +0,0 @@ - - -# MessageCallback - -Message Callback Schema - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**time** | **OffsetDateTime** | | | -|**type** | **CallbackTypeEnum** | | | -|**to** | **String** | | | -|**description** | **String** | A detailed description of the event described by the callback. | | -|**message** | [**MessageCallbackMessage**](MessageCallbackMessage.md) | | | -|**errorCode** | **Integer** | Optional error code, applicable only when type is `message-failed`. | [optional] | -|**carrierName** | **String** | The name of the Authorized Message Provider (AMP) that handled this message. In the US, this is the carrier that the message was sent to. | [optional] | - - - diff --git a/docs/MessageCallbackMessage.md b/docs/MessageCallbackMessage.md deleted file mode 100644 index fee749f4..00000000 --- a/docs/MessageCallbackMessage.md +++ /dev/null @@ -1,25 +0,0 @@ - - -# MessageCallbackMessage - -Message payload schema within a MessageCallback - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**id** | **String** | | | -|**owner** | **String** | | | -|**applicationId** | **String** | | | -|**time** | **OffsetDateTime** | | | -|**segmentCount** | **Integer** | | | -|**direction** | **MessageDirectionEnum** | | | -|**to** | **Set<String>** | | | -|**from** | **String** | | | -|**text** | **String** | | | -|**tag** | **String** | | [optional] | -|**media** | **List<URI>** | Optional media, applicable only for mms | [optional] | -|**priority** | **PriorityEnum** | | [optional] | - - - diff --git a/docs/MessageDeliveredCallback.md b/docs/MessageDeliveredCallback.md deleted file mode 100644 index 0983c27c..00000000 --- a/docs/MessageDeliveredCallback.md +++ /dev/null @@ -1,18 +0,0 @@ - - -# MessageDeliveredCallback - -Message Delivered Callback - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**time** | **OffsetDateTime** | | | -|**type** | **String** | | | -|**to** | **String** | | | -|**description** | **String** | | | -|**message** | [**MessageDeliveredCallbackMessage**](MessageDeliveredCallbackMessage.md) | | | - - - diff --git a/docs/MessageDeliveredCallbackMessage.md b/docs/MessageDeliveredCallbackMessage.md deleted file mode 100644 index 4a774285..00000000 --- a/docs/MessageDeliveredCallbackMessage.md +++ /dev/null @@ -1,25 +0,0 @@ - - -# MessageDeliveredCallbackMessage - -Message Delivered Callback Message Schema - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**id** | **String** | | | -|**owner** | **String** | | | -|**applicationId** | **String** | | | -|**time** | **OffsetDateTime** | | | -|**segmentCount** | **Integer** | | | -|**direction** | **MessageDirectionEnum** | | | -|**to** | **Set<String>** | | | -|**from** | **String** | | | -|**text** | **String** | | | -|**tag** | **String** | | | -|**media** | **List<URI>** | | [optional] | -|**priority** | **PriorityEnum** | | [optional] | - - - diff --git a/docs/MessageFailedCallback.md b/docs/MessageFailedCallback.md deleted file mode 100644 index 89e9d1c8..00000000 --- a/docs/MessageFailedCallback.md +++ /dev/null @@ -1,19 +0,0 @@ - - -# MessageFailedCallback - -Message Failed Callback - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**time** | **OffsetDateTime** | | | -|**type** | **String** | | | -|**to** | **String** | | | -|**description** | **String** | | | -|**message** | [**MessageFailedCallbackMessage**](MessageFailedCallbackMessage.md) | | | -|**errorCode** | **Integer** | | | - - - diff --git a/docs/MessageFailedCallbackMessage.md b/docs/MessageFailedCallbackMessage.md deleted file mode 100644 index 8b628350..00000000 --- a/docs/MessageFailedCallbackMessage.md +++ /dev/null @@ -1,25 +0,0 @@ - - -# MessageFailedCallbackMessage - -Message Failed Callback Message Schema - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**id** | **String** | | | -|**owner** | **String** | | | -|**applicationId** | **String** | | | -|**time** | **OffsetDateTime** | | | -|**segmentCount** | **Integer** | | | -|**direction** | **MessageDirectionEnum** | | | -|**to** | **Set<String>** | | | -|**from** | **String** | | | -|**text** | **String** | | | -|**tag** | **String** | | | -|**media** | **List<URI>** | | [optional] | -|**priority** | **PriorityEnum** | | [optional] | - - - diff --git a/docs/MessageRequest.md b/docs/MessageRequest.md index e64e4d64..5806b908 100644 --- a/docs/MessageRequest.md +++ b/docs/MessageRequest.md @@ -7,7 +7,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| -|**applicationId** | **String** | The ID of the Application your from number is associated with in the Bandwidth Phone Number Dashboard. | | +|**applicationId** | **String** | The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard. | | |**to** | **Set<String>** | The phone number(s) the message should be sent to in E164 format. | | |**from** | **String** | Either an alphanumeric sender ID or the sender's Bandwidth phone number in E.164 format, which must be hosted within Bandwidth and linked to the account that is generating the message. Alphanumeric Sender IDs can contain up to 11 characters, upper-case letters A-Z, lower-case letters a-z, numbers 0-9, space, hyphen -, plus +, underscore _ and ampersand &. Alphanumeric Sender IDs must contain at least one letter. | | |**text** | **String** | The contents of the text message. Must be 2048 characters or less. | [optional] | diff --git a/docs/MessageSendingCallback.md b/docs/MessageSendingCallback.md deleted file mode 100644 index 60bef107..00000000 --- a/docs/MessageSendingCallback.md +++ /dev/null @@ -1,18 +0,0 @@ - - -# MessageSendingCallback - -Message Sending Callback - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**time** | **OffsetDateTime** | | | -|**type** | **String** | | | -|**to** | **String** | | | -|**description** | **String** | | | -|**message** | [**MessageSendingCallbackMessage**](MessageSendingCallbackMessage.md) | | | - - - diff --git a/docs/MessageSendingCallbackMessage.md b/docs/MessageSendingCallbackMessage.md deleted file mode 100644 index 1d2bf5ae..00000000 --- a/docs/MessageSendingCallbackMessage.md +++ /dev/null @@ -1,25 +0,0 @@ - - -# MessageSendingCallbackMessage - -Message Sending Callback Message Schema - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**id** | **String** | | | -|**owner** | **String** | | | -|**applicationId** | **String** | | | -|**time** | **OffsetDateTime** | | | -|**segmentCount** | **Integer** | | | -|**direction** | **MessageDirectionEnum** | | | -|**to** | **Set<String>** | | | -|**from** | **String** | | | -|**text** | **String** | | | -|**tag** | **String** | | [optional] | -|**media** | **List<URI>** | | | -|**priority** | **PriorityEnum** | | [optional] | - - - diff --git a/docs/MessagesApi.md b/docs/MessagesApi.md index 641562b7..1eb88215 100644 --- a/docs/MessagesApi.md +++ b/docs/MessagesApi.md @@ -81,6 +81,7 @@ public class Example { | **401** | Unauthorized | - | | **403** | Forbidden | - | | **404** | Not Found | - | +| **405** | Method Not Allowed | - | | **406** | Not Acceptable | - | | **415** | Unsupported Media Type | - | | **429** | Too Many Requests | - | diff --git a/docs/MmsMessageContent.md b/docs/MmsMessageContent.md index 7263a845..96a0d210 100644 --- a/docs/MmsMessageContent.md +++ b/docs/MmsMessageContent.md @@ -8,7 +8,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| |**text** | **String** | The contents of the text message. Must be 2048 characters or less. | [optional] | -|**media** | **List<URI>** | A list of URLs to include as media attachments as part of the message. Each URL can be at most 4096 characters. | [optional] | +|**media** | [**List<MmsMessageContentFile>**](MmsMessageContentFile.md) | | [optional] | diff --git a/docs/MmsMessageContentFile.md b/docs/MmsMessageContentFile.md new file mode 100644 index 00000000..3518fcae --- /dev/null +++ b/docs/MmsMessageContentFile.md @@ -0,0 +1,13 @@ + + +# MmsMessageContentFile + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**fileUrl** | **URI** | The URL of a media attachment. For MMS, the API limits file size to 3.5MB. Specific carriers and channels may have a smaller limit that could cause a large file to fail, see [here](https://support.bandwidth.com/hc/en-us/articles/360014235473-What-are-the-MMS-file-size-limits) for more details. | | + + + diff --git a/docs/MultiChannelAction.md b/docs/MultiChannelAction.md index e95d4f4c..e895a477 100644 --- a/docs/MultiChannelAction.md +++ b/docs/MultiChannelAction.md @@ -9,7 +9,7 @@ |------------ | ------------- | ------------- | -------------| |**type** | **RbmActionTypeEnum** | | | |**text** | **String** | Displayed text for user to click | | -|**postBackData** | **byte[]** | Base64 payload the customer receives when the reply is clicked. | | +|**postbackData** | **byte[]** | Base64 payload the customer receives when the reply is clicked. | | |**phoneNumber** | **String** | The phone number to dial. Must be E164 format. | | |**latitude** | **Double** | The latitude of the location. | | |**longitude** | **Double** | The longitude of the location. | | diff --git a/docs/MultiChannelActionCalendarEvent.md b/docs/MultiChannelActionCalendarEvent.md index 3976a327..acf9dcf3 100644 --- a/docs/MultiChannelActionCalendarEvent.md +++ b/docs/MultiChannelActionCalendarEvent.md @@ -9,7 +9,7 @@ |------------ | ------------- | ------------- | -------------| |**type** | **RbmActionTypeEnum** | | | |**text** | **String** | Displayed text for user to click | | -|**postBackData** | **byte[]** | Base64 payload the customer receives when the reply is clicked. | | +|**postbackData** | **byte[]** | Base64 payload the customer receives when the reply is clicked. | | |**title** | **String** | The title of the event. | | |**startTime** | **OffsetDateTime** | The start time of the event. | | |**endTime** | **OffsetDateTime** | The end time of the event. | | diff --git a/docs/MultiChannelApi.md b/docs/MultiChannelApi.md index 065905ff..5a6e5307 100644 --- a/docs/MultiChannelApi.md +++ b/docs/MultiChannelApi.md @@ -80,6 +80,7 @@ public class Example { | **401** | Unauthorized | - | | **403** | Forbidden | - | | **404** | Not Found | - | +| **405** | Method Not Allowed | - | | **406** | Not Acceptable | - | | **415** | Unsupported Media Type | - | | **429** | Too Many Requests | - | diff --git a/docs/MultiChannelCallbackData.md b/docs/MultiChannelCallbackData.md deleted file mode 100644 index c9326865..00000000 --- a/docs/MultiChannelCallbackData.md +++ /dev/null @@ -1,17 +0,0 @@ - - -# MultiChannelCallbackData - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**time** | **OffsetDateTime** | The time of the callback event. | [optional] | -|**type** | **MultiChannelStatusEnum** | | [optional] | -|**to** | **String** | The phone number the message should be sent to in E164 format. | [optional] | -|**description** | **String** | | [optional] | -|**message** | [**MultiChannelMessageCallbackData**](MultiChannelMessageCallbackData.md) | | [optional] | - - - diff --git a/docs/MultiChannelChannelListObjectContent.md b/docs/MultiChannelChannelListObjectContent.md index ec331be4..58b1c5f5 100644 --- a/docs/MultiChannelChannelListObjectContent.md +++ b/docs/MultiChannelChannelListObjectContent.md @@ -10,7 +10,7 @@ The content of the message. |------------ | ------------- | ------------- | -------------| |**text** | **String** | The contents of the text message. Must be 2048 characters or less. | | |**suggestions** | [**List<MultiChannelAction>**](MultiChannelAction.md) | An array of suggested actions for the recipient. | [optional] | -|**media** | **List<URI>** | A list of URLs to include as media attachments as part of the message. Each URL can be at most 4096 characters. | | +|**media** | [**List<MmsMessageContentFile>**](MmsMessageContentFile.md) | | | |**orientation** | **StandaloneCardOrientationEnum** | | | |**thumbnailImageAlignment** | **ThumbnailAlignmentEnum** | | | |**cardContent** | [**RbmCardContent**](RbmCardContent.md) | | | diff --git a/docs/MultiChannelError.md b/docs/MultiChannelError.md new file mode 100644 index 00000000..8be2f709 --- /dev/null +++ b/docs/MultiChannelError.md @@ -0,0 +1,15 @@ + + +# MultiChannelError + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**links** | [**List<Link>**](Link.md) | | [optional] | +|**data** | **Object** | | [optional] | +|**errors** | [**List<ErrorObject>**](ErrorObject.md) | | [optional] | + + + diff --git a/docs/MultiChannelMessageCallbackData.md b/docs/MultiChannelMessageCallbackData.md deleted file mode 100644 index 1c4ece86..00000000 --- a/docs/MultiChannelMessageCallbackData.md +++ /dev/null @@ -1,20 +0,0 @@ - - -# MultiChannelMessageCallbackData - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**messageId** | **String** | The ID of the message. | [optional] | -|**status** | **MultiChannelStatusEnum** | | [optional] | -|**direction** | **MultiChannelMessageDirectionEnum** | | [optional] | -|**from** | **String** | The sender ID of the message. This could be an alphanumeric sender ID. | [optional] | -|**to** | **String** | The phone number the message should be sent to in E164 format. | [optional] | -|**applicationId** | **String** | The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard. | [optional] | -|**channel** | **MultiChannelMessageChannelEnum** | | [optional] | -|**tag** | **String** | A custom string that will be included in callback events of the message. Max 1024 characters. | [optional] | - - - diff --git a/docs/MultiChannelMessageContent.md b/docs/MultiChannelMessageContent.md new file mode 100644 index 00000000..906ede51 --- /dev/null +++ b/docs/MultiChannelMessageContent.md @@ -0,0 +1,15 @@ + + +# MultiChannelMessageContent + +The structure of the content field of a multichannel message. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**text** | **String** | | [optional] | +|**media** | [**RbmMessageContentFile**](RbmMessageContentFile.md) | | [optional] | + + + diff --git a/docs/MultiChannelMessageData.md b/docs/MultiChannelMessageData.md deleted file mode 100644 index 79f9c1b0..00000000 --- a/docs/MultiChannelMessageData.md +++ /dev/null @@ -1,21 +0,0 @@ - - -# MultiChannelMessageData - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**messageId** | **String** | The ID of the message. | [optional] | -|**status** | **MultiChannelStatusEnum** | | [optional] | -|**time** | **OffsetDateTime** | The time the message was received by the Bandwidth API. | [optional] | -|**direction** | **MultiChannelMessageDirectionEnum** | | [optional] | -|**from** | **String** | The sender ID of the message. This could be an alphanumeric sender ID. | [optional] | -|**to** | **String** | The phone number the message should be sent to in E164 format. | [optional] | -|**applicationId** | **String** | The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard. | [optional] | -|**channel** | **MultiChannelMessageChannelEnum** | | [optional] | -|**tag** | **String** | A custom string that will be included in callback events of the message. Max 1024 characters. | [optional] | - - - diff --git a/docs/MultiChannelMessageDirectionEnum.md b/docs/MultiChannelMessageDirectionEnum.md deleted file mode 100644 index fb2fb7ed..00000000 --- a/docs/MultiChannelMessageDirectionEnum.md +++ /dev/null @@ -1,13 +0,0 @@ - - -# MultiChannelMessageDirectionEnum - -## Enum - - -* `INBOUND` (value: `"INBOUND"`) - -* `OUTBOUND` (value: `"OUTBOUND"`) - - - diff --git a/docs/MultiChannelMessageResponseData.md b/docs/MultiChannelMessageResponseData.md new file mode 100644 index 00000000..34171831 --- /dev/null +++ b/docs/MultiChannelMessageResponseData.md @@ -0,0 +1,21 @@ + + +# MultiChannelMessageResponseData + +The data returned in a multichannel message response. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**messageId** | **String** | The ID of the message. | | +|**time** | **OffsetDateTime** | The time the message was received by the Bandwidth API. | | +|**direction** | **MessageDirectionEnum** | | | +|**to** | **Set<String>** | The destination phone number(s) of the message, in E164 format. | | +|**channelList** | [**List<MultiChannelMessageResponseDataChannelListInner>**](MultiChannelMessageResponseDataChannelListInner.md) | A list of message bodies. The messages will be attempted in the order they are listed. Once a message sends successfully, the others will be ignored. | | +|**tag** | **String** | A custom string that will be included in callback events of the message. Max 1024 characters. | [optional] | +|**priority** | **PriorityEnum** | | [optional] | +|**expiration** | **OffsetDateTime** | A string with the date/time value that the message will automatically expire by. This must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. Must be a date-time in the future. | [optional] | + + + diff --git a/docs/MultiChannelMessageResponseDataChannelListInner.md b/docs/MultiChannelMessageResponseDataChannelListInner.md new file mode 100644 index 00000000..d26414a8 --- /dev/null +++ b/docs/MultiChannelMessageResponseDataChannelListInner.md @@ -0,0 +1,17 @@ + + +# MultiChannelMessageResponseDataChannelListInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**from** | **String** | The sender ID of the message. This could be an alphanumeric sender ID. | | +|**applicationId** | **String** | The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard. | | +|**channel** | **MultiChannelMessageChannelEnum** | | | +|**content** | [**MultiChannelChannelListObjectContent**](MultiChannelChannelListObjectContent.md) | | | +|**owner** | **String** | The Bandwidth senderId associated with the message. Identical to 'from'. | | + + + diff --git a/docs/MultiChannelStatusEnum.md b/docs/MultiChannelStatusEnum.md deleted file mode 100644 index 92a12012..00000000 --- a/docs/MultiChannelStatusEnum.md +++ /dev/null @@ -1,17 +0,0 @@ - - -# MultiChannelStatusEnum - -## Enum - - -* `QUEUED` (value: `"QUEUED"`) - -* `SENDING` (value: `"SENDING"`) - -* `DELIVERED` (value: `"DELIVERED"`) - -* `FAILED` (value: `"FAILED"`) - - - diff --git a/docs/PublishPermissionsEnum.md b/docs/PublishPermissionsEnum.md deleted file mode 100644 index 4261c2be..00000000 --- a/docs/PublishPermissionsEnum.md +++ /dev/null @@ -1,13 +0,0 @@ - - -# PublishPermissionsEnum - -## Enum - - -* `AUDIO` (value: `"AUDIO"`) - -* `VIDEO` (value: `"VIDEO"`) - - - diff --git a/docs/RbmActionBase.md b/docs/RbmActionBase.md index dc89fee0..33aa0670 100644 --- a/docs/RbmActionBase.md +++ b/docs/RbmActionBase.md @@ -9,7 +9,7 @@ |------------ | ------------- | ------------- | -------------| |**type** | **RbmActionTypeEnum** | | | |**text** | **String** | Displayed text for user to click | | -|**postBackData** | **byte[]** | Base64 payload the customer receives when the reply is clicked. | | +|**postbackData** | **byte[]** | Base64 payload the customer receives when the reply is clicked. | | diff --git a/docs/RbmActionDial.md b/docs/RbmActionDial.md index 20385ee3..617d607a 100644 --- a/docs/RbmActionDial.md +++ b/docs/RbmActionDial.md @@ -9,7 +9,7 @@ |------------ | ------------- | ------------- | -------------| |**type** | **RbmActionTypeEnum** | | | |**text** | **String** | Displayed text for user to click | | -|**postBackData** | **byte[]** | Base64 payload the customer receives when the reply is clicked. | | +|**postbackData** | **byte[]** | Base64 payload the customer receives when the reply is clicked. | | |**phoneNumber** | **String** | The phone number to dial. Must be E164 format. | | diff --git a/docs/RbmActionOpenUrl.md b/docs/RbmActionOpenUrl.md index c2b1ef1c..5f97ed6a 100644 --- a/docs/RbmActionOpenUrl.md +++ b/docs/RbmActionOpenUrl.md @@ -9,7 +9,7 @@ |------------ | ------------- | ------------- | -------------| |**type** | **RbmActionTypeEnum** | | | |**text** | **String** | Displayed text for user to click | | -|**postBackData** | **byte[]** | Base64 payload the customer receives when the reply is clicked. | | +|**postbackData** | **byte[]** | Base64 payload the customer receives when the reply is clicked. | | |**url** | **URI** | The URL to open in browser. | | diff --git a/docs/RbmActionViewLocation.md b/docs/RbmActionViewLocation.md index 4d4b675d..dd57d3f8 100644 --- a/docs/RbmActionViewLocation.md +++ b/docs/RbmActionViewLocation.md @@ -9,7 +9,7 @@ |------------ | ------------- | ------------- | -------------| |**type** | **RbmActionTypeEnum** | | | |**text** | **String** | Displayed text for user to click | | -|**postBackData** | **byte[]** | Base64 payload the customer receives when the reply is clicked. | | +|**postbackData** | **byte[]** | Base64 payload the customer receives when the reply is clicked. | | |**latitude** | **Double** | The latitude of the location. | | |**longitude** | **Double** | The longitude of the location. | | |**label** | **String** | The label of the location. | [optional] | diff --git a/docs/RbmLocationResponse.md b/docs/RbmLocationResponse.md new file mode 100644 index 00000000..8e799a08 --- /dev/null +++ b/docs/RbmLocationResponse.md @@ -0,0 +1,14 @@ + + +# RbmLocationResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**latitude** | **Double** | The latitude of the client's location. | [optional] | +|**longitude** | **Double** | The longitude of the client's location. | [optional] | + + + diff --git a/docs/RbmSuggestionResponse.md b/docs/RbmSuggestionResponse.md new file mode 100644 index 00000000..e718ac21 --- /dev/null +++ b/docs/RbmSuggestionResponse.md @@ -0,0 +1,14 @@ + + +# RbmSuggestionResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**text** | **String** | The text associated with the suggestion response. | [optional] | +|**postbackData** | **byte[]** | Base64 payload the customer receives when the reply is clicked. | [optional] | + + + diff --git a/docs/RequestError.md b/docs/RequestError.md deleted file mode 100644 index 7c081aa3..00000000 --- a/docs/RequestError.md +++ /dev/null @@ -1,14 +0,0 @@ - - -# RequestError - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**error** | **String** | A message describing the error with your request. | [optional] | -|**requestId** | **String** | The associated requestId from AWS. | [optional] | - - - diff --git a/docs/StatusCallback.md b/docs/StatusCallback.md new file mode 100644 index 00000000..91481223 --- /dev/null +++ b/docs/StatusCallback.md @@ -0,0 +1,21 @@ + + +# StatusCallback + +Represents a status callback for an outbound MT SMS or MMS or RBM message. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**time** | **OffsetDateTime** | | | +|**eventTime** | **OffsetDateTime** | Represents the time at which the message was read, for `message-read` callbacks. | [optional] | +|**type** | **StatusCallbackTypeEnum** | | | +|**to** | **String** | The destination phone number the message was sent to. For status callbacks, this the the Bandwidth user's client phone number. | | +|**description** | **String** | A detailed description of the event described by the callback. | | +|**message** | [**StatusCallbackMessage**](StatusCallbackMessage.md) | | | +|**errorCode** | **Integer** | Optional error code, applicable only when type is `message-failed`. | [optional] | +|**carrierName** | **String** | The name of the Authorized Message Provider (AMP) that handled this message. In the US, this is the carrier that the message was sent to. This field is present only when this account feature has been enabled. | [optional] | + + + diff --git a/docs/StatusCallbackMessage.md b/docs/StatusCallbackMessage.md new file mode 100644 index 00000000..e1f61579 --- /dev/null +++ b/docs/StatusCallbackMessage.md @@ -0,0 +1,26 @@ + + +# StatusCallbackMessage + +Message payload schema within a callback + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **String** | A unique identifier of the message. | | +|**owner** | **String** | The Bandwidth phone number or alphanumeric identifier associated with the message. | | +|**applicationId** | **String** | The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard. | | +|**time** | **OffsetDateTime** | | | +|**segmentCount** | **Integer** | The number of segments the user's message is broken into before sending over carrier networks. | | +|**direction** | **MessageDirectionEnum** | | | +|**to** | **Set<String>** | The phone number recipients of the message. | | +|**from** | **String** | The Bandwidth phone number or alphanumeric identifier the message was sent from. | | +|**text** | **String** | | [optional] | +|**tag** | **String** | A custom string that will be included in callback events of the message. Max 1024 characters. | [optional] | +|**media** | **List<URI>** | Optional media, not applicable for sms | [optional] | +|**priority** | **PriorityEnum** | | [optional] | +|**channel** | **MultiChannelMessageChannelEnum** | | [optional] | + + + diff --git a/docs/CallbackTypeEnum.md b/docs/StatusCallbackTypeEnum.md similarity index 69% rename from docs/CallbackTypeEnum.md rename to docs/StatusCallbackTypeEnum.md index e9e2b4f2..6323da6f 100644 --- a/docs/CallbackTypeEnum.md +++ b/docs/StatusCallbackTypeEnum.md @@ -1,17 +1,17 @@ -# CallbackTypeEnum +# StatusCallbackTypeEnum ## Enum -* `RECEIVED` (value: `"message-received"`) - * `SENDING` (value: `"message-sending"`) * `DELIVERED` (value: `"message-delivered"`) * `FAILED` (value: `"message-failed"`) +* `READ` (value: `"message-read"`) + diff --git a/docs/Tag.md b/docs/Tag.md deleted file mode 100644 index 44fd74fd..00000000 --- a/docs/Tag.md +++ /dev/null @@ -1,14 +0,0 @@ - - -# Tag - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**key** | **String** | | [optional] | -|**value** | **String** | | [optional] | - - - diff --git a/docs/TfvStatusWithNoSubmissionInfo.md b/docs/TfvStatusWithNoSubmissionInfo.md deleted file mode 100644 index 28d46044..00000000 --- a/docs/TfvStatusWithNoSubmissionInfo.md +++ /dev/null @@ -1,19 +0,0 @@ - - -# 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 deleted file mode 100644 index 4f8ff296..00000000 --- a/docs/TfvStatusWithSubmissionInfo.md +++ /dev/null @@ -1,20 +0,0 @@ - - -# 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/TollFreeVerificationApi.md b/docs/TollFreeVerificationApi.md index ac7830cb..5f187578 100644 --- a/docs/TollFreeVerificationApi.md +++ b/docs/TollFreeVerificationApi.md @@ -5,6 +5,7 @@ All URIs are relative to *http://localhost* | Method | HTTP request | Description | |------------- | ------------- | -------------| | [**createWebhookSubscription**](TollFreeVerificationApi.md#createWebhookSubscription) | **POST** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions | Create Webhook Subscription | +| [**deleteVerificationRequest**](TollFreeVerificationApi.md#deleteVerificationRequest) | **DELETE** /accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification | Delete a Toll-Free Verification Submission | | [**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 | @@ -92,6 +93,83 @@ public class Example { | **500** | Internal Server Error | - | | **503** | Service Unavailable | - | + +# **deleteVerificationRequest** +> deleteVerificationRequest(accountId, phoneNumber) + +Delete a Toll-Free Verification Submission + +Delete a toll-free verification submission for a toll-free 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. + String phoneNumber = "+18885555555"; // String | Valid Toll-Free telephone number in E.164 format. + try { + apiInstance.deleteVerificationRequest(accountId, phoneNumber); + } catch (ApiException e) { + System.err.println("Exception when calling TollFreeVerificationApi#deleteVerificationRequest"); + 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 + +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 | - | + # **deleteWebhookSubscription** > deleteWebhookSubscription(accountId, id) diff --git a/docs/TranscriptionList.md b/docs/TranscriptionList.md deleted file mode 100644 index 0e83feba..00000000 --- a/docs/TranscriptionList.md +++ /dev/null @@ -1,13 +0,0 @@ - - -# TranscriptionList - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**transcripts** | [**List<Transcription>**](Transcription.md) | | [optional] | - - - diff --git a/docs/TranscriptionMetadata.md b/docs/TranscriptionMetadata.md deleted file mode 100644 index 115f86da..00000000 --- a/docs/TranscriptionMetadata.md +++ /dev/null @@ -1,17 +0,0 @@ - - -# TranscriptionMetadata - -If the recording was transcribed, metadata about the transcription - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**id** | **String** | The unique transcription ID | [optional] | -|**status** | **String** | The current status of the process. For recording, current possible values are 'processing', 'partial', 'complete', 'deleted', and 'error'. For transcriptions, current possible values are 'none', 'processing', 'available', 'error', 'timeout', 'file-size-too-big', and 'file-size-too-small'. Additional states may be added in the future, so your application must be tolerant of unknown values. | [optional] | -|**completedTime** | **String** | The time that the transcription was completed | [optional] | -|**url** | **URI** | The URL of the [transcription](#operation/getCallTranscription) | [optional] | - - - diff --git a/docs/UnauthorizedRequest.md b/docs/UnauthorizedRequest.md deleted file mode 100644 index f14c39e9..00000000 --- a/docs/UnauthorizedRequest.md +++ /dev/null @@ -1,13 +0,0 @@ - - -# UnauthorizedRequest - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**message** | **String** | Unauthorized | [optional] | - - - diff --git a/src/main/java/com/bandwidth/sdk/JSON.java b/src/main/java/com/bandwidth/sdk/JSON.java index f5f0ef06..90740687 100644 --- a/src/main/java/com/bandwidth/sdk/JSON.java +++ b/src/main/java/com/bandwidth/sdk/JSON.java @@ -58,6 +58,24 @@ public class JSON { @SuppressWarnings("unchecked") public static GsonBuilder createGson() { GsonFireBuilder fireBuilder = new GsonFireBuilder() + .registerTypeSelector(com.bandwidth.sdk.model.Callback.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("message-delivered", com.bandwidth.sdk.model.StatusCallback.class); + classByDiscriminatorValue.put("message-failed", com.bandwidth.sdk.model.StatusCallback.class); + classByDiscriminatorValue.put("message-read", com.bandwidth.sdk.model.StatusCallback.class); + classByDiscriminatorValue.put("message-received", com.bandwidth.sdk.model.InboundCallback.class); + classByDiscriminatorValue.put("message-sent", com.bandwidth.sdk.model.StatusCallback.class); + classByDiscriminatorValue.put("request-location-response", com.bandwidth.sdk.model.InboundCallback.class); + classByDiscriminatorValue.put("suggestion-response", com.bandwidth.sdk.model.InboundCallback.class); + classByDiscriminatorValue.put("inboundCallback", com.bandwidth.sdk.model.InboundCallback.class); + classByDiscriminatorValue.put("statusCallback", com.bandwidth.sdk.model.StatusCallback.class); + classByDiscriminatorValue.put("callback", com.bandwidth.sdk.model.Callback.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) .registerTypeSelector(com.bandwidth.sdk.model.MultiChannelAction.class, new TypeSelector() { @Override public Class getClassForElement(JsonElement readElement) { @@ -125,6 +143,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.CallTranscription.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.CallTranscriptionMetadata.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.CallTranscriptionResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.Callback.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.CodeRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.Conference.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.ConferenceCompletedCallback.CustomTypeAdapterFactory()); @@ -141,15 +160,17 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.CreateLookupResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.CreateMessageRequestError.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.CreateMultiChannelMessageResponse.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.DeferredResult.CustomTypeAdapterFactory()); 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.ErrorObject.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.ErrorSource.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.InboundCallback.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.InboundCallbackMessage.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.InitiateCallback.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.Link.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.LinksObject.CustomTypeAdapterFactory()); @@ -162,8 +183,6 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MachineDetectionResult.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.Media.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.Message.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MessageCallback.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MessageCallbackMessage.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MessageRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MessagesList.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MessagingCodeResponse.CustomTypeAdapterFactory()); @@ -172,14 +191,16 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri 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.MmsMessageContent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MmsMessageContentFile.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MultiChannelAction.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MultiChannelActionCalendarEvent.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MultiChannelCallbackData.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MultiChannelChannelListObject.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MultiChannelChannelListObjectContent.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MultiChannelMessageCallbackData.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MultiChannelMessageData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MultiChannelError.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MultiChannelMessageContent.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MultiChannelMessageRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MultiChannelMessageResponseData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MultiChannelMessageResponseDataChannelListInner.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.RbmActionBase.CustomTypeAdapterFactory()); @@ -188,18 +209,22 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RbmActionViewLocation.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RbmCardContent.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RbmCardContentMedia.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RbmLocationResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RbmMessageCarouselCard.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RbmMessageContentFile.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RbmMessageContentRichCard.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RbmMessageContentText.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RbmMessageMedia.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RbmStandaloneCard.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RbmSuggestionResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RecordingAvailableCallback.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RecordingCompleteCallback.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RecordingTranscriptionMetadata.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RecordingTranscriptions.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RedirectCallback.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.SmsMessageContent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.StatusCallback.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.StatusCallbackMessage.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.StirShaken.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.TelephoneNumber.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.TfvBasicAuthentication.CustomTypeAdapterFactory()); diff --git a/src/main/java/com/bandwidth/sdk/api/MessagesApi.java b/src/main/java/com/bandwidth/sdk/api/MessagesApi.java index bd4db0c3..3757c77d 100644 --- a/src/main/java/com/bandwidth/sdk/api/MessagesApi.java +++ b/src/main/java/com/bandwidth/sdk/api/MessagesApi.java @@ -95,6 +95,7 @@ public void setCustomBaseUrl(String customBaseUrl) { 401 Unauthorized - 403 Forbidden - 404 Not Found - + 405 Method Not Allowed - 406 Not Acceptable - 415 Unsupported Media Type - 429 Too Many Requests - @@ -179,6 +180,7 @@ private okhttp3.Call createMessageValidateBeforeCall(String accountId, MessageRe 401 Unauthorized - 403 Forbidden - 404 Not Found - + 405 Method Not Allowed - 406 Not Acceptable - 415 Unsupported Media Type - 429 Too Many Requests - @@ -206,6 +208,7 @@ public Message createMessage(String accountId, MessageRequest messageRequest) th 401 Unauthorized - 403 Forbidden - 404 Not Found - + 405 Method Not Allowed - 406 Not Acceptable - 415 Unsupported Media Type - 429 Too Many Requests - @@ -235,6 +238,7 @@ public ApiResponse createMessageWithHttpInfo(String accountId, MessageR 401 Unauthorized - 403 Forbidden - 404 Not Found - + 405 Method Not Allowed - 406 Not Acceptable - 415 Unsupported Media Type - 429 Too Many Requests - diff --git a/src/main/java/com/bandwidth/sdk/api/MultiChannelApi.java b/src/main/java/com/bandwidth/sdk/api/MultiChannelApi.java index cfc0c59e..e7768696 100644 --- a/src/main/java/com/bandwidth/sdk/api/MultiChannelApi.java +++ b/src/main/java/com/bandwidth/sdk/api/MultiChannelApi.java @@ -27,9 +27,8 @@ import java.io.IOException; -import com.bandwidth.sdk.model.CreateMessageRequestError; import com.bandwidth.sdk.model.CreateMultiChannelMessageResponse; -import com.bandwidth.sdk.model.MessagingRequestError; +import com.bandwidth.sdk.model.MultiChannelError; import com.bandwidth.sdk.model.MultiChannelMessageRequest; import java.lang.reflect.Type; @@ -91,6 +90,7 @@ public void setCustomBaseUrl(String customBaseUrl) { 401 Unauthorized - 403 Forbidden - 404 Not Found - + 405 Method Not Allowed - 406 Not Acceptable - 415 Unsupported Media Type - 429 Too Many Requests - @@ -175,6 +175,7 @@ private okhttp3.Call createMultiChannelMessageValidateBeforeCall(String accountI 401 Unauthorized - 403 Forbidden - 404 Not Found - + 405 Method Not Allowed - 406 Not Acceptable - 415 Unsupported Media Type - 429 Too Many Requests - @@ -202,6 +203,7 @@ public CreateMultiChannelMessageResponse createMultiChannelMessage(String accoun 401 Unauthorized - 403 Forbidden - 404 Not Found - + 405 Method Not Allowed - 406 Not Acceptable - 415 Unsupported Media Type - 429 Too Many Requests - @@ -231,6 +233,7 @@ public ApiResponse createMultiChannelMessageW 401 Unauthorized - 403 Forbidden - 404 Not Found - + 405 Method Not Allowed - 406 Not Acceptable - 415 Unsupported Media Type - 429 Too Many Requests - diff --git a/src/main/java/com/bandwidth/sdk/api/TollFreeVerificationApi.java b/src/main/java/com/bandwidth/sdk/api/TollFreeVerificationApi.java index dc1a4c7a..d2208831 100644 --- a/src/main/java/com/bandwidth/sdk/api/TollFreeVerificationApi.java +++ b/src/main/java/com/bandwidth/sdk/api/TollFreeVerificationApi.java @@ -247,6 +247,171 @@ public okhttp3.Call createWebhookSubscriptionAsync(String accountId, WebhookSubs localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for deleteVerificationRequest + * @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
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 deleteVerificationRequestCall(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, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteVerificationRequestValidateBeforeCall(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 deleteVerificationRequest(Async)"); + } + + // verify the required parameter 'phoneNumber' is set + if (phoneNumber == null) { + throw new ApiException("Missing the required parameter 'phoneNumber' when calling deleteVerificationRequest(Async)"); + } + + return deleteVerificationRequestCall(accountId, phoneNumber, _callback); + + } + + /** + * Delete a Toll-Free Verification Submission + * Delete a toll-free verification submission for a toll-free number. + * @param accountId Your Bandwidth Account ID. (required) + * @param phoneNumber Valid Toll-Free telephone number in E.164 format. (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 deleteVerificationRequest(String accountId, String phoneNumber) throws ApiException { + deleteVerificationRequestWithHttpInfo(accountId, phoneNumber); + } + + /** + * Delete a Toll-Free Verification Submission + * Delete a toll-free verification submission for a toll-free number. + * @param accountId Your Bandwidth Account ID. (required) + * @param phoneNumber Valid Toll-Free telephone number in E.164 format. (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 deleteVerificationRequestWithHttpInfo(String accountId, String phoneNumber) throws ApiException { + okhttp3.Call localVarCall = deleteVerificationRequestValidateBeforeCall(accountId, phoneNumber, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete a Toll-Free Verification Submission (asynchronously) + * Delete a toll-free verification submission for a toll-free number. + * @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
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 deleteVerificationRequestAsync(String accountId, String phoneNumber, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteVerificationRequestValidateBeforeCall(accountId, phoneNumber, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } /** * Build call for deleteWebhookSubscription * @param accountId Your Bandwidth Account ID. (required) diff --git a/src/main/java/com/bandwidth/sdk/model/Callback.java b/src/main/java/com/bandwidth/sdk/model/Callback.java new file mode 100644 index 00000000..afcf7f15 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/Callback.java @@ -0,0 +1,278 @@ +/* + * 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.InboundCallback; +import com.bandwidth.sdk.model.InboundCallbackMessage; +import com.bandwidth.sdk.model.InboundCallbackTypeEnum; +import com.bandwidth.sdk.model.StatusCallback; +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.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +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 com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import com.bandwidth.sdk.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") +public class Callback extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Callback.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Callback.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Callback' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterStatusCallback = gson.getDelegateAdapter(this, TypeToken.get(StatusCallback.class)); + final TypeAdapter adapterInboundCallback = gson.getDelegateAdapter(this, TypeToken.get(InboundCallback.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Callback value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `StatusCallback` + if (value.getActualInstance() instanceof StatusCallback) { + JsonElement element = adapterStatusCallback.toJsonTree((StatusCallback)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `InboundCallback` + if (value.getActualInstance() instanceof InboundCallback) { + JsonElement element = adapterInboundCallback.toJsonTree((InboundCallback)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: InboundCallback, StatusCallback"); + } + + @Override + public Callback read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize StatusCallback + try { + // validate the JSON object to see if any exception is thrown + StatusCallback.validateJsonElement(jsonElement); + actualAdapter = adapterStatusCallback; + match++; + log.log(Level.FINER, "Input data matches schema 'StatusCallback'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for StatusCallback failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'StatusCallback'", e); + } + // deserialize InboundCallback + try { + // validate the JSON object to see if any exception is thrown + InboundCallback.validateJsonElement(jsonElement); + actualAdapter = adapterInboundCallback; + match++; + log.log(Level.FINER, "Input data matches schema 'InboundCallback'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for InboundCallback failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'InboundCallback'", e); + } + + if (match == 1) { + Callback ret = new Callback(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for Callback: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public Callback() { + super("oneOf", Boolean.FALSE); + } + + public Callback(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("StatusCallback", StatusCallback.class); + schemas.put("InboundCallback", InboundCallback.class); + } + + @Override + public Map> getSchemas() { + return Callback.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * InboundCallback, StatusCallback + * + * It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof StatusCallback) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof InboundCallback) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be InboundCallback, StatusCallback"); + } + + /** + * Get the actual instance, which can be the following: + * InboundCallback, StatusCallback + * + * @return The actual instance (InboundCallback, StatusCallback) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `StatusCallback`. If the actual instance is not `StatusCallback`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `StatusCallback` + * @throws ClassCastException if the instance is not `StatusCallback` + */ + public StatusCallback getStatusCallback() throws ClassCastException { + return (StatusCallback)super.getActualInstance(); + } + + /** + * Get the actual instance of `InboundCallback`. If the actual instance is not `InboundCallback`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `InboundCallback` + * @throws ClassCastException if the instance is not `InboundCallback` + */ + public InboundCallback getInboundCallback() throws ClassCastException { + return (InboundCallback)super.getActualInstance(); + } + + /** + * 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 Callback + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with StatusCallback + try { + StatusCallback.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for StatusCallback failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with InboundCallback + try { + InboundCallback.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for InboundCallback failed with `%s`.", e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException(String.format("The JSON string is invalid for Callback with oneOf schemas: InboundCallback, StatusCallback. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of Callback given an JSON string + * + * @param jsonString JSON string + * @return An instance of Callback + * @throws IOException if the JSON string is invalid with respect to Callback + */ + public static Callback fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Callback.class); + } + + /** + * Convert an instance of Callback 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/CreateMultiChannelMessageResponse.java b/src/main/java/com/bandwidth/sdk/model/CreateMultiChannelMessageResponse.java index d8eaba08..b11b43ba 100644 --- a/src/main/java/com/bandwidth/sdk/model/CreateMultiChannelMessageResponse.java +++ b/src/main/java/com/bandwidth/sdk/model/CreateMultiChannelMessageResponse.java @@ -16,7 +16,7 @@ import java.util.Objects; import com.bandwidth.sdk.model.ErrorObject; import com.bandwidth.sdk.model.Link; -import com.bandwidth.sdk.model.MultiChannelMessageData; +import com.bandwidth.sdk.model.MultiChannelMessageResponseData; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -63,7 +63,7 @@ public class CreateMultiChannelMessageResponse { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) @javax.annotation.Nullable - private MultiChannelMessageData data; + private MultiChannelMessageResponseData data; public static final String SERIALIZED_NAME_ERRORS = "errors"; @SerializedName(SERIALIZED_NAME_ERRORS) @@ -100,7 +100,7 @@ public void setLinks(@javax.annotation.Nullable List links) { } - public CreateMultiChannelMessageResponse data(@javax.annotation.Nullable MultiChannelMessageData data) { + public CreateMultiChannelMessageResponse data(@javax.annotation.Nullable MultiChannelMessageResponseData data) { this.data = data; return this; } @@ -110,11 +110,11 @@ public CreateMultiChannelMessageResponse data(@javax.annotation.Nullable MultiCh * @return data */ @javax.annotation.Nullable - public MultiChannelMessageData getData() { + public MultiChannelMessageResponseData getData() { return data; } - public void setData(@javax.annotation.Nullable MultiChannelMessageData data) { + public void setData(@javax.annotation.Nullable MultiChannelMessageResponseData data) { this.data = data; } @@ -278,7 +278,7 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } // validate the optional field `data` if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { - MultiChannelMessageData.validateJsonElement(jsonObj.get("data")); + MultiChannelMessageResponseData.validateJsonElement(jsonObj.get("data")); } if (jsonObj.get("errors") != null && !jsonObj.get("errors").isJsonNull()) { JsonArray jsonArrayerrors = jsonObj.getAsJsonArray("errors"); diff --git a/src/main/java/com/bandwidth/sdk/model/ErrorObject.java b/src/main/java/com/bandwidth/sdk/model/ErrorObject.java index 31d3271e..d15af07e 100644 --- a/src/main/java/com/bandwidth/sdk/model/ErrorObject.java +++ b/src/main/java/com/bandwidth/sdk/model/ErrorObject.java @@ -14,6 +14,7 @@ package com.bandwidth.sdk.model; import java.util.Objects; +import com.bandwidth.sdk.model.ErrorSource; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -50,54 +51,78 @@ */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") public class ErrorObject { - public static final String SERIALIZED_NAME_CODE = "code"; - @SerializedName(SERIALIZED_NAME_CODE) - @javax.annotation.Nullable - private String code; + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; - public static final String SERIALIZED_NAME_MESSAGE = "message"; - @SerializedName(SERIALIZED_NAME_MESSAGE) - @javax.annotation.Nullable - private String message; + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nonnull + private String description; + + public static final String SERIALIZED_NAME_SOURCE = "source"; + @SerializedName(SERIALIZED_NAME_SOURCE) + @javax.annotation.Nonnull + private ErrorSource source; public ErrorObject() { } - public ErrorObject code(@javax.annotation.Nullable String code) { - this.code = code; + public ErrorObject type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * A concise summary of the error used for categorization. + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull String type) { + this.type = type; + } + + + public ErrorObject description(@javax.annotation.Nonnull String description) { + this.description = description; return this; } /** - * Get code - * @return code + * A detailed explanation of the error. + * @return description */ - @javax.annotation.Nullable - public String getCode() { - return code; + @javax.annotation.Nonnull + public String getDescription() { + return description; } - public void setCode(@javax.annotation.Nullable String code) { - this.code = code; + public void setDescription(@javax.annotation.Nonnull String description) { + this.description = description; } - public ErrorObject message(@javax.annotation.Nullable String message) { - this.message = message; + public ErrorObject source(@javax.annotation.Nonnull ErrorSource source) { + this.source = source; return this; } /** - * Get message - * @return message + * Get source + * @return source */ - @javax.annotation.Nullable - public String getMessage() { - return message; + @javax.annotation.Nonnull + public ErrorSource getSource() { + return source; } - public void setMessage(@javax.annotation.Nullable String message) { - this.message = message; + public void setSource(@javax.annotation.Nonnull ErrorSource source) { + this.source = source; } /** @@ -155,22 +180,24 @@ public boolean equals(Object o) { return false; } ErrorObject errorObject = (ErrorObject) o; - return Objects.equals(this.code, errorObject.code) && - Objects.equals(this.message, errorObject.message)&& + return Objects.equals(this.type, errorObject.type) && + Objects.equals(this.description, errorObject.description) && + Objects.equals(this.source, errorObject.source)&& Objects.equals(this.additionalProperties, errorObject.additionalProperties); } @Override public int hashCode() { - return Objects.hash(code, message, additionalProperties); + return Objects.hash(type, description, source, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ErrorObject {\n"); - sb.append(" code: ").append(toIndentedString(code)).append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); @@ -194,11 +221,15 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet(); - openapiFields.add("code"); - openapiFields.add("message"); + openapiFields.add("type"); + openapiFields.add("description"); + openapiFields.add("source"); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("source"); } /** @@ -213,13 +244,22 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format("The required field(s) %s in ErrorObject is not found in the empty JSON string", ErrorObject.openapiRequiredFields.toString())); } } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ErrorObject.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("code") != null && !jsonObj.get("code").isJsonNull()) && !jsonObj.get("code").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); + if (!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("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + 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())); } + // validate the required field `source` + ErrorSource.validateJsonElement(jsonObj.get("source")); } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/src/main/java/com/bandwidth/sdk/model/ErrorSource.java b/src/main/java/com/bandwidth/sdk/model/ErrorSource.java new file mode 100644 index 00000000..dc26c1d4 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/ErrorSource.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; + +/** + * Specifies relevant sources of the error, if any. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") +public class ErrorSource { + public static final String SERIALIZED_NAME_PARAMETER = "parameter"; + @SerializedName(SERIALIZED_NAME_PARAMETER) + @javax.annotation.Nullable + private String parameter; + + public static final String SERIALIZED_NAME_FIELD = "field"; + @SerializedName(SERIALIZED_NAME_FIELD) + @javax.annotation.Nullable + private String field; + + public static final String SERIALIZED_NAME_HEADER = "header"; + @SerializedName(SERIALIZED_NAME_HEADER) + @javax.annotation.Nullable + private String header; + + public static final String SERIALIZED_NAME_REFERENCE = "reference"; + @SerializedName(SERIALIZED_NAME_REFERENCE) + @javax.annotation.Nullable + private String reference; + + public ErrorSource() { + } + + public ErrorSource parameter(@javax.annotation.Nullable String parameter) { + this.parameter = parameter; + return this; + } + + /** + * The relevant URI query parameter causing the error + * @return parameter + */ + @javax.annotation.Nullable + public String getParameter() { + return parameter; + } + + public void setParameter(@javax.annotation.Nullable String parameter) { + this.parameter = parameter; + } + + + public ErrorSource field(@javax.annotation.Nullable String field) { + this.field = field; + return this; + } + + /** + * The request body field that led to the error + * @return field + */ + @javax.annotation.Nullable + public String getField() { + return field; + } + + public void setField(@javax.annotation.Nullable String field) { + this.field = field; + } + + + public ErrorSource header(@javax.annotation.Nullable String header) { + this.header = header; + return this; + } + + /** + * The header field that contributed to the error + * @return header + */ + @javax.annotation.Nullable + public String getHeader() { + return header; + } + + public void setHeader(@javax.annotation.Nullable String header) { + this.header = header; + } + + + public ErrorSource reference(@javax.annotation.Nullable String reference) { + this.reference = reference; + return this; + } + + /** + * A resource ID or path linked to the error + * @return reference + */ + @javax.annotation.Nullable + public String getReference() { + return reference; + } + + public void setReference(@javax.annotation.Nullable String reference) { + this.reference = reference; + } + + /** + * 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 ErrorSource instance itself + */ + public ErrorSource 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; + } + ErrorSource errorSource = (ErrorSource) o; + return Objects.equals(this.parameter, errorSource.parameter) && + Objects.equals(this.field, errorSource.field) && + Objects.equals(this.header, errorSource.header) && + Objects.equals(this.reference, errorSource.reference)&& + Objects.equals(this.additionalProperties, errorSource.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(parameter, field, header, reference, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ErrorSource {\n"); + sb.append(" parameter: ").append(toIndentedString(parameter)).append("\n"); + sb.append(" field: ").append(toIndentedString(field)).append("\n"); + sb.append(" header: ").append(toIndentedString(header)).append("\n"); + sb.append(" reference: ").append(toIndentedString(reference)).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("parameter"); + openapiFields.add("field"); + openapiFields.add("header"); + openapiFields.add("reference"); + + // 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 ErrorSource + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ErrorSource.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ErrorSource is not found in the empty JSON string", ErrorSource.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("parameter") != null && !jsonObj.get("parameter").isJsonNull()) && !jsonObj.get("parameter").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `parameter` to be a primitive type in the JSON string but got `%s`", jsonObj.get("parameter").toString())); + } + if ((jsonObj.get("field") != null && !jsonObj.get("field").isJsonNull()) && !jsonObj.get("field").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `field` to be a primitive type in the JSON string but got `%s`", jsonObj.get("field").toString())); + } + if ((jsonObj.get("header") != null && !jsonObj.get("header").isJsonNull()) && !jsonObj.get("header").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `header` to be a primitive type in the JSON string but got `%s`", jsonObj.get("header").toString())); + } + if ((jsonObj.get("reference") != null && !jsonObj.get("reference").isJsonNull()) && !jsonObj.get("reference").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `reference` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reference").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ErrorSource.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ErrorSource' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ErrorSource.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ErrorSource 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 ErrorSource read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ErrorSource 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 ErrorSource given an JSON string + * + * @param jsonString JSON string + * @return An instance of ErrorSource + * @throws IOException if the JSON string is invalid with respect to ErrorSource + */ + public static ErrorSource fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ErrorSource.class); + } + + /** + * Convert an instance of ErrorSource 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/MessageCallback.java b/src/main/java/com/bandwidth/sdk/model/InboundCallback.java similarity index 75% rename from src/main/java/com/bandwidth/sdk/model/MessageCallback.java rename to src/main/java/com/bandwidth/sdk/model/InboundCallback.java index 8d44ecb3..e08a089c 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessageCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/InboundCallback.java @@ -14,8 +14,8 @@ package com.bandwidth.sdk.model; import java.util.Objects; -import com.bandwidth.sdk.model.CallbackTypeEnum; -import com.bandwidth.sdk.model.MessageCallbackMessage; +import com.bandwidth.sdk.model.InboundCallbackMessage; +import com.bandwidth.sdk.model.InboundCallbackTypeEnum; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -24,7 +24,6 @@ import java.io.IOException; import java.time.OffsetDateTime; import java.util.Arrays; -import org.openapitools.jackson.nullable.JsonNullable; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -50,10 +49,10 @@ import com.bandwidth.sdk.JSON; /** - * Message Callback Schema + * Represents an inbound callback. */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") -public class MessageCallback { +public class InboundCallback { public static final String SERIALIZED_NAME_TIME = "time"; @SerializedName(SERIALIZED_NAME_TIME) @javax.annotation.Nonnull @@ -62,7 +61,7 @@ public class MessageCallback { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nonnull - private CallbackTypeEnum type; + private InboundCallbackTypeEnum type; public static final String SERIALIZED_NAME_TO = "to"; @SerializedName(SERIALIZED_NAME_TO) @@ -77,22 +76,17 @@ public class MessageCallback { public static final String SERIALIZED_NAME_MESSAGE = "message"; @SerializedName(SERIALIZED_NAME_MESSAGE) @javax.annotation.Nonnull - private MessageCallbackMessage message; - - public static final String SERIALIZED_NAME_ERROR_CODE = "errorCode"; - @SerializedName(SERIALIZED_NAME_ERROR_CODE) - @javax.annotation.Nullable - private Integer errorCode; + private InboundCallbackMessage message; public static final String SERIALIZED_NAME_CARRIER_NAME = "carrierName"; @SerializedName(SERIALIZED_NAME_CARRIER_NAME) @javax.annotation.Nullable private String carrierName; - public MessageCallback() { + public InboundCallback() { } - public MessageCallback time(@javax.annotation.Nonnull OffsetDateTime time) { + public InboundCallback time(@javax.annotation.Nonnull OffsetDateTime time) { this.time = time; return this; } @@ -111,7 +105,7 @@ public void setTime(@javax.annotation.Nonnull OffsetDateTime time) { } - public MessageCallback type(@javax.annotation.Nonnull CallbackTypeEnum type) { + public InboundCallback type(@javax.annotation.Nonnull InboundCallbackTypeEnum type) { this.type = type; return this; } @@ -121,22 +115,22 @@ public MessageCallback type(@javax.annotation.Nonnull CallbackTypeEnum type) { * @return type */ @javax.annotation.Nonnull - public CallbackTypeEnum getType() { + public InboundCallbackTypeEnum getType() { return type; } - public void setType(@javax.annotation.Nonnull CallbackTypeEnum type) { + public void setType(@javax.annotation.Nonnull InboundCallbackTypeEnum type) { this.type = type; } - public MessageCallback to(@javax.annotation.Nonnull String to) { + public InboundCallback to(@javax.annotation.Nonnull String to) { this.to = to; return this; } /** - * Get to + * The destination phone number the message was sent to. For inbound callbacks, this is the Bandwidth number or alphanumeric identifier that received the message. * @return to */ @javax.annotation.Nonnull @@ -149,7 +143,7 @@ public void setTo(@javax.annotation.Nonnull String to) { } - public MessageCallback description(@javax.annotation.Nonnull String description) { + public InboundCallback description(@javax.annotation.Nonnull String description) { this.description = description; return this; } @@ -168,7 +162,7 @@ public void setDescription(@javax.annotation.Nonnull String description) { } - public MessageCallback message(@javax.annotation.Nonnull MessageCallbackMessage message) { + public InboundCallback message(@javax.annotation.Nonnull InboundCallbackMessage message) { this.message = message; return this; } @@ -178,41 +172,22 @@ public MessageCallback message(@javax.annotation.Nonnull MessageCallbackMessage * @return message */ @javax.annotation.Nonnull - public MessageCallbackMessage getMessage() { + public InboundCallbackMessage getMessage() { return message; } - public void setMessage(@javax.annotation.Nonnull MessageCallbackMessage message) { + public void setMessage(@javax.annotation.Nonnull InboundCallbackMessage message) { this.message = message; } - public MessageCallback errorCode(@javax.annotation.Nullable Integer errorCode) { - this.errorCode = errorCode; - return this; - } - - /** - * Optional error code, applicable only when type is `message-failed`. - * @return errorCode - */ - @javax.annotation.Nullable - public Integer getErrorCode() { - return errorCode; - } - - public void setErrorCode(@javax.annotation.Nullable Integer errorCode) { - this.errorCode = errorCode; - } - - - public MessageCallback carrierName(@javax.annotation.Nullable String carrierName) { + public InboundCallback carrierName(@javax.annotation.Nullable String carrierName) { this.carrierName = carrierName; return this; } /** - * The name of the Authorized Message Provider (AMP) that handled this message. In the US, this is the carrier that the message was sent to. + * The name of the Authorized Message Provider (AMP) that handled this message. In the US, this is the carrier that the message was sent to. This field is present only when this account feature has been enabled. * @return carrierName */ @javax.annotation.Nullable @@ -237,9 +212,9 @@ public void setCarrierName(@javax.annotation.Nullable String carrierName) { * * @param key name of the property * @param value value of the property - * @return the MessageCallback instance itself + * @return the InboundCallback instance itself */ - public MessageCallback putAdditionalProperty(String key, Object value) { + public InboundCallback putAdditionalProperty(String key, Object value) { if (this.additionalProperties == null) { this.additionalProperties = new HashMap(); } @@ -278,43 +253,30 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - MessageCallback messageCallback = (MessageCallback) o; - return Objects.equals(this.time, messageCallback.time) && - Objects.equals(this.type, messageCallback.type) && - Objects.equals(this.to, messageCallback.to) && - Objects.equals(this.description, messageCallback.description) && - Objects.equals(this.message, messageCallback.message) && - Objects.equals(this.errorCode, messageCallback.errorCode) && - Objects.equals(this.carrierName, messageCallback.carrierName)&& - Objects.equals(this.additionalProperties, messageCallback.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())); + InboundCallback inboundCallback = (InboundCallback) o; + return Objects.equals(this.time, inboundCallback.time) && + Objects.equals(this.type, inboundCallback.type) && + Objects.equals(this.to, inboundCallback.to) && + Objects.equals(this.description, inboundCallback.description) && + Objects.equals(this.message, inboundCallback.message) && + Objects.equals(this.carrierName, inboundCallback.carrierName)&& + Objects.equals(this.additionalProperties, inboundCallback.additionalProperties); } @Override public int hashCode() { - return Objects.hash(time, type, to, description, message, errorCode, carrierName, additionalProperties); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + return Objects.hash(time, type, to, description, message, carrierName, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class MessageCallback {\n"); + sb.append("class InboundCallback {\n"); sb.append(" time: ").append(toIndentedString(time)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" to: ").append(toIndentedString(to)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append(" errorCode: ").append(toIndentedString(errorCode)).append("\n"); sb.append(" carrierName: ").append(toIndentedString(carrierName)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); @@ -344,7 +306,6 @@ private String toIndentedString(Object o) { openapiFields.add("to"); openapiFields.add("description"); openapiFields.add("message"); - openapiFields.add("errorCode"); openapiFields.add("carrierName"); // a set of required properties/fields (JSON key names) @@ -360,24 +321,24 @@ private String toIndentedString(Object o) { * 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 MessageCallback + * @throws IOException if the JSON Element is invalid with respect to InboundCallback */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { - if (!MessageCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in MessageCallback is not found in the empty JSON string", MessageCallback.openapiRequiredFields.toString())); + if (!InboundCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in InboundCallback is not found in the empty JSON string", InboundCallback.openapiRequiredFields.toString())); } } // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : MessageCallback.openapiRequiredFields) { + for (String requiredField : InboundCallback.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 `type` - CallbackTypeEnum.validateJsonElement(jsonObj.get("type")); + InboundCallbackTypeEnum.validateJsonElement(jsonObj.get("type")); if (!jsonObj.get("to").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); } @@ -385,7 +346,7 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti 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())); } // validate the required field `message` - MessageCallbackMessage.validateJsonElement(jsonObj.get("message")); + InboundCallbackMessage.validateJsonElement(jsonObj.get("message")); if ((jsonObj.get("carrierName") != null && !jsonObj.get("carrierName").isJsonNull()) && !jsonObj.get("carrierName").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `carrierName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("carrierName").toString())); } @@ -395,16 +356,16 @@ public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!MessageCallback.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'MessageCallback' and its subtypes + if (!InboundCallback.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'InboundCallback' and its subtypes } final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(MessageCallback.class)); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(InboundCallback.class)); - return (TypeAdapter) new TypeAdapter() { + return (TypeAdapter) new TypeAdapter() { @Override - public void write(JsonWriter out, MessageCallback value) throws IOException { + public void write(JsonWriter out, InboundCallback value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); obj.remove("additionalProperties"); // serialize additional properties @@ -432,12 +393,12 @@ else if (entry.getValue() instanceof Character) } @Override - public MessageCallback read(JsonReader in) throws IOException { + public InboundCallback read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); JsonObject jsonObj = jsonElement.getAsJsonObject(); // store additional fields in the deserialized instance - MessageCallback instance = thisAdapter.fromJsonTree(jsonObj); + InboundCallback instance = thisAdapter.fromJsonTree(jsonObj); for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type @@ -464,18 +425,18 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } /** - * Create an instance of MessageCallback given an JSON string + * Create an instance of InboundCallback given an JSON string * * @param jsonString JSON string - * @return An instance of MessageCallback - * @throws IOException if the JSON string is invalid with respect to MessageCallback + * @return An instance of InboundCallback + * @throws IOException if the JSON string is invalid with respect to InboundCallback */ - public static MessageCallback fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, MessageCallback.class); + public static InboundCallback fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, InboundCallback.class); } /** - * Convert an instance of MessageCallback to an JSON string + * Convert an instance of InboundCallback to an JSON string * * @return JSON string */ diff --git a/src/main/java/com/bandwidth/sdk/model/InboundCallbackMessage.java b/src/main/java/com/bandwidth/sdk/model/InboundCallbackMessage.java new file mode 100644 index 00000000..09b62d76 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/InboundCallbackMessage.java @@ -0,0 +1,782 @@ +/* + * 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.MessageDirectionEnum; +import com.bandwidth.sdk.model.MultiChannelMessageChannelEnum; +import com.bandwidth.sdk.model.MultiChannelMessageContent; +import com.bandwidth.sdk.model.PriorityEnum; +import com.bandwidth.sdk.model.RbmLocationResponse; +import com.bandwidth.sdk.model.RbmSuggestionResponse; +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.net.URI; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; + +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; + +/** + * InboundCallbackMessage + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") +public class InboundCallbackMessage { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_OWNER = "owner"; + @SerializedName(SERIALIZED_NAME_OWNER) + @javax.annotation.Nonnull + private String owner; + + public static final String SERIALIZED_NAME_APPLICATION_ID = "applicationId"; + @SerializedName(SERIALIZED_NAME_APPLICATION_ID) + @javax.annotation.Nonnull + private String applicationId; + + public static final String SERIALIZED_NAME_TIME = "time"; + @SerializedName(SERIALIZED_NAME_TIME) + @javax.annotation.Nonnull + private OffsetDateTime time; + + public static final String SERIALIZED_NAME_SEGMENT_COUNT = "segmentCount"; + @SerializedName(SERIALIZED_NAME_SEGMENT_COUNT) + @javax.annotation.Nonnull + private Integer segmentCount; + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + @javax.annotation.Nonnull + private MessageDirectionEnum direction; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + @javax.annotation.Nonnull + private Set to = new LinkedHashSet<>(); + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + @javax.annotation.Nonnull + private String from; + + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + @javax.annotation.Nullable + private String text; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + @javax.annotation.Nullable + private String tag; + + public static final String SERIALIZED_NAME_MEDIA = "media"; + @SerializedName(SERIALIZED_NAME_MEDIA) + @javax.annotation.Nullable + private List media = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PRIORITY = "priority"; + @SerializedName(SERIALIZED_NAME_PRIORITY) + @javax.annotation.Nullable + private PriorityEnum priority; + + public static final String SERIALIZED_NAME_CHANNEL = "channel"; + @SerializedName(SERIALIZED_NAME_CHANNEL) + @javax.annotation.Nullable + private MultiChannelMessageChannelEnum channel; + + public static final String SERIALIZED_NAME_CONTENT = "content"; + @SerializedName(SERIALIZED_NAME_CONTENT) + @javax.annotation.Nullable + private MultiChannelMessageContent content; + + public static final String SERIALIZED_NAME_SUGGESTION_RESPONSE = "suggestionResponse"; + @SerializedName(SERIALIZED_NAME_SUGGESTION_RESPONSE) + @javax.annotation.Nullable + private RbmSuggestionResponse suggestionResponse; + + public static final String SERIALIZED_NAME_LOCATION_RESPONSE = "locationResponse"; + @SerializedName(SERIALIZED_NAME_LOCATION_RESPONSE) + @javax.annotation.Nullable + private RbmLocationResponse locationResponse; + + public InboundCallbackMessage() { + } + + public InboundCallbackMessage id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * A unique identifier of the message. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public InboundCallbackMessage owner(@javax.annotation.Nonnull String owner) { + this.owner = owner; + return this; + } + + /** + * The Bandwidth phone number or alphanumeric identifier associated with the message. + * @return owner + */ + @javax.annotation.Nonnull + public String getOwner() { + return owner; + } + + public void setOwner(@javax.annotation.Nonnull String owner) { + this.owner = owner; + } + + + public InboundCallbackMessage applicationId(@javax.annotation.Nonnull String applicationId) { + this.applicationId = applicationId; + return this; + } + + /** + * The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard. + * @return applicationId + */ + @javax.annotation.Nonnull + public String getApplicationId() { + return applicationId; + } + + public void setApplicationId(@javax.annotation.Nonnull String applicationId) { + this.applicationId = applicationId; + } + + + public InboundCallbackMessage time(@javax.annotation.Nonnull OffsetDateTime time) { + this.time = time; + return this; + } + + /** + * Get time + * @return time + */ + @javax.annotation.Nonnull + public OffsetDateTime getTime() { + return time; + } + + public void setTime(@javax.annotation.Nonnull OffsetDateTime time) { + this.time = time; + } + + + public InboundCallbackMessage segmentCount(@javax.annotation.Nonnull Integer segmentCount) { + this.segmentCount = segmentCount; + return this; + } + + /** + * The number of segments the user's message is broken into before sending over carrier networks. + * @return segmentCount + */ + @javax.annotation.Nonnull + public Integer getSegmentCount() { + return segmentCount; + } + + public void setSegmentCount(@javax.annotation.Nonnull Integer segmentCount) { + this.segmentCount = segmentCount; + } + + + public InboundCallbackMessage direction(@javax.annotation.Nonnull MessageDirectionEnum direction) { + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + */ + @javax.annotation.Nonnull + public MessageDirectionEnum getDirection() { + return direction; + } + + public void setDirection(@javax.annotation.Nonnull MessageDirectionEnum direction) { + this.direction = direction; + } + + + public InboundCallbackMessage to(@javax.annotation.Nonnull Set to) { + this.to = to; + return this; + } + + public InboundCallbackMessage addToItem(String toItem) { + if (this.to == null) { + this.to = new LinkedHashSet<>(); + } + this.to.add(toItem); + return this; + } + + /** + * The phone number recipients of the message. + * @return to + */ + @javax.annotation.Nonnull + public Set getTo() { + return to; + } + + public void setTo(@javax.annotation.Nonnull Set to) { + this.to = to; + } + + + public InboundCallbackMessage from(@javax.annotation.Nonnull String from) { + this.from = from; + return this; + } + + /** + * The Bandwidth phone number or alphanumeric identifier the message was sent from. + * @return from + */ + @javax.annotation.Nonnull + public String getFrom() { + return from; + } + + public void setFrom(@javax.annotation.Nonnull String from) { + this.from = from; + } + + + public InboundCallbackMessage text(@javax.annotation.Nullable String text) { + this.text = text; + return this; + } + + /** + * Get text + * @return text + */ + @javax.annotation.Nullable + public String getText() { + return text; + } + + public void setText(@javax.annotation.Nullable String text) { + this.text = text; + } + + + public InboundCallbackMessage tag(@javax.annotation.Nullable String tag) { + this.tag = tag; + return this; + } + + /** + * A custom string that will be included in callback events of the message. Max 1024 characters. + * @return tag + */ + @javax.annotation.Nullable + public String getTag() { + return tag; + } + + public void setTag(@javax.annotation.Nullable String tag) { + this.tag = tag; + } + + + public InboundCallbackMessage media(@javax.annotation.Nullable List media) { + this.media = media; + return this; + } + + public InboundCallbackMessage addMediaItem(URI mediaItem) { + if (this.media == null) { + this.media = new ArrayList<>(); + } + this.media.add(mediaItem); + return this; + } + + /** + * Optional media, not applicable for sms + * @return media + */ + @javax.annotation.Nullable + public List getMedia() { + return media; + } + + public void setMedia(@javax.annotation.Nullable List media) { + this.media = media; + } + + + public InboundCallbackMessage priority(@javax.annotation.Nullable PriorityEnum priority) { + this.priority = priority; + return this; + } + + /** + * Get priority + * @return priority + */ + @javax.annotation.Nullable + public PriorityEnum getPriority() { + return priority; + } + + public void setPriority(@javax.annotation.Nullable PriorityEnum priority) { + this.priority = priority; + } + + + public InboundCallbackMessage channel(@javax.annotation.Nullable MultiChannelMessageChannelEnum channel) { + this.channel = channel; + return this; + } + + /** + * Get channel + * @return channel + */ + @javax.annotation.Nullable + public MultiChannelMessageChannelEnum getChannel() { + return channel; + } + + public void setChannel(@javax.annotation.Nullable MultiChannelMessageChannelEnum channel) { + this.channel = channel; + } + + + public InboundCallbackMessage content(@javax.annotation.Nullable MultiChannelMessageContent content) { + this.content = content; + return this; + } + + /** + * Get content + * @return content + */ + @javax.annotation.Nullable + public MultiChannelMessageContent getContent() { + return content; + } + + public void setContent(@javax.annotation.Nullable MultiChannelMessageContent content) { + this.content = content; + } + + + public InboundCallbackMessage suggestionResponse(@javax.annotation.Nullable RbmSuggestionResponse suggestionResponse) { + this.suggestionResponse = suggestionResponse; + return this; + } + + /** + * Get suggestionResponse + * @return suggestionResponse + */ + @javax.annotation.Nullable + public RbmSuggestionResponse getSuggestionResponse() { + return suggestionResponse; + } + + public void setSuggestionResponse(@javax.annotation.Nullable RbmSuggestionResponse suggestionResponse) { + this.suggestionResponse = suggestionResponse; + } + + + public InboundCallbackMessage locationResponse(@javax.annotation.Nullable RbmLocationResponse locationResponse) { + this.locationResponse = locationResponse; + return this; + } + + /** + * Get locationResponse + * @return locationResponse + */ + @javax.annotation.Nullable + public RbmLocationResponse getLocationResponse() { + return locationResponse; + } + + public void setLocationResponse(@javax.annotation.Nullable RbmLocationResponse locationResponse) { + this.locationResponse = locationResponse; + } + + /** + * 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 InboundCallbackMessage instance itself + */ + public InboundCallbackMessage 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; + } + InboundCallbackMessage inboundCallbackMessage = (InboundCallbackMessage) o; + return Objects.equals(this.id, inboundCallbackMessage.id) && + Objects.equals(this.owner, inboundCallbackMessage.owner) && + Objects.equals(this.applicationId, inboundCallbackMessage.applicationId) && + Objects.equals(this.time, inboundCallbackMessage.time) && + Objects.equals(this.segmentCount, inboundCallbackMessage.segmentCount) && + Objects.equals(this.direction, inboundCallbackMessage.direction) && + Objects.equals(this.to, inboundCallbackMessage.to) && + Objects.equals(this.from, inboundCallbackMessage.from) && + Objects.equals(this.text, inboundCallbackMessage.text) && + Objects.equals(this.tag, inboundCallbackMessage.tag) && + Objects.equals(this.media, inboundCallbackMessage.media) && + Objects.equals(this.priority, inboundCallbackMessage.priority) && + Objects.equals(this.channel, inboundCallbackMessage.channel) && + Objects.equals(this.content, inboundCallbackMessage.content) && + Objects.equals(this.suggestionResponse, inboundCallbackMessage.suggestionResponse) && + Objects.equals(this.locationResponse, inboundCallbackMessage.locationResponse)&& + Objects.equals(this.additionalProperties, inboundCallbackMessage.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, owner, applicationId, time, segmentCount, direction, to, from, text, tag, media, priority, channel, content, suggestionResponse, locationResponse, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InboundCallbackMessage {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" owner: ").append(toIndentedString(owner)).append("\n"); + sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); + sb.append(" time: ").append(toIndentedString(time)).append("\n"); + sb.append(" segmentCount: ").append(toIndentedString(segmentCount)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" media: ").append(toIndentedString(media)).append("\n"); + sb.append(" priority: ").append(toIndentedString(priority)).append("\n"); + sb.append(" channel: ").append(toIndentedString(channel)).append("\n"); + sb.append(" content: ").append(toIndentedString(content)).append("\n"); + sb.append(" suggestionResponse: ").append(toIndentedString(suggestionResponse)).append("\n"); + sb.append(" locationResponse: ").append(toIndentedString(locationResponse)).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("owner"); + openapiFields.add("applicationId"); + openapiFields.add("time"); + openapiFields.add("segmentCount"); + openapiFields.add("direction"); + openapiFields.add("to"); + openapiFields.add("from"); + openapiFields.add("text"); + openapiFields.add("tag"); + openapiFields.add("media"); + openapiFields.add("priority"); + openapiFields.add("channel"); + openapiFields.add("content"); + openapiFields.add("suggestionResponse"); + openapiFields.add("locationResponse"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("owner"); + openapiRequiredFields.add("applicationId"); + openapiRequiredFields.add("time"); + openapiRequiredFields.add("segmentCount"); + openapiRequiredFields.add("direction"); + openapiRequiredFields.add("to"); + openapiRequiredFields.add("from"); + } + + /** + * 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 InboundCallbackMessage + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!InboundCallbackMessage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in InboundCallbackMessage is not found in the empty JSON string", InboundCallbackMessage.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : InboundCallbackMessage.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").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("owner").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `owner` to be a primitive type in the JSON string but got `%s`", jsonObj.get("owner").toString())); + } + if (!jsonObj.get("applicationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `applicationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("applicationId").toString())); + } + // validate the required field `direction` + MessageDirectionEnum.validateJsonElement(jsonObj.get("direction")); + // ensure the required json array is present + if (jsonObj.get("to") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("to").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be an array in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + if (!jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + if ((jsonObj.get("text") != null && !jsonObj.get("text").isJsonNull()) && !jsonObj.get("text").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); + } + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("media") != null && !jsonObj.get("media").isJsonNull() && !jsonObj.get("media").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `media` to be an array in the JSON string but got `%s`", jsonObj.get("media").toString())); + } + // validate the optional field `priority` + if (jsonObj.get("priority") != null && !jsonObj.get("priority").isJsonNull()) { + PriorityEnum.validateJsonElement(jsonObj.get("priority")); + } + // validate the optional field `channel` + if (jsonObj.get("channel") != null && !jsonObj.get("channel").isJsonNull()) { + MultiChannelMessageChannelEnum.validateJsonElement(jsonObj.get("channel")); + } + // validate the optional field `content` + if (jsonObj.get("content") != null && !jsonObj.get("content").isJsonNull()) { + MultiChannelMessageContent.validateJsonElement(jsonObj.get("content")); + } + // validate the optional field `suggestionResponse` + if (jsonObj.get("suggestionResponse") != null && !jsonObj.get("suggestionResponse").isJsonNull()) { + RbmSuggestionResponse.validateJsonElement(jsonObj.get("suggestionResponse")); + } + // validate the optional field `locationResponse` + if (jsonObj.get("locationResponse") != null && !jsonObj.get("locationResponse").isJsonNull()) { + RbmLocationResponse.validateJsonElement(jsonObj.get("locationResponse")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!InboundCallbackMessage.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'InboundCallbackMessage' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(InboundCallbackMessage.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, InboundCallbackMessage 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 InboundCallbackMessage read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + InboundCallbackMessage 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 InboundCallbackMessage given an JSON string + * + * @param jsonString JSON string + * @return An instance of InboundCallbackMessage + * @throws IOException if the JSON string is invalid with respect to InboundCallbackMessage + */ + public static InboundCallbackMessage fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, InboundCallbackMessage.class); + } + + /** + * Convert an instance of InboundCallbackMessage 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/InboundCallbackTypeEnum.java b/src/main/java/com/bandwidth/sdk/model/InboundCallbackTypeEnum.java new file mode 100644 index 00000000..fa8eeb3c --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/InboundCallbackTypeEnum.java @@ -0,0 +1,80 @@ +/* + * 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; + +/** + * The possible inbound callback types originating from MO messages or multichannel message client responses: - `message-received` indicates an MO message from a Bandwidth user's client to a Bandwidth number. - `request-location-response` indicates a response to a location request sent by the Bandwidth user's client after receiving an RBM message. - `suggestion-response` indicates a response to a suggestion sent by the Bandwidth user's client after receiving an RBM message. + */ +@JsonAdapter(InboundCallbackTypeEnum.Adapter.class) +public enum InboundCallbackTypeEnum { + + MESSAGE_RECEIVED("message-received"), + + REQUEST_LOCATION_RESPONSE("request-location-response"), + + SUGGESTION_RESPONSE("suggestion-response"); + + private String value; + + InboundCallbackTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static InboundCallbackTypeEnum fromValue(String value) { + for (InboundCallbackTypeEnum b : InboundCallbackTypeEnum.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 InboundCallbackTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public InboundCallbackTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return InboundCallbackTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + InboundCallbackTypeEnum.fromValue(value); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/ListMessageItem.java b/src/main/java/com/bandwidth/sdk/model/ListMessageItem.java index 8791e5c8..611e2633 100644 --- a/src/main/java/com/bandwidth/sdk/model/ListMessageItem.java +++ b/src/main/java/com/bandwidth/sdk/model/ListMessageItem.java @@ -282,7 +282,7 @@ public ListMessageItem segmentCount(@javax.annotation.Nullable Integer segmentCo } /** - * The number of segments the message was sent as. + * The number of segments the user's message is broken into before sending over carrier networks. * @return segmentCount */ @javax.annotation.Nullable diff --git a/src/main/java/com/bandwidth/sdk/model/Message.java b/src/main/java/com/bandwidth/sdk/model/Message.java index 6f31b41f..33749830 100644 --- a/src/main/java/com/bandwidth/sdk/model/Message.java +++ b/src/main/java/com/bandwidth/sdk/model/Message.java @@ -167,7 +167,7 @@ public Message applicationId(@javax.annotation.Nullable String applicationId) { } /** - * The application ID associated with the message. + * The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard. * @return applicationId */ @javax.annotation.Nullable @@ -205,7 +205,7 @@ public Message segmentCount(@javax.annotation.Nullable Integer segmentCount) { } /** - * The number of segments the original message from the user is broken into before sending over to carrier networks. + * The number of segments the user's message is broken into before sending over carrier networks. * @return segmentCount */ @javax.annotation.Nullable @@ -335,7 +335,7 @@ public Message tag(@javax.annotation.Nullable String tag) { } /** - * The custom string set by the user. + * A custom string that will be included in callback events of the message. Max 1024 characters. * @return tag */ @javax.annotation.Nullable diff --git a/src/main/java/com/bandwidth/sdk/model/MessageRequest.java b/src/main/java/com/bandwidth/sdk/model/MessageRequest.java index 3bdddf49..592eabf5 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessageRequest.java +++ b/src/main/java/com/bandwidth/sdk/model/MessageRequest.java @@ -106,7 +106,7 @@ public MessageRequest applicationId(@javax.annotation.Nonnull String application } /** - * The ID of the Application your from number is associated with in the Bandwidth Phone Number Dashboard. + * The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard. * @return applicationId */ @javax.annotation.Nonnull diff --git a/src/main/java/com/bandwidth/sdk/model/MmsMessageContent.java b/src/main/java/com/bandwidth/sdk/model/MmsMessageContent.java index 75a7a2f9..cee4d1ae 100644 --- a/src/main/java/com/bandwidth/sdk/model/MmsMessageContent.java +++ b/src/main/java/com/bandwidth/sdk/model/MmsMessageContent.java @@ -14,13 +14,13 @@ package com.bandwidth.sdk.model; import java.util.Objects; +import com.bandwidth.sdk.model.MmsMessageContentFile; 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.net.URI; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -61,7 +61,7 @@ public class MmsMessageContent { public static final String SERIALIZED_NAME_MEDIA = "media"; @SerializedName(SERIALIZED_NAME_MEDIA) @javax.annotation.Nullable - private List media = new ArrayList<>(); + private List media = new ArrayList<>(); public MmsMessageContent() { } @@ -85,12 +85,12 @@ public void setText(@javax.annotation.Nullable String text) { } - public MmsMessageContent media(@javax.annotation.Nullable List media) { + public MmsMessageContent media(@javax.annotation.Nullable List media) { this.media = media; return this; } - public MmsMessageContent addMediaItem(URI mediaItem) { + public MmsMessageContent addMediaItem(MmsMessageContentFile mediaItem) { if (this.media == null) { this.media = new ArrayList<>(); } @@ -99,15 +99,15 @@ public MmsMessageContent addMediaItem(URI mediaItem) { } /** - * A list of URLs to include as media attachments as part of the message. Each URL can be at most 4096 characters. + * Get media * @return media */ @javax.annotation.Nullable - public List getMedia() { + public List getMedia() { return media; } - public void setMedia(@javax.annotation.Nullable List media) { + public void setMedia(@javax.annotation.Nullable List media) { this.media = media; } @@ -228,9 +228,19 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if ((jsonObj.get("text") != null && !jsonObj.get("text").isJsonNull()) && !jsonObj.get("text").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); } - // ensure the optional json data is an array if present - if (jsonObj.get("media") != null && !jsonObj.get("media").isJsonNull() && !jsonObj.get("media").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `media` to be an array in the JSON string but got `%s`", jsonObj.get("media").toString())); + if (jsonObj.get("media") != null && !jsonObj.get("media").isJsonNull()) { + JsonArray jsonArraymedia = jsonObj.getAsJsonArray("media"); + if (jsonArraymedia != null) { + // ensure the json data is an array + if (!jsonObj.get("media").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `media` to be an array in the JSON string but got `%s`", jsonObj.get("media").toString())); + } + + // validate the optional field `media` (array) + for (int i = 0; i < jsonArraymedia.size(); i++) { + MmsMessageContentFile.validateJsonElement(jsonArraymedia.get(i)); + }; + } } } diff --git a/src/main/java/com/bandwidth/sdk/model/DeferredResult.java b/src/main/java/com/bandwidth/sdk/model/MmsMessageContentFile.java similarity index 69% rename from src/main/java/com/bandwidth/sdk/model/DeferredResult.java rename to src/main/java/com/bandwidth/sdk/model/MmsMessageContentFile.java index bdd0a817..bbcab5ab 100644 --- a/src/main/java/com/bandwidth/sdk/model/DeferredResult.java +++ b/src/main/java/com/bandwidth/sdk/model/MmsMessageContentFile.java @@ -20,6 +20,7 @@ import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.net.URI; import java.util.Arrays; import com.google.gson.Gson; @@ -46,58 +47,34 @@ import com.bandwidth.sdk.JSON; /** - * DeferredResult + * MmsMessageContentFile */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") -public class DeferredResult { - public static final String SERIALIZED_NAME_RESULT = "result"; - @SerializedName(SERIALIZED_NAME_RESULT) - @javax.annotation.Nullable - private Object result; - - public static final String SERIALIZED_NAME_SET_OR_EXPIRED = "setOrExpired"; - @SerializedName(SERIALIZED_NAME_SET_OR_EXPIRED) - @javax.annotation.Nullable - private Boolean setOrExpired; - - public DeferredResult() { - } +public class MmsMessageContentFile { + public static final String SERIALIZED_NAME_FILE_URL = "fileUrl"; + @SerializedName(SERIALIZED_NAME_FILE_URL) + @javax.annotation.Nonnull + private URI fileUrl; - public DeferredResult result(@javax.annotation.Nullable Object result) { - this.result = result; - return this; + public MmsMessageContentFile() { } - /** - * Get result - * @return result - */ - @javax.annotation.Nullable - public Object getResult() { - return result; - } - - public void setResult(@javax.annotation.Nullable Object result) { - this.result = result; - } - - - public DeferredResult setOrExpired(@javax.annotation.Nullable Boolean setOrExpired) { - this.setOrExpired = setOrExpired; + public MmsMessageContentFile fileUrl(@javax.annotation.Nonnull URI fileUrl) { + this.fileUrl = fileUrl; return this; } /** - * Get setOrExpired - * @return setOrExpired + * The URL of a media attachment. For MMS, the API limits file size to 3.5MB. Specific carriers and channels may have a smaller limit that could cause a large file to fail, see [here](https://support.bandwidth.com/hc/en-us/articles/360014235473-What-are-the-MMS-file-size-limits) for more details. + * @return fileUrl */ - @javax.annotation.Nullable - public Boolean getSetOrExpired() { - return setOrExpired; + @javax.annotation.Nonnull + public URI getFileUrl() { + return fileUrl; } - public void setSetOrExpired(@javax.annotation.Nullable Boolean setOrExpired) { - this.setOrExpired = setOrExpired; + public void setFileUrl(@javax.annotation.Nonnull URI fileUrl) { + this.fileUrl = fileUrl; } /** @@ -113,9 +90,9 @@ public void setSetOrExpired(@javax.annotation.Nullable Boolean setOrExpired) { * * @param key name of the property * @param value value of the property - * @return the DeferredResult instance itself + * @return the MmsMessageContentFile instance itself */ - public DeferredResult putAdditionalProperty(String key, Object value) { + public MmsMessageContentFile putAdditionalProperty(String key, Object value) { if (this.additionalProperties == null) { this.additionalProperties = new HashMap(); } @@ -154,23 +131,21 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - DeferredResult deferredResult = (DeferredResult) o; - return Objects.equals(this.result, deferredResult.result) && - Objects.equals(this.setOrExpired, deferredResult.setOrExpired)&& - Objects.equals(this.additionalProperties, deferredResult.additionalProperties); + MmsMessageContentFile mmsMessageContentFile = (MmsMessageContentFile) o; + return Objects.equals(this.fileUrl, mmsMessageContentFile.fileUrl)&& + Objects.equals(this.additionalProperties, mmsMessageContentFile.additionalProperties); } @Override public int hashCode() { - return Objects.hash(result, setOrExpired, additionalProperties); + return Objects.hash(fileUrl, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class DeferredResult {\n"); - sb.append(" result: ").append(toIndentedString(result)).append("\n"); - sb.append(" setOrExpired: ").append(toIndentedString(setOrExpired)).append("\n"); + sb.append("class MmsMessageContentFile {\n"); + sb.append(" fileUrl: ").append(toIndentedString(fileUrl)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); @@ -194,42 +169,52 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet(); - openapiFields.add("result"); - openapiFields.add("setOrExpired"); + openapiFields.add("fileUrl"); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("fileUrl"); } /** * 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 DeferredResult + * @throws IOException if the JSON Element is invalid with respect to MmsMessageContentFile */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { - if (!DeferredResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DeferredResult is not found in the empty JSON string", DeferredResult.openapiRequiredFields.toString())); + if (!MmsMessageContentFile.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MmsMessageContentFile is not found in the empty JSON string", MmsMessageContentFile.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MmsMessageContentFile.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("fileUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `fileUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fileUrl").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!DeferredResult.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DeferredResult' and its subtypes + if (!MmsMessageContentFile.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MmsMessageContentFile' and its subtypes } final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DeferredResult.class)); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MmsMessageContentFile.class)); - return (TypeAdapter) new TypeAdapter() { + return (TypeAdapter) new TypeAdapter() { @Override - public void write(JsonWriter out, DeferredResult value) throws IOException { + public void write(JsonWriter out, MmsMessageContentFile value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); obj.remove("additionalProperties"); // serialize additional properties @@ -257,12 +242,12 @@ else if (entry.getValue() instanceof Character) } @Override - public DeferredResult read(JsonReader in) throws IOException { + public MmsMessageContentFile read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); JsonObject jsonObj = jsonElement.getAsJsonObject(); // store additional fields in the deserialized instance - DeferredResult instance = thisAdapter.fromJsonTree(jsonObj); + MmsMessageContentFile instance = thisAdapter.fromJsonTree(jsonObj); for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type @@ -289,18 +274,18 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } /** - * Create an instance of DeferredResult given an JSON string + * Create an instance of MmsMessageContentFile given an JSON string * * @param jsonString JSON string - * @return An instance of DeferredResult - * @throws IOException if the JSON string is invalid with respect to DeferredResult + * @return An instance of MmsMessageContentFile + * @throws IOException if the JSON string is invalid with respect to MmsMessageContentFile */ - public static DeferredResult fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DeferredResult.class); + public static MmsMessageContentFile fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MmsMessageContentFile.class); } /** - * Convert an instance of DeferredResult to an JSON string + * Convert an instance of MmsMessageContentFile to an JSON string * * @return JSON string */ diff --git a/src/main/java/com/bandwidth/sdk/model/MultiChannelActionCalendarEvent.java b/src/main/java/com/bandwidth/sdk/model/MultiChannelActionCalendarEvent.java index 776b958e..58de6e0d 100644 --- a/src/main/java/com/bandwidth/sdk/model/MultiChannelActionCalendarEvent.java +++ b/src/main/java/com/bandwidth/sdk/model/MultiChannelActionCalendarEvent.java @@ -62,10 +62,10 @@ public class MultiChannelActionCalendarEvent { @javax.annotation.Nonnull private String text; - public static final String SERIALIZED_NAME_POST_BACK_DATA = "postBackData"; - @SerializedName(SERIALIZED_NAME_POST_BACK_DATA) + public static final String SERIALIZED_NAME_POSTBACK_DATA = "postbackData"; + @SerializedName(SERIALIZED_NAME_POSTBACK_DATA) @javax.annotation.Nonnull - private byte[] postBackData; + private byte[] postbackData; public static final String SERIALIZED_NAME_TITLE = "title"; @SerializedName(SERIALIZED_NAME_TITLE) @@ -128,22 +128,22 @@ public void setText(@javax.annotation.Nonnull String text) { } - public MultiChannelActionCalendarEvent postBackData(@javax.annotation.Nonnull byte[] postBackData) { - this.postBackData = postBackData; + public MultiChannelActionCalendarEvent postbackData(@javax.annotation.Nonnull byte[] postbackData) { + this.postbackData = postbackData; return this; } /** * Base64 payload the customer receives when the reply is clicked. - * @return postBackData + * @return postbackData */ @javax.annotation.Nonnull - public byte[] getPostBackData() { - return postBackData; + public byte[] getPostbackData() { + return postbackData; } - public void setPostBackData(@javax.annotation.Nonnull byte[] postBackData) { - this.postBackData = postBackData; + public void setPostbackData(@javax.annotation.Nonnull byte[] postbackData) { + this.postbackData = postbackData; } @@ -279,7 +279,7 @@ public boolean equals(Object o) { MultiChannelActionCalendarEvent multiChannelActionCalendarEvent = (MultiChannelActionCalendarEvent) o; return Objects.equals(this.type, multiChannelActionCalendarEvent.type) && Objects.equals(this.text, multiChannelActionCalendarEvent.text) && - Arrays.equals(this.postBackData, multiChannelActionCalendarEvent.postBackData) && + Arrays.equals(this.postbackData, multiChannelActionCalendarEvent.postbackData) && Objects.equals(this.title, multiChannelActionCalendarEvent.title) && Objects.equals(this.startTime, multiChannelActionCalendarEvent.startTime) && Objects.equals(this.endTime, multiChannelActionCalendarEvent.endTime) && @@ -289,7 +289,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(type, text, Arrays.hashCode(postBackData), title, startTime, endTime, description, additionalProperties); + return Objects.hash(type, text, Arrays.hashCode(postbackData), title, startTime, endTime, description, additionalProperties); } @Override @@ -298,7 +298,7 @@ public String toString() { sb.append("class MultiChannelActionCalendarEvent {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" text: ").append(toIndentedString(text)).append("\n"); - sb.append(" postBackData: ").append(toIndentedString(postBackData)).append("\n"); + sb.append(" postbackData: ").append(toIndentedString(postbackData)).append("\n"); sb.append(" title: ").append(toIndentedString(title)).append("\n"); sb.append(" startTime: ").append(toIndentedString(startTime)).append("\n"); sb.append(" endTime: ").append(toIndentedString(endTime)).append("\n"); @@ -328,7 +328,7 @@ private String toIndentedString(Object o) { openapiFields = new HashSet(); openapiFields.add("type"); openapiFields.add("text"); - openapiFields.add("postBackData"); + openapiFields.add("postbackData"); openapiFields.add("title"); openapiFields.add("startTime"); openapiFields.add("endTime"); @@ -338,7 +338,7 @@ private String toIndentedString(Object o) { openapiRequiredFields = new HashSet(); openapiRequiredFields.add("type"); openapiRequiredFields.add("text"); - openapiRequiredFields.add("postBackData"); + openapiRequiredFields.add("postbackData"); openapiRequiredFields.add("title"); openapiRequiredFields.add("startTime"); openapiRequiredFields.add("endTime"); diff --git a/src/main/java/com/bandwidth/sdk/model/MultiChannelChannelListObjectContent.java b/src/main/java/com/bandwidth/sdk/model/MultiChannelChannelListObjectContent.java index c7106409..0dfbbcee 100644 --- a/src/main/java/com/bandwidth/sdk/model/MultiChannelChannelListObjectContent.java +++ b/src/main/java/com/bandwidth/sdk/model/MultiChannelChannelListObjectContent.java @@ -16,6 +16,7 @@ import java.util.Objects; import com.bandwidth.sdk.model.CardWidthEnum; import com.bandwidth.sdk.model.MmsMessageContent; +import com.bandwidth.sdk.model.MmsMessageContentFile; import com.bandwidth.sdk.model.MultiChannelAction; import com.bandwidth.sdk.model.RbmCardContent; import com.bandwidth.sdk.model.RbmMessageContentRichCard; @@ -30,7 +31,6 @@ import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.net.URI; import java.util.ArrayList; import java.util.Arrays; import java.util.List; diff --git a/src/main/java/com/bandwidth/sdk/model/MultiChannelError.java b/src/main/java/com/bandwidth/sdk/model/MultiChannelError.java new file mode 100644 index 00000000..9104dd19 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/MultiChannelError.java @@ -0,0 +1,398 @@ +/* + * 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.ErrorObject; +import com.bandwidth.sdk.model.Link; +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; + +/** + * MultiChannelError + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") +public class MultiChannelError { + public static final String SERIALIZED_NAME_LINKS = "links"; + @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nullable + private List links = new ArrayList<>(); + + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nullable + private Object data; + + public static final String SERIALIZED_NAME_ERRORS = "errors"; + @SerializedName(SERIALIZED_NAME_ERRORS) + @javax.annotation.Nullable + private List errors = new ArrayList<>(); + + public MultiChannelError() { + } + + public MultiChannelError links(@javax.annotation.Nullable List links) { + this.links = links; + return this; + } + + public MultiChannelError addLinksItem(Link linksItem) { + if (this.links == null) { + this.links = new ArrayList<>(); + } + this.links.add(linksItem); + return this; + } + + /** + * Get links + * @return links + */ + @javax.annotation.Nullable + public List getLinks() { + return links; + } + + public void setLinks(@javax.annotation.Nullable List links) { + this.links = links; + } + + + public MultiChannelError data(@javax.annotation.Nullable Object data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nullable + public Object getData() { + return data; + } + + public void setData(@javax.annotation.Nullable Object data) { + this.data = data; + } + + + public MultiChannelError errors(@javax.annotation.Nullable List errors) { + this.errors = errors; + return this; + } + + public MultiChannelError addErrorsItem(ErrorObject 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; + } + + /** + * 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 MultiChannelError instance itself + */ + public MultiChannelError 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; + } + MultiChannelError multiChannelError = (MultiChannelError) o; + return Objects.equals(this.links, multiChannelError.links) && + Objects.equals(this.data, multiChannelError.data) && + Objects.equals(this.errors, multiChannelError.errors)&& + Objects.equals(this.additionalProperties, multiChannelError.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(links, data, errors, 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 MultiChannelError {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).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("links"); + openapiFields.add("data"); + 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 MultiChannelError + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MultiChannelError.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MultiChannelError is not found in the empty JSON string", MultiChannelError.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("links") != null && !jsonObj.get("links").isJsonNull()) { + JsonArray jsonArraylinks = jsonObj.getAsJsonArray("links"); + if (jsonArraylinks != null) { + // ensure the json data is an array + if (!jsonObj.get("links").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `links` to be an array in the JSON string but got `%s`", jsonObj.get("links").toString())); + } + + // validate the optional field `links` (array) + for (int i = 0; i < jsonArraylinks.size(); i++) { + Link.validateJsonElement(jsonArraylinks.get(i)); + }; + } + } + 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++) { + ErrorObject.validateJsonElement(jsonArrayerrors.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MultiChannelError.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MultiChannelError' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MultiChannelError.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MultiChannelError 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 MultiChannelError read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MultiChannelError 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 MultiChannelError given an JSON string + * + * @param jsonString JSON string + * @return An instance of MultiChannelError + * @throws IOException if the JSON string is invalid with respect to MultiChannelError + */ + public static MultiChannelError fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MultiChannelError.class); + } + + /** + * Convert an instance of MultiChannelError 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/MultiChannelMessageContent.java b/src/main/java/com/bandwidth/sdk/model/MultiChannelMessageContent.java new file mode 100644 index 00000000..2d26e40f --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/MultiChannelMessageContent.java @@ -0,0 +1,319 @@ +/* + * 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.RbmMessageContentFile; +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; + +/** + * The structure of the content field of a multichannel message. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") +public class MultiChannelMessageContent { + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + @javax.annotation.Nullable + private String text; + + public static final String SERIALIZED_NAME_MEDIA = "media"; + @SerializedName(SERIALIZED_NAME_MEDIA) + @javax.annotation.Nullable + private RbmMessageContentFile media; + + public MultiChannelMessageContent() { + } + + public MultiChannelMessageContent text(@javax.annotation.Nullable String text) { + this.text = text; + return this; + } + + /** + * Get text + * @return text + */ + @javax.annotation.Nullable + public String getText() { + return text; + } + + public void setText(@javax.annotation.Nullable String text) { + this.text = text; + } + + + public MultiChannelMessageContent media(@javax.annotation.Nullable RbmMessageContentFile media) { + this.media = media; + return this; + } + + /** + * Get media + * @return media + */ + @javax.annotation.Nullable + public RbmMessageContentFile getMedia() { + return media; + } + + public void setMedia(@javax.annotation.Nullable RbmMessageContentFile media) { + this.media = media; + } + + /** + * 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 MultiChannelMessageContent instance itself + */ + public MultiChannelMessageContent 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; + } + MultiChannelMessageContent multiChannelMessageContent = (MultiChannelMessageContent) o; + return Objects.equals(this.text, multiChannelMessageContent.text) && + Objects.equals(this.media, multiChannelMessageContent.media)&& + Objects.equals(this.additionalProperties, multiChannelMessageContent.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(text, media, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MultiChannelMessageContent {\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" media: ").append(toIndentedString(media)).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("text"); + openapiFields.add("media"); + + // 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 MultiChannelMessageContent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MultiChannelMessageContent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MultiChannelMessageContent is not found in the empty JSON string", MultiChannelMessageContent.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("text") != null && !jsonObj.get("text").isJsonNull()) && !jsonObj.get("text").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); + } + // validate the optional field `media` + if (jsonObj.get("media") != null && !jsonObj.get("media").isJsonNull()) { + RbmMessageContentFile.validateJsonElement(jsonObj.get("media")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MultiChannelMessageContent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MultiChannelMessageContent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MultiChannelMessageContent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MultiChannelMessageContent 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 MultiChannelMessageContent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MultiChannelMessageContent 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 MultiChannelMessageContent given an JSON string + * + * @param jsonString JSON string + * @return An instance of MultiChannelMessageContent + * @throws IOException if the JSON string is invalid with respect to MultiChannelMessageContent + */ + public static MultiChannelMessageContent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MultiChannelMessageContent.class); + } + + /** + * Convert an instance of MultiChannelMessageContent 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/MultiChannelMessageDirectionEnum.java b/src/main/java/com/bandwidth/sdk/model/MultiChannelMessageDirectionEnum.java deleted file mode 100644 index f548e871..00000000 --- a/src/main/java/com/bandwidth/sdk/model/MultiChannelMessageDirectionEnum.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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 multiChannelMessageDirectionEnum - */ -@JsonAdapter(MultiChannelMessageDirectionEnum.Adapter.class) -public enum MultiChannelMessageDirectionEnum { - - INBOUND("INBOUND"), - - OUTBOUND("OUTBOUND"); - - private String value; - - MultiChannelMessageDirectionEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static MultiChannelMessageDirectionEnum fromValue(String value) { - for (MultiChannelMessageDirectionEnum b : MultiChannelMessageDirectionEnum.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 MultiChannelMessageDirectionEnum enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public MultiChannelMessageDirectionEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return MultiChannelMessageDirectionEnum.fromValue(value); - } - } - - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - String value = jsonElement.getAsString(); - MultiChannelMessageDirectionEnum.fromValue(value); - } -} - diff --git a/src/main/java/com/bandwidth/sdk/model/MultiChannelMessageData.java b/src/main/java/com/bandwidth/sdk/model/MultiChannelMessageResponseData.java similarity index 56% rename from src/main/java/com/bandwidth/sdk/model/MultiChannelMessageData.java rename to src/main/java/com/bandwidth/sdk/model/MultiChannelMessageResponseData.java index 02184db2..f1684e1c 100644 --- a/src/main/java/com/bandwidth/sdk/model/MultiChannelMessageData.java +++ b/src/main/java/com/bandwidth/sdk/model/MultiChannelMessageResponseData.java @@ -14,9 +14,9 @@ package com.bandwidth.sdk.model; import java.util.Objects; -import com.bandwidth.sdk.model.MultiChannelMessageChannelEnum; -import com.bandwidth.sdk.model.MultiChannelMessageDirectionEnum; -import com.bandwidth.sdk.model.MultiChannelStatusEnum; +import com.bandwidth.sdk.model.MessageDirectionEnum; +import com.bandwidth.sdk.model.MultiChannelMessageResponseDataChannelListInner; +import com.bandwidth.sdk.model.PriorityEnum; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -24,7 +24,11 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; import java.time.OffsetDateTime; +import java.util.ArrayList; import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -50,59 +54,54 @@ import com.bandwidth.sdk.JSON; /** - * MultiChannelMessageData + * The data returned in a multichannel message response. */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") -public class MultiChannelMessageData { +public class MultiChannelMessageResponseData { public static final String SERIALIZED_NAME_MESSAGE_ID = "messageId"; @SerializedName(SERIALIZED_NAME_MESSAGE_ID) - @javax.annotation.Nullable + @javax.annotation.Nonnull private String messageId; - public static final String SERIALIZED_NAME_STATUS = "status"; - @SerializedName(SERIALIZED_NAME_STATUS) - @javax.annotation.Nullable - private MultiChannelStatusEnum status; - public static final String SERIALIZED_NAME_TIME = "time"; @SerializedName(SERIALIZED_NAME_TIME) - @javax.annotation.Nullable + @javax.annotation.Nonnull private OffsetDateTime time; public static final String SERIALIZED_NAME_DIRECTION = "direction"; @SerializedName(SERIALIZED_NAME_DIRECTION) - @javax.annotation.Nullable - private MultiChannelMessageDirectionEnum direction; - - public static final String SERIALIZED_NAME_FROM = "from"; - @SerializedName(SERIALIZED_NAME_FROM) - @javax.annotation.Nullable - private String from; + @javax.annotation.Nonnull + private MessageDirectionEnum direction; public static final String SERIALIZED_NAME_TO = "to"; @SerializedName(SERIALIZED_NAME_TO) - @javax.annotation.Nullable - private String to; + @javax.annotation.Nonnull + private Set to = new LinkedHashSet<>(); - public static final String SERIALIZED_NAME_APPLICATION_ID = "applicationId"; - @SerializedName(SERIALIZED_NAME_APPLICATION_ID) - @javax.annotation.Nullable - private String applicationId; - - public static final String SERIALIZED_NAME_CHANNEL = "channel"; - @SerializedName(SERIALIZED_NAME_CHANNEL) - @javax.annotation.Nullable - private MultiChannelMessageChannelEnum channel; + public static final String SERIALIZED_NAME_CHANNEL_LIST = "channelList"; + @SerializedName(SERIALIZED_NAME_CHANNEL_LIST) + @javax.annotation.Nonnull + private List channelList = new ArrayList<>(); public static final String SERIALIZED_NAME_TAG = "tag"; @SerializedName(SERIALIZED_NAME_TAG) @javax.annotation.Nullable private String tag; - public MultiChannelMessageData() { + public static final String SERIALIZED_NAME_PRIORITY = "priority"; + @SerializedName(SERIALIZED_NAME_PRIORITY) + @javax.annotation.Nullable + private PriorityEnum priority; + + public static final String SERIALIZED_NAME_EXPIRATION = "expiration"; + @SerializedName(SERIALIZED_NAME_EXPIRATION) + @javax.annotation.Nullable + private OffsetDateTime expiration; + + public MultiChannelMessageResponseData() { } - public MultiChannelMessageData messageId(@javax.annotation.Nullable String messageId) { + public MultiChannelMessageResponseData messageId(@javax.annotation.Nonnull String messageId) { this.messageId = messageId; return this; } @@ -111,36 +110,17 @@ public MultiChannelMessageData messageId(@javax.annotation.Nullable String messa * The ID of the message. * @return messageId */ - @javax.annotation.Nullable + @javax.annotation.Nonnull public String getMessageId() { return messageId; } - public void setMessageId(@javax.annotation.Nullable String messageId) { + public void setMessageId(@javax.annotation.Nonnull String messageId) { this.messageId = messageId; } - public MultiChannelMessageData status(@javax.annotation.Nullable MultiChannelStatusEnum status) { - this.status = status; - return this; - } - - /** - * Get status - * @return status - */ - @javax.annotation.Nullable - public MultiChannelStatusEnum getStatus() { - return status; - } - - public void setStatus(@javax.annotation.Nullable MultiChannelStatusEnum status) { - this.status = status; - } - - - public MultiChannelMessageData time(@javax.annotation.Nullable OffsetDateTime time) { + public MultiChannelMessageResponseData time(@javax.annotation.Nonnull OffsetDateTime time) { this.time = time; return this; } @@ -149,17 +129,17 @@ public MultiChannelMessageData time(@javax.annotation.Nullable OffsetDateTime ti * The time the message was received by the Bandwidth API. * @return time */ - @javax.annotation.Nullable + @javax.annotation.Nonnull public OffsetDateTime getTime() { return time; } - public void setTime(@javax.annotation.Nullable OffsetDateTime time) { + public void setTime(@javax.annotation.Nonnull OffsetDateTime time) { this.time = time; } - public MultiChannelMessageData direction(@javax.annotation.Nullable MultiChannelMessageDirectionEnum direction) { + public MultiChannelMessageResponseData direction(@javax.annotation.Nonnull MessageDirectionEnum direction) { this.direction = direction; return this; } @@ -168,108 +148,124 @@ public MultiChannelMessageData direction(@javax.annotation.Nullable MultiChannel * Get direction * @return direction */ - @javax.annotation.Nullable - public MultiChannelMessageDirectionEnum getDirection() { + @javax.annotation.Nonnull + public MessageDirectionEnum getDirection() { return direction; } - public void setDirection(@javax.annotation.Nullable MultiChannelMessageDirectionEnum direction) { + public void setDirection(@javax.annotation.Nonnull MessageDirectionEnum direction) { this.direction = direction; } - public MultiChannelMessageData from(@javax.annotation.Nullable String from) { - this.from = from; + public MultiChannelMessageResponseData to(@javax.annotation.Nonnull Set to) { + this.to = to; + return this; + } + + public MultiChannelMessageResponseData addToItem(String toItem) { + if (this.to == null) { + this.to = new LinkedHashSet<>(); + } + this.to.add(toItem); return this; } /** - * The sender ID of the message. This could be an alphanumeric sender ID. - * @return from + * The destination phone number(s) of the message, in E164 format. + * @return to */ - @javax.annotation.Nullable - public String getFrom() { - return from; + @javax.annotation.Nonnull + public Set getTo() { + return to; } - public void setFrom(@javax.annotation.Nullable String from) { - this.from = from; + public void setTo(@javax.annotation.Nonnull Set to) { + this.to = to; } - public MultiChannelMessageData to(@javax.annotation.Nullable String to) { - this.to = to; + public MultiChannelMessageResponseData channelList(@javax.annotation.Nonnull List channelList) { + this.channelList = channelList; + return this; + } + + public MultiChannelMessageResponseData addChannelListItem(MultiChannelMessageResponseDataChannelListInner channelListItem) { + if (this.channelList == null) { + this.channelList = new ArrayList<>(); + } + this.channelList.add(channelListItem); return this; } /** - * The phone number the message should be sent to in E164 format. - * @return to + * A list of message bodies. The messages will be attempted in the order they are listed. Once a message sends successfully, the others will be ignored. + * @return channelList */ - @javax.annotation.Nullable - public String getTo() { - return to; + @javax.annotation.Nonnull + public List getChannelList() { + return channelList; } - public void setTo(@javax.annotation.Nullable String to) { - this.to = to; + public void setChannelList(@javax.annotation.Nonnull List channelList) { + this.channelList = channelList; } - public MultiChannelMessageData applicationId(@javax.annotation.Nullable String applicationId) { - this.applicationId = applicationId; + public MultiChannelMessageResponseData tag(@javax.annotation.Nullable String tag) { + this.tag = tag; return this; } /** - * The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard. - * @return applicationId + * A custom string that will be included in callback events of the message. Max 1024 characters. + * @return tag */ @javax.annotation.Nullable - public String getApplicationId() { - return applicationId; + public String getTag() { + return tag; } - public void setApplicationId(@javax.annotation.Nullable String applicationId) { - this.applicationId = applicationId; + public void setTag(@javax.annotation.Nullable String tag) { + this.tag = tag; } - public MultiChannelMessageData channel(@javax.annotation.Nullable MultiChannelMessageChannelEnum channel) { - this.channel = channel; + public MultiChannelMessageResponseData priority(@javax.annotation.Nullable PriorityEnum priority) { + this.priority = priority; return this; } /** - * Get channel - * @return channel + * Get priority + * @return priority */ @javax.annotation.Nullable - public MultiChannelMessageChannelEnum getChannel() { - return channel; + public PriorityEnum getPriority() { + return priority; } - public void setChannel(@javax.annotation.Nullable MultiChannelMessageChannelEnum channel) { - this.channel = channel; + public void setPriority(@javax.annotation.Nullable PriorityEnum priority) { + this.priority = priority; } - public MultiChannelMessageData tag(@javax.annotation.Nullable String tag) { - this.tag = tag; + public MultiChannelMessageResponseData expiration(@javax.annotation.Nullable OffsetDateTime expiration) { + this.expiration = expiration; return this; } /** - * A custom string that will be included in callback events of the message. Max 1024 characters. - * @return tag + * A string with the date/time value that the message will automatically expire by. This must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. Must be a date-time in the future. + * @return expiration */ @javax.annotation.Nullable - public String getTag() { - return tag; + public OffsetDateTime getExpiration() { + return expiration; } - public void setTag(@javax.annotation.Nullable String tag) { - this.tag = tag; + public void setExpiration(@javax.annotation.Nullable OffsetDateTime expiration) { + this.expiration = expiration; } /** @@ -285,9 +281,9 @@ public void setTag(@javax.annotation.Nullable String tag) { * * @param key name of the property * @param value value of the property - * @return the MultiChannelMessageData instance itself + * @return the MultiChannelMessageResponseData instance itself */ - public MultiChannelMessageData putAdditionalProperty(String key, Object value) { + public MultiChannelMessageResponseData putAdditionalProperty(String key, Object value) { if (this.additionalProperties == null) { this.additionalProperties = new HashMap(); } @@ -326,37 +322,35 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - MultiChannelMessageData multiChannelMessageData = (MultiChannelMessageData) o; - return Objects.equals(this.messageId, multiChannelMessageData.messageId) && - Objects.equals(this.status, multiChannelMessageData.status) && - Objects.equals(this.time, multiChannelMessageData.time) && - Objects.equals(this.direction, multiChannelMessageData.direction) && - Objects.equals(this.from, multiChannelMessageData.from) && - Objects.equals(this.to, multiChannelMessageData.to) && - Objects.equals(this.applicationId, multiChannelMessageData.applicationId) && - Objects.equals(this.channel, multiChannelMessageData.channel) && - Objects.equals(this.tag, multiChannelMessageData.tag)&& - Objects.equals(this.additionalProperties, multiChannelMessageData.additionalProperties); + MultiChannelMessageResponseData multiChannelMessageResponseData = (MultiChannelMessageResponseData) o; + return Objects.equals(this.messageId, multiChannelMessageResponseData.messageId) && + Objects.equals(this.time, multiChannelMessageResponseData.time) && + Objects.equals(this.direction, multiChannelMessageResponseData.direction) && + Objects.equals(this.to, multiChannelMessageResponseData.to) && + Objects.equals(this.channelList, multiChannelMessageResponseData.channelList) && + Objects.equals(this.tag, multiChannelMessageResponseData.tag) && + Objects.equals(this.priority, multiChannelMessageResponseData.priority) && + Objects.equals(this.expiration, multiChannelMessageResponseData.expiration)&& + Objects.equals(this.additionalProperties, multiChannelMessageResponseData.additionalProperties); } @Override public int hashCode() { - return Objects.hash(messageId, status, time, direction, from, to, applicationId, channel, tag, additionalProperties); + return Objects.hash(messageId, time, direction, to, channelList, tag, priority, expiration, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class MultiChannelMessageData {\n"); + sb.append("class MultiChannelMessageResponseData {\n"); sb.append(" messageId: ").append(toIndentedString(messageId)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); sb.append(" time: ").append(toIndentedString(time)).append("\n"); sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); - sb.append(" from: ").append(toIndentedString(from)).append("\n"); sb.append(" to: ").append(toIndentedString(to)).append("\n"); - sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); - sb.append(" channel: ").append(toIndentedString(channel)).append("\n"); + sb.append(" channelList: ").append(toIndentedString(channelList)).append("\n"); sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" priority: ").append(toIndentedString(priority)).append("\n"); + sb.append(" expiration: ").append(toIndentedString(expiration)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); @@ -381,75 +375,87 @@ private String toIndentedString(Object o) { // a set of all properties/fields (JSON key names) openapiFields = new HashSet(); openapiFields.add("messageId"); - openapiFields.add("status"); openapiFields.add("time"); openapiFields.add("direction"); - openapiFields.add("from"); openapiFields.add("to"); - openapiFields.add("applicationId"); - openapiFields.add("channel"); + openapiFields.add("channelList"); openapiFields.add("tag"); + openapiFields.add("priority"); + openapiFields.add("expiration"); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("messageId"); + openapiRequiredFields.add("time"); + openapiRequiredFields.add("direction"); + openapiRequiredFields.add("to"); + openapiRequiredFields.add("channelList"); } /** * 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 MultiChannelMessageData + * @throws IOException if the JSON Element is invalid with respect to MultiChannelMessageResponseData */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { - if (!MultiChannelMessageData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in MultiChannelMessageData is not found in the empty JSON string", MultiChannelMessageData.openapiRequiredFields.toString())); + if (!MultiChannelMessageResponseData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MultiChannelMessageResponseData is not found in the empty JSON string", MultiChannelMessageResponseData.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MultiChannelMessageResponseData.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("messageId") != null && !jsonObj.get("messageId").isJsonNull()) && !jsonObj.get("messageId").isJsonPrimitive()) { + if (!jsonObj.get("messageId").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `messageId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("messageId").toString())); } - // validate the optional field `status` - if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { - MultiChannelStatusEnum.validateJsonElement(jsonObj.get("status")); - } - // validate the optional field `direction` - if (jsonObj.get("direction") != null && !jsonObj.get("direction").isJsonNull()) { - MultiChannelMessageDirectionEnum.validateJsonElement(jsonObj.get("direction")); - } - if ((jsonObj.get("from") != null && !jsonObj.get("from").isJsonNull()) && !jsonObj.get("from").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + // validate the required field `direction` + MessageDirectionEnum.validateJsonElement(jsonObj.get("direction")); + // ensure the required json array is present + if (jsonObj.get("to") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("to").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be an array in the JSON string but got `%s`", jsonObj.get("to").toString())); } - if ((jsonObj.get("to") != null && !jsonObj.get("to").isJsonNull()) && !jsonObj.get("to").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); - } - if ((jsonObj.get("applicationId") != null && !jsonObj.get("applicationId").isJsonNull()) && !jsonObj.get("applicationId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `applicationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("applicationId").toString())); - } - // validate the optional field `channel` - if (jsonObj.get("channel") != null && !jsonObj.get("channel").isJsonNull()) { - MultiChannelMessageChannelEnum.validateJsonElement(jsonObj.get("channel")); + // ensure the json data is an array + if (!jsonObj.get("channelList").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `channelList` to be an array in the JSON string but got `%s`", jsonObj.get("channelList").toString())); } + + JsonArray jsonArraychannelList = jsonObj.getAsJsonArray("channelList"); + // validate the required field `channelList` (array) + for (int i = 0; i < jsonArraychannelList.size(); i++) { + MultiChannelMessageResponseDataChannelListInner.validateJsonElement(jsonArraychannelList.get(i)); + }; if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); } + // validate the optional field `priority` + if (jsonObj.get("priority") != null && !jsonObj.get("priority").isJsonNull()) { + PriorityEnum.validateJsonElement(jsonObj.get("priority")); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!MultiChannelMessageData.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'MultiChannelMessageData' and its subtypes + if (!MultiChannelMessageResponseData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MultiChannelMessageResponseData' and its subtypes } final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(MultiChannelMessageData.class)); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MultiChannelMessageResponseData.class)); - return (TypeAdapter) new TypeAdapter() { + return (TypeAdapter) new TypeAdapter() { @Override - public void write(JsonWriter out, MultiChannelMessageData value) throws IOException { + public void write(JsonWriter out, MultiChannelMessageResponseData value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); obj.remove("additionalProperties"); // serialize additional properties @@ -477,12 +483,12 @@ else if (entry.getValue() instanceof Character) } @Override - public MultiChannelMessageData read(JsonReader in) throws IOException { + public MultiChannelMessageResponseData read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); JsonObject jsonObj = jsonElement.getAsJsonObject(); // store additional fields in the deserialized instance - MultiChannelMessageData instance = thisAdapter.fromJsonTree(jsonObj); + MultiChannelMessageResponseData instance = thisAdapter.fromJsonTree(jsonObj); for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type @@ -509,18 +515,18 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } /** - * Create an instance of MultiChannelMessageData given an JSON string + * Create an instance of MultiChannelMessageResponseData given an JSON string * * @param jsonString JSON string - * @return An instance of MultiChannelMessageData - * @throws IOException if the JSON string is invalid with respect to MultiChannelMessageData + * @return An instance of MultiChannelMessageResponseData + * @throws IOException if the JSON string is invalid with respect to MultiChannelMessageResponseData */ - public static MultiChannelMessageData fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, MultiChannelMessageData.class); + public static MultiChannelMessageResponseData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MultiChannelMessageResponseData.class); } /** - * Convert an instance of MultiChannelMessageData to an JSON string + * Convert an instance of MultiChannelMessageResponseData to an JSON string * * @return JSON string */ diff --git a/src/main/java/com/bandwidth/sdk/model/MultiChannelMessageCallbackData.java b/src/main/java/com/bandwidth/sdk/model/MultiChannelMessageResponseDataChannelListInner.java similarity index 54% rename from src/main/java/com/bandwidth/sdk/model/MultiChannelMessageCallbackData.java rename to src/main/java/com/bandwidth/sdk/model/MultiChannelMessageResponseDataChannelListInner.java index a0019733..7454f1e8 100644 --- a/src/main/java/com/bandwidth/sdk/model/MultiChannelMessageCallbackData.java +++ b/src/main/java/com/bandwidth/sdk/model/MultiChannelMessageResponseDataChannelListInner.java @@ -14,9 +14,8 @@ package com.bandwidth.sdk.model; import java.util.Objects; +import com.bandwidth.sdk.model.MultiChannelChannelListObjectContent; import com.bandwidth.sdk.model.MultiChannelMessageChannelEnum; -import com.bandwidth.sdk.model.MultiChannelMessageDirectionEnum; -import com.bandwidth.sdk.model.MultiChannelStatusEnum; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -49,111 +48,39 @@ import com.bandwidth.sdk.JSON; /** - * MultiChannelMessageCallbackData + * MultiChannelMessageResponseDataChannelListInner */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") -public class MultiChannelMessageCallbackData { - public static final String SERIALIZED_NAME_MESSAGE_ID = "messageId"; - @SerializedName(SERIALIZED_NAME_MESSAGE_ID) - @javax.annotation.Nullable - private String messageId; - - public static final String SERIALIZED_NAME_STATUS = "status"; - @SerializedName(SERIALIZED_NAME_STATUS) - @javax.annotation.Nullable - private MultiChannelStatusEnum status; - - public static final String SERIALIZED_NAME_DIRECTION = "direction"; - @SerializedName(SERIALIZED_NAME_DIRECTION) - @javax.annotation.Nullable - private MultiChannelMessageDirectionEnum direction; - +public class MultiChannelMessageResponseDataChannelListInner { public static final String SERIALIZED_NAME_FROM = "from"; @SerializedName(SERIALIZED_NAME_FROM) - @javax.annotation.Nullable + @javax.annotation.Nonnull private String from; - public static final String SERIALIZED_NAME_TO = "to"; - @SerializedName(SERIALIZED_NAME_TO) - @javax.annotation.Nullable - private String to; - public static final String SERIALIZED_NAME_APPLICATION_ID = "applicationId"; @SerializedName(SERIALIZED_NAME_APPLICATION_ID) - @javax.annotation.Nullable + @javax.annotation.Nonnull private String applicationId; public static final String SERIALIZED_NAME_CHANNEL = "channel"; @SerializedName(SERIALIZED_NAME_CHANNEL) - @javax.annotation.Nullable + @javax.annotation.Nonnull private MultiChannelMessageChannelEnum channel; - public static final String SERIALIZED_NAME_TAG = "tag"; - @SerializedName(SERIALIZED_NAME_TAG) - @javax.annotation.Nullable - private String tag; - - public MultiChannelMessageCallbackData() { - } - - public MultiChannelMessageCallbackData messageId(@javax.annotation.Nullable String messageId) { - this.messageId = messageId; - return this; - } - - /** - * The ID of the message. - * @return messageId - */ - @javax.annotation.Nullable - public String getMessageId() { - return messageId; - } - - public void setMessageId(@javax.annotation.Nullable String messageId) { - this.messageId = messageId; - } - - - public MultiChannelMessageCallbackData status(@javax.annotation.Nullable MultiChannelStatusEnum status) { - this.status = status; - return this; - } - - /** - * Get status - * @return status - */ - @javax.annotation.Nullable - public MultiChannelStatusEnum getStatus() { - return status; - } - - public void setStatus(@javax.annotation.Nullable MultiChannelStatusEnum status) { - this.status = status; - } + public static final String SERIALIZED_NAME_CONTENT = "content"; + @SerializedName(SERIALIZED_NAME_CONTENT) + @javax.annotation.Nonnull + private MultiChannelChannelListObjectContent content; + public static final String SERIALIZED_NAME_OWNER = "owner"; + @SerializedName(SERIALIZED_NAME_OWNER) + @javax.annotation.Nonnull + private String owner; - public MultiChannelMessageCallbackData direction(@javax.annotation.Nullable MultiChannelMessageDirectionEnum direction) { - this.direction = direction; - return this; - } - - /** - * Get direction - * @return direction - */ - @javax.annotation.Nullable - public MultiChannelMessageDirectionEnum getDirection() { - return direction; - } - - public void setDirection(@javax.annotation.Nullable MultiChannelMessageDirectionEnum direction) { - this.direction = direction; + public MultiChannelMessageResponseDataChannelListInner() { } - - public MultiChannelMessageCallbackData from(@javax.annotation.Nullable String from) { + public MultiChannelMessageResponseDataChannelListInner from(@javax.annotation.Nonnull String from) { this.from = from; return this; } @@ -162,36 +89,17 @@ public MultiChannelMessageCallbackData from(@javax.annotation.Nullable String fr * The sender ID of the message. This could be an alphanumeric sender ID. * @return from */ - @javax.annotation.Nullable + @javax.annotation.Nonnull public String getFrom() { return from; } - public void setFrom(@javax.annotation.Nullable String from) { + public void setFrom(@javax.annotation.Nonnull String from) { this.from = from; } - public MultiChannelMessageCallbackData to(@javax.annotation.Nullable String to) { - this.to = to; - return this; - } - - /** - * The phone number the message should be sent to in E164 format. - * @return to - */ - @javax.annotation.Nullable - public String getTo() { - return to; - } - - public void setTo(@javax.annotation.Nullable String to) { - this.to = to; - } - - - public MultiChannelMessageCallbackData applicationId(@javax.annotation.Nullable String applicationId) { + public MultiChannelMessageResponseDataChannelListInner applicationId(@javax.annotation.Nonnull String applicationId) { this.applicationId = applicationId; return this; } @@ -200,17 +108,17 @@ public MultiChannelMessageCallbackData applicationId(@javax.annotation.Nullable * The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard. * @return applicationId */ - @javax.annotation.Nullable + @javax.annotation.Nonnull public String getApplicationId() { return applicationId; } - public void setApplicationId(@javax.annotation.Nullable String applicationId) { + public void setApplicationId(@javax.annotation.Nonnull String applicationId) { this.applicationId = applicationId; } - public MultiChannelMessageCallbackData channel(@javax.annotation.Nullable MultiChannelMessageChannelEnum channel) { + public MultiChannelMessageResponseDataChannelListInner channel(@javax.annotation.Nonnull MultiChannelMessageChannelEnum channel) { this.channel = channel; return this; } @@ -219,32 +127,51 @@ public MultiChannelMessageCallbackData channel(@javax.annotation.Nullable MultiC * Get channel * @return channel */ - @javax.annotation.Nullable + @javax.annotation.Nonnull public MultiChannelMessageChannelEnum getChannel() { return channel; } - public void setChannel(@javax.annotation.Nullable MultiChannelMessageChannelEnum channel) { + public void setChannel(@javax.annotation.Nonnull MultiChannelMessageChannelEnum channel) { this.channel = channel; } - public MultiChannelMessageCallbackData tag(@javax.annotation.Nullable String tag) { - this.tag = tag; + public MultiChannelMessageResponseDataChannelListInner content(@javax.annotation.Nonnull MultiChannelChannelListObjectContent content) { + this.content = content; return this; } /** - * A custom string that will be included in callback events of the message. Max 1024 characters. - * @return tag + * Get content + * @return content */ - @javax.annotation.Nullable - public String getTag() { - return tag; + @javax.annotation.Nonnull + public MultiChannelChannelListObjectContent getContent() { + return content; } - public void setTag(@javax.annotation.Nullable String tag) { - this.tag = tag; + public void setContent(@javax.annotation.Nonnull MultiChannelChannelListObjectContent content) { + this.content = content; + } + + + public MultiChannelMessageResponseDataChannelListInner owner(@javax.annotation.Nonnull String owner) { + this.owner = owner; + return this; + } + + /** + * The Bandwidth senderId associated with the message. Identical to 'from'. + * @return owner + */ + @javax.annotation.Nonnull + public String getOwner() { + return owner; + } + + public void setOwner(@javax.annotation.Nonnull String owner) { + this.owner = owner; } /** @@ -260,9 +187,9 @@ public void setTag(@javax.annotation.Nullable String tag) { * * @param key name of the property * @param value value of the property - * @return the MultiChannelMessageCallbackData instance itself + * @return the MultiChannelMessageResponseDataChannelListInner instance itself */ - public MultiChannelMessageCallbackData putAdditionalProperty(String key, Object value) { + public MultiChannelMessageResponseDataChannelListInner putAdditionalProperty(String key, Object value) { if (this.additionalProperties == null) { this.additionalProperties = new HashMap(); } @@ -301,35 +228,29 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - MultiChannelMessageCallbackData multiChannelMessageCallbackData = (MultiChannelMessageCallbackData) o; - return Objects.equals(this.messageId, multiChannelMessageCallbackData.messageId) && - Objects.equals(this.status, multiChannelMessageCallbackData.status) && - Objects.equals(this.direction, multiChannelMessageCallbackData.direction) && - Objects.equals(this.from, multiChannelMessageCallbackData.from) && - Objects.equals(this.to, multiChannelMessageCallbackData.to) && - Objects.equals(this.applicationId, multiChannelMessageCallbackData.applicationId) && - Objects.equals(this.channel, multiChannelMessageCallbackData.channel) && - Objects.equals(this.tag, multiChannelMessageCallbackData.tag)&& - Objects.equals(this.additionalProperties, multiChannelMessageCallbackData.additionalProperties); + MultiChannelMessageResponseDataChannelListInner multiChannelMessageResponseDataChannelListInner = (MultiChannelMessageResponseDataChannelListInner) o; + return Objects.equals(this.from, multiChannelMessageResponseDataChannelListInner.from) && + Objects.equals(this.applicationId, multiChannelMessageResponseDataChannelListInner.applicationId) && + Objects.equals(this.channel, multiChannelMessageResponseDataChannelListInner.channel) && + Objects.equals(this.content, multiChannelMessageResponseDataChannelListInner.content) && + Objects.equals(this.owner, multiChannelMessageResponseDataChannelListInner.owner)&& + Objects.equals(this.additionalProperties, multiChannelMessageResponseDataChannelListInner.additionalProperties); } @Override public int hashCode() { - return Objects.hash(messageId, status, direction, from, to, applicationId, channel, tag, additionalProperties); + return Objects.hash(from, applicationId, channel, content, owner, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class MultiChannelMessageCallbackData {\n"); - sb.append(" messageId: ").append(toIndentedString(messageId)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append("class MultiChannelMessageResponseDataChannelListInner {\n"); sb.append(" from: ").append(toIndentedString(from)).append("\n"); - sb.append(" to: ").append(toIndentedString(to)).append("\n"); sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); sb.append(" channel: ").append(toIndentedString(channel)).append("\n"); - sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" content: ").append(toIndentedString(content)).append("\n"); + sb.append(" owner: ").append(toIndentedString(owner)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); @@ -353,58 +274,53 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet(); - openapiFields.add("messageId"); - openapiFields.add("status"); - openapiFields.add("direction"); openapiFields.add("from"); - openapiFields.add("to"); openapiFields.add("applicationId"); openapiFields.add("channel"); - openapiFields.add("tag"); + openapiFields.add("content"); + openapiFields.add("owner"); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("from"); + openapiRequiredFields.add("applicationId"); + openapiRequiredFields.add("channel"); + openapiRequiredFields.add("content"); + openapiRequiredFields.add("owner"); } /** * 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 MultiChannelMessageCallbackData + * @throws IOException if the JSON Element is invalid with respect to MultiChannelMessageResponseDataChannelListInner */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { - if (!MultiChannelMessageCallbackData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in MultiChannelMessageCallbackData is not found in the empty JSON string", MultiChannelMessageCallbackData.openapiRequiredFields.toString())); + if (!MultiChannelMessageResponseDataChannelListInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MultiChannelMessageResponseDataChannelListInner is not found in the empty JSON string", MultiChannelMessageResponseDataChannelListInner.openapiRequiredFields.toString())); } } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("messageId") != null && !jsonObj.get("messageId").isJsonNull()) && !jsonObj.get("messageId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `messageId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("messageId").toString())); - } - // validate the optional field `status` - if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { - MultiChannelStatusEnum.validateJsonElement(jsonObj.get("status")); - } - // validate the optional field `direction` - if (jsonObj.get("direction") != null && !jsonObj.get("direction").isJsonNull()) { - MultiChannelMessageDirectionEnum.validateJsonElement(jsonObj.get("direction")); + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MultiChannelMessageResponseDataChannelListInner.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())); + } } - if ((jsonObj.get("from") != null && !jsonObj.get("from").isJsonNull()) && !jsonObj.get("from").isJsonPrimitive()) { + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("from").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); } - if ((jsonObj.get("to") != null && !jsonObj.get("to").isJsonNull()) && !jsonObj.get("to").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); - } - if ((jsonObj.get("applicationId") != null && !jsonObj.get("applicationId").isJsonNull()) && !jsonObj.get("applicationId").isJsonPrimitive()) { + if (!jsonObj.get("applicationId").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `applicationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("applicationId").toString())); } - // validate the optional field `channel` - if (jsonObj.get("channel") != null && !jsonObj.get("channel").isJsonNull()) { - MultiChannelMessageChannelEnum.validateJsonElement(jsonObj.get("channel")); - } - if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + // validate the required field `channel` + MultiChannelMessageChannelEnum.validateJsonElement(jsonObj.get("channel")); + // validate the required field `content` + MultiChannelChannelListObjectContent.validateJsonElement(jsonObj.get("content")); + if (!jsonObj.get("owner").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `owner` to be a primitive type in the JSON string but got `%s`", jsonObj.get("owner").toString())); } } @@ -412,16 +328,16 @@ public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!MultiChannelMessageCallbackData.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'MultiChannelMessageCallbackData' and its subtypes + if (!MultiChannelMessageResponseDataChannelListInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MultiChannelMessageResponseDataChannelListInner' and its subtypes } final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(MultiChannelMessageCallbackData.class)); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MultiChannelMessageResponseDataChannelListInner.class)); - return (TypeAdapter) new TypeAdapter() { + return (TypeAdapter) new TypeAdapter() { @Override - public void write(JsonWriter out, MultiChannelMessageCallbackData value) throws IOException { + public void write(JsonWriter out, MultiChannelMessageResponseDataChannelListInner value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); obj.remove("additionalProperties"); // serialize additional properties @@ -449,12 +365,12 @@ else if (entry.getValue() instanceof Character) } @Override - public MultiChannelMessageCallbackData read(JsonReader in) throws IOException { + public MultiChannelMessageResponseDataChannelListInner read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); JsonObject jsonObj = jsonElement.getAsJsonObject(); // store additional fields in the deserialized instance - MultiChannelMessageCallbackData instance = thisAdapter.fromJsonTree(jsonObj); + MultiChannelMessageResponseDataChannelListInner instance = thisAdapter.fromJsonTree(jsonObj); for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type @@ -481,18 +397,18 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } /** - * Create an instance of MultiChannelMessageCallbackData given an JSON string + * Create an instance of MultiChannelMessageResponseDataChannelListInner given an JSON string * * @param jsonString JSON string - * @return An instance of MultiChannelMessageCallbackData - * @throws IOException if the JSON string is invalid with respect to MultiChannelMessageCallbackData + * @return An instance of MultiChannelMessageResponseDataChannelListInner + * @throws IOException if the JSON string is invalid with respect to MultiChannelMessageResponseDataChannelListInner */ - public static MultiChannelMessageCallbackData fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, MultiChannelMessageCallbackData.class); + public static MultiChannelMessageResponseDataChannelListInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MultiChannelMessageResponseDataChannelListInner.class); } /** - * Convert an instance of MultiChannelMessageCallbackData to an JSON string + * Convert an instance of MultiChannelMessageResponseDataChannelListInner to an JSON string * * @return JSON string */ diff --git a/src/main/java/com/bandwidth/sdk/model/MultiChannelStatusEnum.java b/src/main/java/com/bandwidth/sdk/model/MultiChannelStatusEnum.java deleted file mode 100644 index 8a4eda18..00000000 --- a/src/main/java/com/bandwidth/sdk/model/MultiChannelStatusEnum.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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 multiChannelStatusEnum - */ -@JsonAdapter(MultiChannelStatusEnum.Adapter.class) -public enum MultiChannelStatusEnum { - - QUEUED("QUEUED"), - - SENDING("SENDING"), - - DELIVERED("DELIVERED"), - - FAILED("FAILED"); - - private String value; - - MultiChannelStatusEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static MultiChannelStatusEnum fromValue(String value) { - for (MultiChannelStatusEnum b : MultiChannelStatusEnum.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 MultiChannelStatusEnum enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public MultiChannelStatusEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return MultiChannelStatusEnum.fromValue(value); - } - } - - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - String value = jsonElement.getAsString(); - MultiChannelStatusEnum.fromValue(value); - } -} - diff --git a/src/main/java/com/bandwidth/sdk/model/PriorityEnum.java b/src/main/java/com/bandwidth/sdk/model/PriorityEnum.java index 64cf09ed..26533e2c 100644 --- a/src/main/java/com/bandwidth/sdk/model/PriorityEnum.java +++ b/src/main/java/com/bandwidth/sdk/model/PriorityEnum.java @@ -24,7 +24,7 @@ import com.google.gson.stream.JsonWriter; /** - * The priority specified by the user. + * Specifies the message's sending priority with respect to other messages in your account. For best results and optimal throughput, reserve the 'high' priority setting for critical messages only. */ @JsonAdapter(PriorityEnum.Adapter.class) public enum PriorityEnum { diff --git a/src/main/java/com/bandwidth/sdk/model/RbmActionBase.java b/src/main/java/com/bandwidth/sdk/model/RbmActionBase.java index eb52d415..a2f7a6f1 100644 --- a/src/main/java/com/bandwidth/sdk/model/RbmActionBase.java +++ b/src/main/java/com/bandwidth/sdk/model/RbmActionBase.java @@ -61,10 +61,10 @@ public class RbmActionBase { @javax.annotation.Nonnull private String text; - public static final String SERIALIZED_NAME_POST_BACK_DATA = "postBackData"; - @SerializedName(SERIALIZED_NAME_POST_BACK_DATA) + public static final String SERIALIZED_NAME_POSTBACK_DATA = "postbackData"; + @SerializedName(SERIALIZED_NAME_POSTBACK_DATA) @javax.annotation.Nonnull - private byte[] postBackData; + private byte[] postbackData; public RbmActionBase() { } @@ -107,22 +107,22 @@ public void setText(@javax.annotation.Nonnull String text) { } - public RbmActionBase postBackData(@javax.annotation.Nonnull byte[] postBackData) { - this.postBackData = postBackData; + public RbmActionBase postbackData(@javax.annotation.Nonnull byte[] postbackData) { + this.postbackData = postbackData; return this; } /** * Base64 payload the customer receives when the reply is clicked. - * @return postBackData + * @return postbackData */ @javax.annotation.Nonnull - public byte[] getPostBackData() { - return postBackData; + public byte[] getPostbackData() { + return postbackData; } - public void setPostBackData(@javax.annotation.Nonnull byte[] postBackData) { - this.postBackData = postBackData; + public void setPostbackData(@javax.annotation.Nonnull byte[] postbackData) { + this.postbackData = postbackData; } /** @@ -182,13 +182,13 @@ public boolean equals(Object o) { RbmActionBase rbmActionBase = (RbmActionBase) o; return Objects.equals(this.type, rbmActionBase.type) && Objects.equals(this.text, rbmActionBase.text) && - Arrays.equals(this.postBackData, rbmActionBase.postBackData)&& + Arrays.equals(this.postbackData, rbmActionBase.postbackData)&& Objects.equals(this.additionalProperties, rbmActionBase.additionalProperties); } @Override public int hashCode() { - return Objects.hash(type, text, Arrays.hashCode(postBackData), additionalProperties); + return Objects.hash(type, text, Arrays.hashCode(postbackData), additionalProperties); } @Override @@ -197,7 +197,7 @@ public String toString() { sb.append("class RbmActionBase {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" text: ").append(toIndentedString(text)).append("\n"); - sb.append(" postBackData: ").append(toIndentedString(postBackData)).append("\n"); + sb.append(" postbackData: ").append(toIndentedString(postbackData)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); @@ -223,13 +223,13 @@ private String toIndentedString(Object o) { openapiFields = new HashSet(); openapiFields.add("type"); openapiFields.add("text"); - openapiFields.add("postBackData"); + openapiFields.add("postbackData"); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(); openapiRequiredFields.add("type"); openapiRequiredFields.add("text"); - openapiRequiredFields.add("postBackData"); + openapiRequiredFields.add("postbackData"); } /** diff --git a/src/main/java/com/bandwidth/sdk/model/RbmActionDial.java b/src/main/java/com/bandwidth/sdk/model/RbmActionDial.java index 744191b4..4928d8ba 100644 --- a/src/main/java/com/bandwidth/sdk/model/RbmActionDial.java +++ b/src/main/java/com/bandwidth/sdk/model/RbmActionDial.java @@ -61,10 +61,10 @@ public class RbmActionDial { @javax.annotation.Nonnull private String text; - public static final String SERIALIZED_NAME_POST_BACK_DATA = "postBackData"; - @SerializedName(SERIALIZED_NAME_POST_BACK_DATA) + public static final String SERIALIZED_NAME_POSTBACK_DATA = "postbackData"; + @SerializedName(SERIALIZED_NAME_POSTBACK_DATA) @javax.annotation.Nonnull - private byte[] postBackData; + private byte[] postbackData; public static final String SERIALIZED_NAME_PHONE_NUMBER = "phoneNumber"; @SerializedName(SERIALIZED_NAME_PHONE_NUMBER) @@ -112,22 +112,22 @@ public void setText(@javax.annotation.Nonnull String text) { } - public RbmActionDial postBackData(@javax.annotation.Nonnull byte[] postBackData) { - this.postBackData = postBackData; + public RbmActionDial postbackData(@javax.annotation.Nonnull byte[] postbackData) { + this.postbackData = postbackData; return this; } /** * Base64 payload the customer receives when the reply is clicked. - * @return postBackData + * @return postbackData */ @javax.annotation.Nonnull - public byte[] getPostBackData() { - return postBackData; + public byte[] getPostbackData() { + return postbackData; } - public void setPostBackData(@javax.annotation.Nonnull byte[] postBackData) { - this.postBackData = postBackData; + public void setPostbackData(@javax.annotation.Nonnull byte[] postbackData) { + this.postbackData = postbackData; } @@ -206,14 +206,14 @@ public boolean equals(Object o) { RbmActionDial rbmActionDial = (RbmActionDial) o; return Objects.equals(this.type, rbmActionDial.type) && Objects.equals(this.text, rbmActionDial.text) && - Arrays.equals(this.postBackData, rbmActionDial.postBackData) && + Arrays.equals(this.postbackData, rbmActionDial.postbackData) && Objects.equals(this.phoneNumber, rbmActionDial.phoneNumber)&& Objects.equals(this.additionalProperties, rbmActionDial.additionalProperties); } @Override public int hashCode() { - return Objects.hash(type, text, Arrays.hashCode(postBackData), phoneNumber, additionalProperties); + return Objects.hash(type, text, Arrays.hashCode(postbackData), phoneNumber, additionalProperties); } @Override @@ -222,7 +222,7 @@ public String toString() { sb.append("class RbmActionDial {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" text: ").append(toIndentedString(text)).append("\n"); - sb.append(" postBackData: ").append(toIndentedString(postBackData)).append("\n"); + sb.append(" postbackData: ").append(toIndentedString(postbackData)).append("\n"); sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); @@ -249,14 +249,14 @@ private String toIndentedString(Object o) { openapiFields = new HashSet(); openapiFields.add("type"); openapiFields.add("text"); - openapiFields.add("postBackData"); + openapiFields.add("postbackData"); openapiFields.add("phoneNumber"); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(); openapiRequiredFields.add("type"); openapiRequiredFields.add("text"); - openapiRequiredFields.add("postBackData"); + openapiRequiredFields.add("postbackData"); openapiRequiredFields.add("phoneNumber"); } diff --git a/src/main/java/com/bandwidth/sdk/model/RbmActionOpenUrl.java b/src/main/java/com/bandwidth/sdk/model/RbmActionOpenUrl.java index 72875e55..6e9b7fe1 100644 --- a/src/main/java/com/bandwidth/sdk/model/RbmActionOpenUrl.java +++ b/src/main/java/com/bandwidth/sdk/model/RbmActionOpenUrl.java @@ -62,10 +62,10 @@ public class RbmActionOpenUrl { @javax.annotation.Nonnull private String text; - public static final String SERIALIZED_NAME_POST_BACK_DATA = "postBackData"; - @SerializedName(SERIALIZED_NAME_POST_BACK_DATA) + public static final String SERIALIZED_NAME_POSTBACK_DATA = "postbackData"; + @SerializedName(SERIALIZED_NAME_POSTBACK_DATA) @javax.annotation.Nonnull - private byte[] postBackData; + private byte[] postbackData; public static final String SERIALIZED_NAME_URL = "url"; @SerializedName(SERIALIZED_NAME_URL) @@ -113,22 +113,22 @@ public void setText(@javax.annotation.Nonnull String text) { } - public RbmActionOpenUrl postBackData(@javax.annotation.Nonnull byte[] postBackData) { - this.postBackData = postBackData; + public RbmActionOpenUrl postbackData(@javax.annotation.Nonnull byte[] postbackData) { + this.postbackData = postbackData; return this; } /** * Base64 payload the customer receives when the reply is clicked. - * @return postBackData + * @return postbackData */ @javax.annotation.Nonnull - public byte[] getPostBackData() { - return postBackData; + public byte[] getPostbackData() { + return postbackData; } - public void setPostBackData(@javax.annotation.Nonnull byte[] postBackData) { - this.postBackData = postBackData; + public void setPostbackData(@javax.annotation.Nonnull byte[] postbackData) { + this.postbackData = postbackData; } @@ -207,14 +207,14 @@ public boolean equals(Object o) { RbmActionOpenUrl rbmActionOpenUrl = (RbmActionOpenUrl) o; return Objects.equals(this.type, rbmActionOpenUrl.type) && Objects.equals(this.text, rbmActionOpenUrl.text) && - Arrays.equals(this.postBackData, rbmActionOpenUrl.postBackData) && + Arrays.equals(this.postbackData, rbmActionOpenUrl.postbackData) && Objects.equals(this.url, rbmActionOpenUrl.url)&& Objects.equals(this.additionalProperties, rbmActionOpenUrl.additionalProperties); } @Override public int hashCode() { - return Objects.hash(type, text, Arrays.hashCode(postBackData), url, additionalProperties); + return Objects.hash(type, text, Arrays.hashCode(postbackData), url, additionalProperties); } @Override @@ -223,7 +223,7 @@ public String toString() { sb.append("class RbmActionOpenUrl {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" text: ").append(toIndentedString(text)).append("\n"); - sb.append(" postBackData: ").append(toIndentedString(postBackData)).append("\n"); + sb.append(" postbackData: ").append(toIndentedString(postbackData)).append("\n"); sb.append(" url: ").append(toIndentedString(url)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); @@ -250,14 +250,14 @@ private String toIndentedString(Object o) { openapiFields = new HashSet(); openapiFields.add("type"); openapiFields.add("text"); - openapiFields.add("postBackData"); + openapiFields.add("postbackData"); openapiFields.add("url"); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(); openapiRequiredFields.add("type"); openapiRequiredFields.add("text"); - openapiRequiredFields.add("postBackData"); + openapiRequiredFields.add("postbackData"); openapiRequiredFields.add("url"); } diff --git a/src/main/java/com/bandwidth/sdk/model/RbmActionViewLocation.java b/src/main/java/com/bandwidth/sdk/model/RbmActionViewLocation.java index fba28d2e..97bf52a5 100644 --- a/src/main/java/com/bandwidth/sdk/model/RbmActionViewLocation.java +++ b/src/main/java/com/bandwidth/sdk/model/RbmActionViewLocation.java @@ -61,10 +61,10 @@ public class RbmActionViewLocation { @javax.annotation.Nonnull private String text; - public static final String SERIALIZED_NAME_POST_BACK_DATA = "postBackData"; - @SerializedName(SERIALIZED_NAME_POST_BACK_DATA) + public static final String SERIALIZED_NAME_POSTBACK_DATA = "postbackData"; + @SerializedName(SERIALIZED_NAME_POSTBACK_DATA) @javax.annotation.Nonnull - private byte[] postBackData; + private byte[] postbackData; public static final String SERIALIZED_NAME_LATITUDE = "latitude"; @SerializedName(SERIALIZED_NAME_LATITUDE) @@ -122,22 +122,22 @@ public void setText(@javax.annotation.Nonnull String text) { } - public RbmActionViewLocation postBackData(@javax.annotation.Nonnull byte[] postBackData) { - this.postBackData = postBackData; + public RbmActionViewLocation postbackData(@javax.annotation.Nonnull byte[] postbackData) { + this.postbackData = postbackData; return this; } /** * Base64 payload the customer receives when the reply is clicked. - * @return postBackData + * @return postbackData */ @javax.annotation.Nonnull - public byte[] getPostBackData() { - return postBackData; + public byte[] getPostbackData() { + return postbackData; } - public void setPostBackData(@javax.annotation.Nonnull byte[] postBackData) { - this.postBackData = postBackData; + public void setPostbackData(@javax.annotation.Nonnull byte[] postbackData) { + this.postbackData = postbackData; } @@ -254,7 +254,7 @@ public boolean equals(Object o) { RbmActionViewLocation rbmActionViewLocation = (RbmActionViewLocation) o; return Objects.equals(this.type, rbmActionViewLocation.type) && Objects.equals(this.text, rbmActionViewLocation.text) && - Arrays.equals(this.postBackData, rbmActionViewLocation.postBackData) && + Arrays.equals(this.postbackData, rbmActionViewLocation.postbackData) && Objects.equals(this.latitude, rbmActionViewLocation.latitude) && Objects.equals(this.longitude, rbmActionViewLocation.longitude) && Objects.equals(this.label, rbmActionViewLocation.label)&& @@ -263,7 +263,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(type, text, Arrays.hashCode(postBackData), latitude, longitude, label, additionalProperties); + return Objects.hash(type, text, Arrays.hashCode(postbackData), latitude, longitude, label, additionalProperties); } @Override @@ -272,7 +272,7 @@ public String toString() { sb.append("class RbmActionViewLocation {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" text: ").append(toIndentedString(text)).append("\n"); - sb.append(" postBackData: ").append(toIndentedString(postBackData)).append("\n"); + sb.append(" postbackData: ").append(toIndentedString(postbackData)).append("\n"); sb.append(" latitude: ").append(toIndentedString(latitude)).append("\n"); sb.append(" longitude: ").append(toIndentedString(longitude)).append("\n"); sb.append(" label: ").append(toIndentedString(label)).append("\n"); @@ -301,7 +301,7 @@ private String toIndentedString(Object o) { openapiFields = new HashSet(); openapiFields.add("type"); openapiFields.add("text"); - openapiFields.add("postBackData"); + openapiFields.add("postbackData"); openapiFields.add("latitude"); openapiFields.add("longitude"); openapiFields.add("label"); @@ -310,7 +310,7 @@ private String toIndentedString(Object o) { openapiRequiredFields = new HashSet(); openapiRequiredFields.add("type"); openapiRequiredFields.add("text"); - openapiRequiredFields.add("postBackData"); + openapiRequiredFields.add("postbackData"); openapiRequiredFields.add("latitude"); openapiRequiredFields.add("longitude"); } diff --git a/src/main/java/com/bandwidth/sdk/model/RbmLocationResponse.java b/src/main/java/com/bandwidth/sdk/model/RbmLocationResponse.java new file mode 100644 index 00000000..250175fa --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/RbmLocationResponse.java @@ -0,0 +1,317 @@ +/* + * 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; + +/** + * RbmLocationResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") +public class RbmLocationResponse { + public static final String SERIALIZED_NAME_LATITUDE = "latitude"; + @SerializedName(SERIALIZED_NAME_LATITUDE) + @javax.annotation.Nullable + private Double latitude; + + public static final String SERIALIZED_NAME_LONGITUDE = "longitude"; + @SerializedName(SERIALIZED_NAME_LONGITUDE) + @javax.annotation.Nullable + private Double longitude; + + public RbmLocationResponse() { + } + + public RbmLocationResponse latitude(@javax.annotation.Nullable Double latitude) { + this.latitude = latitude; + return this; + } + + /** + * The latitude of the client's location. + * @return latitude + */ + @javax.annotation.Nullable + public Double getLatitude() { + return latitude; + } + + public void setLatitude(@javax.annotation.Nullable Double latitude) { + this.latitude = latitude; + } + + + public RbmLocationResponse longitude(@javax.annotation.Nullable Double longitude) { + this.longitude = longitude; + return this; + } + + /** + * The longitude of the client's location. + * @return longitude + */ + @javax.annotation.Nullable + public Double getLongitude() { + return longitude; + } + + public void setLongitude(@javax.annotation.Nullable Double longitude) { + this.longitude = longitude; + } + + /** + * 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 RbmLocationResponse instance itself + */ + public RbmLocationResponse 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; + } + RbmLocationResponse rbmLocationResponse = (RbmLocationResponse) o; + return Objects.equals(this.latitude, rbmLocationResponse.latitude) && + Objects.equals(this.longitude, rbmLocationResponse.longitude)&& + Objects.equals(this.additionalProperties, rbmLocationResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(latitude, longitude, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RbmLocationResponse {\n"); + sb.append(" latitude: ").append(toIndentedString(latitude)).append("\n"); + sb.append(" longitude: ").append(toIndentedString(longitude)).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("latitude"); + openapiFields.add("longitude"); + + // 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 RbmLocationResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RbmLocationResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RbmLocationResponse is not found in the empty JSON string", RbmLocationResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("latitude") != null && !jsonObj.get("latitude").isJsonNull()) && !jsonObj.get("latitude").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `latitude` to be a primitive type in the JSON string but got `%s`", jsonObj.get("latitude").toString())); + } + if ((jsonObj.get("longitude") != null && !jsonObj.get("longitude").isJsonNull()) && !jsonObj.get("longitude").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `longitude` to be a primitive type in the JSON string but got `%s`", jsonObj.get("longitude").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RbmLocationResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RbmLocationResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RbmLocationResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RbmLocationResponse 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 RbmLocationResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + RbmLocationResponse 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 RbmLocationResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of RbmLocationResponse + * @throws IOException if the JSON string is invalid with respect to RbmLocationResponse + */ + public static RbmLocationResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RbmLocationResponse.class); + } + + /** + * Convert an instance of RbmLocationResponse 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/Tag.java b/src/main/java/com/bandwidth/sdk/model/RbmSuggestionResponse.java similarity index 70% rename from src/main/java/com/bandwidth/sdk/model/Tag.java rename to src/main/java/com/bandwidth/sdk/model/RbmSuggestionResponse.java index f5d89d64..b5fd0185 100644 --- a/src/main/java/com/bandwidth/sdk/model/Tag.java +++ b/src/main/java/com/bandwidth/sdk/model/RbmSuggestionResponse.java @@ -46,58 +46,58 @@ import com.bandwidth.sdk.JSON; /** - * Tag + * RbmSuggestionResponse */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") -public class Tag { - public static final String SERIALIZED_NAME_KEY = "key"; - @SerializedName(SERIALIZED_NAME_KEY) +public class RbmSuggestionResponse { + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) @javax.annotation.Nullable - private String key; + private String text; - public static final String SERIALIZED_NAME_VALUE = "value"; - @SerializedName(SERIALIZED_NAME_VALUE) + public static final String SERIALIZED_NAME_POSTBACK_DATA = "postbackData"; + @SerializedName(SERIALIZED_NAME_POSTBACK_DATA) @javax.annotation.Nullable - private String value; + private byte[] postbackData; - public Tag() { + public RbmSuggestionResponse() { } - public Tag key(@javax.annotation.Nullable String key) { - this.key = key; + public RbmSuggestionResponse text(@javax.annotation.Nullable String text) { + this.text = text; return this; } /** - * Get key - * @return key + * The text associated with the suggestion response. + * @return text */ @javax.annotation.Nullable - public String getKey() { - return key; + public String getText() { + return text; } - public void setKey(@javax.annotation.Nullable String key) { - this.key = key; + public void setText(@javax.annotation.Nullable String text) { + this.text = text; } - public Tag value(@javax.annotation.Nullable String value) { - this.value = value; + public RbmSuggestionResponse postbackData(@javax.annotation.Nullable byte[] postbackData) { + this.postbackData = postbackData; return this; } /** - * Get value - * @return value + * Base64 payload the customer receives when the reply is clicked. + * @return postbackData */ @javax.annotation.Nullable - public String getValue() { - return value; + public byte[] getPostbackData() { + return postbackData; } - public void setValue(@javax.annotation.Nullable String value) { - this.value = value; + public void setPostbackData(@javax.annotation.Nullable byte[] postbackData) { + this.postbackData = postbackData; } /** @@ -113,9 +113,9 @@ public void setValue(@javax.annotation.Nullable String value) { * * @param key name of the property * @param value value of the property - * @return the Tag instance itself + * @return the RbmSuggestionResponse instance itself */ - public Tag putAdditionalProperty(String key, Object value) { + public RbmSuggestionResponse putAdditionalProperty(String key, Object value) { if (this.additionalProperties == null) { this.additionalProperties = new HashMap(); } @@ -154,23 +154,23 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - Tag tag = (Tag) o; - return Objects.equals(this.key, tag.key) && - Objects.equals(this.value, tag.value)&& - Objects.equals(this.additionalProperties, tag.additionalProperties); + RbmSuggestionResponse rbmSuggestionResponse = (RbmSuggestionResponse) o; + return Objects.equals(this.text, rbmSuggestionResponse.text) && + Arrays.equals(this.postbackData, rbmSuggestionResponse.postbackData)&& + Objects.equals(this.additionalProperties, rbmSuggestionResponse.additionalProperties); } @Override public int hashCode() { - return Objects.hash(key, value, additionalProperties); + return Objects.hash(text, Arrays.hashCode(postbackData), additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class Tag {\n"); - sb.append(" key: ").append(toIndentedString(key)).append("\n"); - sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("class RbmSuggestionResponse {\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" postbackData: ").append(toIndentedString(postbackData)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); @@ -194,8 +194,8 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet(); - openapiFields.add("key"); - openapiFields.add("value"); + openapiFields.add("text"); + openapiFields.add("postbackData"); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(); @@ -205,20 +205,17 @@ private String toIndentedString(Object o) { * 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 Tag + * @throws IOException if the JSON Element is invalid with respect to RbmSuggestionResponse */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { - if (!Tag.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Tag is not found in the empty JSON string", Tag.openapiRequiredFields.toString())); + if (!RbmSuggestionResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RbmSuggestionResponse is not found in the empty JSON string", RbmSuggestionResponse.openapiRequiredFields.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("key") != null && !jsonObj.get("key").isJsonNull()) && !jsonObj.get("key").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `key` to be a primitive type in the JSON string but got `%s`", jsonObj.get("key").toString())); - } - if ((jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) && !jsonObj.get("value").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); + if ((jsonObj.get("text") != null && !jsonObj.get("text").isJsonNull()) && !jsonObj.get("text").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); } } @@ -226,16 +223,16 @@ public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!Tag.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Tag' and its subtypes + if (!RbmSuggestionResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RbmSuggestionResponse' and its subtypes } final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Tag.class)); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RbmSuggestionResponse.class)); - return (TypeAdapter) new TypeAdapter() { + return (TypeAdapter) new TypeAdapter() { @Override - public void write(JsonWriter out, Tag value) throws IOException { + public void write(JsonWriter out, RbmSuggestionResponse value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); obj.remove("additionalProperties"); // serialize additional properties @@ -263,12 +260,12 @@ else if (entry.getValue() instanceof Character) } @Override - public Tag read(JsonReader in) throws IOException { + public RbmSuggestionResponse read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); JsonObject jsonObj = jsonElement.getAsJsonObject(); // store additional fields in the deserialized instance - Tag instance = thisAdapter.fromJsonTree(jsonObj); + RbmSuggestionResponse instance = thisAdapter.fromJsonTree(jsonObj); for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type @@ -295,18 +292,18 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } /** - * Create an instance of Tag given an JSON string + * Create an instance of RbmSuggestionResponse given an JSON string * * @param jsonString JSON string - * @return An instance of Tag - * @throws IOException if the JSON string is invalid with respect to Tag + * @return An instance of RbmSuggestionResponse + * @throws IOException if the JSON string is invalid with respect to RbmSuggestionResponse */ - public static Tag fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Tag.class); + public static RbmSuggestionResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RbmSuggestionResponse.class); } /** - * Convert an instance of Tag to an JSON string + * Convert an instance of RbmSuggestionResponse to an JSON string * * @return JSON string */ diff --git a/src/main/java/com/bandwidth/sdk/model/MultiChannelCallbackData.java b/src/main/java/com/bandwidth/sdk/model/StatusCallback.java similarity index 58% rename from src/main/java/com/bandwidth/sdk/model/MultiChannelCallbackData.java rename to src/main/java/com/bandwidth/sdk/model/StatusCallback.java index 208dc46b..64a57657 100644 --- a/src/main/java/com/bandwidth/sdk/model/MultiChannelCallbackData.java +++ b/src/main/java/com/bandwidth/sdk/model/StatusCallback.java @@ -14,8 +14,8 @@ package com.bandwidth.sdk.model; import java.util.Objects; -import com.bandwidth.sdk.model.MultiChannelMessageCallbackData; -import com.bandwidth.sdk.model.MultiChannelStatusEnum; +import com.bandwidth.sdk.model.StatusCallbackMessage; +import com.bandwidth.sdk.model.StatusCallbackTypeEnum; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -49,58 +49,92 @@ import com.bandwidth.sdk.JSON; /** - * MultiChannelCallbackData + * Represents a status callback for an outbound MT SMS or MMS or RBM message. */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") -public class MultiChannelCallbackData { +public class StatusCallback { public static final String SERIALIZED_NAME_TIME = "time"; @SerializedName(SERIALIZED_NAME_TIME) - @javax.annotation.Nullable + @javax.annotation.Nonnull private OffsetDateTime time; + public static final String SERIALIZED_NAME_EVENT_TIME = "eventTime"; + @SerializedName(SERIALIZED_NAME_EVENT_TIME) + @javax.annotation.Nullable + private OffsetDateTime eventTime; + public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) - @javax.annotation.Nullable - private MultiChannelStatusEnum type; + @javax.annotation.Nonnull + private StatusCallbackTypeEnum type; public static final String SERIALIZED_NAME_TO = "to"; @SerializedName(SERIALIZED_NAME_TO) - @javax.annotation.Nullable + @javax.annotation.Nonnull private String to; public static final String SERIALIZED_NAME_DESCRIPTION = "description"; @SerializedName(SERIALIZED_NAME_DESCRIPTION) - @javax.annotation.Nullable + @javax.annotation.Nonnull private String description; public static final String SERIALIZED_NAME_MESSAGE = "message"; @SerializedName(SERIALIZED_NAME_MESSAGE) + @javax.annotation.Nonnull + private StatusCallbackMessage message; + + public static final String SERIALIZED_NAME_ERROR_CODE = "errorCode"; + @SerializedName(SERIALIZED_NAME_ERROR_CODE) @javax.annotation.Nullable - private MultiChannelMessageCallbackData message; + private Integer errorCode; - public MultiChannelCallbackData() { + public static final String SERIALIZED_NAME_CARRIER_NAME = "carrierName"; + @SerializedName(SERIALIZED_NAME_CARRIER_NAME) + @javax.annotation.Nullable + private String carrierName; + + public StatusCallback() { } - public MultiChannelCallbackData time(@javax.annotation.Nullable OffsetDateTime time) { + public StatusCallback time(@javax.annotation.Nonnull OffsetDateTime time) { this.time = time; return this; } /** - * The time of the callback event. + * Get time * @return time */ - @javax.annotation.Nullable + @javax.annotation.Nonnull public OffsetDateTime getTime() { return time; } - public void setTime(@javax.annotation.Nullable OffsetDateTime time) { + public void setTime(@javax.annotation.Nonnull OffsetDateTime time) { this.time = time; } - public MultiChannelCallbackData type(@javax.annotation.Nullable MultiChannelStatusEnum type) { + public StatusCallback eventTime(@javax.annotation.Nullable OffsetDateTime eventTime) { + this.eventTime = eventTime; + return this; + } + + /** + * Represents the time at which the message was read, for `message-read` callbacks. + * @return eventTime + */ + @javax.annotation.Nullable + public OffsetDateTime getEventTime() { + return eventTime; + } + + public void setEventTime(@javax.annotation.Nullable OffsetDateTime eventTime) { + this.eventTime = eventTime; + } + + + public StatusCallback type(@javax.annotation.Nonnull StatusCallbackTypeEnum type) { this.type = type; return this; } @@ -109,55 +143,55 @@ public MultiChannelCallbackData type(@javax.annotation.Nullable MultiChannelStat * Get type * @return type */ - @javax.annotation.Nullable - public MultiChannelStatusEnum getType() { + @javax.annotation.Nonnull + public StatusCallbackTypeEnum getType() { return type; } - public void setType(@javax.annotation.Nullable MultiChannelStatusEnum type) { + public void setType(@javax.annotation.Nonnull StatusCallbackTypeEnum type) { this.type = type; } - public MultiChannelCallbackData to(@javax.annotation.Nullable String to) { + public StatusCallback to(@javax.annotation.Nonnull String to) { this.to = to; return this; } /** - * The phone number the message should be sent to in E164 format. + * The destination phone number the message was sent to. For status callbacks, this the the Bandwidth user's client phone number. * @return to */ - @javax.annotation.Nullable + @javax.annotation.Nonnull public String getTo() { return to; } - public void setTo(@javax.annotation.Nullable String to) { + public void setTo(@javax.annotation.Nonnull String to) { this.to = to; } - public MultiChannelCallbackData description(@javax.annotation.Nullable String description) { + public StatusCallback description(@javax.annotation.Nonnull String description) { this.description = description; return this; } /** - * Get description + * A detailed description of the event described by the callback. * @return description */ - @javax.annotation.Nullable + @javax.annotation.Nonnull public String getDescription() { return description; } - public void setDescription(@javax.annotation.Nullable String description) { + public void setDescription(@javax.annotation.Nonnull String description) { this.description = description; } - public MultiChannelCallbackData message(@javax.annotation.Nullable MultiChannelMessageCallbackData message) { + public StatusCallback message(@javax.annotation.Nonnull StatusCallbackMessage message) { this.message = message; return this; } @@ -166,15 +200,53 @@ public MultiChannelCallbackData message(@javax.annotation.Nullable MultiChannelM * Get message * @return message */ - @javax.annotation.Nullable - public MultiChannelMessageCallbackData getMessage() { + @javax.annotation.Nonnull + public StatusCallbackMessage getMessage() { return message; } - public void setMessage(@javax.annotation.Nullable MultiChannelMessageCallbackData message) { + public void setMessage(@javax.annotation.Nonnull StatusCallbackMessage message) { this.message = message; } + + public StatusCallback errorCode(@javax.annotation.Nullable Integer errorCode) { + this.errorCode = errorCode; + return this; + } + + /** + * Optional error code, applicable only when type is `message-failed`. + * @return errorCode + */ + @javax.annotation.Nullable + public Integer getErrorCode() { + return errorCode; + } + + public void setErrorCode(@javax.annotation.Nullable Integer errorCode) { + this.errorCode = errorCode; + } + + + public StatusCallback carrierName(@javax.annotation.Nullable String carrierName) { + this.carrierName = carrierName; + return this; + } + + /** + * The name of the Authorized Message Provider (AMP) that handled this message. In the US, this is the carrier that the message was sent to. This field is present only when this account feature has been enabled. + * @return carrierName + */ + @javax.annotation.Nullable + public String getCarrierName() { + return carrierName; + } + + public void setCarrierName(@javax.annotation.Nullable String carrierName) { + this.carrierName = carrierName; + } + /** * A container for additional, undeclared properties. * This is a holder for any undeclared properties as specified with @@ -188,9 +260,9 @@ public void setMessage(@javax.annotation.Nullable MultiChannelMessageCallbackDat * * @param key name of the property * @param value value of the property - * @return the MultiChannelCallbackData instance itself + * @return the StatusCallback instance itself */ - public MultiChannelCallbackData putAdditionalProperty(String key, Object value) { + public StatusCallback putAdditionalProperty(String key, Object value) { if (this.additionalProperties == null) { this.additionalProperties = new HashMap(); } @@ -229,29 +301,35 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - MultiChannelCallbackData multiChannelCallbackData = (MultiChannelCallbackData) o; - return Objects.equals(this.time, multiChannelCallbackData.time) && - Objects.equals(this.type, multiChannelCallbackData.type) && - Objects.equals(this.to, multiChannelCallbackData.to) && - Objects.equals(this.description, multiChannelCallbackData.description) && - Objects.equals(this.message, multiChannelCallbackData.message)&& - Objects.equals(this.additionalProperties, multiChannelCallbackData.additionalProperties); + StatusCallback statusCallback = (StatusCallback) o; + return Objects.equals(this.time, statusCallback.time) && + Objects.equals(this.eventTime, statusCallback.eventTime) && + Objects.equals(this.type, statusCallback.type) && + Objects.equals(this.to, statusCallback.to) && + Objects.equals(this.description, statusCallback.description) && + Objects.equals(this.message, statusCallback.message) && + Objects.equals(this.errorCode, statusCallback.errorCode) && + Objects.equals(this.carrierName, statusCallback.carrierName)&& + Objects.equals(this.additionalProperties, statusCallback.additionalProperties); } @Override public int hashCode() { - return Objects.hash(time, type, to, description, message, additionalProperties); + return Objects.hash(time, eventTime, type, to, description, message, errorCode, carrierName, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class MultiChannelCallbackData {\n"); + sb.append("class StatusCallback {\n"); sb.append(" time: ").append(toIndentedString(time)).append("\n"); + sb.append(" eventTime: ").append(toIndentedString(eventTime)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" to: ").append(toIndentedString(to)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" errorCode: ").append(toIndentedString(errorCode)).append("\n"); + sb.append(" carrierName: ").append(toIndentedString(carrierName)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); @@ -276,41 +354,55 @@ private String toIndentedString(Object o) { // a set of all properties/fields (JSON key names) openapiFields = new HashSet(); openapiFields.add("time"); + openapiFields.add("eventTime"); openapiFields.add("type"); openapiFields.add("to"); openapiFields.add("description"); openapiFields.add("message"); + openapiFields.add("errorCode"); + openapiFields.add("carrierName"); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("time"); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("to"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("message"); } /** * 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 MultiChannelCallbackData + * @throws IOException if the JSON Element is invalid with respect to StatusCallback */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { - if (!MultiChannelCallbackData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in MultiChannelCallbackData is not found in the empty JSON string", MultiChannelCallbackData.openapiRequiredFields.toString())); + if (!StatusCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StatusCallback is not found in the empty JSON string", StatusCallback.openapiRequiredFields.toString())); } } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the optional field `type` - if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) { - MultiChannelStatusEnum.validateJsonElement(jsonObj.get("type")); + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : StatusCallback.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())); + } } - if ((jsonObj.get("to") != null && !jsonObj.get("to").isJsonNull()) && !jsonObj.get("to").isJsonPrimitive()) { + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `type` + StatusCallbackTypeEnum.validateJsonElement(jsonObj.get("type")); + if (!jsonObj.get("to").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); } - if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + 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())); } - // validate the optional field `message` - if (jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) { - MultiChannelMessageCallbackData.validateJsonElement(jsonObj.get("message")); + // validate the required field `message` + StatusCallbackMessage.validateJsonElement(jsonObj.get("message")); + if ((jsonObj.get("carrierName") != null && !jsonObj.get("carrierName").isJsonNull()) && !jsonObj.get("carrierName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `carrierName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("carrierName").toString())); } } @@ -318,16 +410,16 @@ public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!MultiChannelCallbackData.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'MultiChannelCallbackData' and its subtypes + if (!StatusCallback.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StatusCallback' and its subtypes } final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(MultiChannelCallbackData.class)); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StatusCallback.class)); - return (TypeAdapter) new TypeAdapter() { + return (TypeAdapter) new TypeAdapter() { @Override - public void write(JsonWriter out, MultiChannelCallbackData value) throws IOException { + public void write(JsonWriter out, StatusCallback value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); obj.remove("additionalProperties"); // serialize additional properties @@ -355,12 +447,12 @@ else if (entry.getValue() instanceof Character) } @Override - public MultiChannelCallbackData read(JsonReader in) throws IOException { + public StatusCallback read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); JsonObject jsonObj = jsonElement.getAsJsonObject(); // store additional fields in the deserialized instance - MultiChannelCallbackData instance = thisAdapter.fromJsonTree(jsonObj); + StatusCallback instance = thisAdapter.fromJsonTree(jsonObj); for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type @@ -387,18 +479,18 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } /** - * Create an instance of MultiChannelCallbackData given an JSON string + * Create an instance of StatusCallback given an JSON string * * @param jsonString JSON string - * @return An instance of MultiChannelCallbackData - * @throws IOException if the JSON string is invalid with respect to MultiChannelCallbackData + * @return An instance of StatusCallback + * @throws IOException if the JSON string is invalid with respect to StatusCallback */ - public static MultiChannelCallbackData fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, MultiChannelCallbackData.class); + public static StatusCallback fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StatusCallback.class); } /** - * Convert an instance of MultiChannelCallbackData to an JSON string + * Convert an instance of StatusCallback to an JSON string * * @return JSON string */ diff --git a/src/main/java/com/bandwidth/sdk/model/MessageCallbackMessage.java b/src/main/java/com/bandwidth/sdk/model/StatusCallbackMessage.java similarity index 75% rename from src/main/java/com/bandwidth/sdk/model/MessageCallbackMessage.java rename to src/main/java/com/bandwidth/sdk/model/StatusCallbackMessage.java index 0ea1c1e3..a983981f 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessageCallbackMessage.java +++ b/src/main/java/com/bandwidth/sdk/model/StatusCallbackMessage.java @@ -15,6 +15,7 @@ import java.util.Objects; import com.bandwidth.sdk.model.MessageDirectionEnum; +import com.bandwidth.sdk.model.MultiChannelMessageChannelEnum; import com.bandwidth.sdk.model.PriorityEnum; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; @@ -29,7 +30,6 @@ import java.util.LinkedHashSet; import java.util.List; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -55,10 +55,10 @@ import com.bandwidth.sdk.JSON; /** - * Message payload schema within a MessageCallback + * Message payload schema within a callback */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") -public class MessageCallbackMessage { +public class StatusCallbackMessage { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nonnull @@ -101,7 +101,7 @@ public class MessageCallbackMessage { public static final String SERIALIZED_NAME_TEXT = "text"; @SerializedName(SERIALIZED_NAME_TEXT) - @javax.annotation.Nonnull + @javax.annotation.Nullable private String text; public static final String SERIALIZED_NAME_TAG = "tag"; @@ -112,23 +112,28 @@ public class MessageCallbackMessage { public static final String SERIALIZED_NAME_MEDIA = "media"; @SerializedName(SERIALIZED_NAME_MEDIA) @javax.annotation.Nullable - private List media; + private List media = new ArrayList<>(); public static final String SERIALIZED_NAME_PRIORITY = "priority"; @SerializedName(SERIALIZED_NAME_PRIORITY) @javax.annotation.Nullable private PriorityEnum priority; - public MessageCallbackMessage() { + public static final String SERIALIZED_NAME_CHANNEL = "channel"; + @SerializedName(SERIALIZED_NAME_CHANNEL) + @javax.annotation.Nullable + private MultiChannelMessageChannelEnum channel; + + public StatusCallbackMessage() { } - public MessageCallbackMessage id(@javax.annotation.Nonnull String id) { + public StatusCallbackMessage id(@javax.annotation.Nonnull String id) { this.id = id; return this; } /** - * Get id + * A unique identifier of the message. * @return id */ @javax.annotation.Nonnull @@ -141,13 +146,13 @@ public void setId(@javax.annotation.Nonnull String id) { } - public MessageCallbackMessage owner(@javax.annotation.Nonnull String owner) { + public StatusCallbackMessage owner(@javax.annotation.Nonnull String owner) { this.owner = owner; return this; } /** - * Get owner + * The Bandwidth phone number or alphanumeric identifier associated with the message. * @return owner */ @javax.annotation.Nonnull @@ -160,13 +165,13 @@ public void setOwner(@javax.annotation.Nonnull String owner) { } - public MessageCallbackMessage applicationId(@javax.annotation.Nonnull String applicationId) { + public StatusCallbackMessage applicationId(@javax.annotation.Nonnull String applicationId) { this.applicationId = applicationId; return this; } /** - * Get applicationId + * The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard. * @return applicationId */ @javax.annotation.Nonnull @@ -179,7 +184,7 @@ public void setApplicationId(@javax.annotation.Nonnull String applicationId) { } - public MessageCallbackMessage time(@javax.annotation.Nonnull OffsetDateTime time) { + public StatusCallbackMessage time(@javax.annotation.Nonnull OffsetDateTime time) { this.time = time; return this; } @@ -198,13 +203,13 @@ public void setTime(@javax.annotation.Nonnull OffsetDateTime time) { } - public MessageCallbackMessage segmentCount(@javax.annotation.Nonnull Integer segmentCount) { + public StatusCallbackMessage segmentCount(@javax.annotation.Nonnull Integer segmentCount) { this.segmentCount = segmentCount; return this; } /** - * Get segmentCount + * The number of segments the user's message is broken into before sending over carrier networks. * @return segmentCount */ @javax.annotation.Nonnull @@ -217,7 +222,7 @@ public void setSegmentCount(@javax.annotation.Nonnull Integer segmentCount) { } - public MessageCallbackMessage direction(@javax.annotation.Nonnull MessageDirectionEnum direction) { + public StatusCallbackMessage direction(@javax.annotation.Nonnull MessageDirectionEnum direction) { this.direction = direction; return this; } @@ -236,12 +241,12 @@ public void setDirection(@javax.annotation.Nonnull MessageDirectionEnum directio } - public MessageCallbackMessage to(@javax.annotation.Nonnull Set to) { + public StatusCallbackMessage to(@javax.annotation.Nonnull Set to) { this.to = to; return this; } - public MessageCallbackMessage addToItem(String toItem) { + public StatusCallbackMessage addToItem(String toItem) { if (this.to == null) { this.to = new LinkedHashSet<>(); } @@ -250,7 +255,7 @@ public MessageCallbackMessage addToItem(String toItem) { } /** - * Get to + * The phone number recipients of the message. * @return to */ @javax.annotation.Nonnull @@ -263,13 +268,13 @@ public void setTo(@javax.annotation.Nonnull Set to) { } - public MessageCallbackMessage from(@javax.annotation.Nonnull String from) { + public StatusCallbackMessage from(@javax.annotation.Nonnull String from) { this.from = from; return this; } /** - * Get from + * The Bandwidth phone number or alphanumeric identifier the message was sent from. * @return from */ @javax.annotation.Nonnull @@ -282,7 +287,7 @@ public void setFrom(@javax.annotation.Nonnull String from) { } - public MessageCallbackMessage text(@javax.annotation.Nonnull String text) { + public StatusCallbackMessage text(@javax.annotation.Nullable String text) { this.text = text; return this; } @@ -291,23 +296,23 @@ public MessageCallbackMessage text(@javax.annotation.Nonnull String text) { * Get text * @return text */ - @javax.annotation.Nonnull + @javax.annotation.Nullable public String getText() { return text; } - public void setText(@javax.annotation.Nonnull String text) { + public void setText(@javax.annotation.Nullable String text) { this.text = text; } - public MessageCallbackMessage tag(@javax.annotation.Nullable String tag) { + public StatusCallbackMessage tag(@javax.annotation.Nullable String tag) { this.tag = tag; return this; } /** - * Get tag + * A custom string that will be included in callback events of the message. Max 1024 characters. * @return tag */ @javax.annotation.Nullable @@ -320,12 +325,12 @@ public void setTag(@javax.annotation.Nullable String tag) { } - public MessageCallbackMessage media(@javax.annotation.Nullable List media) { + public StatusCallbackMessage media(@javax.annotation.Nullable List media) { this.media = media; return this; } - public MessageCallbackMessage addMediaItem(URI mediaItem) { + public StatusCallbackMessage addMediaItem(URI mediaItem) { if (this.media == null) { this.media = new ArrayList<>(); } @@ -334,7 +339,7 @@ public MessageCallbackMessage addMediaItem(URI mediaItem) { } /** - * Optional media, applicable only for mms + * Optional media, not applicable for sms * @return media */ @javax.annotation.Nullable @@ -347,7 +352,7 @@ public void setMedia(@javax.annotation.Nullable List media) { } - public MessageCallbackMessage priority(@javax.annotation.Nullable PriorityEnum priority) { + public StatusCallbackMessage priority(@javax.annotation.Nullable PriorityEnum priority) { this.priority = priority; return this; } @@ -365,6 +370,25 @@ public void setPriority(@javax.annotation.Nullable PriorityEnum priority) { this.priority = priority; } + + public StatusCallbackMessage channel(@javax.annotation.Nullable MultiChannelMessageChannelEnum channel) { + this.channel = channel; + return this; + } + + /** + * Get channel + * @return channel + */ + @javax.annotation.Nullable + public MultiChannelMessageChannelEnum getChannel() { + return channel; + } + + public void setChannel(@javax.annotation.Nullable MultiChannelMessageChannelEnum channel) { + this.channel = channel; + } + /** * A container for additional, undeclared properties. * This is a holder for any undeclared properties as specified with @@ -378,9 +402,9 @@ public void setPriority(@javax.annotation.Nullable PriorityEnum priority) { * * @param key name of the property * @param value value of the property - * @return the MessageCallbackMessage instance itself + * @return the StatusCallbackMessage instance itself */ - public MessageCallbackMessage putAdditionalProperty(String key, Object value) { + public StatusCallbackMessage putAdditionalProperty(String key, Object value) { if (this.additionalProperties == null) { this.additionalProperties = new HashMap(); } @@ -419,42 +443,32 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - MessageCallbackMessage messageCallbackMessage = (MessageCallbackMessage) o; - return Objects.equals(this.id, messageCallbackMessage.id) && - Objects.equals(this.owner, messageCallbackMessage.owner) && - Objects.equals(this.applicationId, messageCallbackMessage.applicationId) && - Objects.equals(this.time, messageCallbackMessage.time) && - Objects.equals(this.segmentCount, messageCallbackMessage.segmentCount) && - Objects.equals(this.direction, messageCallbackMessage.direction) && - Objects.equals(this.to, messageCallbackMessage.to) && - Objects.equals(this.from, messageCallbackMessage.from) && - Objects.equals(this.text, messageCallbackMessage.text) && - Objects.equals(this.tag, messageCallbackMessage.tag) && - Objects.equals(this.media, messageCallbackMessage.media) && - Objects.equals(this.priority, messageCallbackMessage.priority)&& - Objects.equals(this.additionalProperties, messageCallbackMessage.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())); + StatusCallbackMessage statusCallbackMessage = (StatusCallbackMessage) o; + return Objects.equals(this.id, statusCallbackMessage.id) && + Objects.equals(this.owner, statusCallbackMessage.owner) && + Objects.equals(this.applicationId, statusCallbackMessage.applicationId) && + Objects.equals(this.time, statusCallbackMessage.time) && + Objects.equals(this.segmentCount, statusCallbackMessage.segmentCount) && + Objects.equals(this.direction, statusCallbackMessage.direction) && + Objects.equals(this.to, statusCallbackMessage.to) && + Objects.equals(this.from, statusCallbackMessage.from) && + Objects.equals(this.text, statusCallbackMessage.text) && + Objects.equals(this.tag, statusCallbackMessage.tag) && + Objects.equals(this.media, statusCallbackMessage.media) && + Objects.equals(this.priority, statusCallbackMessage.priority) && + Objects.equals(this.channel, statusCallbackMessage.channel)&& + Objects.equals(this.additionalProperties, statusCallbackMessage.additionalProperties); } @Override public int hashCode() { - return Objects.hash(id, owner, applicationId, time, segmentCount, direction, to, from, text, tag, media, priority, additionalProperties); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + return Objects.hash(id, owner, applicationId, time, segmentCount, direction, to, from, text, tag, media, priority, channel, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class MessageCallbackMessage {\n"); + sb.append("class StatusCallbackMessage {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" owner: ").append(toIndentedString(owner)).append("\n"); sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); @@ -467,6 +481,7 @@ public String toString() { sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); sb.append(" media: ").append(toIndentedString(media)).append("\n"); sb.append(" priority: ").append(toIndentedString(priority)).append("\n"); + sb.append(" channel: ").append(toIndentedString(channel)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); @@ -502,6 +517,7 @@ private String toIndentedString(Object o) { openapiFields.add("tag"); openapiFields.add("media"); openapiFields.add("priority"); + openapiFields.add("channel"); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(); @@ -513,24 +529,23 @@ private String toIndentedString(Object o) { openapiRequiredFields.add("direction"); openapiRequiredFields.add("to"); openapiRequiredFields.add("from"); - openapiRequiredFields.add("text"); } /** * 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 MessageCallbackMessage + * @throws IOException if the JSON Element is invalid with respect to StatusCallbackMessage */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { - if (!MessageCallbackMessage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in MessageCallbackMessage is not found in the empty JSON string", MessageCallbackMessage.openapiRequiredFields.toString())); + if (!StatusCallbackMessage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StatusCallbackMessage is not found in the empty JSON string", StatusCallbackMessage.openapiRequiredFields.toString())); } } // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : MessageCallbackMessage.openapiRequiredFields) { + for (String requiredField : StatusCallbackMessage.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())); } @@ -556,7 +571,7 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if (!jsonObj.get("from").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); } - if (!jsonObj.get("text").isJsonPrimitive()) { + if ((jsonObj.get("text") != null && !jsonObj.get("text").isJsonNull()) && !jsonObj.get("text").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); } if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { @@ -570,22 +585,26 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if (jsonObj.get("priority") != null && !jsonObj.get("priority").isJsonNull()) { PriorityEnum.validateJsonElement(jsonObj.get("priority")); } + // validate the optional field `channel` + if (jsonObj.get("channel") != null && !jsonObj.get("channel").isJsonNull()) { + MultiChannelMessageChannelEnum.validateJsonElement(jsonObj.get("channel")); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!MessageCallbackMessage.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'MessageCallbackMessage' and its subtypes + if (!StatusCallbackMessage.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StatusCallbackMessage' and its subtypes } final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(MessageCallbackMessage.class)); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StatusCallbackMessage.class)); - return (TypeAdapter) new TypeAdapter() { + return (TypeAdapter) new TypeAdapter() { @Override - public void write(JsonWriter out, MessageCallbackMessage value) throws IOException { + public void write(JsonWriter out, StatusCallbackMessage value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); obj.remove("additionalProperties"); // serialize additional properties @@ -613,12 +632,12 @@ else if (entry.getValue() instanceof Character) } @Override - public MessageCallbackMessage read(JsonReader in) throws IOException { + public StatusCallbackMessage read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); JsonObject jsonObj = jsonElement.getAsJsonObject(); // store additional fields in the deserialized instance - MessageCallbackMessage instance = thisAdapter.fromJsonTree(jsonObj); + StatusCallbackMessage instance = thisAdapter.fromJsonTree(jsonObj); for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type @@ -645,18 +664,18 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } /** - * Create an instance of MessageCallbackMessage given an JSON string + * Create an instance of StatusCallbackMessage given an JSON string * * @param jsonString JSON string - * @return An instance of MessageCallbackMessage - * @throws IOException if the JSON string is invalid with respect to MessageCallbackMessage + * @return An instance of StatusCallbackMessage + * @throws IOException if the JSON string is invalid with respect to StatusCallbackMessage */ - public static MessageCallbackMessage fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, MessageCallbackMessage.class); + public static StatusCallbackMessage fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StatusCallbackMessage.class); } /** - * Convert an instance of MessageCallbackMessage to an JSON string + * Convert an instance of StatusCallbackMessage to an JSON string * * @return JSON string */ diff --git a/src/main/java/com/bandwidth/sdk/model/CallbackTypeEnum.java b/src/main/java/com/bandwidth/sdk/model/StatusCallbackTypeEnum.java similarity index 54% rename from src/main/java/com/bandwidth/sdk/model/CallbackTypeEnum.java rename to src/main/java/com/bandwidth/sdk/model/StatusCallbackTypeEnum.java index b0ddc5ce..a793aa48 100644 --- a/src/main/java/com/bandwidth/sdk/model/CallbackTypeEnum.java +++ b/src/main/java/com/bandwidth/sdk/model/StatusCallbackTypeEnum.java @@ -24,22 +24,22 @@ import com.google.gson.stream.JsonWriter; /** - * Indicates the type of the callback: - `message-received` for inbound callbacks. - One of `message-sending`, `message-delivered`, `message-failed` for status callbacks. + * The possible status callbacks when sending an MT SMS or MMS or RBM message: - `message-sending` indicates that Bandwidth is sending the message to the upstream provider. - `message-delivered` indicates that the message was successfully sent. - `message-failed` indicates that the message could not be sent to the intended recipient. - `message-read` indicates that the RBM message was read by the recipient. */ -@JsonAdapter(CallbackTypeEnum.Adapter.class) -public enum CallbackTypeEnum { - - RECEIVED("message-received"), +@JsonAdapter(StatusCallbackTypeEnum.Adapter.class) +public enum StatusCallbackTypeEnum { SENDING("message-sending"), DELIVERED("message-delivered"), - FAILED("message-failed"); + FAILED("message-failed"), + + READ("message-read"); private String value; - CallbackTypeEnum(String value) { + StatusCallbackTypeEnum(String value) { this.value = value; } @@ -52,8 +52,8 @@ public String toString() { return String.valueOf(value); } - public static CallbackTypeEnum fromValue(String value) { - for (CallbackTypeEnum b : CallbackTypeEnum.values()) { + public static StatusCallbackTypeEnum fromValue(String value) { + for (StatusCallbackTypeEnum b : StatusCallbackTypeEnum.values()) { if (b.value.equalsIgnoreCase(value)) { return b; } @@ -61,22 +61,22 @@ public static CallbackTypeEnum fromValue(String value) { throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - public static class Adapter extends TypeAdapter { + public static class Adapter extends TypeAdapter { @Override - public void write(final JsonWriter jsonWriter, final CallbackTypeEnum enumeration) throws IOException { + public void write(final JsonWriter jsonWriter, final StatusCallbackTypeEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override - public CallbackTypeEnum read(final JsonReader jsonReader) throws IOException { + public StatusCallbackTypeEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); - return CallbackTypeEnum.fromValue(value); + return StatusCallbackTypeEnum.fromValue(value); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { String value = jsonElement.getAsString(); - CallbackTypeEnum.fromValue(value); + StatusCallbackTypeEnum.fromValue(value); } } diff --git a/src/test/java/com/bandwidth/sdk/smoke/TollFreeVerificationApiTest.java b/src/test/java/com/bandwidth/sdk/smoke/TollFreeVerificationApiTest.java index ec7dcd73..332e8373 100644 --- a/src/test/java/com/bandwidth/sdk/smoke/TollFreeVerificationApiTest.java +++ b/src/test/java/com/bandwidth/sdk/smoke/TollFreeVerificationApiTest.java @@ -61,6 +61,12 @@ public void getTollFreeVerificationStatusTest() throws ApiException { // Test } + @Test + @Disabled + public void deleteVerificationRequestTest() throws ApiException { + // Test + } + @Test public void listTollFreeUseCasesTest() throws ApiException { ApiResponse> response = api.listTollFreeUseCasesWithHttpInfo(); diff --git a/src/test/java/com/bandwidth/sdk/unit/api/TollFreeVerificationApiTest.java b/src/test/java/com/bandwidth/sdk/unit/api/TollFreeVerificationApiTest.java index 717c69d9..7b406858 100644 --- a/src/test/java/com/bandwidth/sdk/unit/api/TollFreeVerificationApiTest.java +++ b/src/test/java/com/bandwidth/sdk/unit/api/TollFreeVerificationApiTest.java @@ -113,6 +113,13 @@ public void getTollFreeVerificationStatusTest() throws ApiException { assertThat(response.getData().getBlockedReason(), instanceOf(String.class)); } + @Test + public void deleteVerificationRequestTest() throws ApiException { + ApiResponse response = api.deleteVerificationRequestWithHttpInfo(BW_ACCOUNT_ID, "+18005551234"); + + assertThat(response.getStatusCode(), is(204)); + } + @Test public void listTollFreeUseCasesTest() throws ApiException { ApiResponse> response = api.listTollFreeUseCasesWithHttpInfo(); diff --git a/src/test/java/com/bandwidth/sdk/unit/models/CallbackTest.java b/src/test/java/com/bandwidth/sdk/unit/models/CallbackTest.java new file mode 100644 index 00000000..871ddf32 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/CallbackTest.java @@ -0,0 +1,43 @@ +/* + * 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.Callback; +import com.bandwidth.sdk.model.InboundCallback; +import com.bandwidth.sdk.model.StatusCallback; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.instanceOf; + +/** + * Model tests for Callback + */ +public class CallbackTest { + private final Callback modelInboundCallback = new Callback(new InboundCallback()); + private final Callback modelStatusCallback = new Callback(new StatusCallback()); + + /** + * Model tests for Callback + */ + @Test + public void testCallback() { + assertThat(modelStatusCallback, instanceOf(Callback.class)); + assertThat(modelStatusCallback.getActualInstance(), instanceOf(StatusCallback.class)); + assertThat(modelInboundCallback, instanceOf(Callback.class)); + assertThat(modelInboundCallback.getActualInstance(), instanceOf(InboundCallback.class)); + + } +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/CallbackTypeEnumTest.java b/src/test/java/com/bandwidth/sdk/unit/models/CallbackTypeEnumTest.java deleted file mode 100644 index 52b986c5..00000000 --- a/src/test/java/com/bandwidth/sdk/unit/models/CallbackTypeEnumTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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.CallbackTypeEnum; - -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.MatcherAssert.assertThat; - -/** - * Model tests for CallbackTypeEnum - */ -public class CallbackTypeEnumTest { - /** - * Model tests for CallbackTypeEnum - */ - @Test - public void testCallbackTypeEnum() { - assertThat(CallbackTypeEnum.DELIVERED.toString(), equalTo("message-delivered")); - assertThat(CallbackTypeEnum.FAILED.toString(), equalTo("message-failed")); - assertThat(CallbackTypeEnum.RECEIVED.toString(), equalTo("message-received")); - assertThat(CallbackTypeEnum.SENDING.toString(), equalTo("message-sending")); - } - -} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/CreateMultiChannelMessageResponseTest.java b/src/test/java/com/bandwidth/sdk/unit/models/CreateMultiChannelMessageResponseTest.java index 448e58ea..802dd329 100644 --- a/src/test/java/com/bandwidth/sdk/unit/models/CreateMultiChannelMessageResponseTest.java +++ b/src/test/java/com/bandwidth/sdk/unit/models/CreateMultiChannelMessageResponseTest.java @@ -18,7 +18,7 @@ import com.bandwidth.sdk.model.CreateMultiChannelMessageResponse; import com.bandwidth.sdk.model.ErrorObject; import com.bandwidth.sdk.model.Link; -import com.bandwidth.sdk.model.MultiChannelMessageData; +import com.bandwidth.sdk.model.MultiChannelMessageResponseData; import java.util.ArrayList; import java.util.Arrays; @@ -33,7 +33,7 @@ public class CreateMultiChannelMessageResponseTest { private final CreateMultiChannelMessageResponse model = new CreateMultiChannelMessageResponse() .links(new ArrayList(Arrays.asList(new Link()))) - .data(new MultiChannelMessageData()) + .data(new MultiChannelMessageResponseData()) .errors(new ArrayList(Arrays.asList(new ErrorObject()))); /** @@ -57,7 +57,7 @@ public void linksTest() { */ @Test public void dataTest() { - assertThat(model.getData(), instanceOf(MultiChannelMessageData.class)); + assertThat(model.getData(), instanceOf(MultiChannelMessageResponseData.class)); } /** diff --git a/src/test/java/com/bandwidth/sdk/unit/models/DeferredResultTest.java b/src/test/java/com/bandwidth/sdk/unit/models/DeferredResultTest.java deleted file mode 100644 index 417c6c17..00000000 --- a/src/test/java/com/bandwidth/sdk/unit/models/DeferredResultTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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.DeferredResult; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.CoreMatchers.instanceOf; - -/** - * Model tests for DeferredResult - */ -public class DeferredResultTest { - private final DeferredResult model = new DeferredResult() - .result("result") - .setOrExpired(true); - - /** - * Model tests for DeferredResult - */ - @Test - public void testDeferredResult() { - assertThat(model, instanceOf(DeferredResult.class)); - } - - /** - * Test the property 'result' - */ - @Test - public void resultTest() { - assertThat(model.getResult(), instanceOf(String.class)); - } - - /** - * Test the property 'setOrExpired' - */ - @Test - public void setOrExpiredTest() { - assertThat(model.getSetOrExpired(), instanceOf(Boolean.class)); - } - -} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/ErrorObjectTest.java b/src/test/java/com/bandwidth/sdk/unit/models/ErrorObjectTest.java index bebad779..89d4b8f0 100644 --- a/src/test/java/com/bandwidth/sdk/unit/models/ErrorObjectTest.java +++ b/src/test/java/com/bandwidth/sdk/unit/models/ErrorObjectTest.java @@ -25,8 +25,8 @@ */ public class ErrorObjectTest { private final ErrorObject model = new ErrorObject() - .code("code") - .message("message"); + .type("type") + .description("description"); /** * Model tests for ErrorObject @@ -37,19 +37,19 @@ public void testErrorObject() { } /** - * Test the property 'code' + * Test the property 'type' */ @Test - public void codeTest() { - assertThat(model.getCode(), instanceOf(String.class)); + public void typeTest() { + assertThat(model.getType(), instanceOf(String.class)); } /** - * Test the property 'message' + * Test the property 'description' */ @Test - public void messageTest() { - assertThat(model.getMessage(), instanceOf(String.class)); + public void descriptionTest() { + assertThat(model.getDescription(), instanceOf(String.class)); } } diff --git a/src/test/java/com/bandwidth/sdk/unit/models/ErrorSourceTest.java b/src/test/java/com/bandwidth/sdk/unit/models/ErrorSourceTest.java new file mode 100644 index 00000000..9c1209be --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/ErrorSourceTest.java @@ -0,0 +1,73 @@ +/* + * 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.ErrorSource; + +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.MatcherAssert.assertThat; + +/** + * Model tests for ErrorSource + */ +public class ErrorSourceTest { + private final ErrorSource model = new ErrorSource() + .parameter("parameter") + .field("field") + .header("header") + .reference("reference"); + + /** + * Model tests for ErrorSource + */ + @Test + public void testErrorSource() { + assertThat(model, instanceOf(ErrorSource.class)); + } + + /** + * Test the property 'parameter' + */ + @Test + public void parameterTest() { + assertThat(model.getParameter(), instanceOf(String.class)); + } + + /** + * Test the property 'field' + */ + @Test + public void fieldTest() { + assertThat(model.getField(), instanceOf(String.class)); + } + + /** + * Test the property 'header' + */ + @Test + public void headerTest() { + assertThat(model.getHeader(), instanceOf(String.class)); + } + + /** + * Test the property 'reference' + */ + @Test + public void referenceTest() { + assertThat(model.getReference(), instanceOf(String.class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/InboundCallbackMessageTest.java b/src/test/java/com/bandwidth/sdk/unit/models/InboundCallbackMessageTest.java new file mode 100644 index 00000000..19b13be8 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/InboundCallbackMessageTest.java @@ -0,0 +1,191 @@ +/* + * 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 org.mockito.internal.util.collections.Sets; + +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.LinkedHashSet; +import com.bandwidth.sdk.model.InboundCallbackMessage; +import com.bandwidth.sdk.model.MessageDirectionEnum; +import com.bandwidth.sdk.model.MultiChannelMessageChannelEnum; +import com.bandwidth.sdk.model.MultiChannelMessageContent; +import com.bandwidth.sdk.model.PriorityEnum; +import com.bandwidth.sdk.model.RbmLocationResponse; +import com.bandwidth.sdk.model.RbmSuggestionResponse; + +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.MatcherAssert.assertThat; + +/** + * Model tests for InboundCallbackMessage + */ +public class InboundCallbackMessageTest { + private final InboundCallbackMessage model = new InboundCallbackMessage() + .id("id") + .owner("owner") + .applicationId("applicationId") + .time(OffsetDateTime.now()) + .segmentCount(1) + .direction(MessageDirectionEnum.IN) + .to(Sets.newSet("to")) + .from("from") + .text("text") + .tag("tag") + .media(new ArrayList<>()) + .priority(PriorityEnum.DEFAULT) + .channel(MultiChannelMessageChannelEnum.SMS) + .content(new MultiChannelMessageContent()) + .suggestionResponse(new RbmSuggestionResponse()) + .locationResponse(new RbmLocationResponse()); + + /** + * Model tests for InboundCallbackMessage + */ + @Test + public void testInboundCallbackMessage() { + assertThat(model, instanceOf(InboundCallbackMessage.class)); + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + assertThat(model.getId(), instanceOf(String.class)); + } + + /** + * Test the property 'owner' + */ + @Test + public void ownerTest() { + assertThat(model.getOwner(), instanceOf(String.class)); + } + + /** + * Test the property 'applicationId' + */ + @Test + public void applicationIdTest() { + assertThat(model.getApplicationId(), instanceOf(String.class)); + } + + /** + * Test the property 'time' + */ + @Test + public void timeTest() { + assertThat(model.getTime(), instanceOf(OffsetDateTime.class)); + } + + /** + * Test the property 'segmentCount' + */ + @Test + public void segmentCountTest() { + assertThat(model.getSegmentCount(), instanceOf(Integer.class)); + } + + /** + * Test the property 'direction' + */ + @Test + public void directionTest() { + assertThat(model.getDirection(), instanceOf(MessageDirectionEnum.class)); + } + + /** + * Test the property 'to' + */ + @Test + public void toTest() { + assertThat(model.getTo(), instanceOf(LinkedHashSet.class)); + } + + /** + * Test the property 'from' + */ + @Test + public void fromTest() { + assertThat(model.getFrom(), instanceOf(String.class)); + } + + /** + * Test the property 'text' + */ + @Test + public void textTest() { + assertThat(model.getText(), instanceOf(String.class)); + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + + } + + /** + * Test the property 'media' + */ + @Test + public void mediaTest() { + assertThat(model.getMedia(), instanceOf(ArrayList.class)); + } + + /** + * Test the property 'priority' + */ + @Test + public void priorityTest() { + assertThat(model.getPriority(), instanceOf(PriorityEnum.class)); + } + + /** + * Test the property 'channel' + */ + @Test + public void channelTest() { + assertThat(model.getChannel(), instanceOf(MultiChannelMessageChannelEnum.class)); + } + + /** + * Test the property 'content' + */ + @Test + public void contentTest() { + assertThat(model.getContent(), instanceOf(MultiChannelMessageContent.class)); + } + + /** + * Test the property 'suggestionResponse' + */ + @Test + public void suggestionResponseTest() { + assertThat(model.getSuggestionResponse(), instanceOf(RbmSuggestionResponse.class)); + } + + /** + * Test the property 'locationResponse' + */ + @Test + public void locationResponseTest() { + assertThat(model.getLocationResponse(), instanceOf(RbmLocationResponse.class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/MultiChannelCallbackDataTest.java b/src/test/java/com/bandwidth/sdk/unit/models/InboundCallbackTest.java similarity index 59% rename from src/test/java/com/bandwidth/sdk/unit/models/MultiChannelCallbackDataTest.java rename to src/test/java/com/bandwidth/sdk/unit/models/InboundCallbackTest.java index dff57684..aa6ee7dd 100644 --- a/src/test/java/com/bandwidth/sdk/unit/models/MultiChannelCallbackDataTest.java +++ b/src/test/java/com/bandwidth/sdk/unit/models/InboundCallbackTest.java @@ -15,32 +15,32 @@ import org.junit.jupiter.api.Test; -import com.bandwidth.sdk.model.MultiChannelCallbackData; -import com.bandwidth.sdk.model.MultiChannelMessageCallbackData; -import com.bandwidth.sdk.model.MultiChannelStatusEnum; - import java.time.OffsetDateTime; +import com.bandwidth.sdk.model.InboundCallback; +import com.bandwidth.sdk.model.InboundCallbackMessage; +import com.bandwidth.sdk.model.InboundCallbackTypeEnum; -import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.MatcherAssert.assertThat; /** - * Model tests for MultiChannelCallbackData + * Model tests for InboundCallback */ -public class MultiChannelCallbackDataTest { - private final MultiChannelCallbackData model = new MultiChannelCallbackData() +public class InboundCallbackTest { + private final InboundCallback model = new InboundCallback() .time(OffsetDateTime.now()) - .type(MultiChannelStatusEnum.DELIVERED) + .type(InboundCallbackTypeEnum.MESSAGE_RECEIVED) .to("to") .description("description") - .message(new MultiChannelMessageCallbackData()); + .carrierName("carrierName") + .message(new InboundCallbackMessage()); /** - * Model tests for MultiChannelCallbackData + * Model tests for InboundCallback */ @Test - public void testMultiChannelCallbackData() { - assertThat(model, instanceOf(MultiChannelCallbackData.class)); + public void testInboundCallback() { + assertThat(model, instanceOf(InboundCallback.class)); } /** @@ -56,7 +56,7 @@ public void timeTest() { */ @Test public void typeTest() { - assertThat(model.getType(), instanceOf(MultiChannelStatusEnum.class)); + assertThat(model.getType(), instanceOf(InboundCallbackTypeEnum.class)); } /** @@ -80,7 +80,15 @@ public void descriptionTest() { */ @Test public void messageTest() { - assertThat(model.getMessage(), instanceOf(MultiChannelMessageCallbackData.class)); + assertThat(model.getMessage(), instanceOf(InboundCallbackMessage.class)); + } + + /** + * Test the property 'carrierName' + */ + @Test + public void carrierNameTest() { + assertThat(model.getCarrierName(), instanceOf(String.class)); } } diff --git a/src/test/java/com/bandwidth/sdk/unit/models/InboundCallbackTypeEnumTest.java b/src/test/java/com/bandwidth/sdk/unit/models/InboundCallbackTypeEnumTest.java new file mode 100644 index 00000000..aed50cad --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/InboundCallbackTypeEnumTest.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.InboundCallbackTypeEnum; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.MatcherAssert.assertThat; + +/** + * Model tests for InboundCallbackTypeEnum + */ +public class InboundCallbackTypeEnumTest { + /** + * Model tests for InboundCallbackTypeEnum + */ + @Test + public void testInboundCallbackTypeEnum() { + assertThat(InboundCallbackTypeEnum.MESSAGE_RECEIVED.toString(), equalTo("message-received")); + assertThat(InboundCallbackTypeEnum.REQUEST_LOCATION_RESPONSE.toString(), equalTo("request-location-response")); + assertThat(InboundCallbackTypeEnum.SUGGESTION_RESPONSE.toString(), equalTo("suggestion-response")); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/MmsMessageContentFileTest.java b/src/test/java/com/bandwidth/sdk/unit/models/MmsMessageContentFileTest.java new file mode 100644 index 00000000..3cdaa651 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/MmsMessageContentFileTest.java @@ -0,0 +1,47 @@ +/* + * 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.net.URI; +import com.bandwidth.sdk.model.MmsMessageContentFile; + +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.MatcherAssert.assertThat; + +/** + * Model tests for MmsMessageContentFile + */ +public class MmsMessageContentFileTest { + private final MmsMessageContentFile model = new MmsMessageContentFile() + .fileUrl(URI.create("https://example.com/file")); + + /** + * Model tests for MmsMessageContentFile + */ + @Test + public void testMmsMessageContentFile() { + assertThat(model, instanceOf(MmsMessageContentFile.class)); + } + + /** + * Test the property 'fileUrl' + */ + @Test + public void fileUrlTest() { + assertThat(model.getFileUrl(), instanceOf(URI.class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/MmsMessageContentTest.java b/src/test/java/com/bandwidth/sdk/unit/models/MmsMessageContentTest.java index 7344fa90..9add3345 100644 --- a/src/test/java/com/bandwidth/sdk/unit/models/MmsMessageContentTest.java +++ b/src/test/java/com/bandwidth/sdk/unit/models/MmsMessageContentTest.java @@ -16,6 +16,7 @@ import org.junit.jupiter.api.Test; import com.bandwidth.sdk.model.MmsMessageContent; +import com.bandwidth.sdk.model.MmsMessageContentFile; import java.net.URI; import java.util.ArrayList; @@ -30,7 +31,9 @@ public class MmsMessageContentTest { private final MmsMessageContent model = new MmsMessageContent() .text("text") - .media(new ArrayList(Arrays.asList(URI.create("https://bandwidth.com")))); + .media(new ArrayList(Arrays.asList( + new MmsMessageContentFile() + .fileUrl(URI.create("http://example.com/file.jpg"))))); /** * Model tests for MmsMessageContent diff --git a/src/test/java/com/bandwidth/sdk/unit/models/MultiChannelActionCalendarEventTest.java b/src/test/java/com/bandwidth/sdk/unit/models/MultiChannelActionCalendarEventTest.java index 7f1f68bf..2441adfe 100644 --- a/src/test/java/com/bandwidth/sdk/unit/models/MultiChannelActionCalendarEventTest.java +++ b/src/test/java/com/bandwidth/sdk/unit/models/MultiChannelActionCalendarEventTest.java @@ -30,7 +30,7 @@ public class MultiChannelActionCalendarEventTest { private final MultiChannelActionCalendarEvent model = new MultiChannelActionCalendarEvent() .type(RbmActionTypeEnum.REPLY) .text("text") - .postBackData(new byte[]{1, 2, 3}) + .postbackData(new byte[]{1, 2, 3}) .title("title") .startTime(OffsetDateTime.now()) .endTime(OffsetDateTime.now()) @@ -61,11 +61,11 @@ public void textTest() { } /** - * Test the property 'postBackData' + * Test the property 'postbackData' */ @Test - public void postBackDataTest() { - assertThat(model.getPostBackData(), instanceOf(byte[].class)); + public void postbackDataTest() { + assertThat(model.getPostbackData(), instanceOf(byte[].class)); } /** diff --git a/src/test/java/com/bandwidth/sdk/unit/models/MultiChannelErrorTest.java b/src/test/java/com/bandwidth/sdk/unit/models/MultiChannelErrorTest.java new file mode 100644 index 00000000..182a4ffe --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/MultiChannelErrorTest.java @@ -0,0 +1,70 @@ +/* + * 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.List; +import com.bandwidth.sdk.model.ErrorObject; +import com.bandwidth.sdk.model.Link; +import com.bandwidth.sdk.model.MultiChannelError; + +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.MatcherAssert.assertThat; + +/** + * Model tests for MultiChannelError + */ +public class MultiChannelErrorTest { + private final MultiChannelError model = new MultiChannelError() + .links(Arrays.asList(new Link())) + .data("data") + .errors(Arrays.asList(new ErrorObject())); + + /** + * Model tests for MultiChannelError + */ + @Test + public void testMultiChannelError() { + assertThat(model, instanceOf(MultiChannelError.class)); + } + + /** + * Test the property 'links' + */ + @Test + public void linksTest() { + assertThat(model.getLinks(), instanceOf(List.class)); + assertThat(model.getLinks().get(0), instanceOf(Link.class)); + } + + /** + * Test the property 'data' + */ + @Test + public void dataTest() { + assertThat(model.getData(), instanceOf(String.class)); + } + + /** + * Test the property 'errors' + */ + @Test + public void errorsTest() { + assertThat(model.getErrors(), instanceOf(List.class)); + assertThat(model.getErrors().get(0), instanceOf(ErrorObject.class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/MultiChannelMessageCallbackDataTest.java b/src/test/java/com/bandwidth/sdk/unit/models/MultiChannelMessageCallbackDataTest.java deleted file mode 100644 index 98aa0cc8..00000000 --- a/src/test/java/com/bandwidth/sdk/unit/models/MultiChannelMessageCallbackDataTest.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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.MultiChannelMessageCallbackData; -import com.bandwidth.sdk.model.MultiChannelMessageChannelEnum; -import com.bandwidth.sdk.model.MultiChannelMessageDirectionEnum; -import com.bandwidth.sdk.model.MultiChannelStatusEnum; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.CoreMatchers.instanceOf; - -/** - * Model tests for MultiChannelMessageCallbackData - */ -public class MultiChannelMessageCallbackDataTest { - private final MultiChannelMessageCallbackData model = new MultiChannelMessageCallbackData() - .messageId("messageId") - .status(MultiChannelStatusEnum.DELIVERED) - .direction(MultiChannelMessageDirectionEnum.INBOUND) - .from("from") - .to("to") - .applicationId("applicationId") - .channel(MultiChannelMessageChannelEnum.SMS) - .tag("tag"); - - /** - * Model tests for MultiChannelMessageCallbackData - */ - @Test - public void testMultiChannelMessageCallbackData() { - assertThat(model, instanceOf(MultiChannelMessageCallbackData.class)); - } - - /** - * Test the property 'messageId' - */ - @Test - public void messageIdTest() { - assertThat(model.getMessageId(), instanceOf(String.class)); - } - - /** - * Test the property 'status' - */ - @Test - public void statusTest() { - assertThat(model.getStatus(), instanceOf(MultiChannelStatusEnum.class)); - } - - /** - * Test the property 'direction' - */ - @Test - public void directionTest() { - assertThat(model.getDirection(), instanceOf(MultiChannelMessageDirectionEnum.class)); - } - - /** - * Test the property 'from' - */ - @Test - public void fromTest() { - assertThat(model.getFrom(), instanceOf(String.class)); - } - - /** - * Test the property 'to' - */ - @Test - public void toTest() { - assertThat(model.getTo(), instanceOf(String.class)); - } - - /** - * Test the property 'applicationId' - */ - @Test - public void applicationIdTest() { - assertThat(model.getApplicationId(), instanceOf(String.class)); - } - - /** - * Test the property 'channel' - */ - @Test - public void channelTest() { - assertThat(model.getChannel(), instanceOf(MultiChannelMessageChannelEnum.class)); - } - - /** - * Test the property 'tag' - */ - @Test - public void tagTest() { - assertThat(model.getTag(), instanceOf(String.class)); - } - -} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/MultiChannelMessageContentTest.java b/src/test/java/com/bandwidth/sdk/unit/models/MultiChannelMessageContentTest.java new file mode 100644 index 00000000..a209f62b --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/MultiChannelMessageContentTest.java @@ -0,0 +1,56 @@ +/* + * 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.MultiChannelMessageContent; +import com.bandwidth.sdk.model.RbmMessageContentFile; + +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.MatcherAssert.assertThat; + +/** + * Model tests for MultiChannelMessageContent + */ +public class MultiChannelMessageContentTest { + private final MultiChannelMessageContent model = new MultiChannelMessageContent() + .text("text") + .media(new RbmMessageContentFile()); + + /** + * Model tests for MultiChannelMessageContent + */ + @Test + public void testMultiChannelMessageContent() { + assertThat(model, instanceOf(MultiChannelMessageContent.class)); + } + + /** + * Test the property 'text' + */ + @Test + public void textTest() { + assertThat(model.getText(), instanceOf(String.class)); + } + + /** + * Test the property 'media' + */ + @Test + public void mediaTest() { + assertThat(model.getMedia(), instanceOf(RbmMessageContentFile.class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/MultiChannelMessageDataTest.java b/src/test/java/com/bandwidth/sdk/unit/models/MultiChannelMessageDataTest.java deleted file mode 100644 index d5f66438..00000000 --- a/src/test/java/com/bandwidth/sdk/unit/models/MultiChannelMessageDataTest.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * 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.MultiChannelMessageChannelEnum; -import com.bandwidth.sdk.model.MultiChannelMessageData; -import com.bandwidth.sdk.model.MultiChannelMessageDirectionEnum; -import com.bandwidth.sdk.model.MultiChannelStatusEnum; - -import java.time.OffsetDateTime; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.CoreMatchers.instanceOf; - -/** - * Model tests for MultiChannelMessageData - */ -public class MultiChannelMessageDataTest { - private final MultiChannelMessageData model = new MultiChannelMessageData() - .messageId("messageId") - .status(MultiChannelStatusEnum.DELIVERED) - .time(OffsetDateTime.now()) - .direction(MultiChannelMessageDirectionEnum.INBOUND) - .from("from") - .to("to") - .applicationId("applicationId") - .channel(MultiChannelMessageChannelEnum.SMS) - .tag("tag"); - - /** - * Model tests for MultiChannelMessageData - */ - @Test - public void testMultiChannelMessageData() { - assertThat(model, instanceOf(MultiChannelMessageData.class)); - } - - /** - * Test the property 'messageId' - */ - @Test - public void messageIdTest() { - assertThat(model.getMessageId(), instanceOf(String.class)); - } - - /** - * Test the property 'status' - */ - @Test - public void statusTest() { - assertThat(model.getStatus(), instanceOf(MultiChannelStatusEnum.class)); - } - - /** - * Test the property 'time' - */ - @Test - public void timeTest() { - assertThat(model.getTime(), instanceOf(OffsetDateTime.class)); - } - - /** - * Test the property 'direction' - */ - @Test - public void directionTest() { - assertThat(model.getDirection(), instanceOf(MultiChannelMessageDirectionEnum.class)); - } - - /** - * Test the property 'from' - */ - @Test - public void fromTest() { - assertThat(model.getFrom(), instanceOf(String.class)); - } - - /** - * Test the property 'to' - */ - @Test - public void toTest() { - assertThat(model.getTo(), instanceOf(String.class)); - } - - /** - * Test the property 'applicationId' - */ - @Test - public void applicationIdTest() { - assertThat(model.getApplicationId(), instanceOf(String.class)); - } - - /** - * Test the property 'channel' - */ - @Test - public void channelTest() { - assertThat(model.getChannel(), instanceOf(MultiChannelMessageChannelEnum.class)); - } - - /** - * Test the property 'tag' - */ - @Test - public void tagTest() { - assertThat(model.getTag(), instanceOf(String.class)); - } - -} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/MultiChannelMessageDirectionEnumTest.java b/src/test/java/com/bandwidth/sdk/unit/models/MultiChannelMessageDirectionEnumTest.java deleted file mode 100644 index a599dd6f..00000000 --- a/src/test/java/com/bandwidth/sdk/unit/models/MultiChannelMessageDirectionEnumTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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.MultiChannelMessageChannelEnum; -import com.bandwidth.sdk.model.MultiChannelMessageDirectionEnum; - -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.MatcherAssert.assertThat; - - -/** - * Model tests for MultiChannelMessageDirectionEnum - */ -public class MultiChannelMessageDirectionEnumTest { - /** - * Model tests for MultiChannelMessageDirectionEnum - */ - @Test - public void testMultiChannelMessageDirectionEnum() { - assertThat(MultiChannelMessageDirectionEnum.INBOUND.toString(), equalTo("INBOUND")); - assertThat(MultiChannelMessageDirectionEnum.OUTBOUND.toString(), equalTo("OUTBOUND")); - } - -} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/MultiChannelMessageResponseDataChannelListInnerTest.java b/src/test/java/com/bandwidth/sdk/unit/models/MultiChannelMessageResponseDataChannelListInnerTest.java new file mode 100644 index 00000000..74105478 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/MultiChannelMessageResponseDataChannelListInnerTest.java @@ -0,0 +1,85 @@ +/* + * 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.MultiChannelChannelListObjectContent; +import com.bandwidth.sdk.model.MultiChannelMessageChannelEnum; +import com.bandwidth.sdk.model.MultiChannelMessageResponseDataChannelListInner; + +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.MatcherAssert.assertThat; + +/** + * Model tests for MultiChannelMessageResponseDataChannelListInner + */ +public class MultiChannelMessageResponseDataChannelListInnerTest { + private final MultiChannelMessageResponseDataChannelListInner model + = new MultiChannelMessageResponseDataChannelListInner() + .from("from") + .applicationId("applicationId") + .channel(MultiChannelMessageChannelEnum.SMS) + .content(new MultiChannelChannelListObjectContent()) + .owner("owner"); + + /** + * Model tests for MultiChannelMessageResponseDataChannelListInner + */ + @Test + public void testMultiChannelMessageResponseDataChannelListInner() { + assertThat(model, instanceOf(MultiChannelMessageResponseDataChannelListInner.class)); + } + + /** + * Test the property 'from' + */ + @Test + public void fromTest() { + assertThat(model.getFrom(), instanceOf(String.class)); + } + + /** + * Test the property 'applicationId' + */ + @Test + public void applicationIdTest() { + assertThat(model.getApplicationId(), instanceOf(String.class)); + } + + /** + * Test the property 'channel' + */ + @Test + public void channelTest() { + assertThat(model.getChannel(), instanceOf(MultiChannelMessageChannelEnum.class)); + } + + /** + * Test the property 'content' + */ + @Test + public void contentTest() { + assertThat(model.getContent(), instanceOf(MultiChannelChannelListObjectContent.class)); + } + + /** + * Test the property 'owner' + */ + @Test + public void ownerTest() { + assertThat(model.getOwner(), instanceOf(String.class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/MultiChannelMessageResponseDataTest.java b/src/test/java/com/bandwidth/sdk/unit/models/MultiChannelMessageResponseDataTest.java new file mode 100644 index 00000000..68097dbb --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/MultiChannelMessageResponseDataTest.java @@ -0,0 +1,116 @@ +/* + * 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 org.mockito.internal.util.collections.Sets; + +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.List; +import com.bandwidth.sdk.model.MessageDirectionEnum; +import com.bandwidth.sdk.model.MultiChannelMessageResponseData; +import com.bandwidth.sdk.model.PriorityEnum; + +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.MatcherAssert.assertThat; + +/** + * Model tests for MultiChannelMessageResponseData + */ +public class MultiChannelMessageResponseDataTest { + private final MultiChannelMessageResponseData model = new MultiChannelMessageResponseData() + .messageId("messageId") + .time(OffsetDateTime.now()) + .direction(MessageDirectionEnum.IN) + .to(Sets.newSet("to")) + .channelList(new ArrayList<>()) + .tag("tag") + .priority(PriorityEnum.DEFAULT) + .expiration(OffsetDateTime.now().plusDays(1)); + + /** + * Model tests for MultiChannelMessageResponseData + */ + @Test + public void testMultiChannelMessageResponseData() { + assertThat(model, instanceOf(MultiChannelMessageResponseData.class)); + } + + /** + * Test the property 'messageId' + */ + @Test + public void messageIdTest() { + assertThat(model.getMessageId(), instanceOf(String.class)); + } + + /** + * Test the property 'time' + */ + @Test + public void timeTest() { + assertThat(model.getTime(), instanceOf(OffsetDateTime.class)); + } + + /** + * Test the property 'direction' + */ + @Test + public void directionTest() { + assertThat(model.getDirection(), instanceOf(MessageDirectionEnum.class)); + } + + /** + * Test the property 'to' + */ + @Test + public void toTest() { + assertThat(model.getTo(), instanceOf(LinkedHashSet.class)); + } + + /** + * Test the property 'channelList' + */ + @Test + public void channelListTest() { + assertThat(model.getChannelList(), instanceOf(List.class)); + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + assertThat(model.getTag(), instanceOf(String.class)); + } + + /** + * Test the property 'priority' + */ + @Test + public void priorityTest() { + assertThat(model.getPriority(), instanceOf(PriorityEnum.class)); + } + + /** + * Test the property 'expiration' + */ + @Test + public void expirationTest() { + assertThat(model.getExpiration(), instanceOf(OffsetDateTime.class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/MultiChannelStatusEnumTest.java b/src/test/java/com/bandwidth/sdk/unit/models/MultiChannelStatusEnumTest.java deleted file mode 100644 index 6b49746c..00000000 --- a/src/test/java/com/bandwidth/sdk/unit/models/MultiChannelStatusEnumTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.MultiChannelMessageDirectionEnum; -import com.bandwidth.sdk.model.MultiChannelStatusEnum; - -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.MatcherAssert.assertThat; - - -/** - * Model tests for MultiChannelStatusEnum - */ -public class MultiChannelStatusEnumTest { - /** - * Model tests for MultiChannelStatusEnum - */ - @Test - public void testMultiChannelStatusEnum() { - assertThat(MultiChannelStatusEnum.QUEUED.toString(), equalTo("QUEUED")); - assertThat(MultiChannelStatusEnum.SENDING.toString(), equalTo("SENDING")); - assertThat(MultiChannelStatusEnum.DELIVERED.toString(), equalTo("DELIVERED")); - assertThat(MultiChannelStatusEnum.FAILED.toString(), equalTo("FAILED")); - } - -} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/RbmActionBaseTest.java b/src/test/java/com/bandwidth/sdk/unit/models/RbmActionBaseTest.java index e8047bdd..ab75e5e9 100644 --- a/src/test/java/com/bandwidth/sdk/unit/models/RbmActionBaseTest.java +++ b/src/test/java/com/bandwidth/sdk/unit/models/RbmActionBaseTest.java @@ -28,7 +28,7 @@ public class RbmActionBaseTest { private final RbmActionBase model = new RbmActionBase() .type(RbmActionTypeEnum.REPLY) .text("text") - .postBackData(new byte[]{1, 2, 3}); + .postbackData(new byte[]{1, 2, 3}); /** * Model tests for RbmActionBase @@ -55,11 +55,11 @@ public void textTest() { } /** - * Test the property 'postBackData' + * Test the property 'postbackData' */ @Test - public void postBackDataTest() { - assertThat(model.getPostBackData(), instanceOf(byte[].class)); + public void postbackDataTest() { + assertThat(model.getPostbackData(), instanceOf(byte[].class)); } } diff --git a/src/test/java/com/bandwidth/sdk/unit/models/RbmActionDialTest.java b/src/test/java/com/bandwidth/sdk/unit/models/RbmActionDialTest.java index 5c6051ab..fc9f47f4 100644 --- a/src/test/java/com/bandwidth/sdk/unit/models/RbmActionDialTest.java +++ b/src/test/java/com/bandwidth/sdk/unit/models/RbmActionDialTest.java @@ -28,7 +28,7 @@ public class RbmActionDialTest { private final RbmActionDial model = new RbmActionDial() .type(RbmActionTypeEnum.DIAL_PHONE) .text("text") - .postBackData(new byte[]{1, 2, 3}) + .postbackData(new byte[]{1, 2, 3}) .phoneNumber("phoneNumber"); /** @@ -56,11 +56,11 @@ public void textTest() { } /** - * Test the property 'postBackData' + * Test the property 'postbackData' */ @Test - public void postBackDataTest() { - assertThat(model.getPostBackData(), instanceOf(byte[].class)); + public void postbackDataTest() { + assertThat(model.getPostbackData(), instanceOf(byte[].class)); } /** diff --git a/src/test/java/com/bandwidth/sdk/unit/models/RbmActionOpenUrlTest.java b/src/test/java/com/bandwidth/sdk/unit/models/RbmActionOpenUrlTest.java index 8725bcf9..60d2587b 100644 --- a/src/test/java/com/bandwidth/sdk/unit/models/RbmActionOpenUrlTest.java +++ b/src/test/java/com/bandwidth/sdk/unit/models/RbmActionOpenUrlTest.java @@ -31,7 +31,7 @@ public class RbmActionOpenUrlTest { private final RbmActionOpenUrl model = new RbmActionOpenUrl() .type(RbmActionTypeEnum.OPEN_URL) .text("text") - .postBackData(new byte[]{1, 2, 3}) + .postbackData(new byte[]{1, 2, 3}) .url(URI.create("https://bandwidth.com")); /** @@ -62,8 +62,8 @@ public void textTest() { * Test the property 'postBackData' */ @Test - public void postBackDataTest() { - assertThat(model.getPostBackData(), instanceOf(byte[].class)); + public void postbackDataTest() { + assertThat(model.getPostbackData(), instanceOf(byte[].class)); } /** diff --git a/src/test/java/com/bandwidth/sdk/unit/models/RbmActionTypeEnumTest.java b/src/test/java/com/bandwidth/sdk/unit/models/RbmActionTypeEnumTest.java index e2684a18..cac6c1fa 100644 --- a/src/test/java/com/bandwidth/sdk/unit/models/RbmActionTypeEnumTest.java +++ b/src/test/java/com/bandwidth/sdk/unit/models/RbmActionTypeEnumTest.java @@ -15,7 +15,6 @@ import org.junit.jupiter.api.Test; -import com.bandwidth.sdk.model.MultiChannelMessageDirectionEnum; import com.bandwidth.sdk.model.RbmActionTypeEnum; import static org.hamcrest.CoreMatchers.equalTo; diff --git a/src/test/java/com/bandwidth/sdk/unit/models/RbmActionViewLocationTest.java b/src/test/java/com/bandwidth/sdk/unit/models/RbmActionViewLocationTest.java index 9057fa7a..cf754d36 100644 --- a/src/test/java/com/bandwidth/sdk/unit/models/RbmActionViewLocationTest.java +++ b/src/test/java/com/bandwidth/sdk/unit/models/RbmActionViewLocationTest.java @@ -28,7 +28,7 @@ public class RbmActionViewLocationTest { private final RbmActionViewLocation model = new RbmActionViewLocation() .type(RbmActionTypeEnum.SHOW_LOCATION) .text("text") - .postBackData(new byte[]{1, 2, 3}) + .postbackData(new byte[]{1, 2, 3}) .latitude(1.0) .longitude(1.0) .label("label"); @@ -62,7 +62,7 @@ public void textTest() { */ @Test public void postBackDataTest() { - assertThat(model.getPostBackData(), instanceOf(byte[].class)); + assertThat(model.getPostbackData(), instanceOf(byte[].class)); } /** diff --git a/src/test/java/com/bandwidth/sdk/unit/models/RbmLocationResponseTest.java b/src/test/java/com/bandwidth/sdk/unit/models/RbmLocationResponseTest.java new file mode 100644 index 00000000..2edbce93 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/RbmLocationResponseTest.java @@ -0,0 +1,55 @@ +/* + * 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.RbmLocationResponse; + +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.MatcherAssert.assertThat; + +/** + * Model tests for RbmLocationResponse + */ +public class RbmLocationResponseTest { + private final RbmLocationResponse model = new RbmLocationResponse() + .latitude(37.7749) + .longitude(-122.4194); + + /** + * Model tests for RbmLocationResponse + */ + @Test + public void testRbmLocationResponse() { + assertThat(model, instanceOf(RbmLocationResponse.class)); + } + + /** + * Test the property 'latitude' + */ + @Test + public void latitudeTest() { + assertThat(model.getLatitude(), instanceOf(Double.class)); + } + + /** + * Test the property 'longitude' + */ + @Test + public void longitudeTest() { + assertThat(model.getLongitude(), instanceOf(Double.class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/RbmMediaHeightEnumTest.java b/src/test/java/com/bandwidth/sdk/unit/models/RbmMediaHeightEnumTest.java index 1feabe21..ed904c39 100644 --- a/src/test/java/com/bandwidth/sdk/unit/models/RbmMediaHeightEnumTest.java +++ b/src/test/java/com/bandwidth/sdk/unit/models/RbmMediaHeightEnumTest.java @@ -15,7 +15,6 @@ import org.junit.jupiter.api.Test; -import com.bandwidth.sdk.model.MultiChannelMessageDirectionEnum; import com.bandwidth.sdk.model.RbmMediaHeightEnum; import static org.hamcrest.CoreMatchers.equalTo; diff --git a/src/test/java/com/bandwidth/sdk/unit/models/RbmSuggestionResponseTest.java b/src/test/java/com/bandwidth/sdk/unit/models/RbmSuggestionResponseTest.java new file mode 100644 index 00000000..39241f8f --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/RbmSuggestionResponseTest.java @@ -0,0 +1,55 @@ +/* + * 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.RbmSuggestionResponse; + +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.MatcherAssert.assertThat; + +/** + * Model tests for RbmSuggestionResponse + */ +public class RbmSuggestionResponseTest { + private final RbmSuggestionResponse model = new RbmSuggestionResponse() + .text("text") + .postbackData(new byte[]{1, 2, 3}); + + /** + * Model tests for RbmSuggestionResponse + */ + @Test + public void testRbmSuggestionResponse() { + assertThat(model, instanceOf(RbmSuggestionResponse.class)); + } + + /** + * Test the property 'text' + */ + @Test + public void textTest() { + assertThat(model.getText(), instanceOf(String.class)); + } + + /** + * Test the property 'postbackData' + */ + @Test + public void postbackDataTest() { + assertThat(model.getPostbackData(), instanceOf(byte[].class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/StandaloneCardOrientationEnumTest.java b/src/test/java/com/bandwidth/sdk/unit/models/StandaloneCardOrientationEnumTest.java index be8d12b2..44281414 100644 --- a/src/test/java/com/bandwidth/sdk/unit/models/StandaloneCardOrientationEnumTest.java +++ b/src/test/java/com/bandwidth/sdk/unit/models/StandaloneCardOrientationEnumTest.java @@ -15,7 +15,6 @@ import org.junit.jupiter.api.Test; -import com.bandwidth.sdk.model.MultiChannelMessageDirectionEnum; import com.bandwidth.sdk.model.StandaloneCardOrientationEnum; import static org.hamcrest.CoreMatchers.equalTo; diff --git a/src/test/java/com/bandwidth/sdk/unit/models/MessageCallbackMessageTest.java b/src/test/java/com/bandwidth/sdk/unit/models/StatusCallbackMessageTest.java similarity index 76% rename from src/test/java/com/bandwidth/sdk/unit/models/MessageCallbackMessageTest.java rename to src/test/java/com/bandwidth/sdk/unit/models/StatusCallbackMessageTest.java index 6f05a9d2..feb478f0 100644 --- a/src/test/java/com/bandwidth/sdk/unit/models/MessageCallbackMessageTest.java +++ b/src/test/java/com/bandwidth/sdk/unit/models/StatusCallbackMessageTest.java @@ -10,47 +10,49 @@ * Do not edit the class manually. */ + package com.bandwidth.sdk.unit.models; import org.junit.jupiter.api.Test; +import org.mockito.internal.util.collections.Sets; -import java.net.URI; import java.time.OffsetDateTime; import java.util.ArrayList; +import java.util.LinkedHashSet; import java.util.List; -import java.util.Set; -import org.mockito.internal.util.collections.Sets; -import com.bandwidth.sdk.model.MessageCallbackMessage; import com.bandwidth.sdk.model.MessageDirectionEnum; +import com.bandwidth.sdk.model.MultiChannelMessageChannelEnum; import com.bandwidth.sdk.model.PriorityEnum; +import com.bandwidth.sdk.model.StatusCallbackMessage; -import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.MatcherAssert.assertThat; /** - * Model tests for MessageCallbackMessage + * Model tests for StatusCallbackMessage */ -public class MessageCallbackMessageTest { - private final MessageCallbackMessage model = new MessageCallbackMessage() - .id("id") +public class StatusCallbackMessageTest { + private final StatusCallbackMessage model = new StatusCallbackMessage() + .id("12345") .owner("owner") .applicationId("applicationId") .time(OffsetDateTime.now()) .segmentCount(1) .direction(MessageDirectionEnum.IN) - .to(Sets.newSet("+1234567890")) + .to(Sets.newSet("to")) .from("from") .text("text") .tag("tag") - .media(new ArrayList()) - .priority(PriorityEnum.HIGH); + .media(new ArrayList<>()) + .priority(PriorityEnum.DEFAULT) + .channel(MultiChannelMessageChannelEnum.SMS); /** - * Model tests for MessageCallbackMessage + * Model tests for StatusCallbackMessage */ @Test - public void testMessageCallbackMessage() { - assertThat(model, instanceOf(MessageCallbackMessage.class)); + public void testStatusCallbackMessage() { + assertThat(model, instanceOf(StatusCallbackMessage.class)); } /** @@ -106,7 +108,7 @@ public void directionTest() { */ @Test public void toTest() { - assertThat(model.getTo(), instanceOf(Set.class)); + assertThat(model.getTo(), instanceOf(LinkedHashSet.class)); } /** @@ -149,4 +151,12 @@ public void priorityTest() { assertThat(model.getPriority(), instanceOf(PriorityEnum.class)); } + /** + * Test the property 'channel' + */ + @Test + public void channelTest() { + assertThat(model.getChannel(), instanceOf(MultiChannelMessageChannelEnum.class)); + } + } diff --git a/src/test/java/com/bandwidth/sdk/unit/models/MessageCallbackTest.java b/src/test/java/com/bandwidth/sdk/unit/models/StatusCallbackTest.java similarity index 64% rename from src/test/java/com/bandwidth/sdk/unit/models/MessageCallbackTest.java rename to src/test/java/com/bandwidth/sdk/unit/models/StatusCallbackTest.java index 6f913dec..226f5c1d 100644 --- a/src/test/java/com/bandwidth/sdk/unit/models/MessageCallbackTest.java +++ b/src/test/java/com/bandwidth/sdk/unit/models/StatusCallbackTest.java @@ -10,37 +10,39 @@ * Do not edit the class manually. */ + package com.bandwidth.sdk.unit.models; import org.junit.jupiter.api.Test; import java.time.OffsetDateTime; -import com.bandwidth.sdk.model.MessageCallback; -import com.bandwidth.sdk.model.CallbackTypeEnum; -import com.bandwidth.sdk.model.MessageCallbackMessage; +import com.bandwidth.sdk.model.StatusCallback; +import com.bandwidth.sdk.model.StatusCallbackMessage; +import com.bandwidth.sdk.model.StatusCallbackTypeEnum; -import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.MatcherAssert.assertThat; /** - * Model tests for MessageCallback + * Model tests for StatusCallback */ -public class MessageCallbackTest { - private final MessageCallback model = new MessageCallback() +public class StatusCallbackTest { + private final StatusCallback model = new StatusCallback() .time(OffsetDateTime.now()) - .type(CallbackTypeEnum.DELIVERED) - .to("+1234567890") + .eventTime(OffsetDateTime.now()) + .type(StatusCallbackTypeEnum.DELIVERED) + .to("to") .description("description") - .message(new MessageCallbackMessage()) - .errorCode(123) + .message(new StatusCallbackMessage()) + .errorCode(1234) .carrierName("carrierName"); /** - * Model tests for MessageCallback + * Model tests for StatusCallback */ @Test - public void testMessageCallback() { - assertThat(model, instanceOf(MessageCallback.class)); + public void testStatusCallback() { + assertThat(model, instanceOf(StatusCallback.class)); } /** @@ -51,12 +53,20 @@ public void timeTest() { assertThat(model.getTime(), instanceOf(OffsetDateTime.class)); } + /** + * Test the property 'eventTime' + */ + @Test + public void eventTimeTest() { + assertThat(model.getEventTime(), instanceOf(OffsetDateTime.class)); + } + /** * Test the property 'type' */ @Test public void typeTest() { - assertThat(model.getType(), instanceOf(CallbackTypeEnum.class)); + assertThat(model.getType(), instanceOf(StatusCallbackTypeEnum.class)); } /** @@ -80,7 +90,7 @@ public void descriptionTest() { */ @Test public void messageTest() { - assertThat(model.getMessage(), instanceOf(MessageCallbackMessage.class)); + assertThat(model.getMessage(), instanceOf(StatusCallbackMessage.class)); } /** diff --git a/src/test/java/com/bandwidth/sdk/unit/models/StatusCallbackTypeEnumTest.java b/src/test/java/com/bandwidth/sdk/unit/models/StatusCallbackTypeEnumTest.java new file mode 100644 index 00000000..0317bd89 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/StatusCallbackTypeEnumTest.java @@ -0,0 +1,39 @@ +/* + * 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.StatusCallbackTypeEnum; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.MatcherAssert.assertThat; + +/** + * Model tests for StatusCallbackTypeEnum + */ +public class StatusCallbackTypeEnumTest { + /** + * Model tests for StatusCallbackTypeEnum + */ + @Test + public void testStatusCallbackTypeEnum() { + assertThat(StatusCallbackTypeEnum.SENDING.toString(), equalTo("message-sending")); + assertThat(StatusCallbackTypeEnum.DELIVERED.toString(), equalTo("message-delivered")); + assertThat(StatusCallbackTypeEnum.FAILED.toString(), equalTo("message-failed")); + assertThat(StatusCallbackTypeEnum.READ.toString(), equalTo("message-read")); + + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/TagTest.java b/src/test/java/com/bandwidth/sdk/unit/models/TagTest.java deleted file mode 100644 index a077cd00..00000000 --- a/src/test/java/com/bandwidth/sdk/unit/models/TagTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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.Tag; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.CoreMatchers.instanceOf; - -/** - * Model tests for Tag - */ -public class TagTest { - private final Tag model = new Tag() - .key("key") - .value("value"); - - /** - * Model tests for Tag - */ - @Test - public void testTag() { - assertThat(model, instanceOf(Tag.class)); - } - - /** - * Test the property 'key' - */ - @Test - public void keyTest() { - assertThat(model.getKey(), instanceOf(String.class)); - } - - /** - * Test the property 'value' - */ - @Test - public void valueTest() { - assertThat(model.getValue(), instanceOf(String.class)); - } - -} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/ThumbnailAlignmentEnumTest.java b/src/test/java/com/bandwidth/sdk/unit/models/ThumbnailAlignmentEnumTest.java index d1fca38d..6254a645 100644 --- a/src/test/java/com/bandwidth/sdk/unit/models/ThumbnailAlignmentEnumTest.java +++ b/src/test/java/com/bandwidth/sdk/unit/models/ThumbnailAlignmentEnumTest.java @@ -15,7 +15,6 @@ import org.junit.jupiter.api.Test; -import com.bandwidth.sdk.model.MultiChannelMessageDirectionEnum; import com.bandwidth.sdk.model.ThumbnailAlignmentEnum; import static org.hamcrest.CoreMatchers.equalTo;