diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 09e76395..3f34402b 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -235,106 +235,3 @@ src/main/java/com/bandwidth/sdk/model/VerifyCodeRequest.java src/main/java/com/bandwidth/sdk/model/VerifyCodeResponse.java src/main/java/com/bandwidth/sdk/model/VoiceApiError.java src/main/java/com/bandwidth/sdk/model/VoiceCodeResponse.java -src/test/java/com/bandwidth/sdk/api/CallsApiTest.java -src/test/java/com/bandwidth/sdk/api/ConferencesApiTest.java -src/test/java/com/bandwidth/sdk/api/MediaApiTest.java -src/test/java/com/bandwidth/sdk/api/MessagesApiTest.java -src/test/java/com/bandwidth/sdk/api/MfaApiTest.java -src/test/java/com/bandwidth/sdk/api/PhoneNumberLookupApiTest.java -src/test/java/com/bandwidth/sdk/api/RecordingsApiTest.java -src/test/java/com/bandwidth/sdk/api/StatisticsApiTest.java -src/test/java/com/bandwidth/sdk/api/TranscriptionsApiTest.java -src/test/java/com/bandwidth/sdk/model/AccountStatisticsTest.java -src/test/java/com/bandwidth/sdk/model/AnswerCallbackTest.java -src/test/java/com/bandwidth/sdk/model/BridgeCompleteCallbackTest.java -src/test/java/com/bandwidth/sdk/model/BridgeTargetCompleteCallbackTest.java -src/test/java/com/bandwidth/sdk/model/CallDirectionEnumTest.java -src/test/java/com/bandwidth/sdk/model/CallRecordingMetadataTest.java -src/test/java/com/bandwidth/sdk/model/CallStateEnumTest.java -src/test/java/com/bandwidth/sdk/model/CallStateTest.java -src/test/java/com/bandwidth/sdk/model/CallTranscriptionDetectedLanguageEnumTest.java -src/test/java/com/bandwidth/sdk/model/CallTranscriptionMetadataTest.java -src/test/java/com/bandwidth/sdk/model/CallTranscriptionResponseTest.java -src/test/java/com/bandwidth/sdk/model/CallTranscriptionTest.java -src/test/java/com/bandwidth/sdk/model/CallTranscriptionTrackEnumTest.java -src/test/java/com/bandwidth/sdk/model/CallbackMethodEnumTest.java -src/test/java/com/bandwidth/sdk/model/CodeRequestTest.java -src/test/java/com/bandwidth/sdk/model/ConferenceCompletedCallbackTest.java -src/test/java/com/bandwidth/sdk/model/ConferenceCreatedCallbackTest.java -src/test/java/com/bandwidth/sdk/model/ConferenceMemberExitCallbackTest.java -src/test/java/com/bandwidth/sdk/model/ConferenceMemberJoinCallbackTest.java -src/test/java/com/bandwidth/sdk/model/ConferenceMemberTest.java -src/test/java/com/bandwidth/sdk/model/ConferenceRecordingAvailableCallbackTest.java -src/test/java/com/bandwidth/sdk/model/ConferenceRecordingMetadataTest.java -src/test/java/com/bandwidth/sdk/model/ConferenceRedirectCallbackTest.java -src/test/java/com/bandwidth/sdk/model/ConferenceStateEnumTest.java -src/test/java/com/bandwidth/sdk/model/ConferenceTest.java -src/test/java/com/bandwidth/sdk/model/CreateCallResponseTest.java -src/test/java/com/bandwidth/sdk/model/CreateCallTest.java -src/test/java/com/bandwidth/sdk/model/CreateLookupResponseTest.java -src/test/java/com/bandwidth/sdk/model/CreateMessageRequestErrorTest.java -src/test/java/com/bandwidth/sdk/model/DeferredResultTest.java -src/test/java/com/bandwidth/sdk/model/DisconnectCallbackTest.java -src/test/java/com/bandwidth/sdk/model/DiversionTest.java -src/test/java/com/bandwidth/sdk/model/DtmfCallbackTest.java -src/test/java/com/bandwidth/sdk/model/FieldErrorTest.java -src/test/java/com/bandwidth/sdk/model/FileFormatEnumTest.java -src/test/java/com/bandwidth/sdk/model/GatherCallbackTest.java -src/test/java/com/bandwidth/sdk/model/InboundMessageCallbackMessageTest.java -src/test/java/com/bandwidth/sdk/model/InboundMessageCallbackTest.java -src/test/java/com/bandwidth/sdk/model/InitiateCallbackTest.java -src/test/java/com/bandwidth/sdk/model/ListMessageDirectionEnumTest.java -src/test/java/com/bandwidth/sdk/model/ListMessageItemTest.java -src/test/java/com/bandwidth/sdk/model/LookupRequestTest.java -src/test/java/com/bandwidth/sdk/model/LookupResultTest.java -src/test/java/com/bandwidth/sdk/model/LookupStatusEnumTest.java -src/test/java/com/bandwidth/sdk/model/LookupStatusTest.java -src/test/java/com/bandwidth/sdk/model/MachineDetectionCompleteCallbackTest.java -src/test/java/com/bandwidth/sdk/model/MachineDetectionConfigurationTest.java -src/test/java/com/bandwidth/sdk/model/MachineDetectionModeEnumTest.java -src/test/java/com/bandwidth/sdk/model/MachineDetectionResultTest.java -src/test/java/com/bandwidth/sdk/model/MediaTest.java -src/test/java/com/bandwidth/sdk/model/MessageDeliveredCallbackMessageTest.java -src/test/java/com/bandwidth/sdk/model/MessageDeliveredCallbackTest.java -src/test/java/com/bandwidth/sdk/model/MessageDirectionEnumTest.java -src/test/java/com/bandwidth/sdk/model/MessageFailedCallbackMessageTest.java -src/test/java/com/bandwidth/sdk/model/MessageFailedCallbackTest.java -src/test/java/com/bandwidth/sdk/model/MessageRequestTest.java -src/test/java/com/bandwidth/sdk/model/MessageSendingCallbackMessageTest.java -src/test/java/com/bandwidth/sdk/model/MessageSendingCallbackTest.java -src/test/java/com/bandwidth/sdk/model/MessageStatusEnumTest.java -src/test/java/com/bandwidth/sdk/model/MessageTest.java -src/test/java/com/bandwidth/sdk/model/MessageTypeEnumTest.java -src/test/java/com/bandwidth/sdk/model/MessagesListTest.java -src/test/java/com/bandwidth/sdk/model/MessagingCodeResponseTest.java -src/test/java/com/bandwidth/sdk/model/MessagingRequestErrorTest.java -src/test/java/com/bandwidth/sdk/model/MfaForbiddenRequestErrorTest.java -src/test/java/com/bandwidth/sdk/model/MfaRequestErrorTest.java -src/test/java/com/bandwidth/sdk/model/MfaUnauthorizedRequestErrorTest.java -src/test/java/com/bandwidth/sdk/model/PageInfoTest.java -src/test/java/com/bandwidth/sdk/model/PriorityEnumTest.java -src/test/java/com/bandwidth/sdk/model/RecordingAvailableCallbackTest.java -src/test/java/com/bandwidth/sdk/model/RecordingCompleteCallbackTest.java -src/test/java/com/bandwidth/sdk/model/RecordingStateEnumTest.java -src/test/java/com/bandwidth/sdk/model/RecordingTranscriptionMetadataTest.java -src/test/java/com/bandwidth/sdk/model/RecordingTranscriptionsTest.java -src/test/java/com/bandwidth/sdk/model/RedirectCallbackTest.java -src/test/java/com/bandwidth/sdk/model/RedirectMethodEnumTest.java -src/test/java/com/bandwidth/sdk/model/RegionTest.java -src/test/java/com/bandwidth/sdk/model/StirShakenTest.java -src/test/java/com/bandwidth/sdk/model/TagTest.java -src/test/java/com/bandwidth/sdk/model/TnLookupRequestErrorTest.java -src/test/java/com/bandwidth/sdk/model/TranscribeRecordingTest.java -src/test/java/com/bandwidth/sdk/model/TranscriptionAvailableCallbackTest.java -src/test/java/com/bandwidth/sdk/model/TranscriptionTest.java -src/test/java/com/bandwidth/sdk/model/TransferAnswerCallbackTest.java -src/test/java/com/bandwidth/sdk/model/TransferCompleteCallbackTest.java -src/test/java/com/bandwidth/sdk/model/TransferDisconnectCallbackTest.java -src/test/java/com/bandwidth/sdk/model/UpdateCallRecordingTest.java -src/test/java/com/bandwidth/sdk/model/UpdateCallTest.java -src/test/java/com/bandwidth/sdk/model/UpdateConferenceMemberTest.java -src/test/java/com/bandwidth/sdk/model/UpdateConferenceTest.java -src/test/java/com/bandwidth/sdk/model/VerifyCodeRequestTest.java -src/test/java/com/bandwidth/sdk/model/VerifyCodeResponseTest.java -src/test/java/com/bandwidth/sdk/model/VoiceApiErrorTest.java -src/test/java/com/bandwidth/sdk/model/VoiceCodeResponseTest.java diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION index 41225218..09a6d308 100644 --- a/.openapi-generator/VERSION +++ b/.openapi-generator/VERSION @@ -1 +1 @@ -7.0.0 \ No newline at end of file +7.8.0 diff --git a/README.md b/README.md index ddb7c71f..b20224a4 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ Bandwidth - API version: 1.0.0 + - Generator version: 7.8.0 Bandwidth's Communication APIs diff --git a/api/openapi.yaml b/api/openapi.yaml index 4db0e754..2afcea85 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -112,7 +112,8 @@ paths: summary: List Media tags: - Media - x-accepts: application/json + x-accepts: + - application/json servers: - description: Production url: https://messaging.bandwidth.com/api/v2 @@ -198,7 +199,8 @@ paths: summary: Delete Media tags: - Media - x-accepts: application/json + x-accepts: + - application/json get: description: Downloads a media file you previously uploaded. operationId: getMedia @@ -281,7 +283,9 @@ paths: summary: Get Media tags: - Media - x-accepts: application/json + x-accepts: + - application/json + - application/octet-stream put: description: |- Upload a file. You may add headers to the request in order to provide some control to your media file. @@ -385,7 +389,8 @@ paths: tags: - Media x-content-type: application/json - x-accepts: application/json + x-accepts: + - application/json servers: - description: Production url: https://messaging.bandwidth.com/api/v2 @@ -616,7 +621,8 @@ paths: summary: List Messages tags: - Messages - x-accepts: application/json + x-accepts: + - application/json post: callbacks: inboundCallback: @@ -697,7 +703,8 @@ paths: tags: - Messages x-content-type: application/json - x-accepts: application/json + x-accepts: + - application/json servers: - description: Production url: https://messaging.bandwidth.com/api/v2 @@ -880,7 +887,8 @@ paths: summary: Get Calls tags: - Calls - x-accepts: application/json + x-accepts: + - application/json post: description: |- Creates an outbound phone call. @@ -1001,7 +1009,8 @@ paths: tags: - Calls x-content-type: application/json - x-accepts: application/json + x-accepts: + - application/json servers: - description: Production url: https://voice.bandwidth.com/api/v2 @@ -1120,7 +1129,8 @@ paths: summary: Get Call State Information tags: - Calls - x-accepts: application/json + x-accepts: + - application/json post: description: Interrupts and redirects a call to a different URL that should return a BXML document. @@ -1241,7 +1251,8 @@ paths: tags: - Calls x-content-type: application/json - x-accepts: application/json + x-accepts: + - application/json servers: - description: Production url: https://voice.bandwidth.com/api/v2 @@ -1365,7 +1376,8 @@ paths: tags: - Calls x-content-type: application/xml - x-accepts: application/json + x-accepts: + - application/json servers: - description: Production url: https://voice.bandwidth.com/api/v2 @@ -1532,7 +1544,8 @@ paths: summary: Get Conferences tags: - Conferences - x-accepts: application/json + x-accepts: + - application/json servers: - description: Production url: https://voice.bandwidth.com/api/v2 @@ -1648,7 +1661,8 @@ paths: summary: Get Conference Information tags: - Conferences - x-accepts: application/json + x-accepts: + - application/json post: description: Update the conference state. operationId: updateConference @@ -1759,7 +1773,8 @@ paths: tags: - Conferences x-content-type: application/json - x-accepts: application/json + x-accepts: + - application/json servers: - description: Production url: https://voice.bandwidth.com/api/v2 @@ -1874,7 +1889,8 @@ paths: tags: - Conferences x-content-type: application/xml - x-accepts: application/json + x-accepts: + - application/json servers: - description: Production url: https://voice.bandwidth.com/api/v2 @@ -1999,7 +2015,8 @@ paths: summary: Get Conference Member tags: - Conferences - x-accepts: application/json + x-accepts: + - application/json put: description: Updates settings for a particular conference member. operationId: updateConferenceMember @@ -2119,7 +2136,8 @@ paths: tags: - Conferences x-content-type: application/json - x-accepts: application/json + x-accepts: + - application/json servers: - description: Production url: https://voice.bandwidth.com/api/v2 @@ -2238,7 +2256,8 @@ paths: summary: Get Conference Recordings tags: - Conferences - x-accepts: application/json + x-accepts: + - application/json servers: - description: Production url: https://voice.bandwidth.com/api/v2 @@ -2363,7 +2382,8 @@ paths: summary: Get Conference Recording Information tags: - Conferences - x-accepts: application/json + x-accepts: + - application/json servers: - description: Production url: https://voice.bandwidth.com/api/v2 @@ -2493,7 +2513,10 @@ paths: summary: Download Conference Recording tags: - Conferences - x-accepts: application/json + x-accepts: + - application/json + - audio/mpeg + - audio/vnd.wave servers: - description: Production url: https://voice.bandwidth.com/api/v2 @@ -2644,7 +2667,8 @@ paths: summary: Get Call Recordings tags: - Recordings - x-accepts: application/json + x-accepts: + - application/json servers: - description: Production url: https://voice.bandwidth.com/api/v2 @@ -2759,7 +2783,8 @@ paths: tags: - Recordings x-content-type: application/json - x-accepts: application/json + x-accepts: + - application/json servers: - description: Production url: https://voice.bandwidth.com/api/v2 @@ -2879,7 +2904,8 @@ paths: summary: List Call Recordings tags: - Recordings - x-accepts: application/json + x-accepts: + - application/json servers: - description: Production url: https://voice.bandwidth.com/api/v2 @@ -3003,7 +3029,8 @@ paths: summary: Delete Recording tags: - Recordings - x-accepts: application/json + x-accepts: + - application/json get: description: Returns metadata for the specified recording. operationId: getCallRecording @@ -3124,7 +3151,8 @@ paths: summary: Get Call Recording tags: - Recordings - x-accepts: application/json + x-accepts: + - application/json servers: - description: Production url: https://voice.bandwidth.com/api/v2 @@ -3245,7 +3273,8 @@ paths: summary: Delete Recording Media tags: - Recordings - x-accepts: application/json + x-accepts: + - application/json get: description: Downloads the specified recording. operationId: downloadCallRecording @@ -3371,7 +3400,10 @@ paths: summary: Download Recording tags: - Recordings - x-accepts: application/json + x-accepts: + - application/json + - audio/mpeg + - audio/vnd.wave servers: - description: Production url: https://voice.bandwidth.com/api/v2 @@ -3495,7 +3527,8 @@ paths: summary: Delete Transcription tags: - Recordings - x-accepts: application/json + x-accepts: + - application/json get: description: |- Downloads the specified transcription. @@ -3620,7 +3653,8 @@ paths: summary: Get Transcription tags: - Recordings - x-accepts: application/json + x-accepts: + - application/json post: description: |- Generate the transcription for a specific recording. Transcription @@ -3743,7 +3777,8 @@ paths: tags: - Recordings x-content-type: application/json - x-accepts: application/json + x-accepts: + - application/json servers: - description: Production url: https://voice.bandwidth.com/api/v2 @@ -3850,7 +3885,8 @@ paths: summary: Get Account Statistics tags: - Statistics - x-accepts: application/json + x-accepts: + - application/json servers: - description: Production url: https://voice.bandwidth.com/api/v2 @@ -3966,7 +4002,8 @@ paths: summary: Enumerate transcriptions made with StartTranscription tags: - Transcriptions - x-accepts: application/json + x-accepts: + - application/json servers: - description: Production url: https://voice.bandwidth.com/api/v2 @@ -4090,7 +4127,8 @@ paths: summary: Delete a specific transcription tags: - Transcriptions - x-accepts: application/json + x-accepts: + - application/json get: description: "Retrieve the specified transcription that was created on this\ \ call via [startTranscription](/docs/voice/bxml/startTranscription)." @@ -4212,7 +4250,8 @@ paths: summary: Retrieve a specific transcription tags: - Transcriptions - x-accepts: application/json + x-accepts: + - application/json servers: - description: Production url: https://voice.bandwidth.com/api/v2 @@ -4267,7 +4306,8 @@ paths: tags: - MFA x-content-type: application/json - x-accepts: application/json + x-accepts: + - application/json servers: - description: Production url: https://mfa.bandwidth.com/api/v1 @@ -4322,7 +4362,8 @@ paths: tags: - MFA x-content-type: application/json - x-accepts: application/json + x-accepts: + - application/json servers: - description: Production url: https://mfa.bandwidth.com/api/v1 @@ -4383,7 +4424,8 @@ paths: tags: - MFA x-content-type: application/json - x-accepts: application/json + x-accepts: + - application/json servers: - description: Production url: https://mfa.bandwidth.com/api/v1 @@ -4487,7 +4529,8 @@ paths: tags: - Phone Number Lookup x-content-type: application/json - x-accepts: application/json + x-accepts: + - application/json servers: - description: Production url: https://numbers.bandwidth.com/api/v1 @@ -4598,7 +4641,8 @@ paths: summary: Get Lookup Request Status tags: - Phone Number Lookup - x-accepts: application/json + x-accepts: + - application/json servers: - description: Production url: https://numbers.bandwidth.com/api/v1 @@ -4641,8 +4685,8 @@ components: applicationId: 04e88489-df02-4e34-a0ee-27a91849555f accountId: "9900000" callId: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 - to: +19195551234 - from: +19195554312 + to: "+19195551234" + from: "+19195554312" enqueuedTime: 2022-06-16T13:15:07.160Z callUrl: https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 callTimeout: 30 @@ -4718,13 +4762,13 @@ components: summary: Example Number Lookup Request for One Number value: tns: - - +19195551234 + - "+19195551234" multipleNumberRequestExample: summary: Example Number Lookup Request for Multiple Numbers value: tns: - - +19195551234 - - +19195554321 + - "+19195551234" + - "+19195554321" lookupInProgressExample: summary: Example Lookup In Progress Response value: @@ -4736,7 +4780,7 @@ components: requestId: 004223a0-8b17-41b1-bf81-20732adf5590 status: FAILED failedTelephoneNumbers: - - +191955512345 + - "+191955512345" lookupSingleNumberCompleteExample: summary: Example Single Number Lookup Complete Response value: @@ -4745,7 +4789,7 @@ components: result: - Response Code: 0 Message: NOERROR - E.164 Format: +19195551234 + E.164 Format: "+19195551234" Formatted: (919) 555-1234 Country: US Line Type: Mobile @@ -4760,7 +4804,7 @@ components: result: - Response Code: 0 Message: NOERROR - E.164 Format: +19195551234 + E.164 Format: "+19195551234" Formatted: (919) 555-1234 Country: US Line Type: Mobile @@ -4769,7 +4813,7 @@ components: Mobile Network Code: "010" - Response Code: 0 Message: NOERROR - E.164 Format: +19195554321 + E.164 Format: "+19195554321" Formatted: (919) 555-4321 Country: US Line Type: Mobile @@ -4784,7 +4828,7 @@ components: result: - Response Code: 0 Message: NOERROR - E.164 Format: +19195551234 + E.164 Format: "+19195551234" Formatted: (919) 555-1234 Country: US Line Type: Mobile @@ -4792,7 +4836,7 @@ components: Mobile Country Code: "310" Mobile Network Code: "010" failedTelephoneNumbers: - - +191955512345 + - "+191955512345" lookupSingleNumberCompleteNoInfoExample: summary: Example Single Number Lookup Complete with No Information Response value: @@ -4801,7 +4845,7 @@ components: result: - Response Code: 3 Message: NXDOMAIN - E.164 Format: +19195550000 + E.164 Format: "+19195550000" Formatted: (919) 555-0000 Country: US parameters: @@ -6024,6 +6068,10 @@ components: example: US type: string fieldError: + example: + fieldName: from + description: '''+invalid'' must be replaced with a valid E164 formatted telephone + number' properties: fieldName: description: The name of the field that contains the error @@ -6043,34 +6091,34 @@ components: nextPageToken: GL83PD3C prevPage: https://messaging.bandwidth.com/api/v2/users/accountId/messages?messageStatus=DLR_EXPIRED&nextPage=DLAPE902 messages: - - sourceTn: +15554443333 + - sourceTn: "+15554443333" messageLength: 18 campaignId: CJEUMDK messageId: 1589228074636lm4k2je7j7jklbn2 errorCode: 9902 - destinationTn: +15554442222 + destinationTn: "+15554442222" segmentCount: 1 messageStatus: RECEIVED receiveTime: 2020-04-07T14:03:07Z accountId: "9900000" - messageDirection: null + messageDirection: INBOUND messageType: sms carrierName: other recipientCount: 1 campaignClass: T attachmentCount: 1 messageSize: 27 - - sourceTn: +15554443333 + - sourceTn: "+15554443333" messageLength: 18 campaignId: CJEUMDK messageId: 1589228074636lm4k2je7j7jklbn2 errorCode: 9902 - destinationTn: +15554442222 + destinationTn: "+15554442222" segmentCount: 1 messageStatus: RECEIVED receiveTime: 2020-04-07T14:03:07Z accountId: "9900000" - messageDirection: null + messageDirection: INBOUND messageType: sms carrierName: other recipientCount: 1 @@ -6094,17 +6142,17 @@ components: type: object listMessageItem: example: - sourceTn: +15554443333 + sourceTn: "+15554443333" messageLength: 18 campaignId: CJEUMDK messageId: 1589228074636lm4k2je7j7jklbn2 errorCode: 9902 - destinationTn: +15554442222 + destinationTn: "+15554442222" segmentCount: 1 messageStatus: RECEIVED receiveTime: 2020-04-07T14:03:07Z accountId: "9900000" - messageDirection: null + messageDirection: INBOUND messageType: sms carrierName: other recipientCount: 1 @@ -6122,11 +6170,11 @@ components: type: string sourceTn: description: The source phone number of the message. - example: +15554443333 + example: "+15554443333" type: string destinationTn: description: The recipient phone number of the message. - example: +15554442222 + example: "+15554442222" type: string messageStatus: $ref: '#/components/schemas/messageStatusEnum' @@ -6210,6 +6258,9 @@ components: title: PageInfo type: object messagingRequestError: + example: + description: description + type: type properties: type: type: string @@ -6221,6 +6272,16 @@ components: title: MessagingRequestError type: object createMessageRequestError: + example: + fieldErrors: + - fieldName: from + description: '''+invalid'' must be replaced with a valid E164 formatted + telephone number' + - fieldName: from + description: '''+invalid'' must be replaced with a valid E164 formatted + telephone number' + description: description + type: type properties: type: type: string @@ -6267,21 +6328,21 @@ components: type: object message: example: - owner: +15554443333 + owner: "+15554443333" media: - https://dev.bandwidth.com/images/bandwidth-logo.png priority: default segmentCount: 2 - from: +15553332222 + from: "+15553332222" expiration: 2021-02-01T11:29:18-05:00 id: 1589228074636lm4k2je7j7jklbn2 time: 2022-09-14T18:20:16Z to: - - +15552223333 + - "+15552223333" text: Hello world tag: custom tag applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 - direction: null + direction: in properties: id: description: The id of the message. @@ -6289,7 +6350,7 @@ components: type: string owner: description: The Bandwidth phone number associated with the message. - example: +15554443333 + example: "+15554443333" type: string applicationId: description: The application ID associated with the message. @@ -6310,14 +6371,14 @@ components: to: description: The phone number recipients of the message. example: - - +15552223333 + - "+15552223333" items: type: string type: array uniqueItems: true from: description: The phone number the message was sent from. - example: +15553332222 + example: "+15553332222" type: string media: description: The list of media URLs sent in the message. Including a `filename` @@ -6357,8 +6418,8 @@ components: to: description: The phone number(s) the message should be sent to in E164 format. example: - - +15554443333 - - +15552223333 + - "+15554443333" + - "+15552223333" items: type: string type: array @@ -6371,7 +6432,7 @@ components: \ lower-case letters a-z, numbers 0-9, space, hyphen -, plus +, underscore\ \ _ and ampersand &. Alphanumeric Sender IDs must contain at least one\ \ letter." - example: +15551113333 + example: "+15551113333" type: string text: description: The contents of the text message. Must be 2048 characters or @@ -6422,7 +6483,7 @@ components: example: message-received type: string to: - example: +15552223333 + example: "+15552223333" type: string description: example: Incoming message received @@ -6443,7 +6504,7 @@ components: example: 1661365814859loidf7mcwd4qacn7 type: string owner: - example: +15553332222 + example: "+15553332222" type: string applicationId: example: 93de2206-9669-4e07-948d-329f4b722ee2 @@ -6459,13 +6520,13 @@ components: $ref: '#/components/schemas/messageDirectionEnum' to: example: - - +15552223333 + - "+15552223333" items: type: string type: array uniqueItems: true from: - example: +15553332222 + example: "+15553332222" type: string text: example: Hello world @@ -6505,7 +6566,7 @@ components: example: message-sending type: string to: - example: +15552223333 + example: "+15552223333" type: string description: example: Message is sending to carrier @@ -6526,7 +6587,7 @@ components: example: 1661365814859loidf7mcwd4qacn7 type: string owner: - example: +15553332222 + example: "+15553332222" type: string applicationId: example: 93de2206-9669-4e07-948d-329f4b722ee2 @@ -6542,13 +6603,13 @@ components: $ref: '#/components/schemas/messageDirectionEnum' to: example: - - +15552223333 + - "+15552223333" items: type: string type: array uniqueItems: true from: - example: +15553332222 + example: "+15553332222" type: string text: example: Hello world @@ -6590,7 +6651,7 @@ components: example: message-delivered type: string to: - example: +15552223333 + example: "+15552223333" type: string description: example: Message delivered to carrier. @@ -6611,7 +6672,7 @@ components: example: 1661365814859loidf7mcwd4qacn7 type: string owner: - example: +15553332222 + example: "+15553332222" type: string applicationId: example: 93de2206-9669-4e07-948d-329f4b722ee2 @@ -6627,13 +6688,13 @@ components: $ref: '#/components/schemas/messageDirectionEnum' to: example: - - +15552223333 + - "+15552223333" items: type: string type: array uniqueItems: true from: - example: +15553332222 + example: "+15553332222" type: string text: example: Hello world @@ -6674,7 +6735,7 @@ components: example: message-failed type: string to: - example: +15552223333 + example: "+15552223333" type: string description: example: rejected-unallocated-from-number @@ -6699,7 +6760,7 @@ components: example: 1661365814859loidf7mcwd4qacn7 type: string owner: - example: +15553332222 + example: "+15553332222" type: string applicationId: example: 93de2206-9669-4e07-948d-329f4b722ee2 @@ -6715,13 +6776,13 @@ components: $ref: '#/components/schemas/messageDirectionEnum' to: example: - - +15552223333 + - "+15552223333" items: type: string type: array uniqueItems: true from: - example: +15553332222 + example: "+15553332222" type: string text: example: Hello world @@ -6855,13 +6916,13 @@ components: description: |- The destination to call (must be an E.164 formatted number (e.g. `+15555551212`) or a SIP URI (e.g. `sip:user@server.example`)). - example: +19195551234 + example: "+19195551234" type: string from: description: |- A Bandwidth phone number on your account the call should come from (must be in E.164 format, like `+15555551212`) even if `privacy` is set to true. - example: +15555551212 + example: "+15555551212" type: string privacy: description: Hide the calling number. The `displayName` field can be used @@ -7029,9 +7090,9 @@ components: answerMethod: POST enqueuedTime: 2022-06-16T13:15:07.16Z disconnectUrl: https://myServer.example/bandwidth/webhooks/disconnect - from: +19195554321 + from: "+19195554321" fallbackPassword: mySecretPassword1! - to: +19195551234 + to: "+19195551234" tag: My custom tag value applicationId: 04e88489-df02-4e34-a0ee-27a91849555f username: mySecretUsername @@ -7051,11 +7112,11 @@ components: type: string to: description: Recipient of the outgoing call. - example: +19195551234 + example: "+19195551234" type: string from: description: Phone number that created the outbound call. - example: +19195554321 + example: "+19195554321" type: string enqueuedTime: description: The time at which the call was accepted into the queue. @@ -7163,9 +7224,9 @@ components: verstat: TN-Verification-Passed attestationIndicator: A originatingId: abc123 - from: +19195554321 + from: "+19195554321" startTime: 2022-06-16T13:15:07.16Z - to: +19195551234 + to: "+19195551234" state: disconnected endTime: 2022-06-16T13:15:18.314Z errorId: errorId @@ -7193,12 +7254,12 @@ components: to: description: "The phone number that received the call, in E.164 format (e.g.\ \ +15555555555), or if the call was to a SIP URI, the SIP URI." - example: +19195551234 + example: "+19195551234" type: string from: description: "The phone number that made the call, in E.164 format (e.g.\ \ +15555555555)." - example: +19195554321 + example: "+19195554321" type: string direction: $ref: '#/components/schemas/callDirectionEnum' @@ -7406,14 +7467,14 @@ components: status: completed parentCallId: c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d recordingName: my-recording-name - transferCallerId: +15555555555 - transferTo: +15555555555 + transferCallerId: "+15555555555" + transferTo: "+15555555555" duration: PT13.67S accountId: "9900000" channels: 1 - from: +15555555555 + from: "+15555555555" startTime: 2022-06-17T22:19:40.375Z - to: +15555555555 + to: "+15555555555" endTime: 2022-06-17T22:20:00Z applicationId: 04e88489-df02-4e34-a0ee-27a91849555f recordingId: r-fbe05094-9fd2afe9-bf5b-4c68-820a-41a01c1c5833 @@ -7446,22 +7507,22 @@ components: to: description: "The phone number that received the call, in E.164 format (e.g.\ \ +15555555555)." - example: +15555555555 + example: "+15555555555" type: string from: description: The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). - example: +15555555555 + example: "+15555555555" type: string transferCallerId: description: "The phone number used as the from field of the B-leg call,\ \ in E.164 format (e.g. +15555555555)." - example: +15555555555 + example: "+15555555555" type: string transferTo: description: "The phone number used as the to field of the B-leg call, in\ \ E.164 format (e.g. +15555555555)." - example: +15555555555 + example: "+15555555555" type: string duration: description: The duration of the recording in ISO-8601 format @@ -8080,6 +8141,10 @@ components: type: string type: object voiceApiError: + example: + description: description + id: id + type: type properties: type: type: string @@ -8120,12 +8185,12 @@ components: from: description: The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). - example: +15555555555 + example: "+15555555555" type: string to: description: "The phone number that received the call, in E.164 format (e.g.\ \ +15555555555)." - example: +15555555555 + example: "+15555555555" type: string direction: $ref: '#/components/schemas/callDirectionEnum' @@ -8199,12 +8264,12 @@ components: from: description: The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). - example: +15555555555 + example: "+15555555555" type: string to: description: "The phone number that received the call, in E.164 format (e.g.\ \ +15555555555)." - example: +15555555555 + example: "+15555555555" type: string direction: $ref: '#/components/schemas/callDirectionEnum' @@ -8293,12 +8358,12 @@ components: from: description: The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). - example: +15555555555 + example: "+15555555555" type: string to: description: "The phone number that received the call, in E.164 format (e.g.\ \ +15555555555)." - example: +15555555555 + example: "+15555555555" type: string direction: $ref: '#/components/schemas/callDirectionEnum' @@ -8456,12 +8521,12 @@ components: from: description: The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). - example: +15555555555 + example: "+15555555555" type: string to: description: "The phone number that received the call, in E.164 format (e.g.\ \ +15555555555)." - example: +15555555555 + example: "+15555555555" type: string callId: description: The call id associated with the event. @@ -8511,12 +8576,12 @@ components: from: description: The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). - example: +15555555555 + example: "+15555555555" type: string to: description: "The phone number that received the call, in E.164 format (e.g.\ \ +15555555555)." - example: +15555555555 + example: "+15555555555" type: string callId: description: The call id associated with the event. @@ -8678,12 +8743,12 @@ components: from: description: The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). - example: +15555555555 + example: "+15555555555" type: string to: description: "The phone number that received the call, in E.164 format (e.g.\ \ +15555555555)." - example: +15555555555 + example: "+15555555555" type: string callId: description: The call id associated with the event. @@ -8775,12 +8840,12 @@ components: from: description: The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). - example: +15555555555 + example: "+15555555555" type: string to: description: "The phone number that received the call, in E.164 format (e.g.\ \ +15555555555)." - example: +15555555555 + example: "+15555555555" type: string callId: description: The call id associated with the event. @@ -8824,12 +8889,12 @@ components: transferCallerId: description: "The phone number used as the from field of the B-leg call,\ \ in E.164 format (e.g. +15555555555)." - example: +15555555555 + example: "+15555555555" type: string transferTo: description: "The phone number used as the to field of the B-leg call, in\ \ E.164 format (e.g. +15555555555)." - example: +15555555555 + example: "+15555555555" type: string tag: description: "(optional) The tag specified on call creation. If no tag was\ @@ -8869,12 +8934,12 @@ components: from: description: The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). - example: +15555555555 + example: "+15555555555" type: string to: description: "The phone number that received the call, in E.164 format (e.g.\ \ +15555555555)." - example: +15555555555 + example: "+15555555555" type: string direction: $ref: '#/components/schemas/callDirectionEnum' @@ -8925,12 +8990,12 @@ components: transferCallerId: description: "The phone number used as the from field of the B-leg call,\ \ in E.164 format (e.g. +15555555555)." - example: +15555555555 + example: "+15555555555" type: string transferTo: description: "The phone number used as the to field of the B-leg call, in\ \ E.164 format (e.g. +15555555555)." - example: +15555555555 + example: "+15555555555" type: string tag: description: "(optional) The tag specified on call creation. If no tag was\ @@ -8972,12 +9037,12 @@ components: from: description: The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). - example: +15555555555 + example: "+15555555555" type: string to: description: "The phone number that received the call, in E.164 format (e.g.\ \ +15555555555)." - example: +15555555555 + example: "+15555555555" type: string direction: $ref: '#/components/schemas/callDirectionEnum' @@ -9033,12 +9098,12 @@ components: from: description: The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). - example: +15555555555 + example: "+15555555555" type: string to: description: "The phone number that received the call, in E.164 format (e.g.\ \ +15555555555)." - example: +15555555555 + example: "+15555555555" type: string direction: $ref: '#/components/schemas/callDirectionEnum' @@ -9111,12 +9176,12 @@ components: from: description: The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). - example: +15555555555 + example: "+15555555555" type: string to: description: "The phone number that received the call, in E.164 format (e.g.\ \ +15555555555)." - example: +15555555555 + example: "+15555555555" type: string direction: $ref: '#/components/schemas/callDirectionEnum' @@ -9190,12 +9255,12 @@ components: transferCallerId: description: "The phone number used as the from field of the B-leg call,\ \ in E.164 format (e.g. +15555555555)." - example: +15555555555 + example: "+15555555555" type: string transferTo: description: "The phone number used as the to field of the B-leg call, in\ \ E.164 format (e.g. +15555555555)." - example: +15555555555 + example: "+15555555555" type: string type: object recordingAvailableCallback: @@ -9229,12 +9294,12 @@ components: from: description: The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). - example: +15555555555 + example: "+15555555555" type: string to: description: "The phone number that received the call, in E.164 format (e.g.\ \ +15555555555)." - example: +15555555555 + example: "+15555555555" type: string direction: $ref: '#/components/schemas/callDirectionEnum' @@ -9311,12 +9376,12 @@ components: transferCallerId: description: "The phone number used as the from field of the B-leg call,\ \ in E.164 format (e.g. +15555555555)." - example: +15555555555 + example: "+15555555555" type: string transferTo: description: "The phone number used as the to field of the B-leg call, in\ \ E.164 format (e.g. +15555555555)." - example: +15555555555 + example: "+15555555555" type: string type: object redirectCallback: @@ -9350,12 +9415,12 @@ components: from: description: The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). - example: +15555555555 + example: "+15555555555" type: string to: description: "The phone number that received the call, in E.164 format (e.g.\ \ +15555555555)." - example: +15555555555 + example: "+15555555555" type: string direction: $ref: '#/components/schemas/callDirectionEnum' @@ -9401,12 +9466,12 @@ components: transferCallerId: description: "The phone number used as the from field of the B-leg call,\ \ in E.164 format (e.g. +15555555555)." - example: +15555555555 + example: "+15555555555" type: string transferTo: description: "The phone number used as the to field of the B-leg call, in\ \ E.164 format (e.g. +15555555555)." - example: +15555555555 + example: "+15555555555" type: string type: object transcriptionAvailableCallback: @@ -9440,12 +9505,12 @@ components: from: description: The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). - example: +15555555555 + example: "+15555555555" type: string to: description: "The phone number that received the call, in E.164 format (e.g.\ \ +15555555555)." - example: +15555555555 + example: "+15555555555" type: string direction: $ref: '#/components/schemas/callDirectionEnum' @@ -9509,12 +9574,12 @@ components: transferCallerId: description: "The phone number used as the from field of the B-leg call,\ \ in E.164 format (e.g. +15555555555)." - example: +15555555555 + example: "+15555555555" type: string transferTo: description: "The phone number used as the to field of the B-leg call, in\ \ E.164 format (e.g. +15555555555)." - example: +15555555555 + example: "+15555555555" type: string type: object transferAnswerCallback: @@ -9553,12 +9618,12 @@ components: from: description: The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). - example: +15555555555 + example: "+15555555555" type: string to: description: "The phone number that received the call, in E.164 format (e.g.\ \ +15555555555)." - example: +15555555555 + example: "+15555555555" type: string direction: $ref: '#/components/schemas/callDirectionEnum' @@ -9598,12 +9663,12 @@ components: transferCallerId: description: "The phone number used as the from field of the B-leg call,\ \ in E.164 format (e.g. +15555555555)." - example: +15555555555 + example: "+15555555555" type: string transferTo: description: "The phone number used as the to field of the B-leg call, in\ \ E.164 format (e.g. +15555555555)." - example: +15555555555 + example: "+15555555555" type: string type: object transferCompleteCallback: @@ -9640,12 +9705,12 @@ components: from: description: The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). - example: +15555555555 + example: "+15555555555" type: string to: description: "The phone number that received the call, in E.164 format (e.g.\ \ +15555555555)." - example: +15555555555 + example: "+15555555555" type: string direction: $ref: '#/components/schemas/callDirectionEnum' @@ -9685,12 +9750,12 @@ components: transferCallerId: description: "The phone number used as the from field of the B-leg call,\ \ in E.164 format (e.g. +15555555555)." - example: +15555555555 + example: "+15555555555" type: string transferTo: description: "The phone number used as the to field of the B-leg call, in\ \ E.164 format (e.g. +15555555555)." - example: +15555555555 + example: "+15555555555" type: string cause: description: "Reason the call failed - hangup, busy, timeout, cancel, rejected,\ @@ -9746,12 +9811,12 @@ components: from: description: The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). - example: +15555555555 + example: "+15555555555" type: string to: description: "The phone number that received the call, in E.164 format (e.g.\ \ +15555555555)." - example: +15555555555 + example: "+15555555555" type: string direction: $ref: '#/components/schemas/callDirectionEnum' @@ -9802,12 +9867,12 @@ components: transferCallerId: description: "The phone number used as the from field of the B-leg call,\ \ in E.164 format (e.g. +15555555555)." - example: +15555555555 + example: "+15555555555" type: string transferTo: description: "The phone number used as the to field of the B-leg call, in\ \ E.164 format (e.g. +15555555555)." - example: +15555555555 + example: "+15555555555" type: string cause: description: "Reason the call failed - hangup, busy, timeout, cancel, rejected,\ @@ -9855,12 +9920,12 @@ components: to: description: "The phone number that received the call, in E.164 format (e.g.\ \ +15555555555)." - example: +15555555555 + example: "+15555555555" type: string from: description: The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). - example: +15555555555 + example: "+15555555555" type: string conferenceId: description: "The unique, Bandwidth-generated ID of the conference that was\ @@ -9935,12 +10000,12 @@ components: transferCallerId: description: "The phone number used as the from field of the B-leg call, in\ \ E.164 format (e.g. +15555555555)." - example: +15555555555 + example: "+15555555555" type: string transferTo: description: "The phone number used as the to field of the B-leg call, in E.164\ \ format (e.g. +15555555555)." - example: +15555555555 + example: "+15555555555" type: string mediaUrl: description: The URL that can be used to download the recording. Only present @@ -10041,7 +10106,7 @@ components: origTo: description: Always present. Indicates the last telephone number that the call was diverted from. - example: +15558884444 + example: "+15558884444" type: string type: object transcription: @@ -10082,12 +10147,12 @@ components: properties: to: description: The phone number to send the mfa code to. - example: +19195551234 + example: "+19195551234" pattern: "^\\+[1-9]\\d{1,14}$" type: string from: description: "The application phone number, the sender of the mfa code." - example: +19195554321 + example: "+19195554321" maxLength: 32 pattern: "^\\+[1-9]\\d{1,14}$" type: string @@ -10149,7 +10214,7 @@ components: properties: to: description: The phone number to send the mfa code to. - example: +19195551234 + example: "+19195551234" pattern: "^\\+[1-9]\\d{1,14}$" type: string scope: @@ -10187,6 +10252,9 @@ components: type: boolean type: object mfaRequestError: + example: + requestId: 354cc8a3-6701-461e-8fa7-8671703dd898 + error: 400 Request is malformed or invalid properties: error: description: A message describing the error with your request. @@ -10198,6 +10266,8 @@ components: type: string type: object mfaUnauthorizedRequestError: + example: + message: Unauthorized properties: message: description: Unauthorized @@ -10205,6 +10275,8 @@ components: type: string type: object mfaForbiddenRequestError: + example: + message: Missing Authentication Token properties: message: description: The message containing the reason behind the request being @@ -10253,7 +10325,7 @@ components: \ was available for the TN." example: result: - - E.164 Format: +19195551234 + - E.164 Format: "+19195551234" Formatted: (919) 555-1234 Line Provider: Verizon Wireless Message: NOERROR @@ -10262,7 +10334,7 @@ components: Mobile Country Code: "310" Mobile Network Code: "010" Response Code: 0 - - E.164 Format: +19195551234 + - E.164 Format: "+19195551234" Formatted: (919) 555-1234 Line Provider: Verizon Wireless Message: NOERROR @@ -10273,7 +10345,7 @@ components: Response Code: 0 requestId: 004223a0-8b17-41b1-bf81-20732adf5590 failedTelephoneNumbers: - - +191955512345 + - "+191955512345" status: COMPLETE properties: requestId: @@ -10291,7 +10363,7 @@ components: failedTelephoneNumbers: description: The telephone numbers whose lookup failed. example: - - +191955512345 + - "+191955512345" items: type: string type: array @@ -10299,7 +10371,7 @@ components: lookupResult: description: Carrier information results for the specified telephone number. example: - E.164 Format: +19195551234 + E.164 Format: "+19195551234" Formatted: (919) 555-1234 Line Provider: Verizon Wireless Message: NOERROR @@ -10319,7 +10391,7 @@ components: type: string E.164 Format: description: The telephone number in E.164 format. - example: +19195551234 + example: "+19195551234" type: string Formatted: description: The formatted version of the telephone number. @@ -10347,6 +10419,8 @@ components: type: string type: object tnLookupRequestError: + example: + message: example error message properties: message: description: A description of what validation error occurred. diff --git a/build.gradle b/build.gradle index c1f22406..7e11e0b0 100644 --- a/build.gradle +++ b/build.gradle @@ -62,9 +62,9 @@ if(hasProperty('target') && target == 'android') { def task = project.tasks.create "jar${variant.name.capitalize()}", Jar task.description = "Create jar artifact for ${variant.name}" task.dependsOn variant.javaCompile - task.from variant.javaCompile.destinationDir - task.destinationDir = project.file("${project.buildDir}/outputs/jar") - task.archiveName = "${project.name}-${variant.baseName}-${version}.jar" + task.from variant.javaCompile.destinationDirectory + task.destinationDirectory = project.file("${project.buildDir}/outputs/jar") + task.archiveFileName = "${project.name}-${variant.baseName}-${version}.jar" artifacts.add('archives', task) } } @@ -108,18 +108,17 @@ ext { dependencies { implementation 'io.swagger:swagger-annotations:1.6.8' implementation "com.google.code.findbugs:jsr305:3.0.2" - implementation 'com.squareup.okhttp3:okhttp:4.10.0' - implementation 'com.squareup.okhttp3:logging-interceptor:4.10.0' + implementation 'com.squareup.okhttp3:okhttp:4.12.0' + implementation 'com.squareup.okhttp3:logging-interceptor:4.12.0' implementation 'com.google.code.gson:gson:2.9.1' - implementation 'io.gsonfire:gson-fire:1.8.5' - implementation 'javax.ws.rs:jsr311-api:1.1.1' - implementation 'javax.ws.rs:javax.ws.rs-api:2.1.1' + implementation 'io.gsonfire:gson-fire:1.9.0' + implementation 'jakarta.ws.rs:jakarta.ws.rs-api:2.1.6' implementation 'org.openapitools:jackson-databind-nullable:0.2.6' implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0' implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.1' + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3' testImplementation 'org.mockito:mockito-core:3.12.4' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.1' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.3' } javadoc { diff --git a/build.sbt b/build.sbt index 306436b0..8ce42414 100644 --- a/build.sbt +++ b/build.sbt @@ -10,18 +10,17 @@ lazy val root = (project in file(".")). resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( "io.swagger" % "swagger-annotations" % "1.6.5", - "com.squareup.okhttp3" % "okhttp" % "4.10.0", - "com.squareup.okhttp3" % "logging-interceptor" % "4.10.0", + "com.squareup.okhttp3" % "okhttp" % "4.12.0", + "com.squareup.okhttp3" % "logging-interceptor" % "4.12.0", "com.google.code.gson" % "gson" % "2.9.1", "org.apache.commons" % "commons-lang3" % "3.12.0", - "javax.ws.rs" % "jsr311-api" % "1.1.1", - "javax.ws.rs" % "javax.ws.rs-api" % "2.1.1", + "jakarta.ws.rs" % "jakarta.ws.rs-api" % "2.1.6", "org.openapitools" % "jackson-databind-nullable" % "0.2.6", - "io.gsonfire" % "gson-fire" % "1.8.5" % "compile", + "io.gsonfire" % "gson-fire" % "1.9.0" % "compile", "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", "com.google.code.findbugs" % "jsr305" % "3.0.2" % "compile", "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", - "org.junit.jupiter" % "junit-jupiter-api" % "5.9.1" % "test", + "org.junit.jupiter" % "junit-jupiter-api" % "5.10.3" % "test", "com.novocode" % "junit-interface" % "0.10" % "test", "org.mockito" % "mockito-core" % "3.12.4" % "test" ) diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7454180f..e6441136 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ffed3a25..b82aa23a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 005bcde0..9d0ce634 100644 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -69,37 +69,35 @@ app_path=$0 # Need this for daisy-chained symlinks. while - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path - [ -h "$app_path" ] +APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path +[ -h "$app_path" ] do - ls=$( ls -ld "$app_path" ) - link=${ls#*' -> '} - case $link in #( - /*) app_path=$link ;; #( - *) app_path=$APP_HOME$link ;; - esac +ls=$( ls -ld "$app_path" ) +link=${ls#*' -> '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum warn () { - echo "$*" +echo "$*" } >&2 die () { - echo - echo "$*" - echo - exit 1 +echo +echo "$*" +echo +exit 1 } >&2 # OS specific support (must be 'true' or 'false'). @@ -108,10 +106,10 @@ msys=false darwin=false nonstop=false case "$( uname )" in #( - CYGWIN* ) cygwin=true ;; #( - Darwin* ) darwin=true ;; #( - MSYS* | MINGW* ) msys=true ;; #( - NONSTOP* ) nonstop=true ;; +CYGWIN* ) cygwin=true ;; #( +Darwin* ) darwin=true ;; #( +MSYS* | MINGW* ) msys=true ;; #( +NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -119,39 +117,46 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD=$JAVA_HOME/jre/sh/java - else - JAVACMD=$JAVA_HOME/bin/java - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME +if [ -x "$JAVA_HOME/jre/sh/java" ] ; then +# IBM's JDK on AIX uses strange locations for the executables +JAVACMD=$JAVA_HOME/jre/sh/java +else +JAVACMD=$JAVA_HOME/bin/java +fi +if [ ! -x "$JAVACMD" ] ; then +die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME Please set the JAVA_HOME variable in your environment to match the location of your Java installation." - fi +fi else - JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +JAVACMD=java +if ! command -v java >/dev/null 2>&1 +then +die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi +fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then - case $MAX_FD in #( - max*) - MAX_FD=$( ulimit -H -n ) || - warn "Could not query maximum file descriptor limit" - esac - case $MAX_FD in #( - '' | soft) :;; #( - *) - ulimit -n "$MAX_FD" || - warn "Could not set maximum file descriptor limit to $MAX_FD" - esac +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac fi # Collect all arguments for the java command, stacking in reverse order: @@ -164,46 +169,56 @@ fi # For Cygwin or MSYS, switch paths to Windows format before running java if "$cygwin" || "$msys" ; then - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) - - JAVACMD=$( cygpath --unix "$JAVACMD" ) - - # Now convert the arguments - kludge to limit ourselves to /bin/sh - for arg do - if - case $arg in #( - -*) false ;; # don't mess with options #( - /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath - [ -e "$t" ] ;; #( - *) false ;; - esac - then - arg=$( cygpath --path --ignore --mixed "$arg" ) - fi - # Roll the args list around exactly as many times as the number of - # args, so each arg winds up back in the position where it started, but - # possibly modified. - # - # NB: a `for` loop captures its iteration list before it begins, so - # changing the positional parameters here affects neither the number of - # iterations, nor the values presented in `arg`. - shift # remove old arg - set -- "$@" "$arg" # push replacement arg - done +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ - "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ - "$@" +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi # Use "xargs" to parse quoted args. # @@ -225,10 +240,10 @@ set -- \ # eval "set -- $( - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | - xargs -n1 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | - tr '\n' ' ' - )" '"$@"' +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 6a68175e..25da30db 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -33,20 +34,20 @@ set APP_HOME=%DIRNAME% for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -56,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/openapitools.json b/openapitools.json index 3015568c..f80faaa6 100644 --- a/openapitools.json +++ b/openapitools.json @@ -2,6 +2,6 @@ "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", "spaces": 2, "generator-cli": { - "version": "7.0.0" + "version": "7.9.0" } } diff --git a/src/main/java/com/bandwidth/sdk/ApiClient.java b/src/main/java/com/bandwidth/sdk/ApiClient.java index eb567e25..5307b00f 100644 --- a/src/main/java/com/bandwidth/sdk/ApiClient.java +++ b/src/main/java/com/bandwidth/sdk/ApiClient.java @@ -47,6 +47,7 @@ import java.util.*; import java.util.Map.Entry; import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -466,6 +467,19 @@ public void setAWS4Configuration(String accessKey, String secretKey, String regi throw new RuntimeException("No AWS4 authentication configured!"); } + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param sessionToken Session Token + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String sessionToken, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + /** * Set the User-Agent header's value (by adding to the default header map). * @@ -721,6 +735,30 @@ public List parameterToPairs(String collectionFormat, String name, Collect return params; } + /** + * Formats the specified free-form query parameters to a list of {@code Pair} objects. + * + * @param value The free-form query parameters. + * @return A list of {@code Pair} objects. + */ + public List freeFormParameterToPairs(Object value) { + List params = new ArrayList<>(); + + // preconditions + if (value == null || !(value instanceof Map )) { + return params; + } + + final Map valuesMap = (Map) value; + + for (Map.Entry entry : valuesMap.entrySet()) { + params.add(new Pair(entry.getKey(), parameterToString(entry.getValue()))); + } + + return params; + } + + /** * Formats the specified collection path parameter to a string value. * @@ -1159,10 +1197,6 @@ public Call buildCall(String baseUrl, String path, String method, List que * @throws com.bandwidth.sdk.ApiException If fail to serialize the request body object */ public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { - // aggregate queryParams (non-collection) and collectionQueryParams into allQueryParams - List allQueryParams = new ArrayList(queryParams); - allQueryParams.addAll(collectionQueryParams); - final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); // prepare HTTP request body @@ -1190,10 +1224,12 @@ public Request buildRequest(String baseUrl, String path, String method, List updatedQueryParams = new ArrayList<>(queryParams); + // update parameters with authentication settings - updateParamsForAuth(authNames, allQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); - final Request.Builder reqBuilder = new Request.Builder().url(url); + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); processHeaderParams(headerParams, reqBuilder); processCookieParams(cookieParams, reqBuilder); diff --git a/src/main/java/com/bandwidth/sdk/ApiException.java b/src/main/java/com/bandwidth/sdk/ApiException.java index 55fe2953..3ec11cbe 100644 --- a/src/main/java/com/bandwidth/sdk/ApiException.java +++ b/src/main/java/com/bandwidth/sdk/ApiException.java @@ -21,8 +21,10 @@ *

ApiException class.

*/ @SuppressWarnings("serial") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class ApiException extends Exception { + private static final long serialVersionUID = 1L; + private int code = 0; private Map> responseHeaders = null; private String responseBody = null; diff --git a/src/main/java/com/bandwidth/sdk/Configuration.java b/src/main/java/com/bandwidth/sdk/Configuration.java index d730b801..00719909 100644 --- a/src/main/java/com/bandwidth/sdk/Configuration.java +++ b/src/main/java/com/bandwidth/sdk/Configuration.java @@ -13,7 +13,7 @@ package com.bandwidth.sdk; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class Configuration { public static final String VERSION = "10.1.0"; diff --git a/src/main/java/com/bandwidth/sdk/JSON.java b/src/main/java/com/bandwidth/sdk/JSON.java index 4e1175f7..fce101a7 100644 --- a/src/main/java/com/bandwidth/sdk/JSON.java +++ b/src/main/java/com/bandwidth/sdk/JSON.java @@ -86,7 +86,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri return clazz; } - { + static { GsonBuilder gsonBuilder = createGson(); gsonBuilder.registerTypeAdapter(Date.class, dateTypeAdapter); gsonBuilder.registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter); diff --git a/src/main/java/com/bandwidth/sdk/Pair.java b/src/main/java/com/bandwidth/sdk/Pair.java index 93fad347..315d1d54 100644 --- a/src/main/java/com/bandwidth/sdk/Pair.java +++ b/src/main/java/com/bandwidth/sdk/Pair.java @@ -13,7 +13,7 @@ package com.bandwidth.sdk; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class Pair { private String name = ""; private String value = ""; diff --git a/src/main/java/com/bandwidth/sdk/ServerConfiguration.java b/src/main/java/com/bandwidth/sdk/ServerConfiguration.java index df9dc784..9576cd00 100644 --- a/src/main/java/com/bandwidth/sdk/ServerConfiguration.java +++ b/src/main/java/com/bandwidth/sdk/ServerConfiguration.java @@ -1,3 +1,16 @@ +/* + * 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; import java.util.Map; @@ -5,6 +18,7 @@ /** * Representing a Server configuration. */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class ServerConfiguration { public String URL; public String description; diff --git a/src/main/java/com/bandwidth/sdk/ServerVariable.java b/src/main/java/com/bandwidth/sdk/ServerVariable.java index 675f9e28..d43982c3 100644 --- a/src/main/java/com/bandwidth/sdk/ServerVariable.java +++ b/src/main/java/com/bandwidth/sdk/ServerVariable.java @@ -1,3 +1,16 @@ +/* + * 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; import java.util.HashSet; @@ -5,6 +18,7 @@ /** * Representing a Server Variable for server URL template substitution. */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class ServerVariable { public String description; public String defaultValue; diff --git a/src/main/java/com/bandwidth/sdk/StringUtil.java b/src/main/java/com/bandwidth/sdk/StringUtil.java index 29277114..6eea0913 100644 --- a/src/main/java/com/bandwidth/sdk/StringUtil.java +++ b/src/main/java/com/bandwidth/sdk/StringUtil.java @@ -16,7 +16,7 @@ import java.util.Collection; import java.util.Iterator; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/src/main/java/com/bandwidth/sdk/auth/ApiKeyAuth.java b/src/main/java/com/bandwidth/sdk/auth/ApiKeyAuth.java index 6cf0d0c8..0ff3e900 100644 --- a/src/main/java/com/bandwidth/sdk/auth/ApiKeyAuth.java +++ b/src/main/java/com/bandwidth/sdk/auth/ApiKeyAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/src/main/java/com/bandwidth/sdk/auth/HttpBasicAuth.java b/src/main/java/com/bandwidth/sdk/auth/HttpBasicAuth.java index d313b5b0..2f3bc4f8 100644 --- a/src/main/java/com/bandwidth/sdk/auth/HttpBasicAuth.java +++ b/src/main/java/com/bandwidth/sdk/auth/HttpBasicAuth.java @@ -22,8 +22,6 @@ import java.util.Map; import java.util.List; -import java.io.UnsupportedEncodingException; - public class HttpBasicAuth implements Authentication { private String username; private String password; diff --git a/src/main/java/com/bandwidth/sdk/auth/HttpBearerAuth.java b/src/main/java/com/bandwidth/sdk/auth/HttpBearerAuth.java index 8773cf97..4f4203c2 100644 --- a/src/main/java/com/bandwidth/sdk/auth/HttpBearerAuth.java +++ b/src/main/java/com/bandwidth/sdk/auth/HttpBearerAuth.java @@ -17,13 +17,15 @@ import com.bandwidth.sdk.Pair; import java.net.URI; -import java.util.Map; import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.function.Supplier; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class HttpBearerAuth implements Authentication { private final String scheme; - private String bearerToken; + private Supplier tokenSupplier; public HttpBearerAuth(String scheme) { this.scheme = scheme; @@ -35,7 +37,7 @@ public HttpBearerAuth(String scheme) { * @return The bearer token */ public String getBearerToken() { - return bearerToken; + return tokenSupplier.get(); } /** @@ -44,12 +46,22 @@ public String getBearerToken() { * @param bearerToken The bearer token to send in the Authorization header */ public void setBearerToken(String bearerToken) { - this.bearerToken = bearerToken; + this.tokenSupplier = () -> bearerToken; + } + + /** + * Sets the supplier of tokens, which together with the scheme, will be sent as the value of the Authorization header. + * + * @param tokenSupplier The supplier of bearer tokens to send in the Authorization header + */ + public void setBearerToken(Supplier tokenSupplier) { + this.tokenSupplier = tokenSupplier; } @Override public void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException { + String bearerToken = Optional.ofNullable(tokenSupplier).map(Supplier::get).orElse(null); if (bearerToken == null) { return; } diff --git a/src/main/java/com/bandwidth/sdk/model/AbstractOpenApiSchema.java b/src/main/java/com/bandwidth/sdk/model/AbstractOpenApiSchema.java index dbe969d8..3ae9c1d1 100644 --- a/src/main/java/com/bandwidth/sdk/model/AbstractOpenApiSchema.java +++ b/src/main/java/com/bandwidth/sdk/model/AbstractOpenApiSchema.java @@ -18,12 +18,10 @@ import java.lang.reflect.Type; import java.util.Map; -//import com.fasterxml.jackson.annotation.JsonValue; - /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/src/main/java/com/bandwidth/sdk/model/AccountStatistics.java b/src/main/java/com/bandwidth/sdk/model/AccountStatistics.java index b27df3b4..d89e7b36 100644 --- a/src/main/java/com/bandwidth/sdk/model/AccountStatistics.java +++ b/src/main/java/com/bandwidth/sdk/model/AccountStatistics.java @@ -37,12 +37,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -50,7 +48,7 @@ /** * AccountStatistics */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class AccountStatistics { public static final String SERIALIZED_NAME_CURRENT_CALL_QUEUE_SIZE = "currentCallQueueSize"; @SerializedName(SERIALIZED_NAME_CURRENT_CALL_QUEUE_SIZE) @@ -64,42 +62,38 @@ public AccountStatistics() { } public AccountStatistics currentCallQueueSize(Integer currentCallQueueSize) { - this.currentCallQueueSize = currentCallQueueSize; return this; } - /** + /** * The number of calls currently enqueued. * @return currentCallQueueSize - **/ + */ @javax.annotation.Nullable public Integer getCurrentCallQueueSize() { return currentCallQueueSize; } - public void setCurrentCallQueueSize(Integer currentCallQueueSize) { this.currentCallQueueSize = currentCallQueueSize; } public AccountStatistics maxCallQueueSize(Integer maxCallQueueSize) { - this.maxCallQueueSize = maxCallQueueSize; return this; } - /** + /** * The maximum size of the queue before outgoing calls start being rejected. * @return maxCallQueueSize - **/ + */ @javax.annotation.Nullable public Integer getMaxCallQueueSize() { return maxCallQueueSize; } - public void setMaxCallQueueSize(Integer maxCallQueueSize) { this.maxCallQueueSize = maxCallQueueSize; } @@ -205,12 +199,12 @@ private String toIndentedString(Object o) { 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 AccountStatistics - */ + /** + * 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 AccountStatistics + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!AccountStatistics.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -248,7 +242,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -287,22 +286,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of AccountStatistics given an JSON string - * - * @param jsonString JSON string - * @return An instance of AccountStatistics - * @throws IOException if the JSON string is invalid with respect to AccountStatistics - */ + /** + * Create an instance of AccountStatistics given an JSON string + * + * @param jsonString JSON string + * @return An instance of AccountStatistics + * @throws IOException if the JSON string is invalid with respect to AccountStatistics + */ public static AccountStatistics fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, AccountStatistics.class); } - /** - * Convert an instance of AccountStatistics to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of AccountStatistics 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/AnswerCallback.java b/src/main/java/com/bandwidth/sdk/model/AnswerCallback.java index 5d7a6c31..830afd03 100644 --- a/src/main/java/com/bandwidth/sdk/model/AnswerCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/AnswerCallback.java @@ -42,12 +42,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -55,7 +53,7 @@ /** * The Answer event is sent to the answerUrl specified in the createCall request when an outbound call is answered. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class AnswerCallback { public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; @SerializedName(SERIALIZED_NAME_EVENT_TYPE) @@ -117,294 +115,266 @@ public AnswerCallback() { } public AnswerCallback eventType(String eventType) { - this.eventType = eventType; return this; } - /** + /** * 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. * @return eventType - **/ + */ @javax.annotation.Nullable public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public AnswerCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } - /** + /** * 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. * @return eventTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public AnswerCallback accountId(String accountId) { - this.accountId = accountId; return this; } - /** + /** * The user account associated with the call. * @return accountId - **/ + */ @javax.annotation.Nullable public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public AnswerCallback applicationId(String applicationId) { - this.applicationId = applicationId; return this; } - /** + /** * The id of the application associated with the call. * @return applicationId - **/ + */ @javax.annotation.Nullable public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public AnswerCallback from(String from) { - this.from = from; return this; } - /** + /** * The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). * @return from - **/ + */ @javax.annotation.Nullable public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public AnswerCallback to(String to) { - this.to = to; return this; } - /** + /** * The phone number that received the call, in E.164 format (e.g. +15555555555). * @return to - **/ + */ @javax.annotation.Nullable public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public AnswerCallback direction(CallDirectionEnum direction) { - this.direction = direction; return this; } - /** + /** * Get direction * @return direction - **/ + */ @javax.annotation.Nullable public CallDirectionEnum getDirection() { return direction; } - public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public AnswerCallback callId(String callId) { - this.callId = callId; return this; } - /** + /** * The call id associated with the event. * @return callId - **/ + */ @javax.annotation.Nullable public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public AnswerCallback callUrl(URI callUrl) { - this.callUrl = callUrl; return this; } - /** + /** * The URL of the call associated with the event. * @return callUrl - **/ + */ @javax.annotation.Nullable public URI getCallUrl() { return callUrl; } - public void setCallUrl(URI callUrl) { this.callUrl = callUrl; } public AnswerCallback enqueuedTime(OffsetDateTime enqueuedTime) { - this.enqueuedTime = enqueuedTime; return this; } - /** + /** * (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. * @return enqueuedTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } - public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public AnswerCallback startTime(OffsetDateTime startTime) { - this.startTime = startTime; return this; } - /** + /** * Time the call was started, in ISO 8601 format. * @return startTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getStartTime() { return startTime; } - public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public AnswerCallback answerTime(OffsetDateTime answerTime) { - this.answerTime = answerTime; return this; } - /** + /** * Time the call was answered, in ISO 8601 format. * @return answerTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getAnswerTime() { return answerTime; } - public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public AnswerCallback tag(String tag) { - this.tag = tag; return this; } - /** + /** * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. * @return tag - **/ + */ @javax.annotation.Nullable public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public AnswerCallback machineDetectionResult(MachineDetectionResult machineDetectionResult) { - this.machineDetectionResult = machineDetectionResult; return this; } - /** + /** * Get machineDetectionResult * @return machineDetectionResult - **/ + */ @javax.annotation.Nullable public MachineDetectionResult getMachineDetectionResult() { return machineDetectionResult; } - public void setMachineDetectionResult(MachineDetectionResult machineDetectionResult) { this.machineDetectionResult = machineDetectionResult; } @@ -557,12 +527,12 @@ private String toIndentedString(Object o) { 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 AnswerCallback - */ + /** + * 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 AnswerCallback + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!AnswerCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -585,6 +555,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti 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())); } + // validate the optional field `direction` + if (jsonObj.get("direction") != null && !jsonObj.get("direction").isJsonNull()) { + CallDirectionEnum.validateJsonElement(jsonObj.get("direction")); + } if ((jsonObj.get("callId") != null && !jsonObj.get("callId").isJsonNull()) && !jsonObj.get("callId").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `callId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callId").toString())); } @@ -628,7 +602,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -667,22 +646,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of AnswerCallback given an JSON string - * - * @param jsonString JSON string - * @return An instance of AnswerCallback - * @throws IOException if the JSON string is invalid with respect to AnswerCallback - */ + /** + * Create an instance of AnswerCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of AnswerCallback + * @throws IOException if the JSON string is invalid with respect to AnswerCallback + */ public static AnswerCallback fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, AnswerCallback.class); } - /** - * Convert an instance of AnswerCallback to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of AnswerCallback 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/BridgeCompleteCallback.java b/src/main/java/com/bandwidth/sdk/model/BridgeCompleteCallback.java index b739d764..836b0c62 100644 --- a/src/main/java/com/bandwidth/sdk/model/BridgeCompleteCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/BridgeCompleteCallback.java @@ -41,12 +41,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -54,7 +52,7 @@ /** * If the target call leaves the <Bridge>, then this callback is sent to the bridgeCompleteUrl, and the BXML returned in it is executed on the call. If this webhook is sent, the Bridge Target Complete webhook is NOT sent. This callback is also sent if any problem occurs that prevents the calls to be bridged. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class BridgeCompleteCallback { public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; @SerializedName(SERIALIZED_NAME_EVENT_TYPE) @@ -124,336 +122,304 @@ public BridgeCompleteCallback() { } public BridgeCompleteCallback eventType(String eventType) { - this.eventType = eventType; return this; } - /** + /** * 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. * @return eventType - **/ + */ @javax.annotation.Nullable public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public BridgeCompleteCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } - /** + /** * 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. * @return eventTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public BridgeCompleteCallback accountId(String accountId) { - this.accountId = accountId; return this; } - /** + /** * The user account associated with the call. * @return accountId - **/ + */ @javax.annotation.Nullable public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public BridgeCompleteCallback applicationId(String applicationId) { - this.applicationId = applicationId; return this; } - /** + /** * The id of the application associated with the call. * @return applicationId - **/ + */ @javax.annotation.Nullable public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public BridgeCompleteCallback from(String from) { - this.from = from; return this; } - /** + /** * The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). * @return from - **/ + */ @javax.annotation.Nullable public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public BridgeCompleteCallback to(String to) { - this.to = to; return this; } - /** + /** * The phone number that received the call, in E.164 format (e.g. +15555555555). * @return to - **/ + */ @javax.annotation.Nullable public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public BridgeCompleteCallback direction(CallDirectionEnum direction) { - this.direction = direction; return this; } - /** + /** * Get direction * @return direction - **/ + */ @javax.annotation.Nullable public CallDirectionEnum getDirection() { return direction; } - public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public BridgeCompleteCallback callId(String callId) { - this.callId = callId; return this; } - /** + /** * The call id associated with the event. * @return callId - **/ + */ @javax.annotation.Nullable public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public BridgeCompleteCallback callUrl(URI callUrl) { - this.callUrl = callUrl; return this; } - /** + /** * The URL of the call associated with the event. * @return callUrl - **/ + */ @javax.annotation.Nullable public URI getCallUrl() { return callUrl; } - public void setCallUrl(URI callUrl) { this.callUrl = callUrl; } public BridgeCompleteCallback enqueuedTime(OffsetDateTime enqueuedTime) { - this.enqueuedTime = enqueuedTime; return this; } - /** + /** * (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. * @return enqueuedTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } - public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public BridgeCompleteCallback startTime(OffsetDateTime startTime) { - this.startTime = startTime; return this; } - /** + /** * Time the call was started, in ISO 8601 format. * @return startTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getStartTime() { return startTime; } - public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public BridgeCompleteCallback answerTime(OffsetDateTime answerTime) { - this.answerTime = answerTime; return this; } - /** + /** * Time the call was answered, in ISO 8601 format. * @return answerTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getAnswerTime() { return answerTime; } - public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public BridgeCompleteCallback tag(String tag) { - this.tag = tag; return this; } - /** + /** * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. * @return tag - **/ + */ @javax.annotation.Nullable public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public BridgeCompleteCallback cause(String cause) { - this.cause = cause; return this; } - /** + /** * Reason the call failed - hangup, busy, timeout, cancel, rejected, callback-error, invalid-bxml, application-error, account-limit, node-capacity-exceeded, error, or unknown. * @return cause - **/ + */ @javax.annotation.Nullable public String getCause() { return cause; } - public void setCause(String cause) { this.cause = cause; } public BridgeCompleteCallback errorMessage(String errorMessage) { - this.errorMessage = errorMessage; return this; } - /** + /** * Text explaining the reason that caused the call to fail in case of errors. * @return errorMessage - **/ + */ @javax.annotation.Nullable public String getErrorMessage() { return errorMessage; } - public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; } public BridgeCompleteCallback errorId(String errorId) { - this.errorId = errorId; return this; } - /** + /** * Bandwidth's internal id that references the error event. * @return errorId - **/ + */ @javax.annotation.Nullable public String getErrorId() { return errorId; } - public void setErrorId(String errorId) { this.errorId = errorId; } @@ -612,12 +578,12 @@ private String toIndentedString(Object o) { 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 BridgeCompleteCallback - */ + /** + * 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 BridgeCompleteCallback + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!BridgeCompleteCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -640,6 +606,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti 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())); } + // validate the optional field `direction` + if (jsonObj.get("direction") != null && !jsonObj.get("direction").isJsonNull()) { + CallDirectionEnum.validateJsonElement(jsonObj.get("direction")); + } if ((jsonObj.get("callId") != null && !jsonObj.get("callId").isJsonNull()) && !jsonObj.get("callId").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `callId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callId").toString())); } @@ -688,7 +658,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -727,22 +702,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of BridgeCompleteCallback given an JSON string - * - * @param jsonString JSON string - * @return An instance of BridgeCompleteCallback - * @throws IOException if the JSON string is invalid with respect to BridgeCompleteCallback - */ + /** + * Create an instance of BridgeCompleteCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of BridgeCompleteCallback + * @throws IOException if the JSON string is invalid with respect to BridgeCompleteCallback + */ public static BridgeCompleteCallback fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, BridgeCompleteCallback.class); } - /** - * Convert an instance of BridgeCompleteCallback to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of BridgeCompleteCallback 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/BridgeTargetCompleteCallback.java b/src/main/java/com/bandwidth/sdk/model/BridgeTargetCompleteCallback.java index 7f02e1fc..908c0dbc 100644 --- a/src/main/java/com/bandwidth/sdk/model/BridgeTargetCompleteCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/BridgeTargetCompleteCallback.java @@ -41,12 +41,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -54,7 +52,7 @@ /** * If the originating call leaves the <Bridge>, then this callback is sent to the bridgeTargetCompleteUrl, and the BXML returned in it is executed on the target call. If this webhook is sent, the Bridge Complete webhook is NOT sent. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class BridgeTargetCompleteCallback { public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; @SerializedName(SERIALIZED_NAME_EVENT_TYPE) @@ -112,273 +110,247 @@ public BridgeTargetCompleteCallback() { } public BridgeTargetCompleteCallback eventType(String eventType) { - this.eventType = eventType; return this; } - /** + /** * 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. * @return eventType - **/ + */ @javax.annotation.Nullable public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public BridgeTargetCompleteCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } - /** + /** * 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. * @return eventTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public BridgeTargetCompleteCallback accountId(String accountId) { - this.accountId = accountId; return this; } - /** + /** * The user account associated with the call. * @return accountId - **/ + */ @javax.annotation.Nullable public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public BridgeTargetCompleteCallback applicationId(String applicationId) { - this.applicationId = applicationId; return this; } - /** + /** * The id of the application associated with the call. * @return applicationId - **/ + */ @javax.annotation.Nullable public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public BridgeTargetCompleteCallback from(String from) { - this.from = from; return this; } - /** + /** * The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). * @return from - **/ + */ @javax.annotation.Nullable public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public BridgeTargetCompleteCallback to(String to) { - this.to = to; return this; } - /** + /** * The phone number that received the call, in E.164 format (e.g. +15555555555). * @return to - **/ + */ @javax.annotation.Nullable public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public BridgeTargetCompleteCallback direction(CallDirectionEnum direction) { - this.direction = direction; return this; } - /** + /** * Get direction * @return direction - **/ + */ @javax.annotation.Nullable public CallDirectionEnum getDirection() { return direction; } - public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public BridgeTargetCompleteCallback callId(String callId) { - this.callId = callId; return this; } - /** + /** * The call id associated with the event. * @return callId - **/ + */ @javax.annotation.Nullable public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public BridgeTargetCompleteCallback callUrl(URI callUrl) { - this.callUrl = callUrl; return this; } - /** + /** * The URL of the call associated with the event. * @return callUrl - **/ + */ @javax.annotation.Nullable public URI getCallUrl() { return callUrl; } - public void setCallUrl(URI callUrl) { this.callUrl = callUrl; } public BridgeTargetCompleteCallback enqueuedTime(OffsetDateTime enqueuedTime) { - this.enqueuedTime = enqueuedTime; return this; } - /** + /** * (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. * @return enqueuedTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } - public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public BridgeTargetCompleteCallback startTime(OffsetDateTime startTime) { - this.startTime = startTime; return this; } - /** + /** * Time the call was started, in ISO 8601 format. * @return startTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getStartTime() { return startTime; } - public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public BridgeTargetCompleteCallback answerTime(OffsetDateTime answerTime) { - this.answerTime = answerTime; return this; } - /** + /** * Time the call was answered, in ISO 8601 format. * @return answerTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getAnswerTime() { return answerTime; } - public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public BridgeTargetCompleteCallback tag(String tag) { - this.tag = tag; return this; } - /** + /** * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. * @return tag - **/ + */ @javax.annotation.Nullable public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } @@ -528,12 +500,12 @@ private String toIndentedString(Object o) { 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 BridgeTargetCompleteCallback - */ + /** + * 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 BridgeTargetCompleteCallback + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!BridgeTargetCompleteCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -556,6 +528,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti 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())); } + // validate the optional field `direction` + if (jsonObj.get("direction") != null && !jsonObj.get("direction").isJsonNull()) { + CallDirectionEnum.validateJsonElement(jsonObj.get("direction")); + } if ((jsonObj.get("callId") != null && !jsonObj.get("callId").isJsonNull()) && !jsonObj.get("callId").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `callId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callId").toString())); } @@ -595,7 +571,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -634,22 +615,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of BridgeTargetCompleteCallback given an JSON string - * - * @param jsonString JSON string - * @return An instance of BridgeTargetCompleteCallback - * @throws IOException if the JSON string is invalid with respect to BridgeTargetCompleteCallback - */ + /** + * Create an instance of BridgeTargetCompleteCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of BridgeTargetCompleteCallback + * @throws IOException if the JSON string is invalid with respect to BridgeTargetCompleteCallback + */ public static BridgeTargetCompleteCallback fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, BridgeTargetCompleteCallback.class); } - /** - * Convert an instance of BridgeTargetCompleteCallback to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of BridgeTargetCompleteCallback 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/CallDirectionEnum.java b/src/main/java/com/bandwidth/sdk/model/CallDirectionEnum.java index f0891c9c..ddf8bbde 100644 --- a/src/main/java/com/bandwidth/sdk/model/CallDirectionEnum.java +++ b/src/main/java/com/bandwidth/sdk/model/CallDirectionEnum.java @@ -18,6 +18,7 @@ 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; @@ -68,5 +69,10 @@ public CallDirectionEnum read(final JsonReader jsonReader) throws IOException { return CallDirectionEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + CallDirectionEnum.fromValue(value); + } } diff --git a/src/main/java/com/bandwidth/sdk/model/CallRecordingMetadata.java b/src/main/java/com/bandwidth/sdk/model/CallRecordingMetadata.java index a014328d..9befbb02 100644 --- a/src/main/java/com/bandwidth/sdk/model/CallRecordingMetadata.java +++ b/src/main/java/com/bandwidth/sdk/model/CallRecordingMetadata.java @@ -43,12 +43,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -56,7 +54,7 @@ /** * CallRecordingMetadata */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class CallRecordingMetadata { public static final String SERIALIZED_NAME_APPLICATION_ID = "applicationId"; @SerializedName(SERIALIZED_NAME_APPLICATION_ID) @@ -138,399 +136,361 @@ public CallRecordingMetadata() { } public CallRecordingMetadata applicationId(String applicationId) { - this.applicationId = applicationId; return this; } - /** + /** * The id of the application associated with the call. * @return applicationId - **/ + */ @javax.annotation.Nullable public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public CallRecordingMetadata accountId(String accountId) { - this.accountId = accountId; return this; } - /** + /** * The user account associated with the call. * @return accountId - **/ + */ @javax.annotation.Nullable public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public CallRecordingMetadata callId(String callId) { - this.callId = callId; return this; } - /** + /** * The call id associated with the event. * @return callId - **/ + */ @javax.annotation.Nullable public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public CallRecordingMetadata parentCallId(String parentCallId) { - this.parentCallId = parentCallId; return this; } - /** + /** * (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present. * @return parentCallId - **/ + */ @javax.annotation.Nullable public String getParentCallId() { return parentCallId; } - public void setParentCallId(String parentCallId) { this.parentCallId = parentCallId; } public CallRecordingMetadata recordingId(String recordingId) { - this.recordingId = recordingId; return this; } - /** + /** * The unique ID of this recording * @return recordingId - **/ + */ @javax.annotation.Nullable public String getRecordingId() { return recordingId; } - public void setRecordingId(String recordingId) { this.recordingId = recordingId; } public CallRecordingMetadata to(String to) { - this.to = to; return this; } - /** + /** * The phone number that received the call, in E.164 format (e.g. +15555555555). * @return to - **/ + */ @javax.annotation.Nullable public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public CallRecordingMetadata from(String from) { - this.from = from; return this; } - /** + /** * The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). * @return from - **/ + */ @javax.annotation.Nullable public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public CallRecordingMetadata transferCallerId(String transferCallerId) { - this.transferCallerId = transferCallerId; return this; } - /** + /** * The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). * @return transferCallerId - **/ + */ @javax.annotation.Nullable public String getTransferCallerId() { return transferCallerId; } - public void setTransferCallerId(String transferCallerId) { this.transferCallerId = transferCallerId; } public CallRecordingMetadata transferTo(String transferTo) { - this.transferTo = transferTo; return this; } - /** + /** * The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). * @return transferTo - **/ + */ @javax.annotation.Nullable public String getTransferTo() { return transferTo; } - public void setTransferTo(String transferTo) { this.transferTo = transferTo; } public CallRecordingMetadata duration(String duration) { - this.duration = duration; return this; } - /** + /** * The duration of the recording in ISO-8601 format * @return duration - **/ + */ @javax.annotation.Nullable public String getDuration() { return duration; } - public void setDuration(String duration) { this.duration = duration; } public CallRecordingMetadata direction(CallDirectionEnum direction) { - this.direction = direction; return this; } - /** + /** * Get direction * @return direction - **/ + */ @javax.annotation.Nullable public CallDirectionEnum getDirection() { return direction; } - public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public CallRecordingMetadata channels(Integer channels) { - this.channels = channels; return this; } - /** + /** * Always `1` for conference recordings; multi-channel recordings are not supported on conferences. * @return channels - **/ + */ @javax.annotation.Nullable public Integer getChannels() { return channels; } - public void setChannels(Integer channels) { this.channels = channels; } public CallRecordingMetadata startTime(OffsetDateTime startTime) { - this.startTime = startTime; return this; } - /** + /** * Time the call was started, in ISO 8601 format. * @return startTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getStartTime() { return startTime; } - public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public CallRecordingMetadata endTime(OffsetDateTime endTime) { - this.endTime = endTime; return this; } - /** + /** * The time that the recording ended in ISO-8601 format * @return endTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEndTime() { return endTime; } - public void setEndTime(OffsetDateTime endTime) { this.endTime = endTime; } public CallRecordingMetadata fileFormat(FileFormatEnum fileFormat) { - this.fileFormat = fileFormat; return this; } - /** + /** * Get fileFormat * @return fileFormat - **/ + */ @javax.annotation.Nullable public FileFormatEnum getFileFormat() { return fileFormat; } - public void setFileFormat(FileFormatEnum fileFormat) { this.fileFormat = fileFormat; } public CallRecordingMetadata status(String status) { - this.status = status; return this; } - /** + /** * 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. * @return status - **/ + */ @javax.annotation.Nullable public String getStatus() { return status; } - public void setStatus(String status) { this.status = status; } public CallRecordingMetadata mediaUrl(URI mediaUrl) { - this.mediaUrl = mediaUrl; return this; } - /** + /** * The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded. * @return mediaUrl - **/ + */ @javax.annotation.Nullable public URI getMediaUrl() { return mediaUrl; } - public void setMediaUrl(URI mediaUrl) { this.mediaUrl = mediaUrl; } public CallRecordingMetadata transcription(RecordingTranscriptionMetadata transcription) { - this.transcription = transcription; return this; } - /** + /** * Get transcription * @return transcription - **/ + */ @javax.annotation.Nullable public RecordingTranscriptionMetadata getTranscription() { return transcription; } - public void setTranscription(RecordingTranscriptionMetadata transcription) { this.transcription = transcription; } public CallRecordingMetadata recordingName(String recordingName) { - this.recordingName = recordingName; return this; } - /** + /** * A name to identify this recording. * @return recordingName - **/ + */ @javax.annotation.Nullable public String getRecordingName() { return recordingName; } - public void setRecordingName(String recordingName) { this.recordingName = recordingName; } @@ -698,12 +658,12 @@ private String toIndentedString(Object o) { 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 CallRecordingMetadata - */ + /** + * 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 CallRecordingMetadata + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!CallRecordingMetadata.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -741,6 +701,14 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if ((jsonObj.get("duration") != null && !jsonObj.get("duration").isJsonNull()) && !jsonObj.get("duration").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `duration` to be a primitive type in the JSON string but got `%s`", jsonObj.get("duration").toString())); } + // validate the optional field `direction` + if (jsonObj.get("direction") != null && !jsonObj.get("direction").isJsonNull()) { + CallDirectionEnum.validateJsonElement(jsonObj.get("direction")); + } + // validate the optional field `fileFormat` + if (jsonObj.get("fileFormat") != null && !jsonObj.get("fileFormat").isJsonNull()) { + FileFormatEnum.validateJsonElement(jsonObj.get("fileFormat")); + } if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); } @@ -784,7 +752,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -823,22 +796,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of CallRecordingMetadata given an JSON string - * - * @param jsonString JSON string - * @return An instance of CallRecordingMetadata - * @throws IOException if the JSON string is invalid with respect to CallRecordingMetadata - */ + /** + * Create an instance of CallRecordingMetadata given an JSON string + * + * @param jsonString JSON string + * @return An instance of CallRecordingMetadata + * @throws IOException if the JSON string is invalid with respect to CallRecordingMetadata + */ public static CallRecordingMetadata fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CallRecordingMetadata.class); } - /** - * Convert an instance of CallRecordingMetadata to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of CallRecordingMetadata 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/CallState.java b/src/main/java/com/bandwidth/sdk/model/CallState.java index f9f2d025..b59e10af 100644 --- a/src/main/java/com/bandwidth/sdk/model/CallState.java +++ b/src/main/java/com/bandwidth/sdk/model/CallState.java @@ -42,12 +42,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -55,7 +53,7 @@ /** * CallState */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class CallState { public static final String SERIALIZED_NAME_APPLICATION_ID = "applicationId"; @SerializedName(SERIALIZED_NAME_APPLICATION_ID) @@ -133,175 +131,158 @@ public CallState() { } public CallState applicationId(String applicationId) { - this.applicationId = applicationId; return this; } - /** + /** * The application id associated with the call. * @return applicationId - **/ + */ @javax.annotation.Nullable public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public CallState accountId(String accountId) { - this.accountId = accountId; return this; } - /** + /** * The account id associated with the call. * @return accountId - **/ + */ @javax.annotation.Nullable public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public CallState callId(String callId) { - this.callId = callId; return this; } - /** + /** * The programmable voice API call ID. * @return callId - **/ + */ @javax.annotation.Nullable public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public CallState parentCallId(String parentCallId) { - this.parentCallId = parentCallId; return this; } - /** + /** * The A-leg call id, set only if this call is the B-leg of a [`<Transfer>`](/docs/voice/bxml/transfer). * @return parentCallId - **/ + */ @javax.annotation.Nullable public String getParentCallId() { return parentCallId; } - public void setParentCallId(String parentCallId) { this.parentCallId = parentCallId; } public CallState to(String to) { - this.to = to; return this; } - /** + /** * The phone number that received the call, in E.164 format (e.g. +15555555555), or if the call was to a SIP URI, the SIP URI. * @return to - **/ + */ @javax.annotation.Nullable public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public CallState from(String from) { - this.from = from; return this; } - /** + /** * The phone number that made the call, in E.164 format (e.g. +15555555555). * @return from - **/ + */ @javax.annotation.Nullable public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public CallState direction(CallDirectionEnum direction) { - this.direction = direction; return this; } - /** + /** * Get direction * @return direction - **/ + */ @javax.annotation.Nullable public CallDirectionEnum getDirection() { return direction; } - public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public CallState state(String state) { - this.state = state; return this; } - /** + /** * The current state of the call. Current possible values are `queued`, `initiated`, `answered` and `disconnected`. Additional states may be added in the future, so your application must be tolerant of unknown values. * @return state - **/ + */ @javax.annotation.Nullable public String getState() { return state; } - public void setState(String state) { this.state = state; } public CallState stirShaken(Map stirShaken) { - this.stirShaken = stirShaken; return this; } @@ -314,205 +295,186 @@ public CallState putStirShakenItem(String key, String stirShakenItem) { return this; } - /** + /** * For inbound calls, the Bandwidth STIR/SHAKEN implementation will verify the information provided in the inbound invite request `Identity` header. The verification status is stored in the call state `stirShaken` property as follows. | Property | Description | |:------------------|:------------| | verstat | (optional) The verification status indicating whether the verification was successful or not. Possible values are `TN-Verification-Passed` or `TN-Verification-Failed`. | | attestationIndicator | (optional) The attestation level verified by Bandwidth. Possible values are `A` (full), `B` (partial) or `C` (gateway). | | originatingId | (optional) A unique origination identifier. | Note that these are common properties but that the `stirShaken` object is free form and can contain other key-value pairs. More information: [Understanding STIR/SHAKEN](https://www.bandwidth.com/regulations/stir-shaken). * @return stirShaken - **/ + */ @javax.annotation.Nullable public Map getStirShaken() { return stirShaken; } - public void setStirShaken(Map stirShaken) { this.stirShaken = stirShaken; } public CallState identity(String identity) { - this.identity = identity; return this; } - /** + /** * The value of the `Identity` header from the inbound invite request. Only present for inbound calls and if the account is configured to forward this header. * @return identity - **/ + */ @javax.annotation.Nullable public String getIdentity() { return identity; } - public void setIdentity(String identity) { this.identity = identity; } public CallState enqueuedTime(OffsetDateTime enqueuedTime) { - this.enqueuedTime = enqueuedTime; return this; } - /** + /** * The time this call was placed in queue. * @return enqueuedTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } - public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public CallState startTime(OffsetDateTime startTime) { - this.startTime = startTime; return this; } - /** + /** * The time the call was initiated, in ISO 8601 format. `null` if the call is still in your queue. * @return startTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getStartTime() { return startTime; } - public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public CallState answerTime(OffsetDateTime answerTime) { - this.answerTime = answerTime; return this; } - /** + /** * Populated once the call has been answered, with the time in ISO 8601 format. * @return answerTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getAnswerTime() { return answerTime; } - public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public CallState endTime(OffsetDateTime endTime) { - this.endTime = endTime; return this; } - /** + /** * Populated once the call has ended, with the time in ISO 8601 format. * @return endTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEndTime() { return endTime; } - public void setEndTime(OffsetDateTime endTime) { this.endTime = endTime; } public CallState disconnectCause(String disconnectCause) { - this.disconnectCause = disconnectCause; return this; } - /** + /** * | Cause | Description | |:------|:------------| | `hangup`| One party hung up the call, a [`<Hangup>`](../../bxml/verbs/hangup.md) verb was executed, or there was no more BXML to execute; it indicates that the call ended normally. | | `busy` | Callee was busy. | | `timeout` | Call wasn't answered before the `callTimeout` was reached. | | `cancel` | Call was cancelled by its originator while it was ringing. | | `rejected` | Call was rejected by the callee. | | `callback-error` | BXML callback couldn't be delivered to your callback server. | | `invalid-bxml` | Invalid BXML was returned in response to a callback. | | `application-error` | An unsupported action was tried on the call, e.g. trying to play a .ogg audio. | | `account-limit` | Account rate limits were reached. | | `node-capacity-exceeded` | System maximum capacity was reached. | | `error` | Some error not described in any of the other causes happened on the call. | | `unknown` | Unknown error happened on the call. | Note: This list is not exhaustive and other values can appear in the future. * @return disconnectCause - **/ + */ @javax.annotation.Nullable public String getDisconnectCause() { return disconnectCause; } - public void setDisconnectCause(String disconnectCause) { this.disconnectCause = disconnectCause; } public CallState errorMessage(String errorMessage) { - this.errorMessage = errorMessage; return this; } - /** + /** * Populated only if the call ended with an error, with text explaining the reason. * @return errorMessage - **/ + */ @javax.annotation.Nullable public String getErrorMessage() { return errorMessage; } - public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; } public CallState errorId(String errorId) { - this.errorId = errorId; return this; } - /** + /** * Populated only if the call ended with an error, with a Bandwidth internal id that references the error event. * @return errorId - **/ + */ @javax.annotation.Nullable public String getErrorId() { return errorId; } - public void setErrorId(String errorId) { this.errorId = errorId; } public CallState lastUpdate(OffsetDateTime lastUpdate) { - this.lastUpdate = lastUpdate; return this; } - /** + /** * The last time the call had a state update, in ISO 8601 format. * @return lastUpdate - **/ + */ @javax.annotation.Nullable public OffsetDateTime getLastUpdate() { return lastUpdate; } - public void setLastUpdate(OffsetDateTime lastUpdate) { this.lastUpdate = lastUpdate; } @@ -677,12 +639,12 @@ private String toIndentedString(Object o) { 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 CallState - */ + /** + * 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 CallState + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!CallState.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -708,6 +670,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti 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 optional field `direction` + if (jsonObj.get("direction") != null && !jsonObj.get("direction").isJsonNull()) { + CallDirectionEnum.validateJsonElement(jsonObj.get("direction")); + } if ((jsonObj.get("state") != null && !jsonObj.get("state").isJsonNull()) && !jsonObj.get("state").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `state` to be a primitive type in the JSON string but got `%s`", jsonObj.get("state").toString())); } @@ -753,7 +719,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -792,22 +763,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of CallState given an JSON string - * - * @param jsonString JSON string - * @return An instance of CallState - * @throws IOException if the JSON string is invalid with respect to CallState - */ + /** + * Create an instance of CallState given an JSON string + * + * @param jsonString JSON string + * @return An instance of CallState + * @throws IOException if the JSON string is invalid with respect to CallState + */ public static CallState fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CallState.class); } - /** - * Convert an instance of CallState to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of CallState 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/CallStateEnum.java b/src/main/java/com/bandwidth/sdk/model/CallStateEnum.java index 24b1224c..64fd1045 100644 --- a/src/main/java/com/bandwidth/sdk/model/CallStateEnum.java +++ b/src/main/java/com/bandwidth/sdk/model/CallStateEnum.java @@ -18,6 +18,7 @@ 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; @@ -68,5 +69,10 @@ public CallStateEnum read(final JsonReader jsonReader) throws IOException { return CallStateEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + CallStateEnum.fromValue(value); + } } diff --git a/src/main/java/com/bandwidth/sdk/model/CallTranscription.java b/src/main/java/com/bandwidth/sdk/model/CallTranscription.java index 74370836..ea30192f 100644 --- a/src/main/java/com/bandwidth/sdk/model/CallTranscription.java +++ b/src/main/java/com/bandwidth/sdk/model/CallTranscription.java @@ -39,12 +39,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -52,7 +50,7 @@ /** * CallTranscription */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class CallTranscription { public static final String SERIALIZED_NAME_DETECTED_LANGUAGE = "detectedLanguage"; @SerializedName(SERIALIZED_NAME_DETECTED_LANGUAGE) @@ -74,86 +72,78 @@ public CallTranscription() { } public CallTranscription detectedLanguage(CallTranscriptionDetectedLanguageEnum detectedLanguage) { - this.detectedLanguage = detectedLanguage; return this; } - /** + /** * Get detectedLanguage * @return detectedLanguage - **/ + */ @javax.annotation.Nullable public CallTranscriptionDetectedLanguageEnum getDetectedLanguage() { return detectedLanguage; } - public void setDetectedLanguage(CallTranscriptionDetectedLanguageEnum detectedLanguage) { this.detectedLanguage = detectedLanguage; } public CallTranscription track(CallTranscriptionTrackEnum track) { - this.track = track; return this; } - /** + /** * Get track * @return track - **/ + */ @javax.annotation.Nullable public CallTranscriptionTrackEnum getTrack() { return track; } - public void setTrack(CallTranscriptionTrackEnum track) { this.track = track; } public CallTranscription transcript(String transcript) { - this.transcript = transcript; return this; } - /** + /** * The transcription itself. * @return transcript - **/ + */ @javax.annotation.Nullable public String getTranscript() { return transcript; } - public void setTranscript(String transcript) { this.transcript = transcript; } public CallTranscription confidence(Double confidence) { - this.confidence = confidence; return this; } - /** + /** * How confident the transcription engine was in transcribing the associated audio (from `0` to `1`). * minimum: 0 * maximum: 1 * @return confidence - **/ + */ @javax.annotation.Nullable public Double getConfidence() { return confidence; } - public void setConfidence(Double confidence) { this.confidence = confidence; } @@ -265,12 +255,12 @@ private String toIndentedString(Object o) { 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 CallTranscription - */ + /** + * 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 CallTranscription + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!CallTranscription.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -278,6 +268,14 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `detectedLanguage` + if (jsonObj.get("detectedLanguage") != null && !jsonObj.get("detectedLanguage").isJsonNull()) { + CallTranscriptionDetectedLanguageEnum.validateJsonElement(jsonObj.get("detectedLanguage")); + } + // validate the optional field `track` + if (jsonObj.get("track") != null && !jsonObj.get("track").isJsonNull()) { + CallTranscriptionTrackEnum.validateJsonElement(jsonObj.get("track")); + } if ((jsonObj.get("transcript") != null && !jsonObj.get("transcript").isJsonNull()) && !jsonObj.get("transcript").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `transcript` to be a primitive type in the JSON string but got `%s`", jsonObj.get("transcript").toString())); } @@ -311,7 +309,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -350,22 +353,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of CallTranscription given an JSON string - * - * @param jsonString JSON string - * @return An instance of CallTranscription - * @throws IOException if the JSON string is invalid with respect to CallTranscription - */ + /** + * Create an instance of CallTranscription given an JSON string + * + * @param jsonString JSON string + * @return An instance of CallTranscription + * @throws IOException if the JSON string is invalid with respect to CallTranscription + */ public static CallTranscription fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CallTranscription.class); } - /** - * Convert an instance of CallTranscription to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of CallTranscription 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/CallTranscriptionDetectedLanguageEnum.java b/src/main/java/com/bandwidth/sdk/model/CallTranscriptionDetectedLanguageEnum.java index 93170297..6295e064 100644 --- a/src/main/java/com/bandwidth/sdk/model/CallTranscriptionDetectedLanguageEnum.java +++ b/src/main/java/com/bandwidth/sdk/model/CallTranscriptionDetectedLanguageEnum.java @@ -18,6 +18,7 @@ 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; @@ -70,5 +71,10 @@ public CallTranscriptionDetectedLanguageEnum read(final JsonReader jsonReader) t return CallTranscriptionDetectedLanguageEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + CallTranscriptionDetectedLanguageEnum.fromValue(value); + } } diff --git a/src/main/java/com/bandwidth/sdk/model/CallTranscriptionMetadata.java b/src/main/java/com/bandwidth/sdk/model/CallTranscriptionMetadata.java index a0f7f314..a6790a81 100644 --- a/src/main/java/com/bandwidth/sdk/model/CallTranscriptionMetadata.java +++ b/src/main/java/com/bandwidth/sdk/model/CallTranscriptionMetadata.java @@ -37,12 +37,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -50,7 +48,7 @@ /** * CallTranscriptionMetadata */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class CallTranscriptionMetadata { public static final String SERIALIZED_NAME_TRANSCRIPTION_ID = "transcriptionId"; @SerializedName(SERIALIZED_NAME_TRANSCRIPTION_ID) @@ -68,63 +66,57 @@ public CallTranscriptionMetadata() { } public CallTranscriptionMetadata transcriptionId(String transcriptionId) { - this.transcriptionId = transcriptionId; return this; } - /** + /** * The programmable voice API transcription ID. * @return transcriptionId - **/ + */ @javax.annotation.Nullable public String getTranscriptionId() { return transcriptionId; } - public void setTranscriptionId(String transcriptionId) { this.transcriptionId = transcriptionId; } public CallTranscriptionMetadata transcriptionName(String transcriptionName) { - this.transcriptionName = transcriptionName; return this; } - /** + /** * The programmable voice API transcription name. This name could be provided by the user when creating the transcription. * @return transcriptionName - **/ + */ @javax.annotation.Nullable public String getTranscriptionName() { return transcriptionName; } - public void setTranscriptionName(String transcriptionName) { this.transcriptionName = transcriptionName; } public CallTranscriptionMetadata transcriptionUrl(String transcriptionUrl) { - this.transcriptionUrl = transcriptionUrl; return this; } - /** + /** * A URL that may be used to retrieve the transcription itself. This points to the [Get Call Transcription](/apis/voice/#operation/getCallTranscription) endpoint. * @return transcriptionUrl - **/ + */ @javax.annotation.Nullable public String getTranscriptionUrl() { return transcriptionUrl; } - public void setTranscriptionUrl(String transcriptionUrl) { this.transcriptionUrl = transcriptionUrl; } @@ -233,12 +225,12 @@ private String toIndentedString(Object o) { 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 CallTranscriptionMetadata - */ + /** + * 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 CallTranscriptionMetadata + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!CallTranscriptionMetadata.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -285,7 +277,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -324,22 +321,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of CallTranscriptionMetadata given an JSON string - * - * @param jsonString JSON string - * @return An instance of CallTranscriptionMetadata - * @throws IOException if the JSON string is invalid with respect to CallTranscriptionMetadata - */ + /** + * Create an instance of CallTranscriptionMetadata given an JSON string + * + * @param jsonString JSON string + * @return An instance of CallTranscriptionMetadata + * @throws IOException if the JSON string is invalid with respect to CallTranscriptionMetadata + */ public static CallTranscriptionMetadata fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CallTranscriptionMetadata.class); } - /** - * Convert an instance of CallTranscriptionMetadata to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of CallTranscriptionMetadata 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/CallTranscriptionResponse.java b/src/main/java/com/bandwidth/sdk/model/CallTranscriptionResponse.java index f52be69c..fe5c9272 100644 --- a/src/main/java/com/bandwidth/sdk/model/CallTranscriptionResponse.java +++ b/src/main/java/com/bandwidth/sdk/model/CallTranscriptionResponse.java @@ -40,12 +40,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -53,7 +51,7 @@ /** * CallTranscriptionResponse */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class CallTranscriptionResponse { public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) @@ -69,76 +67,69 @@ public class CallTranscriptionResponse { public static final String SERIALIZED_NAME_TRACKS = "tracks"; @SerializedName(SERIALIZED_NAME_TRACKS) - private List tracks; + private List tracks = new ArrayList<>(); public CallTranscriptionResponse() { } public CallTranscriptionResponse accountId(String accountId) { - this.accountId = accountId; return this; } - /** + /** * The user account associated with the call. * @return accountId - **/ + */ @javax.annotation.Nullable public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public CallTranscriptionResponse callId(String callId) { - this.callId = callId; return this; } - /** + /** * The call id associated with the event. * @return callId - **/ + */ @javax.annotation.Nullable public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public CallTranscriptionResponse transcriptionId(String transcriptionId) { - this.transcriptionId = transcriptionId; return this; } - /** + /** * The programmable voice API transcription ID. * @return transcriptionId - **/ + */ @javax.annotation.Nullable public String getTranscriptionId() { return transcriptionId; } - public void setTranscriptionId(String transcriptionId) { this.transcriptionId = transcriptionId; } public CallTranscriptionResponse tracks(List tracks) { - this.tracks = tracks; return this; } @@ -151,16 +142,15 @@ public CallTranscriptionResponse addTracksItem(CallTranscription tracksItem) { return this; } - /** + /** * Get tracks * @return tracks - **/ + */ @javax.annotation.Nullable public List getTracks() { return tracks; } - public void setTracks(List tracks) { this.tracks = tracks; } @@ -272,12 +262,12 @@ private String toIndentedString(Object o) { 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 CallTranscriptionResponse - */ + /** + * 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 CallTranscriptionResponse + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!CallTranscriptionResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -338,7 +328,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -377,22 +372,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of CallTranscriptionResponse given an JSON string - * - * @param jsonString JSON string - * @return An instance of CallTranscriptionResponse - * @throws IOException if the JSON string is invalid with respect to CallTranscriptionResponse - */ + /** + * Create an instance of CallTranscriptionResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of CallTranscriptionResponse + * @throws IOException if the JSON string is invalid with respect to CallTranscriptionResponse + */ public static CallTranscriptionResponse fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CallTranscriptionResponse.class); } - /** - * Convert an instance of CallTranscriptionResponse to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of CallTranscriptionResponse 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/CallTranscriptionTrackEnum.java b/src/main/java/com/bandwidth/sdk/model/CallTranscriptionTrackEnum.java index 8d607c37..0d0089a7 100644 --- a/src/main/java/com/bandwidth/sdk/model/CallTranscriptionTrackEnum.java +++ b/src/main/java/com/bandwidth/sdk/model/CallTranscriptionTrackEnum.java @@ -18,6 +18,7 @@ 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; @@ -68,5 +69,10 @@ public CallTranscriptionTrackEnum read(final JsonReader jsonReader) throws IOExc return CallTranscriptionTrackEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + CallTranscriptionTrackEnum.fromValue(value); + } } diff --git a/src/main/java/com/bandwidth/sdk/model/CallbackMethodEnum.java b/src/main/java/com/bandwidth/sdk/model/CallbackMethodEnum.java index fef1dcce..3e169433 100644 --- a/src/main/java/com/bandwidth/sdk/model/CallbackMethodEnum.java +++ b/src/main/java/com/bandwidth/sdk/model/CallbackMethodEnum.java @@ -18,6 +18,7 @@ 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; @@ -68,5 +69,10 @@ public CallbackMethodEnum read(final JsonReader jsonReader) throws IOException { return CallbackMethodEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + CallbackMethodEnum.fromValue(value); + } } diff --git a/src/main/java/com/bandwidth/sdk/model/CodeRequest.java b/src/main/java/com/bandwidth/sdk/model/CodeRequest.java index 5f0253ee..fe8614b7 100644 --- a/src/main/java/com/bandwidth/sdk/model/CodeRequest.java +++ b/src/main/java/com/bandwidth/sdk/model/CodeRequest.java @@ -37,12 +37,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -50,7 +48,7 @@ /** * CodeRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class CodeRequest { public static final String SERIALIZED_NAME_TO = "to"; @SerializedName(SERIALIZED_NAME_TO) @@ -80,128 +78,116 @@ public CodeRequest() { } public CodeRequest to(String to) { - this.to = to; return this; } - /** + /** * The phone number to send the mfa code to. * @return to - **/ + */ @javax.annotation.Nonnull public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public CodeRequest from(String from) { - this.from = from; return this; } - /** + /** * The application phone number, the sender of the mfa code. * @return from - **/ + */ @javax.annotation.Nonnull public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public CodeRequest applicationId(String applicationId) { - this.applicationId = applicationId; return this; } - /** + /** * The application unique ID, obtained from Bandwidth. * @return applicationId - **/ + */ @javax.annotation.Nonnull public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public CodeRequest scope(String scope) { - this.scope = scope; return this; } - /** + /** * An optional field to denote what scope or action the mfa code is addressing. If not supplied, defaults to \"2FA\". * @return scope - **/ + */ @javax.annotation.Nullable public String getScope() { return scope; } - public void setScope(String scope) { this.scope = scope; } public CodeRequest message(String message) { - this.message = message; return this; } - /** + /** * The message format of the mfa code. There are three values that the system will replace \"{CODE}\", \"{NAME}\", \"{SCOPE}\". The \"{SCOPE}\" and \"{NAME} value template are optional, while \"{CODE}\" must be supplied. As the name would suggest, code will be replace with the actual mfa code. Name is replaced with the application name, configured during provisioning of mfa. The scope value is the same value sent during the call and partitioned by the server. * @return message - **/ + */ @javax.annotation.Nonnull public String getMessage() { return message; } - public void setMessage(String message) { this.message = message; } public CodeRequest digits(Integer digits) { - this.digits = digits; return this; } - /** + /** * The number of digits for your mfa code. The valid number ranges from 2 to 8, inclusively. * minimum: 4 * maximum: 8 * @return digits - **/ + */ @javax.annotation.Nonnull public Integer getDigits() { return digits; } - public void setDigits(Integer digits) { this.digits = digits; } @@ -324,12 +310,12 @@ private String toIndentedString(Object o) { openapiRequiredFields.add("digits"); } - /** - * 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 CodeRequest - */ + /** + * 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 CodeRequest + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!CodeRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -389,7 +375,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -428,22 +419,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of CodeRequest given an JSON string - * - * @param jsonString JSON string - * @return An instance of CodeRequest - * @throws IOException if the JSON string is invalid with respect to CodeRequest - */ + /** + * Create an instance of CodeRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CodeRequest + * @throws IOException if the JSON string is invalid with respect to CodeRequest + */ public static CodeRequest fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CodeRequest.class); } - /** - * Convert an instance of CodeRequest to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of CodeRequest 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/Conference.java b/src/main/java/com/bandwidth/sdk/model/Conference.java index 91f59645..98ccebc8 100644 --- a/src/main/java/com/bandwidth/sdk/model/Conference.java +++ b/src/main/java/com/bandwidth/sdk/model/Conference.java @@ -44,12 +44,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -57,7 +55,7 @@ /** * Conference */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class Conference { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @@ -95,154 +93,139 @@ public Conference() { } public Conference id(String id) { - this.id = id; return this; } - /** + /** * The Bandwidth-generated conference ID. * @return id - **/ + */ @javax.annotation.Nullable public String getId() { return id; } - public void setId(String id) { this.id = id; } public Conference name(String name) { - this.name = name; return this; } - /** + /** * The name of the conference, as specified by your application. * @return name - **/ + */ @javax.annotation.Nullable public String getName() { return name; } - public void setName(String name) { this.name = name; } public Conference createdTime(OffsetDateTime createdTime) { - this.createdTime = createdTime; return this; } - /** + /** * The time the conference was initiated, in ISO 8601 format. * @return createdTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getCreatedTime() { return createdTime; } - public void setCreatedTime(OffsetDateTime createdTime) { this.createdTime = createdTime; } public Conference completedTime(OffsetDateTime completedTime) { - this.completedTime = completedTime; return this; } - /** + /** * The time the conference was terminated, in ISO 8601 format. * @return completedTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getCompletedTime() { return completedTime; } - public void setCompletedTime(OffsetDateTime completedTime) { this.completedTime = completedTime; } public Conference conferenceEventUrl(URI conferenceEventUrl) { - this.conferenceEventUrl = conferenceEventUrl; return this; } - /** + /** * The URL to send the conference-related events. * @return conferenceEventUrl - **/ + */ @javax.annotation.Nullable public URI getConferenceEventUrl() { return conferenceEventUrl; } - public void setConferenceEventUrl(URI conferenceEventUrl) { this.conferenceEventUrl = conferenceEventUrl; } public Conference conferenceEventMethod(CallbackMethodEnum conferenceEventMethod) { - this.conferenceEventMethod = conferenceEventMethod; return this; } - /** + /** * Get conferenceEventMethod * @return conferenceEventMethod - **/ + */ @javax.annotation.Nullable public CallbackMethodEnum getConferenceEventMethod() { return conferenceEventMethod; } - public void setConferenceEventMethod(CallbackMethodEnum conferenceEventMethod) { this.conferenceEventMethod = conferenceEventMethod; } public Conference tag(String tag) { - this.tag = tag; return this; } - /** + /** * The custom string attached to the conference that will be sent with callbacks. * @return tag - **/ + */ @javax.annotation.Nullable public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public Conference activeMembers(List activeMembers) { - this.activeMembers = activeMembers; return this; } @@ -255,16 +238,15 @@ public Conference addActiveMembersItem(ConferenceMember activeMembersItem) { return this; } - /** + /** * A list of active members of the conference. Omitted if this is a response to the [Get Conferences endpoint](/apis/voice#tag/Conferences/operation/listConferences). * @return activeMembers - **/ + */ @javax.annotation.Nullable public List getActiveMembers() { return activeMembers; } - public void setActiveMembers(List activeMembers) { this.activeMembers = activeMembers; } @@ -399,12 +381,12 @@ private String toIndentedString(Object o) { 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 Conference - */ + /** + * 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 Conference + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!Conference.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -421,6 +403,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if ((jsonObj.get("conferenceEventUrl") != null && !jsonObj.get("conferenceEventUrl").isJsonNull()) && !jsonObj.get("conferenceEventUrl").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `conferenceEventUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("conferenceEventUrl").toString())); } + // validate the optional field `conferenceEventMethod` + if (jsonObj.get("conferenceEventMethod") != null && !jsonObj.get("conferenceEventMethod").isJsonNull()) { + CallbackMethodEnum.validateJsonElement(jsonObj.get("conferenceEventMethod")); + } 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())); } @@ -468,7 +454,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -507,22 +498,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of Conference given an JSON string - * - * @param jsonString JSON string - * @return An instance of Conference - * @throws IOException if the JSON string is invalid with respect to Conference - */ + /** + * Create an instance of Conference given an JSON string + * + * @param jsonString JSON string + * @return An instance of Conference + * @throws IOException if the JSON string is invalid with respect to Conference + */ public static Conference fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, Conference.class); } - /** - * Convert an instance of Conference to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of Conference 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/ConferenceCompletedCallback.java b/src/main/java/com/bandwidth/sdk/model/ConferenceCompletedCallback.java index d0987304..486a8156 100644 --- a/src/main/java/com/bandwidth/sdk/model/ConferenceCompletedCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/ConferenceCompletedCallback.java @@ -39,12 +39,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -52,7 +50,7 @@ /** * The Conference Completed event is fired when the last member leaves the conference. The response to this event may not contain BXML. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class ConferenceCompletedCallback { public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; @SerializedName(SERIALIZED_NAME_EVENT_TYPE) @@ -78,105 +76,95 @@ public ConferenceCompletedCallback() { } public ConferenceCompletedCallback eventType(String eventType) { - this.eventType = eventType; return this; } - /** + /** * 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. * @return eventType - **/ + */ @javax.annotation.Nullable public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public ConferenceCompletedCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } - /** + /** * 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. * @return eventTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public ConferenceCompletedCallback conferenceId(String conferenceId) { - this.conferenceId = conferenceId; return this; } - /** + /** * The unique, Bandwidth-generated ID of the conference that was recorded * @return conferenceId - **/ + */ @javax.annotation.Nullable public String getConferenceId() { return conferenceId; } - public void setConferenceId(String conferenceId) { this.conferenceId = conferenceId; } public ConferenceCompletedCallback name(String name) { - this.name = name; return this; } - /** + /** * The user-specified name of the conference that was recorded * @return name - **/ + */ @javax.annotation.Nullable public String getName() { return name; } - public void setName(String name) { this.name = name; } public ConferenceCompletedCallback tag(String tag) { - this.tag = tag; return this; } - /** + /** * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. * @return tag - **/ + */ @javax.annotation.Nullable public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } @@ -302,12 +290,12 @@ private String toIndentedString(Object o) { 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 ConferenceCompletedCallback - */ + /** + * 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 ConferenceCompletedCallback + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!ConferenceCompletedCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -357,7 +345,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -396,22 +389,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of ConferenceCompletedCallback given an JSON string - * - * @param jsonString JSON string - * @return An instance of ConferenceCompletedCallback - * @throws IOException if the JSON string is invalid with respect to ConferenceCompletedCallback - */ + /** + * Create an instance of ConferenceCompletedCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of ConferenceCompletedCallback + * @throws IOException if the JSON string is invalid with respect to ConferenceCompletedCallback + */ public static ConferenceCompletedCallback fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, ConferenceCompletedCallback.class); } - /** - * Convert an instance of ConferenceCompletedCallback to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of ConferenceCompletedCallback 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/ConferenceCreatedCallback.java b/src/main/java/com/bandwidth/sdk/model/ConferenceCreatedCallback.java index 705be5c1..ba3d0685 100644 --- a/src/main/java/com/bandwidth/sdk/model/ConferenceCreatedCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/ConferenceCreatedCallback.java @@ -39,12 +39,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -52,7 +50,7 @@ /** * The Conference Created event is fired whenever a new conference that specified a callbackUrl is created. The response may be either empty or a BXML document. Only the following verbs are valid for conferences: PlayAudio, SpeakSentence, StartRecording, StopRecording, PauseRecording, ResumeRecording. Audio verbs will be heard by all members of the conference. Recordings capture audio from all members who are not muted or on hold, as well as any audio verbs that are played into the conference. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class ConferenceCreatedCallback { public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; @SerializedName(SERIALIZED_NAME_EVENT_TYPE) @@ -78,105 +76,95 @@ public ConferenceCreatedCallback() { } public ConferenceCreatedCallback eventType(String eventType) { - this.eventType = eventType; return this; } - /** + /** * 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. * @return eventType - **/ + */ @javax.annotation.Nullable public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public ConferenceCreatedCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } - /** + /** * 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. * @return eventTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public ConferenceCreatedCallback conferenceId(String conferenceId) { - this.conferenceId = conferenceId; return this; } - /** + /** * The unique, Bandwidth-generated ID of the conference that was recorded * @return conferenceId - **/ + */ @javax.annotation.Nullable public String getConferenceId() { return conferenceId; } - public void setConferenceId(String conferenceId) { this.conferenceId = conferenceId; } public ConferenceCreatedCallback name(String name) { - this.name = name; return this; } - /** + /** * The user-specified name of the conference that was recorded * @return name - **/ + */ @javax.annotation.Nullable public String getName() { return name; } - public void setName(String name) { this.name = name; } public ConferenceCreatedCallback tag(String tag) { - this.tag = tag; return this; } - /** + /** * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. * @return tag - **/ + */ @javax.annotation.Nullable public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } @@ -302,12 +290,12 @@ private String toIndentedString(Object o) { 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 ConferenceCreatedCallback - */ + /** + * 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 ConferenceCreatedCallback + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!ConferenceCreatedCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -357,7 +345,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -396,22 +389,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of ConferenceCreatedCallback given an JSON string - * - * @param jsonString JSON string - * @return An instance of ConferenceCreatedCallback - * @throws IOException if the JSON string is invalid with respect to ConferenceCreatedCallback - */ + /** + * Create an instance of ConferenceCreatedCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of ConferenceCreatedCallback + * @throws IOException if the JSON string is invalid with respect to ConferenceCreatedCallback + */ public static ConferenceCreatedCallback fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, ConferenceCreatedCallback.class); } - /** - * Convert an instance of ConferenceCreatedCallback to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of ConferenceCreatedCallback 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/ConferenceMember.java b/src/main/java/com/bandwidth/sdk/model/ConferenceMember.java index d0bfae44..0ecbc750 100644 --- a/src/main/java/com/bandwidth/sdk/model/ConferenceMember.java +++ b/src/main/java/com/bandwidth/sdk/model/ConferenceMember.java @@ -41,12 +41,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -54,7 +52,7 @@ /** * ConferenceMember */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class ConferenceMember { public static final String SERIALIZED_NAME_CALL_ID = "callId"; @SerializedName(SERIALIZED_NAME_CALL_ID) @@ -84,112 +82,101 @@ public ConferenceMember() { } public ConferenceMember callId(String callId) { - this.callId = callId; return this; } - /** + /** * The call id associated with the event. * @return callId - **/ + */ @javax.annotation.Nullable public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public ConferenceMember conferenceId(String conferenceId) { - this.conferenceId = conferenceId; return this; } - /** + /** * The unique, Bandwidth-generated ID of the conference that was recorded * @return conferenceId - **/ + */ @javax.annotation.Nullable public String getConferenceId() { return conferenceId; } - public void setConferenceId(String conferenceId) { this.conferenceId = conferenceId; } public ConferenceMember memberUrl(URI memberUrl) { - this.memberUrl = memberUrl; return this; } - /** + /** * A URL that may be used to retrieve information about or update the state of this conference member. This is the URL of this member's [Get Conference Member](/apis/voice/#operation/getConferenceMember) endpoint and [Modify Conference Member](/apis/voice/#operation/updateConferenceMember) endpoint. * @return memberUrl - **/ + */ @javax.annotation.Nullable public URI getMemberUrl() { return memberUrl; } - public void setMemberUrl(URI memberUrl) { this.memberUrl = memberUrl; } public ConferenceMember mute(Boolean mute) { - this.mute = mute; return this; } - /** + /** * Whether or not this member is currently muted. Members who are muted are still able to hear other participants. If used in a PUT request, updates this member's mute status. Has no effect if omitted. * @return mute - **/ + */ @javax.annotation.Nullable public Boolean getMute() { return mute; } - public void setMute(Boolean mute) { this.mute = mute; } public ConferenceMember hold(Boolean hold) { - this.hold = hold; return this; } - /** + /** * Whether or not this member is currently on hold. Members who are on hold are not able to hear or speak in the conference. If used in a PUT request, updates this member's hold status. Has no effect if omitted. * @return hold - **/ + */ @javax.annotation.Nullable public Boolean getHold() { return hold; } - public void setHold(Boolean hold) { this.hold = hold; } public ConferenceMember callIdsToCoach(List callIdsToCoach) { - this.callIdsToCoach = callIdsToCoach; return this; } @@ -202,16 +189,15 @@ public ConferenceMember addCallIdsToCoachItem(String callIdsToCoachItem) { return this; } - /** + /** * If this member had a value set for `callIdsToCoach` in its [Conference](/docs/voice/bxml/conference) verb or this list was added with a previous PUT request to modify the member, this is that list of calls. If present in a PUT request, modifies the calls that this member is coaching. Has no effect if omitted. See the documentation for the [Conference](/docs/voice/bxml/conference) verb for more details about coaching. Note that this will not add the matching calls to the conference; each call must individually execute a Conference verb to join. * @return callIdsToCoach - **/ + */ @javax.annotation.Nullable public List getCallIdsToCoach() { return callIdsToCoach; } - public void setCallIdsToCoach(List callIdsToCoach) { this.callIdsToCoach = callIdsToCoach; } @@ -340,12 +326,12 @@ private String toIndentedString(Object o) { 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 ConferenceMember - */ + /** + * 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 ConferenceMember + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!ConferenceMember.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -396,7 +382,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -435,22 +426,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of ConferenceMember given an JSON string - * - * @param jsonString JSON string - * @return An instance of ConferenceMember - * @throws IOException if the JSON string is invalid with respect to ConferenceMember - */ + /** + * Create an instance of ConferenceMember given an JSON string + * + * @param jsonString JSON string + * @return An instance of ConferenceMember + * @throws IOException if the JSON string is invalid with respect to ConferenceMember + */ public static ConferenceMember fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, ConferenceMember.class); } - /** - * Convert an instance of ConferenceMember to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of ConferenceMember 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/ConferenceMemberExitCallback.java b/src/main/java/com/bandwidth/sdk/model/ConferenceMemberExitCallback.java index a58454d1..11c80c02 100644 --- a/src/main/java/com/bandwidth/sdk/model/ConferenceMemberExitCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/ConferenceMemberExitCallback.java @@ -39,12 +39,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -52,7 +50,7 @@ /** * The Conference Member Exit event is fired whenever a caller exits a conference that specified a callbackUrl. The response may be either empty or a BXML document. Only the following verbs are valid for conferences: PlayAudio, SpeakSentence, StartRecording, StopRecording, PauseRecording, ResumeRecording. Audio verbs will be heard by all members of the conference. Recordings capture audio from all members who are not muted or on hold, as well as any audio verbs that are played into the conference. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class ConferenceMemberExitCallback { public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; @SerializedName(SERIALIZED_NAME_EVENT_TYPE) @@ -90,168 +88,152 @@ public ConferenceMemberExitCallback() { } public ConferenceMemberExitCallback eventType(String eventType) { - this.eventType = eventType; return this; } - /** + /** * 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. * @return eventType - **/ + */ @javax.annotation.Nullable public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public ConferenceMemberExitCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } - /** + /** * 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. * @return eventTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public ConferenceMemberExitCallback conferenceId(String conferenceId) { - this.conferenceId = conferenceId; return this; } - /** + /** * The unique, Bandwidth-generated ID of the conference that was recorded * @return conferenceId - **/ + */ @javax.annotation.Nullable public String getConferenceId() { return conferenceId; } - public void setConferenceId(String conferenceId) { this.conferenceId = conferenceId; } public ConferenceMemberExitCallback name(String name) { - this.name = name; return this; } - /** + /** * The user-specified name of the conference that was recorded * @return name - **/ + */ @javax.annotation.Nullable public String getName() { return name; } - public void setName(String name) { this.name = name; } public ConferenceMemberExitCallback from(String from) { - this.from = from; return this; } - /** + /** * The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). * @return from - **/ + */ @javax.annotation.Nullable public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public ConferenceMemberExitCallback to(String to) { - this.to = to; return this; } - /** + /** * The phone number that received the call, in E.164 format (e.g. +15555555555). * @return to - **/ + */ @javax.annotation.Nullable public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public ConferenceMemberExitCallback callId(String callId) { - this.callId = callId; return this; } - /** + /** * The call id associated with the event. * @return callId - **/ + */ @javax.annotation.Nullable public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public ConferenceMemberExitCallback tag(String tag) { - this.tag = tag; return this; } - /** + /** * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. * @return tag - **/ + */ @javax.annotation.Nullable public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } @@ -386,12 +368,12 @@ private String toIndentedString(Object o) { 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 ConferenceMemberExitCallback - */ + /** + * 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 ConferenceMemberExitCallback + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!ConferenceMemberExitCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -450,7 +432,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -489,22 +476,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of ConferenceMemberExitCallback given an JSON string - * - * @param jsonString JSON string - * @return An instance of ConferenceMemberExitCallback - * @throws IOException if the JSON string is invalid with respect to ConferenceMemberExitCallback - */ + /** + * Create an instance of ConferenceMemberExitCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of ConferenceMemberExitCallback + * @throws IOException if the JSON string is invalid with respect to ConferenceMemberExitCallback + */ public static ConferenceMemberExitCallback fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, ConferenceMemberExitCallback.class); } - /** - * Convert an instance of ConferenceMemberExitCallback to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of ConferenceMemberExitCallback 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/ConferenceMemberJoinCallback.java b/src/main/java/com/bandwidth/sdk/model/ConferenceMemberJoinCallback.java index 16070f9f..b04511fa 100644 --- a/src/main/java/com/bandwidth/sdk/model/ConferenceMemberJoinCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/ConferenceMemberJoinCallback.java @@ -39,12 +39,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -52,7 +50,7 @@ /** * The Conference Member Join event is fired whenever a caller joins a conference that specified a callbackUrl. The response may be either empty or a BXML document. Only the following verbs are valid for conferences: PlayAudio, SpeakSentence, StartRecording, StopRecording, PauseRecording, ResumeRecording. Audio verbs will be heard by all members of the conference. Recordings capture audio from all members who are not muted or on hold, as well as any audio verbs that are played into the conference. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class ConferenceMemberJoinCallback { public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; @SerializedName(SERIALIZED_NAME_EVENT_TYPE) @@ -90,168 +88,152 @@ public ConferenceMemberJoinCallback() { } public ConferenceMemberJoinCallback eventType(String eventType) { - this.eventType = eventType; return this; } - /** + /** * 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. * @return eventType - **/ + */ @javax.annotation.Nullable public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public ConferenceMemberJoinCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } - /** + /** * 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. * @return eventTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public ConferenceMemberJoinCallback conferenceId(String conferenceId) { - this.conferenceId = conferenceId; return this; } - /** + /** * The unique, Bandwidth-generated ID of the conference that was recorded * @return conferenceId - **/ + */ @javax.annotation.Nullable public String getConferenceId() { return conferenceId; } - public void setConferenceId(String conferenceId) { this.conferenceId = conferenceId; } public ConferenceMemberJoinCallback name(String name) { - this.name = name; return this; } - /** + /** * The user-specified name of the conference that was recorded * @return name - **/ + */ @javax.annotation.Nullable public String getName() { return name; } - public void setName(String name) { this.name = name; } public ConferenceMemberJoinCallback from(String from) { - this.from = from; return this; } - /** + /** * The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). * @return from - **/ + */ @javax.annotation.Nullable public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public ConferenceMemberJoinCallback to(String to) { - this.to = to; return this; } - /** + /** * The phone number that received the call, in E.164 format (e.g. +15555555555). * @return to - **/ + */ @javax.annotation.Nullable public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public ConferenceMemberJoinCallback callId(String callId) { - this.callId = callId; return this; } - /** + /** * The call id associated with the event. * @return callId - **/ + */ @javax.annotation.Nullable public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public ConferenceMemberJoinCallback tag(String tag) { - this.tag = tag; return this; } - /** + /** * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. * @return tag - **/ + */ @javax.annotation.Nullable public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } @@ -386,12 +368,12 @@ private String toIndentedString(Object o) { 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 ConferenceMemberJoinCallback - */ + /** + * 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 ConferenceMemberJoinCallback + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!ConferenceMemberJoinCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -450,7 +432,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -489,22 +476,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of ConferenceMemberJoinCallback given an JSON string - * - * @param jsonString JSON string - * @return An instance of ConferenceMemberJoinCallback - * @throws IOException if the JSON string is invalid with respect to ConferenceMemberJoinCallback - */ + /** + * Create an instance of ConferenceMemberJoinCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of ConferenceMemberJoinCallback + * @throws IOException if the JSON string is invalid with respect to ConferenceMemberJoinCallback + */ public static ConferenceMemberJoinCallback fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, ConferenceMemberJoinCallback.class); } - /** - * Convert an instance of ConferenceMemberJoinCallback to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of ConferenceMemberJoinCallback 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/ConferenceRecordingAvailableCallback.java b/src/main/java/com/bandwidth/sdk/model/ConferenceRecordingAvailableCallback.java index c0785daf..e4871ae9 100644 --- a/src/main/java/com/bandwidth/sdk/model/ConferenceRecordingAvailableCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/ConferenceRecordingAvailableCallback.java @@ -41,12 +41,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -54,7 +52,7 @@ /** * The Conference Recording Available event is sent after a conference recording has been processed. It indicates that the recording is available for download. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class ConferenceRecordingAvailableCallback { public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; @SerializedName(SERIALIZED_NAME_EVENT_TYPE) @@ -116,294 +114,266 @@ public ConferenceRecordingAvailableCallback() { } public ConferenceRecordingAvailableCallback eventType(String eventType) { - this.eventType = eventType; return this; } - /** + /** * 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. * @return eventType - **/ + */ @javax.annotation.Nullable public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public ConferenceRecordingAvailableCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } - /** + /** * 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. * @return eventTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public ConferenceRecordingAvailableCallback conferenceId(String conferenceId) { - this.conferenceId = conferenceId; return this; } - /** + /** * The unique, Bandwidth-generated ID of the conference that was recorded * @return conferenceId - **/ + */ @javax.annotation.Nullable public String getConferenceId() { return conferenceId; } - public void setConferenceId(String conferenceId) { this.conferenceId = conferenceId; } public ConferenceRecordingAvailableCallback name(String name) { - this.name = name; return this; } - /** + /** * The user-specified name of the conference that was recorded * @return name - **/ + */ @javax.annotation.Nullable public String getName() { return name; } - public void setName(String name) { this.name = name; } public ConferenceRecordingAvailableCallback accountId(String accountId) { - this.accountId = accountId; return this; } - /** + /** * The user account associated with the call. * @return accountId - **/ + */ @javax.annotation.Nullable public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public ConferenceRecordingAvailableCallback recordingId(String recordingId) { - this.recordingId = recordingId; return this; } - /** + /** * The unique ID of this recording * @return recordingId - **/ + */ @javax.annotation.Nullable public String getRecordingId() { return recordingId; } - public void setRecordingId(String recordingId) { this.recordingId = recordingId; } public ConferenceRecordingAvailableCallback channels(Integer channels) { - this.channels = channels; return this; } - /** + /** * Always `1` for conference recordings; multi-channel recordings are not supported on conferences. * @return channels - **/ + */ @javax.annotation.Nullable public Integer getChannels() { return channels; } - public void setChannels(Integer channels) { this.channels = channels; } public ConferenceRecordingAvailableCallback startTime(OffsetDateTime startTime) { - this.startTime = startTime; return this; } - /** + /** * Time the call was started, in ISO 8601 format. * @return startTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getStartTime() { return startTime; } - public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public ConferenceRecordingAvailableCallback endTime(OffsetDateTime endTime) { - this.endTime = endTime; return this; } - /** + /** * The time that the recording ended in ISO-8601 format * @return endTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEndTime() { return endTime; } - public void setEndTime(OffsetDateTime endTime) { this.endTime = endTime; } public ConferenceRecordingAvailableCallback duration(String duration) { - this.duration = duration; return this; } - /** + /** * The duration of the recording in ISO-8601 format * @return duration - **/ + */ @javax.annotation.Nullable public String getDuration() { return duration; } - public void setDuration(String duration) { this.duration = duration; } public ConferenceRecordingAvailableCallback fileFormat(FileFormatEnum fileFormat) { - this.fileFormat = fileFormat; return this; } - /** + /** * Get fileFormat * @return fileFormat - **/ + */ @javax.annotation.Nullable public FileFormatEnum getFileFormat() { return fileFormat; } - public void setFileFormat(FileFormatEnum fileFormat) { this.fileFormat = fileFormat; } public ConferenceRecordingAvailableCallback mediaUrl(URI mediaUrl) { - this.mediaUrl = mediaUrl; return this; } - /** + /** * The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded. * @return mediaUrl - **/ + */ @javax.annotation.Nullable public URI getMediaUrl() { return mediaUrl; } - public void setMediaUrl(URI mediaUrl) { this.mediaUrl = mediaUrl; } public ConferenceRecordingAvailableCallback tag(String tag) { - this.tag = tag; return this; } - /** + /** * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. * @return tag - **/ + */ @javax.annotation.Nullable public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public ConferenceRecordingAvailableCallback status(String status) { - this.status = status; return this; } - /** + /** * 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. * @return status - **/ + */ @javax.annotation.Nullable public String getStatus() { return status; } - public void setStatus(String status) { this.status = status; } @@ -556,12 +526,12 @@ private String toIndentedString(Object o) { 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 ConferenceRecordingAvailableCallback - */ + /** + * 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 ConferenceRecordingAvailableCallback + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!ConferenceRecordingAvailableCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -587,6 +557,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if ((jsonObj.get("duration") != null && !jsonObj.get("duration").isJsonNull()) && !jsonObj.get("duration").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `duration` to be a primitive type in the JSON string but got `%s`", jsonObj.get("duration").toString())); } + // validate the optional field `fileFormat` + if (jsonObj.get("fileFormat") != null && !jsonObj.get("fileFormat").isJsonNull()) { + FileFormatEnum.validateJsonElement(jsonObj.get("fileFormat")); + } if ((jsonObj.get("mediaUrl") != null && !jsonObj.get("mediaUrl").isJsonNull()) && !jsonObj.get("mediaUrl").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `mediaUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("mediaUrl").toString())); } @@ -626,7 +600,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -665,22 +644,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of ConferenceRecordingAvailableCallback given an JSON string - * - * @param jsonString JSON string - * @return An instance of ConferenceRecordingAvailableCallback - * @throws IOException if the JSON string is invalid with respect to ConferenceRecordingAvailableCallback - */ + /** + * Create an instance of ConferenceRecordingAvailableCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of ConferenceRecordingAvailableCallback + * @throws IOException if the JSON string is invalid with respect to ConferenceRecordingAvailableCallback + */ public static ConferenceRecordingAvailableCallback fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, ConferenceRecordingAvailableCallback.class); } - /** - * Convert an instance of ConferenceRecordingAvailableCallback to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of ConferenceRecordingAvailableCallback 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/ConferenceRecordingMetadata.java b/src/main/java/com/bandwidth/sdk/model/ConferenceRecordingMetadata.java index 009b983f..1bec34a8 100644 --- a/src/main/java/com/bandwidth/sdk/model/ConferenceRecordingMetadata.java +++ b/src/main/java/com/bandwidth/sdk/model/ConferenceRecordingMetadata.java @@ -41,12 +41,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -54,7 +52,7 @@ /** * ConferenceRecordingMetadata */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class ConferenceRecordingMetadata { public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) @@ -108,252 +106,228 @@ public ConferenceRecordingMetadata() { } public ConferenceRecordingMetadata accountId(String accountId) { - this.accountId = accountId; return this; } - /** + /** * The user account associated with the call. * @return accountId - **/ + */ @javax.annotation.Nullable public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public ConferenceRecordingMetadata conferenceId(String conferenceId) { - this.conferenceId = conferenceId; return this; } - /** + /** * The unique, Bandwidth-generated ID of the conference that was recorded * @return conferenceId - **/ + */ @javax.annotation.Nullable public String getConferenceId() { return conferenceId; } - public void setConferenceId(String conferenceId) { this.conferenceId = conferenceId; } public ConferenceRecordingMetadata name(String name) { - this.name = name; return this; } - /** + /** * The user-specified name of the conference that was recorded * @return name - **/ + */ @javax.annotation.Nullable public String getName() { return name; } - public void setName(String name) { this.name = name; } public ConferenceRecordingMetadata recordingId(String recordingId) { - this.recordingId = recordingId; return this; } - /** + /** * The unique ID of this recording * @return recordingId - **/ + */ @javax.annotation.Nullable public String getRecordingId() { return recordingId; } - public void setRecordingId(String recordingId) { this.recordingId = recordingId; } public ConferenceRecordingMetadata duration(String duration) { - this.duration = duration; return this; } - /** + /** * The duration of the recording in ISO-8601 format * @return duration - **/ + */ @javax.annotation.Nullable public String getDuration() { return duration; } - public void setDuration(String duration) { this.duration = duration; } public ConferenceRecordingMetadata channels(Integer channels) { - this.channels = channels; return this; } - /** + /** * Always `1` for conference recordings; multi-channel recordings are not supported on conferences. * @return channels - **/ + */ @javax.annotation.Nullable public Integer getChannels() { return channels; } - public void setChannels(Integer channels) { this.channels = channels; } public ConferenceRecordingMetadata startTime(OffsetDateTime startTime) { - this.startTime = startTime; return this; } - /** + /** * Time the call was started, in ISO 8601 format. * @return startTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getStartTime() { return startTime; } - public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public ConferenceRecordingMetadata endTime(OffsetDateTime endTime) { - this.endTime = endTime; return this; } - /** + /** * The time that the recording ended in ISO-8601 format * @return endTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEndTime() { return endTime; } - public void setEndTime(OffsetDateTime endTime) { this.endTime = endTime; } public ConferenceRecordingMetadata fileFormat(FileFormatEnum fileFormat) { - this.fileFormat = fileFormat; return this; } - /** + /** * Get fileFormat * @return fileFormat - **/ + */ @javax.annotation.Nullable public FileFormatEnum getFileFormat() { return fileFormat; } - public void setFileFormat(FileFormatEnum fileFormat) { this.fileFormat = fileFormat; } public ConferenceRecordingMetadata status(String status) { - this.status = status; return this; } - /** + /** * 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. * @return status - **/ + */ @javax.annotation.Nullable public String getStatus() { return status; } - public void setStatus(String status) { this.status = status; } public ConferenceRecordingMetadata mediaUrl(URI mediaUrl) { - this.mediaUrl = mediaUrl; return this; } - /** + /** * The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded. * @return mediaUrl - **/ + */ @javax.annotation.Nullable public URI getMediaUrl() { return mediaUrl; } - public void setMediaUrl(URI mediaUrl) { this.mediaUrl = mediaUrl; } public ConferenceRecordingMetadata recordingName(String recordingName) { - this.recordingName = recordingName; return this; } - /** + /** * A name to identify this recording. * @return recordingName - **/ + */ @javax.annotation.Nullable public String getRecordingName() { return recordingName; } - public void setRecordingName(String recordingName) { this.recordingName = recordingName; } @@ -500,12 +474,12 @@ private String toIndentedString(Object o) { 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 ConferenceRecordingMetadata - */ + /** + * 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 ConferenceRecordingMetadata + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!ConferenceRecordingMetadata.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -528,6 +502,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if ((jsonObj.get("duration") != null && !jsonObj.get("duration").isJsonNull()) && !jsonObj.get("duration").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `duration` to be a primitive type in the JSON string but got `%s`", jsonObj.get("duration").toString())); } + // validate the optional field `fileFormat` + if (jsonObj.get("fileFormat") != null && !jsonObj.get("fileFormat").isJsonNull()) { + FileFormatEnum.validateJsonElement(jsonObj.get("fileFormat")); + } if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); } @@ -567,7 +545,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -606,22 +589,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of ConferenceRecordingMetadata given an JSON string - * - * @param jsonString JSON string - * @return An instance of ConferenceRecordingMetadata - * @throws IOException if the JSON string is invalid with respect to ConferenceRecordingMetadata - */ + /** + * Create an instance of ConferenceRecordingMetadata given an JSON string + * + * @param jsonString JSON string + * @return An instance of ConferenceRecordingMetadata + * @throws IOException if the JSON string is invalid with respect to ConferenceRecordingMetadata + */ public static ConferenceRecordingMetadata fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, ConferenceRecordingMetadata.class); } - /** - * Convert an instance of ConferenceRecordingMetadata to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of ConferenceRecordingMetadata 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/ConferenceRedirectCallback.java b/src/main/java/com/bandwidth/sdk/model/ConferenceRedirectCallback.java index 6158fcbf..792a6408 100644 --- a/src/main/java/com/bandwidth/sdk/model/ConferenceRedirectCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/ConferenceRedirectCallback.java @@ -39,12 +39,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -52,7 +50,7 @@ /** * The Conference Redirect event is fired whenever an existing conference is modified via a POST request made to the /conferences/{conferenceId} endpoint. The response may be either empty or a BXML document. Only the following verbs are valid for conferences: PlayAudio, SpeakSentence, StartRecording, StopRecording, PauseRecording, ResumeRecording. Audio verbs will be heard by all members of the conference. Recordings capture audio from all members who are not muted or on hold, as well as any audio verbs that are played into the conference. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class ConferenceRedirectCallback { public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; @SerializedName(SERIALIZED_NAME_EVENT_TYPE) @@ -78,105 +76,95 @@ public ConferenceRedirectCallback() { } public ConferenceRedirectCallback eventType(String eventType) { - this.eventType = eventType; return this; } - /** + /** * 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. * @return eventType - **/ + */ @javax.annotation.Nullable public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public ConferenceRedirectCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } - /** + /** * 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. * @return eventTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public ConferenceRedirectCallback conferenceId(String conferenceId) { - this.conferenceId = conferenceId; return this; } - /** + /** * The unique, Bandwidth-generated ID of the conference that was recorded * @return conferenceId - **/ + */ @javax.annotation.Nullable public String getConferenceId() { return conferenceId; } - public void setConferenceId(String conferenceId) { this.conferenceId = conferenceId; } public ConferenceRedirectCallback name(String name) { - this.name = name; return this; } - /** + /** * The user-specified name of the conference that was recorded * @return name - **/ + */ @javax.annotation.Nullable public String getName() { return name; } - public void setName(String name) { this.name = name; } public ConferenceRedirectCallback tag(String tag) { - this.tag = tag; return this; } - /** + /** * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. * @return tag - **/ + */ @javax.annotation.Nullable public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } @@ -302,12 +290,12 @@ private String toIndentedString(Object o) { 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 ConferenceRedirectCallback - */ + /** + * 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 ConferenceRedirectCallback + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!ConferenceRedirectCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -357,7 +345,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -396,22 +389,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of ConferenceRedirectCallback given an JSON string - * - * @param jsonString JSON string - * @return An instance of ConferenceRedirectCallback - * @throws IOException if the JSON string is invalid with respect to ConferenceRedirectCallback - */ + /** + * Create an instance of ConferenceRedirectCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of ConferenceRedirectCallback + * @throws IOException if the JSON string is invalid with respect to ConferenceRedirectCallback + */ public static ConferenceRedirectCallback fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, ConferenceRedirectCallback.class); } - /** - * Convert an instance of ConferenceRedirectCallback to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of ConferenceRedirectCallback 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/ConferenceStateEnum.java b/src/main/java/com/bandwidth/sdk/model/ConferenceStateEnum.java index 76446226..8f457611 100644 --- a/src/main/java/com/bandwidth/sdk/model/ConferenceStateEnum.java +++ b/src/main/java/com/bandwidth/sdk/model/ConferenceStateEnum.java @@ -18,6 +18,7 @@ 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; @@ -68,5 +69,10 @@ public ConferenceStateEnum read(final JsonReader jsonReader) throws IOException return ConferenceStateEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ConferenceStateEnum.fromValue(value); + } } diff --git a/src/main/java/com/bandwidth/sdk/model/CreateCall.java b/src/main/java/com/bandwidth/sdk/model/CreateCall.java index 43f756c9..e8ca3306 100644 --- a/src/main/java/com/bandwidth/sdk/model/CreateCall.java +++ b/src/main/java/com/bandwidth/sdk/model/CreateCall.java @@ -41,12 +41,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -54,7 +52,7 @@ /** * CreateCall */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class CreateCall { public static final String SERIALIZED_NAME_TO = "to"; @SerializedName(SERIALIZED_NAME_TO) @@ -144,447 +142,405 @@ public CreateCall() { } public CreateCall to(String to) { - this.to = to; return this; } - /** + /** * The destination to call (must be an E.164 formatted number (e.g. `+15555551212`) or a SIP URI (e.g. `sip:user@server.example`)). * @return to - **/ + */ @javax.annotation.Nonnull public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public CreateCall from(String from) { - this.from = from; return this; } - /** + /** * A Bandwidth phone number on your account the call should come from (must be in E.164 format, like `+15555551212`) even if `privacy` is set to true. * @return from - **/ + */ @javax.annotation.Nonnull public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public CreateCall privacy(Boolean privacy) { - this.privacy = privacy; return this; } - /** + /** * Hide the calling number. The `displayName` field can be used to customize the displayed name. * @return privacy - **/ + */ @javax.annotation.Nullable public Boolean getPrivacy() { return privacy; } - public void setPrivacy(Boolean privacy) { this.privacy = privacy; } public CreateCall displayName(String displayName) { - this.displayName = displayName; return this; } - /** + /** * The caller display name to use when the call is created. May not exceed 256 characters nor contain control characters such as new lines. If `privacy` is true, only the following values are valid: `Restricted`, `Anonymous`, `Private`, or `Unavailable`. * @return displayName - **/ + */ @javax.annotation.Nullable public String getDisplayName() { return displayName; } - public void setDisplayName(String displayName) { this.displayName = displayName; } public CreateCall uui(String uui) { - this.uui = uui; return this; } - /** + /** * A comma-separated list of 'User-To-User' headers to be sent in the INVITE when calling a SIP URI. Each value must end with an 'encoding' parameter as described in <a href='https://tools.ietf.org/html/rfc7433'>RFC 7433</a>. Only 'jwt' and 'base64' encodings are allowed. The entire value cannot exceed 350 characters, including parameters and separators. * @return uui - **/ + */ @javax.annotation.Nullable public String getUui() { return uui; } - public void setUui(String uui) { this.uui = uui; } public CreateCall applicationId(String applicationId) { - this.applicationId = applicationId; return this; } - /** + /** * The id of the application associated with the `from` number. * @return applicationId - **/ + */ @javax.annotation.Nonnull public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public CreateCall answerUrl(URI answerUrl) { - this.answerUrl = answerUrl; return this; } - /** + /** * The full URL to send the <a href='/docs/voice/webhooks/answer'>Answer</a> event to when the called party answers. This endpoint should return the first <a href='/docs/voice/bxml'>BXML document</a> to be executed in the call. Must use `https` if specifying `username` and `password`. * @return answerUrl - **/ + */ @javax.annotation.Nonnull public URI getAnswerUrl() { return answerUrl; } - public void setAnswerUrl(URI answerUrl) { this.answerUrl = answerUrl; } public CreateCall answerMethod(CallbackMethodEnum answerMethod) { - this.answerMethod = answerMethod; return this; } - /** + /** * Get answerMethod * @return answerMethod - **/ + */ @javax.annotation.Nullable public CallbackMethodEnum getAnswerMethod() { return answerMethod; } - public void setAnswerMethod(CallbackMethodEnum answerMethod) { this.answerMethod = answerMethod; } public CreateCall username(String username) { - this.username = username; return this; } - /** + /** * Basic auth username. * @return username - **/ + */ @javax.annotation.Nullable public String getUsername() { return username; } - public void setUsername(String username) { this.username = username; } public CreateCall password(String password) { - this.password = password; return this; } - /** + /** * Basic auth password. * @return password - **/ + */ @javax.annotation.Nullable public String getPassword() { return password; } - public void setPassword(String password) { this.password = password; } public CreateCall answerFallbackUrl(URI answerFallbackUrl) { - this.answerFallbackUrl = answerFallbackUrl; return this; } - /** + /** * A fallback url which, if provided, will be used to retry the `answer` webhook delivery in case `answerUrl` fails to respond Must use `https` if specifying `fallbackUsername` and `fallbackPassword`. * @return answerFallbackUrl - **/ + */ @javax.annotation.Nullable public URI getAnswerFallbackUrl() { return answerFallbackUrl; } - public void setAnswerFallbackUrl(URI answerFallbackUrl) { this.answerFallbackUrl = answerFallbackUrl; } public CreateCall answerFallbackMethod(CallbackMethodEnum answerFallbackMethod) { - this.answerFallbackMethod = answerFallbackMethod; return this; } - /** + /** * Get answerFallbackMethod * @return answerFallbackMethod - **/ + */ @javax.annotation.Nullable public CallbackMethodEnum getAnswerFallbackMethod() { return answerFallbackMethod; } - public void setAnswerFallbackMethod(CallbackMethodEnum answerFallbackMethod) { this.answerFallbackMethod = answerFallbackMethod; } public CreateCall fallbackUsername(String fallbackUsername) { - this.fallbackUsername = fallbackUsername; return this; } - /** + /** * Basic auth username. * @return fallbackUsername - **/ + */ @javax.annotation.Nullable public String getFallbackUsername() { return fallbackUsername; } - public void setFallbackUsername(String fallbackUsername) { this.fallbackUsername = fallbackUsername; } public CreateCall fallbackPassword(String fallbackPassword) { - this.fallbackPassword = fallbackPassword; return this; } - /** + /** * Basic auth password. * @return fallbackPassword - **/ + */ @javax.annotation.Nullable public String getFallbackPassword() { return fallbackPassword; } - public void setFallbackPassword(String fallbackPassword) { this.fallbackPassword = fallbackPassword; } public CreateCall disconnectUrl(URI disconnectUrl) { - this.disconnectUrl = disconnectUrl; return this; } - /** + /** * The URL to send the <a href='/docs/voice/webhooks/disconnect'>Disconnect</a> event to when the call ends. This event does not expect a BXML response. * @return disconnectUrl - **/ + */ @javax.annotation.Nullable public URI getDisconnectUrl() { return disconnectUrl; } - public void setDisconnectUrl(URI disconnectUrl) { this.disconnectUrl = disconnectUrl; } public CreateCall disconnectMethod(CallbackMethodEnum disconnectMethod) { - this.disconnectMethod = disconnectMethod; return this; } - /** + /** * Get disconnectMethod * @return disconnectMethod - **/ + */ @javax.annotation.Nullable public CallbackMethodEnum getDisconnectMethod() { return disconnectMethod; } - public void setDisconnectMethod(CallbackMethodEnum disconnectMethod) { this.disconnectMethod = disconnectMethod; } public CreateCall callTimeout(Double callTimeout) { - this.callTimeout = callTimeout; return this; } - /** + /** * The timeout (in seconds) for the callee to answer the call after it starts ringing. If the call does not start ringing within 30s, the call will be cancelled regardless of this value. Can be any numeric value (including decimals) between 1 and 300. * minimum: 1 * maximum: 300 * @return callTimeout - **/ + */ @javax.annotation.Nullable public Double getCallTimeout() { return callTimeout; } - public void setCallTimeout(Double callTimeout) { this.callTimeout = callTimeout; } public CreateCall callbackTimeout(Double callbackTimeout) { - this.callbackTimeout = callbackTimeout; return this; } - /** + /** * This is the timeout (in seconds) to use when delivering webhooks for the call. Can be any numeric value (including decimals) between 1 and 25. * minimum: 1 * maximum: 25 * @return callbackTimeout - **/ + */ @javax.annotation.Nullable public Double getCallbackTimeout() { return callbackTimeout; } - public void setCallbackTimeout(Double callbackTimeout) { this.callbackTimeout = callbackTimeout; } public CreateCall machineDetection(MachineDetectionConfiguration machineDetection) { - this.machineDetection = machineDetection; return this; } - /** + /** * Get machineDetection * @return machineDetection - **/ + */ @javax.annotation.Nullable public MachineDetectionConfiguration getMachineDetection() { return machineDetection; } - public void setMachineDetection(MachineDetectionConfiguration machineDetection) { this.machineDetection = machineDetection; } public CreateCall priority(Integer priority) { - this.priority = priority; return this; } - /** + /** * The priority of this call over other calls from your account. For example, if during a call your application needs to place a new call and bridge it with the current call, you might want to create the call with priority 1 so that it will be the next call picked off your queue, ahead of other less time sensitive calls. A lower value means higher priority, so a priority 1 call takes precedence over a priority 2 call. * minimum: 1 * maximum: 5 * @return priority - **/ + */ @javax.annotation.Nullable public Integer getPriority() { return priority; } - public void setPriority(Integer priority) { this.priority = priority; } public CreateCall tag(String tag) { - this.tag = tag; return this; } - /** + /** * A custom string that will be sent with all webhooks for this call unless overwritten by a future <a href='/docs/voice/bxml/tag'>`<Tag>`</a> verb or `tag` attribute on another verb, or cleared. May be cleared by setting `tag=\"\"` Max length 256 characters. * @return tag - **/ + */ @javax.annotation.Nullable public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } @@ -762,12 +718,12 @@ private String toIndentedString(Object o) { openapiRequiredFields.add("answerUrl"); } - /** - * 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 CreateCall - */ + /** + * 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 CreateCall + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!CreateCall.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -800,6 +756,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if (!jsonObj.get("answerUrl").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `answerUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("answerUrl").toString())); } + // validate the optional field `answerMethod` + if (jsonObj.get("answerMethod") != null && !jsonObj.get("answerMethod").isJsonNull()) { + CallbackMethodEnum.validateJsonElement(jsonObj.get("answerMethod")); + } if ((jsonObj.get("username") != null && !jsonObj.get("username").isJsonNull()) && !jsonObj.get("username").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString())); } @@ -809,6 +769,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if ((jsonObj.get("answerFallbackUrl") != null && !jsonObj.get("answerFallbackUrl").isJsonNull()) && !jsonObj.get("answerFallbackUrl").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `answerFallbackUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("answerFallbackUrl").toString())); } + // validate the optional field `answerFallbackMethod` + if (jsonObj.get("answerFallbackMethod") != null && !jsonObj.get("answerFallbackMethod").isJsonNull()) { + CallbackMethodEnum.validateJsonElement(jsonObj.get("answerFallbackMethod")); + } if ((jsonObj.get("fallbackUsername") != null && !jsonObj.get("fallbackUsername").isJsonNull()) && !jsonObj.get("fallbackUsername").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `fallbackUsername` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fallbackUsername").toString())); } @@ -818,6 +782,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if ((jsonObj.get("disconnectUrl") != null && !jsonObj.get("disconnectUrl").isJsonNull()) && !jsonObj.get("disconnectUrl").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `disconnectUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("disconnectUrl").toString())); } + // validate the optional field `disconnectMethod` + if (jsonObj.get("disconnectMethod") != null && !jsonObj.get("disconnectMethod").isJsonNull()) { + CallbackMethodEnum.validateJsonElement(jsonObj.get("disconnectMethod")); + } // validate the optional field `machineDetection` if (jsonObj.get("machineDetection") != null && !jsonObj.get("machineDetection").isJsonNull()) { MachineDetectionConfiguration.validateJsonElement(jsonObj.get("machineDetection")); @@ -855,7 +823,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -894,22 +867,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of CreateCall given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateCall - * @throws IOException if the JSON string is invalid with respect to CreateCall - */ + /** + * Create an instance of CreateCall given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateCall + * @throws IOException if the JSON string is invalid with respect to CreateCall + */ public static CreateCall fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CreateCall.class); } - /** - * Convert an instance of CreateCall to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of CreateCall 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/CreateCallResponse.java b/src/main/java/com/bandwidth/sdk/model/CreateCallResponse.java index e99359cc..2a59b716 100644 --- a/src/main/java/com/bandwidth/sdk/model/CreateCallResponse.java +++ b/src/main/java/com/bandwidth/sdk/model/CreateCallResponse.java @@ -41,12 +41,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -54,7 +52,7 @@ /** * CreateCallResponse */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class CreateCallResponse { public static final String SERIALIZED_NAME_APPLICATION_ID = "applicationId"; @SerializedName(SERIALIZED_NAME_APPLICATION_ID) @@ -144,441 +142,399 @@ public CreateCallResponse() { } public CreateCallResponse applicationId(String applicationId) { - this.applicationId = applicationId; return this; } - /** + /** * The id of the application associated with the `from` number. * @return applicationId - **/ + */ @javax.annotation.Nonnull public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public CreateCallResponse accountId(String accountId) { - this.accountId = accountId; return this; } - /** + /** * The bandwidth account ID associated with the call. * @return accountId - **/ + */ @javax.annotation.Nonnull public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public CreateCallResponse callId(String callId) { - this.callId = callId; return this; } - /** + /** * Programmable Voice API Call ID. * @return callId - **/ + */ @javax.annotation.Nonnull public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public CreateCallResponse to(String to) { - this.to = to; return this; } - /** + /** * Recipient of the outgoing call. * @return to - **/ + */ @javax.annotation.Nonnull public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public CreateCallResponse from(String from) { - this.from = from; return this; } - /** + /** * Phone number that created the outbound call. * @return from - **/ + */ @javax.annotation.Nonnull public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public CreateCallResponse enqueuedTime(OffsetDateTime enqueuedTime) { - this.enqueuedTime = enqueuedTime; return this; } - /** + /** * The time at which the call was accepted into the queue. * @return enqueuedTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } - public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public CreateCallResponse callUrl(URI callUrl) { - this.callUrl = callUrl; return this; } - /** + /** * The URL to update this call's state. * @return callUrl - **/ + */ @javax.annotation.Nonnull public URI getCallUrl() { return callUrl; } - public void setCallUrl(URI callUrl) { this.callUrl = callUrl; } public CreateCallResponse callTimeout(Double callTimeout) { - this.callTimeout = callTimeout; return this; } - /** + /** * The timeout (in seconds) for the callee to answer the call after it starts ringing. * @return callTimeout - **/ + */ @javax.annotation.Nullable public Double getCallTimeout() { return callTimeout; } - public void setCallTimeout(Double callTimeout) { this.callTimeout = callTimeout; } public CreateCallResponse callbackTimeout(Double callbackTimeout) { - this.callbackTimeout = callbackTimeout; return this; } - /** + /** * This is the timeout (in seconds) to use when delivering webhooks for the call. * @return callbackTimeout - **/ + */ @javax.annotation.Nullable public Double getCallbackTimeout() { return callbackTimeout; } - public void setCallbackTimeout(Double callbackTimeout) { this.callbackTimeout = callbackTimeout; } public CreateCallResponse tag(String tag) { - this.tag = tag; return this; } - /** + /** * Custom tag value. * @return tag - **/ + */ @javax.annotation.Nullable public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public CreateCallResponse answerMethod(CallbackMethodEnum answerMethod) { - this.answerMethod = answerMethod; return this; } - /** + /** * Get answerMethod * @return answerMethod - **/ + */ @javax.annotation.Nullable public CallbackMethodEnum getAnswerMethod() { return answerMethod; } - public void setAnswerMethod(CallbackMethodEnum answerMethod) { this.answerMethod = answerMethod; } public CreateCallResponse answerUrl(URI answerUrl) { - this.answerUrl = answerUrl; return this; } - /** + /** * URL to deliver the `answer` event webhook. * @return answerUrl - **/ + */ @javax.annotation.Nonnull public URI getAnswerUrl() { return answerUrl; } - public void setAnswerUrl(URI answerUrl) { this.answerUrl = answerUrl; } public CreateCallResponse answerFallbackMethod(CallbackMethodEnum answerFallbackMethod) { - this.answerFallbackMethod = answerFallbackMethod; return this; } - /** + /** * Get answerFallbackMethod * @return answerFallbackMethod - **/ + */ @javax.annotation.Nullable public CallbackMethodEnum getAnswerFallbackMethod() { return answerFallbackMethod; } - public void setAnswerFallbackMethod(CallbackMethodEnum answerFallbackMethod) { this.answerFallbackMethod = answerFallbackMethod; } public CreateCallResponse answerFallbackUrl(URI answerFallbackUrl) { - this.answerFallbackUrl = answerFallbackUrl; return this; } - /** + /** * Fallback URL to deliver the `answer` event webhook. * @return answerFallbackUrl - **/ + */ @javax.annotation.Nullable public URI getAnswerFallbackUrl() { return answerFallbackUrl; } - public void setAnswerFallbackUrl(URI answerFallbackUrl) { this.answerFallbackUrl = answerFallbackUrl; } public CreateCallResponse disconnectMethod(CallbackMethodEnum disconnectMethod) { - this.disconnectMethod = disconnectMethod; return this; } - /** + /** * Get disconnectMethod * @return disconnectMethod - **/ + */ @javax.annotation.Nullable public CallbackMethodEnum getDisconnectMethod() { return disconnectMethod; } - public void setDisconnectMethod(CallbackMethodEnum disconnectMethod) { this.disconnectMethod = disconnectMethod; } public CreateCallResponse disconnectUrl(URI disconnectUrl) { - this.disconnectUrl = disconnectUrl; return this; } - /** + /** * URL to deliver the `disconnect` event webhook. * @return disconnectUrl - **/ + */ @javax.annotation.Nullable public URI getDisconnectUrl() { return disconnectUrl; } - public void setDisconnectUrl(URI disconnectUrl) { this.disconnectUrl = disconnectUrl; } public CreateCallResponse username(String username) { - this.username = username; return this; } - /** + /** * Basic auth username. * @return username - **/ + */ @javax.annotation.Nullable public String getUsername() { return username; } - public void setUsername(String username) { this.username = username; } public CreateCallResponse password(String password) { - this.password = password; return this; } - /** + /** * Basic auth password. * @return password - **/ + */ @javax.annotation.Nullable public String getPassword() { return password; } - public void setPassword(String password) { this.password = password; } public CreateCallResponse fallbackUsername(String fallbackUsername) { - this.fallbackUsername = fallbackUsername; return this; } - /** + /** * Basic auth username. * @return fallbackUsername - **/ + */ @javax.annotation.Nullable public String getFallbackUsername() { return fallbackUsername; } - public void setFallbackUsername(String fallbackUsername) { this.fallbackUsername = fallbackUsername; } public CreateCallResponse fallbackPassword(String fallbackPassword) { - this.fallbackPassword = fallbackPassword; return this; } - /** + /** * Basic auth password. * @return fallbackPassword - **/ + */ @javax.annotation.Nullable public String getFallbackPassword() { return fallbackPassword; } - public void setFallbackPassword(String fallbackPassword) { this.fallbackPassword = fallbackPassword; } public CreateCallResponse priority(Integer priority) { - this.priority = priority; return this; } - /** + /** * The priority of this call over other calls from your account. * @return priority - **/ + */ @javax.annotation.Nullable public Integer getPriority() { return priority; } - public void setPriority(Integer priority) { this.priority = priority; } @@ -761,12 +717,12 @@ private String toIndentedString(Object o) { openapiRequiredFields.add("disconnectMethod"); } - /** - * 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 CreateCallResponse - */ + /** + * 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 CreateCallResponse + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!CreateCallResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -802,12 +758,20 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti 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 `answerMethod` + CallbackMethodEnum.validateJsonElement(jsonObj.get("answerMethod")); if (!jsonObj.get("answerUrl").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `answerUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("answerUrl").toString())); } + // validate the optional field `answerFallbackMethod` + if (jsonObj.get("answerFallbackMethod") != null && !jsonObj.get("answerFallbackMethod").isJsonNull()) { + CallbackMethodEnum.validateJsonElement(jsonObj.get("answerFallbackMethod")); + } if ((jsonObj.get("answerFallbackUrl") != null && !jsonObj.get("answerFallbackUrl").isJsonNull()) && !jsonObj.get("answerFallbackUrl").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `answerFallbackUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("answerFallbackUrl").toString())); } + // validate the required field `disconnectMethod` + CallbackMethodEnum.validateJsonElement(jsonObj.get("disconnectMethod")); if ((jsonObj.get("disconnectUrl") != null && !jsonObj.get("disconnectUrl").isJsonNull()) && !jsonObj.get("disconnectUrl").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `disconnectUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("disconnectUrl").toString())); } @@ -853,7 +817,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -892,22 +861,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of CreateCallResponse given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateCallResponse - * @throws IOException if the JSON string is invalid with respect to CreateCallResponse - */ + /** + * Create an instance of CreateCallResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateCallResponse + * @throws IOException if the JSON string is invalid with respect to CreateCallResponse + */ public static CreateCallResponse fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CreateCallResponse.class); } - /** - * Convert an instance of CreateCallResponse to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of CreateCallResponse 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/CreateLookupResponse.java b/src/main/java/com/bandwidth/sdk/model/CreateLookupResponse.java index 5a9bdcab..211b1ccd 100644 --- a/src/main/java/com/bandwidth/sdk/model/CreateLookupResponse.java +++ b/src/main/java/com/bandwidth/sdk/model/CreateLookupResponse.java @@ -38,12 +38,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -51,7 +49,7 @@ /** * The request has been accepted for processing but not yet finished and in a terminal state (COMPLETE, PARTIAL_COMPLETE, or FAILED). */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class CreateLookupResponse { public static final String SERIALIZED_NAME_REQUEST_ID = "requestId"; @SerializedName(SERIALIZED_NAME_REQUEST_ID) @@ -65,42 +63,38 @@ public CreateLookupResponse() { } public CreateLookupResponse requestId(String requestId) { - this.requestId = requestId; return this; } - /** + /** * The phone number lookup request ID from Bandwidth. * @return requestId - **/ + */ @javax.annotation.Nullable public String getRequestId() { return requestId; } - public void setRequestId(String requestId) { this.requestId = requestId; } public CreateLookupResponse status(LookupStatusEnum status) { - this.status = status; return this; } - /** + /** * Get status * @return status - **/ + */ @javax.annotation.Nullable public LookupStatusEnum getStatus() { return status; } - public void setStatus(LookupStatusEnum status) { this.status = status; } @@ -206,12 +200,12 @@ private String toIndentedString(Object o) { 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 CreateLookupResponse - */ + /** + * 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 CreateLookupResponse + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!CreateLookupResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -222,6 +216,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if ((jsonObj.get("requestId") != null && !jsonObj.get("requestId").isJsonNull()) && !jsonObj.get("requestId").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `requestId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("requestId").toString())); } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + LookupStatusEnum.validateJsonElement(jsonObj.get("status")); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @@ -252,7 +250,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -291,22 +294,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of CreateLookupResponse given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateLookupResponse - * @throws IOException if the JSON string is invalid with respect to CreateLookupResponse - */ + /** + * Create an instance of CreateLookupResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateLookupResponse + * @throws IOException if the JSON string is invalid with respect to CreateLookupResponse + */ public static CreateLookupResponse fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CreateLookupResponse.class); } - /** - * Convert an instance of CreateLookupResponse to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of CreateLookupResponse 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/CreateMessageRequestError.java b/src/main/java/com/bandwidth/sdk/model/CreateMessageRequestError.java index a54042d2..0f1f7360 100644 --- a/src/main/java/com/bandwidth/sdk/model/CreateMessageRequestError.java +++ b/src/main/java/com/bandwidth/sdk/model/CreateMessageRequestError.java @@ -40,12 +40,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -53,7 +51,7 @@ /** * CreateMessageRequestError */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class CreateMessageRequestError { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @@ -65,55 +63,50 @@ public class CreateMessageRequestError { public static final String SERIALIZED_NAME_FIELD_ERRORS = "fieldErrors"; @SerializedName(SERIALIZED_NAME_FIELD_ERRORS) - private List fieldErrors; + private List fieldErrors = new ArrayList<>(); public CreateMessageRequestError() { } public CreateMessageRequestError type(String type) { - this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull public String getType() { return type; } - public void setType(String type) { this.type = type; } public CreateMessageRequestError description(String description) { - this.description = description; return this; } - /** + /** * Get description * @return description - **/ + */ @javax.annotation.Nonnull public String getDescription() { return description; } - public void setDescription(String description) { this.description = description; } public CreateMessageRequestError fieldErrors(List fieldErrors) { - this.fieldErrors = fieldErrors; return this; } @@ -126,16 +119,15 @@ public CreateMessageRequestError addFieldErrorsItem(FieldError fieldErrorsItem) return this; } - /** + /** * Get fieldErrors * @return fieldErrors - **/ + */ @javax.annotation.Nullable public List getFieldErrors() { return fieldErrors; } - public void setFieldErrors(List fieldErrors) { this.fieldErrors = fieldErrors; } @@ -246,12 +238,12 @@ private String toIndentedString(Object o) { openapiRequiredFields.add("description"); } - /** - * 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 CreateMessageRequestError - */ + /** + * 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 CreateMessageRequestError + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!CreateMessageRequestError.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -316,7 +308,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -355,22 +352,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of CreateMessageRequestError given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateMessageRequestError - * @throws IOException if the JSON string is invalid with respect to CreateMessageRequestError - */ + /** + * Create an instance of CreateMessageRequestError given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateMessageRequestError + * @throws IOException if the JSON string is invalid with respect to CreateMessageRequestError + */ public static CreateMessageRequestError fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CreateMessageRequestError.class); } - /** - * Convert an instance of CreateMessageRequestError to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of CreateMessageRequestError 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/DeferredResult.java b/src/main/java/com/bandwidth/sdk/model/DeferredResult.java index 2a480d08..521831e0 100644 --- a/src/main/java/com/bandwidth/sdk/model/DeferredResult.java +++ b/src/main/java/com/bandwidth/sdk/model/DeferredResult.java @@ -37,12 +37,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -50,7 +48,7 @@ /** * DeferredResult */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class DeferredResult { public static final String SERIALIZED_NAME_RESULT = "result"; @SerializedName(SERIALIZED_NAME_RESULT) @@ -64,42 +62,38 @@ public DeferredResult() { } public DeferredResult result(Object result) { - this.result = result; return this; } - /** + /** * Get result * @return result - **/ + */ @javax.annotation.Nullable public Object getResult() { return result; } - public void setResult(Object result) { this.result = result; } public DeferredResult setOrExpired(Boolean setOrExpired) { - this.setOrExpired = setOrExpired; return this; } - /** + /** * Get setOrExpired * @return setOrExpired - **/ + */ @javax.annotation.Nullable public Boolean getSetOrExpired() { return setOrExpired; } - public void setSetOrExpired(Boolean setOrExpired) { this.setOrExpired = setOrExpired; } @@ -205,12 +199,12 @@ private String toIndentedString(Object o) { 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 DeferredResult - */ + /** + * 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 + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!DeferredResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -248,7 +242,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -287,22 +286,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of DeferredResult 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 - */ + /** + * Create an instance of DeferredResult 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 + */ public static DeferredResult fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, DeferredResult.class); } - /** - * Convert an instance of DeferredResult to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of DeferredResult 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/DisconnectCallback.java b/src/main/java/com/bandwidth/sdk/model/DisconnectCallback.java index 7c70e624..901905dd 100644 --- a/src/main/java/com/bandwidth/sdk/model/DisconnectCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/DisconnectCallback.java @@ -41,12 +41,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -54,7 +52,7 @@ /** * The Disconnect event is fired when a call ends, for any reason. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class DisconnectCallback { public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; @SerializedName(SERIALIZED_NAME_EVENT_TYPE) @@ -128,357 +126,323 @@ public DisconnectCallback() { } public DisconnectCallback eventType(String eventType) { - this.eventType = eventType; return this; } - /** + /** * 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. * @return eventType - **/ + */ @javax.annotation.Nullable public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public DisconnectCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } - /** + /** * 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. * @return eventTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public DisconnectCallback accountId(String accountId) { - this.accountId = accountId; return this; } - /** + /** * The user account associated with the call. * @return accountId - **/ + */ @javax.annotation.Nullable public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public DisconnectCallback applicationId(String applicationId) { - this.applicationId = applicationId; return this; } - /** + /** * The id of the application associated with the call. * @return applicationId - **/ + */ @javax.annotation.Nullable public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public DisconnectCallback from(String from) { - this.from = from; return this; } - /** + /** * The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). * @return from - **/ + */ @javax.annotation.Nullable public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public DisconnectCallback to(String to) { - this.to = to; return this; } - /** + /** * The phone number that received the call, in E.164 format (e.g. +15555555555). * @return to - **/ + */ @javax.annotation.Nullable public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public DisconnectCallback callId(String callId) { - this.callId = callId; return this; } - /** + /** * The call id associated with the event. * @return callId - **/ + */ @javax.annotation.Nullable public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public DisconnectCallback direction(CallDirectionEnum direction) { - this.direction = direction; return this; } - /** + /** * Get direction * @return direction - **/ + */ @javax.annotation.Nullable public CallDirectionEnum getDirection() { return direction; } - public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public DisconnectCallback callUrl(URI callUrl) { - this.callUrl = callUrl; return this; } - /** + /** * The URL of the call associated with the event. * @return callUrl - **/ + */ @javax.annotation.Nullable public URI getCallUrl() { return callUrl; } - public void setCallUrl(URI callUrl) { this.callUrl = callUrl; } public DisconnectCallback enqueuedTime(OffsetDateTime enqueuedTime) { - this.enqueuedTime = enqueuedTime; return this; } - /** + /** * (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. * @return enqueuedTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } - public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public DisconnectCallback startTime(OffsetDateTime startTime) { - this.startTime = startTime; return this; } - /** + /** * Time the call was started, in ISO 8601 format. * @return startTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getStartTime() { return startTime; } - public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public DisconnectCallback answerTime(OffsetDateTime answerTime) { - this.answerTime = answerTime; return this; } - /** + /** * Time the call was answered, in ISO 8601 format. * @return answerTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getAnswerTime() { return answerTime; } - public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public DisconnectCallback endTime(OffsetDateTime endTime) { - this.endTime = endTime; return this; } - /** + /** * The time that the recording ended in ISO-8601 format * @return endTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEndTime() { return endTime; } - public void setEndTime(OffsetDateTime endTime) { this.endTime = endTime; } public DisconnectCallback cause(String cause) { - this.cause = cause; return this; } - /** + /** * Reason the call failed - hangup, busy, timeout, cancel, rejected, callback-error, invalid-bxml, application-error, account-limit, node-capacity-exceeded, error, or unknown. * @return cause - **/ + */ @javax.annotation.Nullable public String getCause() { return cause; } - public void setCause(String cause) { this.cause = cause; } public DisconnectCallback errorMessage(String errorMessage) { - this.errorMessage = errorMessage; return this; } - /** + /** * Text explaining the reason that caused the call to fail in case of errors. * @return errorMessage - **/ + */ @javax.annotation.Nullable public String getErrorMessage() { return errorMessage; } - public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; } public DisconnectCallback errorId(String errorId) { - this.errorId = errorId; return this; } - /** + /** * Bandwidth's internal id that references the error event. * @return errorId - **/ + */ @javax.annotation.Nullable public String getErrorId() { return errorId; } - public void setErrorId(String errorId) { this.errorId = errorId; } public DisconnectCallback tag(String tag) { - this.tag = tag; return this; } - /** + /** * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. * @return tag - **/ + */ @javax.annotation.Nullable public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } @@ -640,12 +604,12 @@ private String toIndentedString(Object o) { 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 DisconnectCallback - */ + /** + * 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 DisconnectCallback + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!DisconnectCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -671,6 +635,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if ((jsonObj.get("callId") != null && !jsonObj.get("callId").isJsonNull()) && !jsonObj.get("callId").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `callId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callId").toString())); } + // validate the optional field `direction` + if (jsonObj.get("direction") != null && !jsonObj.get("direction").isJsonNull()) { + CallDirectionEnum.validateJsonElement(jsonObj.get("direction")); + } if ((jsonObj.get("callUrl") != null && !jsonObj.get("callUrl").isJsonNull()) && !jsonObj.get("callUrl").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `callUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callUrl").toString())); } @@ -716,7 +684,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -755,22 +728,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of DisconnectCallback given an JSON string - * - * @param jsonString JSON string - * @return An instance of DisconnectCallback - * @throws IOException if the JSON string is invalid with respect to DisconnectCallback - */ + /** + * Create an instance of DisconnectCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of DisconnectCallback + * @throws IOException if the JSON string is invalid with respect to DisconnectCallback + */ public static DisconnectCallback fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, DisconnectCallback.class); } - /** - * Convert an instance of DisconnectCallback to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of DisconnectCallback 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/Diversion.java b/src/main/java/com/bandwidth/sdk/model/Diversion.java index 78fc646b..190ff096 100644 --- a/src/main/java/com/bandwidth/sdk/model/Diversion.java +++ b/src/main/java/com/bandwidth/sdk/model/Diversion.java @@ -37,12 +37,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -50,7 +48,7 @@ /** * Diversion */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class Diversion { public static final String SERIALIZED_NAME_REASON = "reason"; @SerializedName(SERIALIZED_NAME_REASON) @@ -84,147 +82,133 @@ public Diversion() { } public Diversion reason(String reason) { - this.reason = reason; return this; } - /** + /** * The reason for the diversion. Common values: unknown, user-busy, no-answer, unavailable, unconditional, time-of-day, do-not-disturb, deflection, follow-me, out-of-service, away. * @return reason - **/ + */ @javax.annotation.Nullable public String getReason() { return reason; } - public void setReason(String reason) { this.reason = reason; } public Diversion privacy(String privacy) { - this.privacy = privacy; return this; } - /** + /** * off or full * @return privacy - **/ + */ @javax.annotation.Nullable public String getPrivacy() { return privacy; } - public void setPrivacy(String privacy) { this.privacy = privacy; } public Diversion screen(String screen) { - this.screen = screen; return this; } - /** + /** * No if the number was provided by the user, yes if the number was provided by the network * @return screen - **/ + */ @javax.annotation.Nullable public String getScreen() { return screen; } - public void setScreen(String screen) { this.screen = screen; } public Diversion counter(String counter) { - this.counter = counter; return this; } - /** + /** * The number of diversions that have occurred * @return counter - **/ + */ @javax.annotation.Nullable public String getCounter() { return counter; } - public void setCounter(String counter) { this.counter = counter; } public Diversion limit(String limit) { - this.limit = limit; return this; } - /** + /** * The maximum number of diversions allowed for this session * @return limit - **/ + */ @javax.annotation.Nullable public String getLimit() { return limit; } - public void setLimit(String limit) { this.limit = limit; } public Diversion unknown(String unknown) { - this.unknown = unknown; return this; } - /** + /** * The normal list of values is not exhaustive. Your application must be tolerant of unlisted keys and unlisted values of those keys. * @return unknown - **/ + */ @javax.annotation.Nullable public String getUnknown() { return unknown; } - public void setUnknown(String unknown) { this.unknown = unknown; } public Diversion origTo(String origTo) { - this.origTo = origTo; return this; } - /** + /** * Always present. Indicates the last telephone number that the call was diverted from. * @return origTo - **/ + */ @javax.annotation.Nullable public String getOrigTo() { return origTo; } - public void setOrigTo(String origTo) { this.origTo = origTo; } @@ -345,12 +329,12 @@ private String toIndentedString(Object o) { 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 Diversion - */ + /** + * 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 Diversion + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!Diversion.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -409,7 +393,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -448,22 +437,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of Diversion given an JSON string - * - * @param jsonString JSON string - * @return An instance of Diversion - * @throws IOException if the JSON string is invalid with respect to Diversion - */ + /** + * Create an instance of Diversion given an JSON string + * + * @param jsonString JSON string + * @return An instance of Diversion + * @throws IOException if the JSON string is invalid with respect to Diversion + */ public static Diversion fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, Diversion.class); } - /** - * Convert an instance of Diversion to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of Diversion 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/DtmfCallback.java b/src/main/java/com/bandwidth/sdk/model/DtmfCallback.java index d3f32ac4..ef3cfdac 100644 --- a/src/main/java/com/bandwidth/sdk/model/DtmfCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/DtmfCallback.java @@ -41,12 +41,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -54,7 +52,7 @@ /** * The DTMF event is sent for every digit detected after a <StartGather> verb is executed. You may not respond to this event with BXML. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class DtmfCallback { public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; @SerializedName(SERIALIZED_NAME_EVENT_TYPE) @@ -128,357 +126,323 @@ public DtmfCallback() { } public DtmfCallback eventType(String eventType) { - this.eventType = eventType; return this; } - /** + /** * 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. * @return eventType - **/ + */ @javax.annotation.Nullable public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public DtmfCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } - /** + /** * 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. * @return eventTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public DtmfCallback accountId(String accountId) { - this.accountId = accountId; return this; } - /** + /** * The user account associated with the call. * @return accountId - **/ + */ @javax.annotation.Nullable public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public DtmfCallback applicationId(String applicationId) { - this.applicationId = applicationId; return this; } - /** + /** * The id of the application associated with the call. * @return applicationId - **/ + */ @javax.annotation.Nullable public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public DtmfCallback from(String from) { - this.from = from; return this; } - /** + /** * The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). * @return from - **/ + */ @javax.annotation.Nullable public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public DtmfCallback to(String to) { - this.to = to; return this; } - /** + /** * The phone number that received the call, in E.164 format (e.g. +15555555555). * @return to - **/ + */ @javax.annotation.Nullable public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public DtmfCallback callId(String callId) { - this.callId = callId; return this; } - /** + /** * The call id associated with the event. * @return callId - **/ + */ @javax.annotation.Nullable public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public DtmfCallback direction(CallDirectionEnum direction) { - this.direction = direction; return this; } - /** + /** * Get direction * @return direction - **/ + */ @javax.annotation.Nullable public CallDirectionEnum getDirection() { return direction; } - public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public DtmfCallback digit(String digit) { - this.digit = digit; return this; } - /** + /** * The digit collected in the call. * @return digit - **/ + */ @javax.annotation.Nullable public String getDigit() { return digit; } - public void setDigit(String digit) { this.digit = digit; } public DtmfCallback callUrl(URI callUrl) { - this.callUrl = callUrl; return this; } - /** + /** * The URL of the call associated with the event. * @return callUrl - **/ + */ @javax.annotation.Nullable public URI getCallUrl() { return callUrl; } - public void setCallUrl(URI callUrl) { this.callUrl = callUrl; } public DtmfCallback enqueuedTime(OffsetDateTime enqueuedTime) { - this.enqueuedTime = enqueuedTime; return this; } - /** + /** * (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. * @return enqueuedTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } - public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public DtmfCallback startTime(OffsetDateTime startTime) { - this.startTime = startTime; return this; } - /** + /** * Time the call was started, in ISO 8601 format. * @return startTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getStartTime() { return startTime; } - public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public DtmfCallback answerTime(OffsetDateTime answerTime) { - this.answerTime = answerTime; return this; } - /** + /** * Time the call was answered, in ISO 8601 format. * @return answerTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getAnswerTime() { return answerTime; } - public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public DtmfCallback parentCallId(String parentCallId) { - this.parentCallId = parentCallId; return this; } - /** + /** * (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present. * @return parentCallId - **/ + */ @javax.annotation.Nullable public String getParentCallId() { return parentCallId; } - public void setParentCallId(String parentCallId) { this.parentCallId = parentCallId; } public DtmfCallback transferCallerId(String transferCallerId) { - this.transferCallerId = transferCallerId; return this; } - /** + /** * The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). * @return transferCallerId - **/ + */ @javax.annotation.Nullable public String getTransferCallerId() { return transferCallerId; } - public void setTransferCallerId(String transferCallerId) { this.transferCallerId = transferCallerId; } public DtmfCallback transferTo(String transferTo) { - this.transferTo = transferTo; return this; } - /** + /** * The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). * @return transferTo - **/ + */ @javax.annotation.Nullable public String getTransferTo() { return transferTo; } - public void setTransferTo(String transferTo) { this.transferTo = transferTo; } public DtmfCallback tag(String tag) { - this.tag = tag; return this; } - /** + /** * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. * @return tag - **/ + */ @javax.annotation.Nullable public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } @@ -640,12 +604,12 @@ private String toIndentedString(Object o) { 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 DtmfCallback - */ + /** + * 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 DtmfCallback + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!DtmfCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -671,6 +635,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if ((jsonObj.get("callId") != null && !jsonObj.get("callId").isJsonNull()) && !jsonObj.get("callId").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `callId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callId").toString())); } + // validate the optional field `direction` + if (jsonObj.get("direction") != null && !jsonObj.get("direction").isJsonNull()) { + CallDirectionEnum.validateJsonElement(jsonObj.get("direction")); + } if ((jsonObj.get("digit") != null && !jsonObj.get("digit").isJsonNull()) && !jsonObj.get("digit").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `digit` to be a primitive type in the JSON string but got `%s`", jsonObj.get("digit").toString())); } @@ -719,7 +687,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -758,22 +731,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of DtmfCallback given an JSON string - * - * @param jsonString JSON string - * @return An instance of DtmfCallback - * @throws IOException if the JSON string is invalid with respect to DtmfCallback - */ + /** + * Create an instance of DtmfCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of DtmfCallback + * @throws IOException if the JSON string is invalid with respect to DtmfCallback + */ public static DtmfCallback fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, DtmfCallback.class); } - /** - * Convert an instance of DtmfCallback to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of DtmfCallback 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/FieldError.java b/src/main/java/com/bandwidth/sdk/model/FieldError.java index 46618903..8cdf7abb 100644 --- a/src/main/java/com/bandwidth/sdk/model/FieldError.java +++ b/src/main/java/com/bandwidth/sdk/model/FieldError.java @@ -37,12 +37,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -50,7 +48,7 @@ /** * FieldError */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class FieldError { public static final String SERIALIZED_NAME_FIELD_NAME = "fieldName"; @SerializedName(SERIALIZED_NAME_FIELD_NAME) @@ -64,42 +62,38 @@ public FieldError() { } public FieldError fieldName(String fieldName) { - this.fieldName = fieldName; return this; } - /** + /** * The name of the field that contains the error * @return fieldName - **/ + */ @javax.annotation.Nullable public String getFieldName() { return fieldName; } - public void setFieldName(String fieldName) { this.fieldName = fieldName; } public FieldError description(String description) { - this.description = description; return this; } - /** + /** * The error associated with the field * @return description - **/ + */ @javax.annotation.Nullable public String getDescription() { return description; } - public void setDescription(String description) { this.description = description; } @@ -205,12 +199,12 @@ private String toIndentedString(Object o) { 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 FieldError - */ + /** + * 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 FieldError + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!FieldError.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -254,7 +248,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -293,22 +292,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of FieldError given an JSON string - * - * @param jsonString JSON string - * @return An instance of FieldError - * @throws IOException if the JSON string is invalid with respect to FieldError - */ + /** + * Create an instance of FieldError given an JSON string + * + * @param jsonString JSON string + * @return An instance of FieldError + * @throws IOException if the JSON string is invalid with respect to FieldError + */ public static FieldError fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, FieldError.class); } - /** - * Convert an instance of FieldError to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of FieldError 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/FileFormatEnum.java b/src/main/java/com/bandwidth/sdk/model/FileFormatEnum.java index 69296f70..1f27ba16 100644 --- a/src/main/java/com/bandwidth/sdk/model/FileFormatEnum.java +++ b/src/main/java/com/bandwidth/sdk/model/FileFormatEnum.java @@ -18,6 +18,7 @@ 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; @@ -68,5 +69,10 @@ public FileFormatEnum read(final JsonReader jsonReader) throws IOException { return FileFormatEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + FileFormatEnum.fromValue(value); + } } diff --git a/src/main/java/com/bandwidth/sdk/model/GatherCallback.java b/src/main/java/com/bandwidth/sdk/model/GatherCallback.java index 4cdf2c67..e789af98 100644 --- a/src/main/java/com/bandwidth/sdk/model/GatherCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/GatherCallback.java @@ -41,12 +41,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -54,7 +52,7 @@ /** * The gather event is sent after a <Gather> verb is executed. Its purpose is to report the gathered digits to the calling application. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class GatherCallback { public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; @SerializedName(SERIALIZED_NAME_EVENT_TYPE) @@ -132,378 +130,342 @@ public GatherCallback() { } public GatherCallback eventType(String eventType) { - this.eventType = eventType; return this; } - /** + /** * 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. * @return eventType - **/ + */ @javax.annotation.Nullable public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public GatherCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } - /** + /** * 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. * @return eventTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public GatherCallback accountId(String accountId) { - this.accountId = accountId; return this; } - /** + /** * The user account associated with the call. * @return accountId - **/ + */ @javax.annotation.Nullable public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public GatherCallback applicationId(String applicationId) { - this.applicationId = applicationId; return this; } - /** + /** * The id of the application associated with the call. * @return applicationId - **/ + */ @javax.annotation.Nullable public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public GatherCallback from(String from) { - this.from = from; return this; } - /** + /** * The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). * @return from - **/ + */ @javax.annotation.Nullable public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public GatherCallback to(String to) { - this.to = to; return this; } - /** + /** * The phone number that received the call, in E.164 format (e.g. +15555555555). * @return to - **/ + */ @javax.annotation.Nullable public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public GatherCallback direction(CallDirectionEnum direction) { - this.direction = direction; return this; } - /** + /** * Get direction * @return direction - **/ + */ @javax.annotation.Nullable public CallDirectionEnum getDirection() { return direction; } - public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public GatherCallback callId(String callId) { - this.callId = callId; return this; } - /** + /** * The call id associated with the event. * @return callId - **/ + */ @javax.annotation.Nullable public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public GatherCallback digits(String digits) { - this.digits = digits; return this; } - /** + /** * (optional) The digits, letters, and/or symbols entered by the user. The string is empty if a timeout occurred before any buttons were pressed. * @return digits - **/ + */ @javax.annotation.Nullable public String getDigits() { return digits; } - public void setDigits(String digits) { this.digits = digits; } public GatherCallback callUrl(URI callUrl) { - this.callUrl = callUrl; return this; } - /** + /** * The URL of the call associated with the event. * @return callUrl - **/ + */ @javax.annotation.Nullable public URI getCallUrl() { return callUrl; } - public void setCallUrl(URI callUrl) { this.callUrl = callUrl; } public GatherCallback enqueuedTime(OffsetDateTime enqueuedTime) { - this.enqueuedTime = enqueuedTime; return this; } - /** + /** * (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. * @return enqueuedTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } - public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public GatherCallback startTime(OffsetDateTime startTime) { - this.startTime = startTime; return this; } - /** + /** * Time the call was started, in ISO 8601 format. * @return startTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getStartTime() { return startTime; } - public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public GatherCallback answerTime(OffsetDateTime answerTime) { - this.answerTime = answerTime; return this; } - /** + /** * Time the call was answered, in ISO 8601 format. * @return answerTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getAnswerTime() { return answerTime; } - public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public GatherCallback parentCallId(String parentCallId) { - this.parentCallId = parentCallId; return this; } - /** + /** * (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present. * @return parentCallId - **/ + */ @javax.annotation.Nullable public String getParentCallId() { return parentCallId; } - public void setParentCallId(String parentCallId) { this.parentCallId = parentCallId; } public GatherCallback terminatingDigit(String terminatingDigit) { - this.terminatingDigit = terminatingDigit; return this; } - /** + /** * (optional) The digit the user pressed to end the gather. Empty string value if no terminating digit was pressed. * @return terminatingDigit - **/ + */ @javax.annotation.Nullable public String getTerminatingDigit() { return terminatingDigit; } - public void setTerminatingDigit(String terminatingDigit) { this.terminatingDigit = terminatingDigit; } public GatherCallback transferCallerId(String transferCallerId) { - this.transferCallerId = transferCallerId; return this; } - /** + /** * The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). * @return transferCallerId - **/ + */ @javax.annotation.Nullable public String getTransferCallerId() { return transferCallerId; } - public void setTransferCallerId(String transferCallerId) { this.transferCallerId = transferCallerId; } public GatherCallback transferTo(String transferTo) { - this.transferTo = transferTo; return this; } - /** + /** * The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). * @return transferTo - **/ + */ @javax.annotation.Nullable public String getTransferTo() { return transferTo; } - public void setTransferTo(String transferTo) { this.transferTo = transferTo; } public GatherCallback tag(String tag) { - this.tag = tag; return this; } - /** + /** * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. * @return tag - **/ + */ @javax.annotation.Nullable public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } @@ -668,12 +630,12 @@ private String toIndentedString(Object o) { 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 GatherCallback - */ + /** + * 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 GatherCallback + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!GatherCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -696,6 +658,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti 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())); } + // validate the optional field `direction` + if (jsonObj.get("direction") != null && !jsonObj.get("direction").isJsonNull()) { + CallDirectionEnum.validateJsonElement(jsonObj.get("direction")); + } if ((jsonObj.get("callId") != null && !jsonObj.get("callId").isJsonNull()) && !jsonObj.get("callId").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `callId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callId").toString())); } @@ -750,7 +716,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -789,22 +760,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of GatherCallback given an JSON string - * - * @param jsonString JSON string - * @return An instance of GatherCallback - * @throws IOException if the JSON string is invalid with respect to GatherCallback - */ + /** + * Create an instance of GatherCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of GatherCallback + * @throws IOException if the JSON string is invalid with respect to GatherCallback + */ public static GatherCallback fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, GatherCallback.class); } - /** - * Convert an instance of GatherCallback to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of GatherCallback 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/InboundMessageCallback.java b/src/main/java/com/bandwidth/sdk/model/InboundMessageCallback.java index 1ba464ec..251b60c5 100644 --- a/src/main/java/com/bandwidth/sdk/model/InboundMessageCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/InboundMessageCallback.java @@ -39,12 +39,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -52,7 +50,7 @@ /** * Inbound Message Callback */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class InboundMessageCallback { public static final String SERIALIZED_NAME_TIME = "time"; @SerializedName(SERIALIZED_NAME_TIME) @@ -78,105 +76,95 @@ public InboundMessageCallback() { } public InboundMessageCallback time(OffsetDateTime time) { - this.time = time; return this; } - /** + /** * Get time * @return time - **/ + */ @javax.annotation.Nonnull public OffsetDateTime getTime() { return time; } - public void setTime(OffsetDateTime time) { this.time = time; } public InboundMessageCallback type(String type) { - this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull public String getType() { return type; } - public void setType(String type) { this.type = type; } public InboundMessageCallback to(String to) { - this.to = to; return this; } - /** + /** * Get to * @return to - **/ + */ @javax.annotation.Nonnull public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public InboundMessageCallback description(String description) { - this.description = description; return this; } - /** + /** * Get description * @return description - **/ + */ @javax.annotation.Nonnull public String getDescription() { return description; } - public void setDescription(String description) { this.description = description; } public InboundMessageCallback message(InboundMessageCallbackMessage message) { - this.message = message; return this; } - /** + /** * Get message * @return message - **/ + */ @javax.annotation.Nonnull public InboundMessageCallbackMessage getMessage() { return message; } - public void setMessage(InboundMessageCallbackMessage message) { this.message = message; } @@ -296,12 +284,12 @@ private String toIndentedString(Object o) { 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 InboundMessageCallback - */ + /** + * 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 InboundMessageCallback + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!InboundMessageCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -357,7 +345,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -396,22 +389,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of InboundMessageCallback given an JSON string - * - * @param jsonString JSON string - * @return An instance of InboundMessageCallback - * @throws IOException if the JSON string is invalid with respect to InboundMessageCallback - */ + /** + * Create an instance of InboundMessageCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of InboundMessageCallback + * @throws IOException if the JSON string is invalid with respect to InboundMessageCallback + */ public static InboundMessageCallback fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, InboundMessageCallback.class); } - /** - * Convert an instance of InboundMessageCallback to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of InboundMessageCallback 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/InboundMessageCallbackMessage.java b/src/main/java/com/bandwidth/sdk/model/InboundMessageCallbackMessage.java index 9d5d99d9..063db4b9 100644 --- a/src/main/java/com/bandwidth/sdk/model/InboundMessageCallbackMessage.java +++ b/src/main/java/com/bandwidth/sdk/model/InboundMessageCallbackMessage.java @@ -45,12 +45,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -58,7 +56,7 @@ /** * Inbound Message Callback Message Schema */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class InboundMessageCallbackMessage { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @@ -102,7 +100,7 @@ public class InboundMessageCallbackMessage { public static final String SERIALIZED_NAME_MEDIA = "media"; @SerializedName(SERIALIZED_NAME_MEDIA) - private List media; + private List media = new ArrayList<>(); public static final String SERIALIZED_NAME_PRIORITY = "priority"; @SerializedName(SERIALIZED_NAME_PRIORITY) @@ -112,133 +110,120 @@ public InboundMessageCallbackMessage() { } public InboundMessageCallbackMessage id(String id) { - this.id = id; return this; } - /** + /** * Get id * @return id - **/ + */ @javax.annotation.Nonnull public String getId() { return id; } - public void setId(String id) { this.id = id; } public InboundMessageCallbackMessage owner(String owner) { - this.owner = owner; return this; } - /** + /** * Get owner * @return owner - **/ + */ @javax.annotation.Nonnull public String getOwner() { return owner; } - public void setOwner(String owner) { this.owner = owner; } public InboundMessageCallbackMessage applicationId(String applicationId) { - this.applicationId = applicationId; return this; } - /** + /** * Get applicationId * @return applicationId - **/ + */ @javax.annotation.Nonnull public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public InboundMessageCallbackMessage time(OffsetDateTime time) { - this.time = time; return this; } - /** + /** * Get time * @return time - **/ + */ @javax.annotation.Nonnull public OffsetDateTime getTime() { return time; } - public void setTime(OffsetDateTime time) { this.time = time; } public InboundMessageCallbackMessage segmentCount(Integer segmentCount) { - this.segmentCount = segmentCount; return this; } - /** + /** * Get segmentCount * @return segmentCount - **/ + */ @javax.annotation.Nonnull public Integer getSegmentCount() { return segmentCount; } - public void setSegmentCount(Integer segmentCount) { this.segmentCount = segmentCount; } public InboundMessageCallbackMessage direction(MessageDirectionEnum direction) { - this.direction = direction; return this; } - /** + /** * Get direction * @return direction - **/ + */ @javax.annotation.Nonnull public MessageDirectionEnum getDirection() { return direction; } - public void setDirection(MessageDirectionEnum direction) { this.direction = direction; } public InboundMessageCallbackMessage to(Set to) { - this.to = to; return this; } @@ -251,86 +236,78 @@ public InboundMessageCallbackMessage addToItem(String toItem) { return this; } - /** + /** * Get to * @return to - **/ + */ @javax.annotation.Nonnull public Set getTo() { return to; } - public void setTo(Set to) { this.to = to; } public InboundMessageCallbackMessage from(String from) { - this.from = from; return this; } - /** + /** * Get from * @return from - **/ + */ @javax.annotation.Nonnull public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public InboundMessageCallbackMessage text(String text) { - this.text = text; return this; } - /** + /** * Get text * @return text - **/ + */ @javax.annotation.Nonnull public String getText() { return text; } - public void setText(String text) { this.text = text; } public InboundMessageCallbackMessage tag(String tag) { - this.tag = tag; return this; } - /** + /** * Get tag * @return tag - **/ + */ @javax.annotation.Nullable public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public InboundMessageCallbackMessage media(List media) { - this.media = media; return this; } @@ -343,37 +320,34 @@ public InboundMessageCallbackMessage addMediaItem(URI mediaItem) { return this; } - /** + /** * Get media * @return media - **/ + */ @javax.annotation.Nullable public List getMedia() { return media; } - public void setMedia(List media) { this.media = media; } public InboundMessageCallbackMessage priority(PriorityEnum priority) { - this.priority = priority; return this; } - /** + /** * Get priority * @return priority - **/ + */ @javax.annotation.Nullable public PriorityEnum getPriority() { return priority; } - public void setPriority(PriorityEnum priority) { this.priority = priority; } @@ -518,12 +492,12 @@ private String toIndentedString(Object o) { 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 InboundMessageCallbackMessage - */ + /** + * 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 InboundMessageCallbackMessage + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!InboundMessageCallbackMessage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -547,6 +521,8 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti 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`"); @@ -566,6 +542,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti 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")); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @@ -596,7 +576,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -635,22 +620,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of InboundMessageCallbackMessage given an JSON string - * - * @param jsonString JSON string - * @return An instance of InboundMessageCallbackMessage - * @throws IOException if the JSON string is invalid with respect to InboundMessageCallbackMessage - */ + /** + * Create an instance of InboundMessageCallbackMessage given an JSON string + * + * @param jsonString JSON string + * @return An instance of InboundMessageCallbackMessage + * @throws IOException if the JSON string is invalid with respect to InboundMessageCallbackMessage + */ public static InboundMessageCallbackMessage fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, InboundMessageCallbackMessage.class); } - /** - * Convert an instance of InboundMessageCallbackMessage to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of InboundMessageCallbackMessage 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/InitiateCallback.java b/src/main/java/com/bandwidth/sdk/model/InitiateCallback.java index 9b901de0..b5f3e3b3 100644 --- a/src/main/java/com/bandwidth/sdk/model/InitiateCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/InitiateCallback.java @@ -42,12 +42,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -55,7 +53,7 @@ /** * The Initiate event is fired when an inbound call is received for a Telephone Number on your Account. It is sent to the URL specified in the application associated with the location (sip-peer) that the called telephone number belongs to. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class InitiateCallback { public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; @SerializedName(SERIALIZED_NAME_EVENT_TYPE) @@ -109,252 +107,228 @@ public InitiateCallback() { } public InitiateCallback eventType(String eventType) { - this.eventType = eventType; return this; } - /** + /** * 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. * @return eventType - **/ + */ @javax.annotation.Nullable public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public InitiateCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } - /** + /** * 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. * @return eventTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public InitiateCallback accountId(String accountId) { - this.accountId = accountId; return this; } - /** + /** * The user account associated with the call. * @return accountId - **/ + */ @javax.annotation.Nullable public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public InitiateCallback applicationId(String applicationId) { - this.applicationId = applicationId; return this; } - /** + /** * The id of the application associated with the call. * @return applicationId - **/ + */ @javax.annotation.Nullable public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public InitiateCallback from(String from) { - this.from = from; return this; } - /** + /** * The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). * @return from - **/ + */ @javax.annotation.Nullable public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public InitiateCallback to(String to) { - this.to = to; return this; } - /** + /** * The phone number that received the call, in E.164 format (e.g. +15555555555). * @return to - **/ + */ @javax.annotation.Nullable public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public InitiateCallback direction(CallDirectionEnum direction) { - this.direction = direction; return this; } - /** + /** * Get direction * @return direction - **/ + */ @javax.annotation.Nullable public CallDirectionEnum getDirection() { return direction; } - public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public InitiateCallback callId(String callId) { - this.callId = callId; return this; } - /** + /** * The call id associated with the event. * @return callId - **/ + */ @javax.annotation.Nullable public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public InitiateCallback callUrl(URI callUrl) { - this.callUrl = callUrl; return this; } - /** + /** * The URL of the call associated with the event. * @return callUrl - **/ + */ @javax.annotation.Nullable public URI getCallUrl() { return callUrl; } - public void setCallUrl(URI callUrl) { this.callUrl = callUrl; } public InitiateCallback startTime(OffsetDateTime startTime) { - this.startTime = startTime; return this; } - /** + /** * Time the call was started, in ISO 8601 format. * @return startTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getStartTime() { return startTime; } - public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public InitiateCallback diversion(Diversion diversion) { - this.diversion = diversion; return this; } - /** + /** * Get diversion * @return diversion - **/ + */ @javax.annotation.Nullable public Diversion getDiversion() { return diversion; } - public void setDiversion(Diversion diversion) { this.diversion = diversion; } public InitiateCallback stirShaken(StirShaken stirShaken) { - this.stirShaken = stirShaken; return this; } - /** + /** * Get stirShaken * @return stirShaken - **/ + */ @javax.annotation.Nullable public StirShaken getStirShaken() { return stirShaken; } - public void setStirShaken(StirShaken stirShaken) { this.stirShaken = stirShaken; } @@ -490,12 +464,12 @@ private String toIndentedString(Object o) { 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 InitiateCallback - */ + /** + * 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 InitiateCallback + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!InitiateCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -518,6 +492,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti 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())); } + // validate the optional field `direction` + if (jsonObj.get("direction") != null && !jsonObj.get("direction").isJsonNull()) { + CallDirectionEnum.validateJsonElement(jsonObj.get("direction")); + } if ((jsonObj.get("callId") != null && !jsonObj.get("callId").isJsonNull()) && !jsonObj.get("callId").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `callId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callId").toString())); } @@ -562,7 +540,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -601,22 +584,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of InitiateCallback given an JSON string - * - * @param jsonString JSON string - * @return An instance of InitiateCallback - * @throws IOException if the JSON string is invalid with respect to InitiateCallback - */ + /** + * Create an instance of InitiateCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of InitiateCallback + * @throws IOException if the JSON string is invalid with respect to InitiateCallback + */ public static InitiateCallback fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, InitiateCallback.class); } - /** - * Convert an instance of InitiateCallback to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of InitiateCallback 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/ListMessageDirectionEnum.java b/src/main/java/com/bandwidth/sdk/model/ListMessageDirectionEnum.java index 5fbe269b..f175c9cd 100644 --- a/src/main/java/com/bandwidth/sdk/model/ListMessageDirectionEnum.java +++ b/src/main/java/com/bandwidth/sdk/model/ListMessageDirectionEnum.java @@ -18,6 +18,7 @@ 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; @@ -68,5 +69,10 @@ public ListMessageDirectionEnum read(final JsonReader jsonReader) throws IOExcep return ListMessageDirectionEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ListMessageDirectionEnum.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 465c76f0..3781989e 100644 --- a/src/main/java/com/bandwidth/sdk/model/ListMessageItem.java +++ b/src/main/java/com/bandwidth/sdk/model/ListMessageItem.java @@ -42,12 +42,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -55,7 +53,7 @@ /** * ListMessageItem */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class ListMessageItem { public static final String SERIALIZED_NAME_MESSAGE_ID = "messageId"; @SerializedName(SERIALIZED_NAME_MESSAGE_ID) @@ -129,357 +127,323 @@ public ListMessageItem() { } public ListMessageItem messageId(String messageId) { - this.messageId = messageId; return this; } - /** + /** * The message id * @return messageId - **/ + */ @javax.annotation.Nullable public String getMessageId() { return messageId; } - public void setMessageId(String messageId) { this.messageId = messageId; } public ListMessageItem accountId(String accountId) { - this.accountId = accountId; return this; } - /** + /** * The account id associated with this message. * @return accountId - **/ + */ @javax.annotation.Nullable public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public ListMessageItem sourceTn(String sourceTn) { - this.sourceTn = sourceTn; return this; } - /** + /** * The source phone number of the message. * @return sourceTn - **/ + */ @javax.annotation.Nullable public String getSourceTn() { return sourceTn; } - public void setSourceTn(String sourceTn) { this.sourceTn = sourceTn; } public ListMessageItem destinationTn(String destinationTn) { - this.destinationTn = destinationTn; return this; } - /** + /** * The recipient phone number of the message. * @return destinationTn - **/ + */ @javax.annotation.Nullable public String getDestinationTn() { return destinationTn; } - public void setDestinationTn(String destinationTn) { this.destinationTn = destinationTn; } public ListMessageItem messageStatus(MessageStatusEnum messageStatus) { - this.messageStatus = messageStatus; return this; } - /** + /** * Get messageStatus * @return messageStatus - **/ + */ @javax.annotation.Nullable public MessageStatusEnum getMessageStatus() { return messageStatus; } - public void setMessageStatus(MessageStatusEnum messageStatus) { this.messageStatus = messageStatus; } public ListMessageItem messageDirection(ListMessageDirectionEnum messageDirection) { - this.messageDirection = messageDirection; return this; } - /** + /** * Get messageDirection * @return messageDirection - **/ + */ @javax.annotation.Nullable public ListMessageDirectionEnum getMessageDirection() { return messageDirection; } - public void setMessageDirection(ListMessageDirectionEnum messageDirection) { this.messageDirection = messageDirection; } public ListMessageItem messageType(MessageTypeEnum messageType) { - this.messageType = messageType; return this; } - /** + /** * Get messageType * @return messageType - **/ + */ @javax.annotation.Nullable public MessageTypeEnum getMessageType() { return messageType; } - public void setMessageType(MessageTypeEnum messageType) { this.messageType = messageType; } public ListMessageItem segmentCount(Integer segmentCount) { - this.segmentCount = segmentCount; return this; } - /** + /** * The number of segments the message was sent as. * @return segmentCount - **/ + */ @javax.annotation.Nullable public Integer getSegmentCount() { return segmentCount; } - public void setSegmentCount(Integer segmentCount) { this.segmentCount = segmentCount; } public ListMessageItem errorCode(Integer errorCode) { - this.errorCode = errorCode; return this; } - /** + /** * The numeric error code of the message. * @return errorCode - **/ + */ @javax.annotation.Nullable public Integer getErrorCode() { return errorCode; } - public void setErrorCode(Integer errorCode) { this.errorCode = errorCode; } public ListMessageItem receiveTime(OffsetDateTime receiveTime) { - this.receiveTime = receiveTime; return this; } - /** + /** * The ISO 8601 datetime of the message. * @return receiveTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getReceiveTime() { return receiveTime; } - public void setReceiveTime(OffsetDateTime receiveTime) { this.receiveTime = receiveTime; } public ListMessageItem carrierName(String carrierName) { - this.carrierName = carrierName; return this; } - /** + /** * The name of the carrier. Not currently supported for MMS coming soon. * @return carrierName - **/ + */ @javax.annotation.Nullable public String getCarrierName() { return carrierName; } - public void setCarrierName(String carrierName) { this.carrierName = carrierName; } public ListMessageItem messageSize(Integer messageSize) { - this.messageSize = messageSize; return this; } - /** + /** * The size of the message including message content and headers. * @return messageSize - **/ + */ @javax.annotation.Nullable public Integer getMessageSize() { return messageSize; } - public void setMessageSize(Integer messageSize) { this.messageSize = messageSize; } public ListMessageItem messageLength(Integer messageLength) { - this.messageLength = messageLength; return this; } - /** + /** * The length of the message content. * @return messageLength - **/ + */ @javax.annotation.Nullable public Integer getMessageLength() { return messageLength; } - public void setMessageLength(Integer messageLength) { this.messageLength = messageLength; } public ListMessageItem attachmentCount(Integer attachmentCount) { - this.attachmentCount = attachmentCount; return this; } - /** + /** * The number of attachments the message has. * @return attachmentCount - **/ + */ @javax.annotation.Nullable public Integer getAttachmentCount() { return attachmentCount; } - public void setAttachmentCount(Integer attachmentCount) { this.attachmentCount = attachmentCount; } public ListMessageItem recipientCount(Integer recipientCount) { - this.recipientCount = recipientCount; return this; } - /** + /** * The number of recipients the message has. * @return recipientCount - **/ + */ @javax.annotation.Nullable public Integer getRecipientCount() { return recipientCount; } - public void setRecipientCount(Integer recipientCount) { this.recipientCount = recipientCount; } public ListMessageItem campaignClass(String campaignClass) { - this.campaignClass = campaignClass; return this; } - /** + /** * The campaign class of the message if it has one. * @return campaignClass - **/ + */ @javax.annotation.Nullable public String getCampaignClass() { return campaignClass; } - public void setCampaignClass(String campaignClass) { this.campaignClass = campaignClass; } public ListMessageItem campaignId(String campaignId) { - this.campaignId = campaignId; return this; } - /** + /** * The campaign ID of the message if it has one. * @return campaignId - **/ + */ @javax.annotation.Nullable public String getCampaignId() { return campaignId; } - public void setCampaignId(String campaignId) { this.campaignId = campaignId; } @@ -641,12 +605,12 @@ private String toIndentedString(Object o) { 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 ListMessageItem - */ + /** + * 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 ListMessageItem + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!ListMessageItem.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -666,6 +630,18 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if ((jsonObj.get("destinationTn") != null && !jsonObj.get("destinationTn").isJsonNull()) && !jsonObj.get("destinationTn").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `destinationTn` to be a primitive type in the JSON string but got `%s`", jsonObj.get("destinationTn").toString())); } + // validate the optional field `messageStatus` + if (jsonObj.get("messageStatus") != null && !jsonObj.get("messageStatus").isJsonNull()) { + MessageStatusEnum.validateJsonElement(jsonObj.get("messageStatus")); + } + // validate the optional field `messageDirection` + if (jsonObj.get("messageDirection") != null && !jsonObj.get("messageDirection").isJsonNull()) { + ListMessageDirectionEnum.validateJsonElement(jsonObj.get("messageDirection")); + } + // validate the optional field `messageType` + if (jsonObj.get("messageType") != null && !jsonObj.get("messageType").isJsonNull()) { + MessageTypeEnum.validateJsonElement(jsonObj.get("messageType")); + } 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())); } @@ -705,7 +681,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -744,22 +725,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of ListMessageItem given an JSON string - * - * @param jsonString JSON string - * @return An instance of ListMessageItem - * @throws IOException if the JSON string is invalid with respect to ListMessageItem - */ + /** + * Create an instance of ListMessageItem given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListMessageItem + * @throws IOException if the JSON string is invalid with respect to ListMessageItem + */ public static ListMessageItem fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, ListMessageItem.class); } - /** - * Convert an instance of ListMessageItem to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of ListMessageItem 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/LookupRequest.java b/src/main/java/com/bandwidth/sdk/model/LookupRequest.java index f41a7f01..2a1118a6 100644 --- a/src/main/java/com/bandwidth/sdk/model/LookupRequest.java +++ b/src/main/java/com/bandwidth/sdk/model/LookupRequest.java @@ -39,12 +39,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -52,7 +50,7 @@ /** * Create phone number lookup request. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class LookupRequest { public static final String SERIALIZED_NAME_TNS = "tns"; @SerializedName(SERIALIZED_NAME_TNS) @@ -62,7 +60,6 @@ public LookupRequest() { } public LookupRequest tns(List tns) { - this.tns = tns; return this; } @@ -75,16 +72,15 @@ public LookupRequest addTnsItem(String tnsItem) { return this; } - /** + /** * Get tns * @return tns - **/ + */ @javax.annotation.Nonnull public List getTns() { return tns; } - public void setTns(List tns) { this.tns = tns; } @@ -188,12 +184,12 @@ private String toIndentedString(Object o) { openapiRequiredFields.add("tns"); } - /** - * 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 LookupRequest - */ + /** + * 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 LookupRequest + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!LookupRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -244,7 +240,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -283,22 +284,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of LookupRequest given an JSON string - * - * @param jsonString JSON string - * @return An instance of LookupRequest - * @throws IOException if the JSON string is invalid with respect to LookupRequest - */ + /** + * Create an instance of LookupRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of LookupRequest + * @throws IOException if the JSON string is invalid with respect to LookupRequest + */ public static LookupRequest fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, LookupRequest.class); } - /** - * Convert an instance of LookupRequest to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of LookupRequest 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/LookupResult.java b/src/main/java/com/bandwidth/sdk/model/LookupResult.java index 7238b192..f4001240 100644 --- a/src/main/java/com/bandwidth/sdk/model/LookupResult.java +++ b/src/main/java/com/bandwidth/sdk/model/LookupResult.java @@ -37,12 +37,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -50,7 +48,7 @@ /** * Carrier information results for the specified telephone number. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class LookupResult { public static final String SERIALIZED_NAME_RESPONSE_CODE = "Response Code"; @SerializedName(SERIALIZED_NAME_RESPONSE_CODE) @@ -92,189 +90,171 @@ public LookupResult() { } public LookupResult responseCode(Integer responseCode) { - this.responseCode = responseCode; return this; } - /** + /** * Our vendor's response code. * @return responseCode - **/ + */ @javax.annotation.Nullable public Integer getResponseCode() { return responseCode; } - public void setResponseCode(Integer responseCode) { this.responseCode = responseCode; } public LookupResult message(String message) { - this.message = message; return this; } - /** + /** * Message associated with the response code. * @return message - **/ + */ @javax.annotation.Nullable public String getMessage() { return message; } - public void setMessage(String message) { this.message = message; } public LookupResult e164Format(String e164Format) { - this.e164Format = e164Format; return this; } - /** + /** * The telephone number in E.164 format. * @return e164Format - **/ + */ @javax.annotation.Nullable public String getE164Format() { return e164Format; } - public void setE164Format(String e164Format) { this.e164Format = e164Format; } public LookupResult formatted(String formatted) { - this.formatted = formatted; return this; } - /** + /** * The formatted version of the telephone number. * @return formatted - **/ + */ @javax.annotation.Nullable public String getFormatted() { return formatted; } - public void setFormatted(String formatted) { this.formatted = formatted; } public LookupResult country(String country) { - this.country = country; return this; } - /** + /** * The country of the telephone number. * @return country - **/ + */ @javax.annotation.Nullable public String getCountry() { return country; } - public void setCountry(String country) { this.country = country; } public LookupResult lineType(String lineType) { - this.lineType = lineType; return this; } - /** + /** * The line type of the telephone number. * @return lineType - **/ + */ @javax.annotation.Nullable public String getLineType() { return lineType; } - public void setLineType(String lineType) { this.lineType = lineType; } public LookupResult lineProvider(String lineProvider) { - this.lineProvider = lineProvider; return this; } - /** + /** * The messaging service provider of the telephone number. * @return lineProvider - **/ + */ @javax.annotation.Nullable public String getLineProvider() { return lineProvider; } - public void setLineProvider(String lineProvider) { this.lineProvider = lineProvider; } public LookupResult mobileCountryCode(String mobileCountryCode) { - this.mobileCountryCode = mobileCountryCode; return this; } - /** + /** * The first half of the Home Network Identity (HNI). * @return mobileCountryCode - **/ + */ @javax.annotation.Nullable public String getMobileCountryCode() { return mobileCountryCode; } - public void setMobileCountryCode(String mobileCountryCode) { this.mobileCountryCode = mobileCountryCode; } public LookupResult mobileNetworkCode(String mobileNetworkCode) { - this.mobileNetworkCode = mobileNetworkCode; return this; } - /** + /** * The second half of the HNI. * @return mobileNetworkCode - **/ + */ @javax.annotation.Nullable public String getMobileNetworkCode() { return mobileNetworkCode; } - public void setMobileNetworkCode(String mobileNetworkCode) { this.mobileNetworkCode = mobileNetworkCode; } @@ -401,12 +381,12 @@ private String toIndentedString(Object o) { 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 LookupResult - */ + /** + * 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 LookupResult + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!LookupResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -468,7 +448,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -507,22 +492,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of LookupResult given an JSON string - * - * @param jsonString JSON string - * @return An instance of LookupResult - * @throws IOException if the JSON string is invalid with respect to LookupResult - */ + /** + * Create an instance of LookupResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of LookupResult + * @throws IOException if the JSON string is invalid with respect to LookupResult + */ public static LookupResult fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, LookupResult.class); } - /** - * Convert an instance of LookupResult to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of LookupResult 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/LookupStatus.java b/src/main/java/com/bandwidth/sdk/model/LookupStatus.java index 227b1bd3..6facf948 100644 --- a/src/main/java/com/bandwidth/sdk/model/LookupStatus.java +++ b/src/main/java/com/bandwidth/sdk/model/LookupStatus.java @@ -41,12 +41,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -54,7 +52,7 @@ /** * If requestId exists, the result for that request is returned. See the Examples for details on the various responses that you can receive. Generally, if you see a Response Code of 0 in a result for a TN, information will be available for it. Any other Response Code will indicate no information was available for the TN. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class LookupStatus { public static final String SERIALIZED_NAME_REQUEST_ID = "requestId"; @SerializedName(SERIALIZED_NAME_REQUEST_ID) @@ -66,59 +64,54 @@ public class LookupStatus { public static final String SERIALIZED_NAME_RESULT = "result"; @SerializedName(SERIALIZED_NAME_RESULT) - private List result; + private List result = new ArrayList<>(); public static final String SERIALIZED_NAME_FAILED_TELEPHONE_NUMBERS = "failedTelephoneNumbers"; @SerializedName(SERIALIZED_NAME_FAILED_TELEPHONE_NUMBERS) - private List failedTelephoneNumbers; + private List failedTelephoneNumbers = new ArrayList<>(); public LookupStatus() { } public LookupStatus requestId(String requestId) { - this.requestId = requestId; return this; } - /** + /** * The requestId. * @return requestId - **/ + */ @javax.annotation.Nullable public String getRequestId() { return requestId; } - public void setRequestId(String requestId) { this.requestId = requestId; } public LookupStatus status(LookupStatusEnum status) { - this.status = status; return this; } - /** + /** * Get status * @return status - **/ + */ @javax.annotation.Nullable public LookupStatusEnum getStatus() { return status; } - public void setStatus(LookupStatusEnum status) { this.status = status; } public LookupStatus result(List result) { - this.result = result; return this; } @@ -131,23 +124,21 @@ public LookupStatus addResultItem(LookupResult resultItem) { return this; } - /** + /** * The carrier information results for the specified telephone number. * @return result - **/ + */ @javax.annotation.Nullable public List getResult() { return result; } - public void setResult(List result) { this.result = result; } public LookupStatus failedTelephoneNumbers(List failedTelephoneNumbers) { - this.failedTelephoneNumbers = failedTelephoneNumbers; return this; } @@ -160,16 +151,15 @@ public LookupStatus addFailedTelephoneNumbersItem(String failedTelephoneNumbersI return this; } - /** + /** * The telephone numbers whose lookup failed. * @return failedTelephoneNumbers - **/ + */ @javax.annotation.Nullable public List getFailedTelephoneNumbers() { return failedTelephoneNumbers; } - public void setFailedTelephoneNumbers(List failedTelephoneNumbers) { this.failedTelephoneNumbers = failedTelephoneNumbers; } @@ -281,12 +271,12 @@ private String toIndentedString(Object o) { 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 LookupStatus - */ + /** + * 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 LookupStatus + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!LookupStatus.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -297,6 +287,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if ((jsonObj.get("requestId") != null && !jsonObj.get("requestId").isJsonNull()) && !jsonObj.get("requestId").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `requestId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("requestId").toString())); } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + LookupStatusEnum.validateJsonElement(jsonObj.get("status")); + } if (jsonObj.get("result") != null && !jsonObj.get("result").isJsonNull()) { JsonArray jsonArrayresult = jsonObj.getAsJsonArray("result"); if (jsonArrayresult != null) { @@ -345,7 +339,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -384,22 +383,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of LookupStatus given an JSON string - * - * @param jsonString JSON string - * @return An instance of LookupStatus - * @throws IOException if the JSON string is invalid with respect to LookupStatus - */ + /** + * Create an instance of LookupStatus given an JSON string + * + * @param jsonString JSON string + * @return An instance of LookupStatus + * @throws IOException if the JSON string is invalid with respect to LookupStatus + */ public static LookupStatus fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, LookupStatus.class); } - /** - * Convert an instance of LookupStatus to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of LookupStatus 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/LookupStatusEnum.java b/src/main/java/com/bandwidth/sdk/model/LookupStatusEnum.java index 59798a1f..02a72484 100644 --- a/src/main/java/com/bandwidth/sdk/model/LookupStatusEnum.java +++ b/src/main/java/com/bandwidth/sdk/model/LookupStatusEnum.java @@ -18,6 +18,7 @@ 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; @@ -72,5 +73,10 @@ public LookupStatusEnum read(final JsonReader jsonReader) throws IOException { return LookupStatusEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + LookupStatusEnum.fromValue(value); + } } diff --git a/src/main/java/com/bandwidth/sdk/model/MachineDetectionCompleteCallback.java b/src/main/java/com/bandwidth/sdk/model/MachineDetectionCompleteCallback.java index ab96ac6b..7df2350d 100644 --- a/src/main/java/com/bandwidth/sdk/model/MachineDetectionCompleteCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/MachineDetectionCompleteCallback.java @@ -42,12 +42,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -55,7 +53,7 @@ /** * This event is sent to the url informed when requesting a machine detection operation. It contains the machine detection operation result, which can be: human, answering-machine, silence, timeout, error. This event is not sent when sync answering machine detection mode is chosen. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class MachineDetectionCompleteCallback { public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; @SerializedName(SERIALIZED_NAME_EVENT_TYPE) @@ -117,294 +115,266 @@ public MachineDetectionCompleteCallback() { } public MachineDetectionCompleteCallback eventType(String eventType) { - this.eventType = eventType; return this; } - /** + /** * 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. * @return eventType - **/ + */ @javax.annotation.Nullable public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public MachineDetectionCompleteCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } - /** + /** * 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. * @return eventTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public MachineDetectionCompleteCallback accountId(String accountId) { - this.accountId = accountId; return this; } - /** + /** * The user account associated with the call. * @return accountId - **/ + */ @javax.annotation.Nullable public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public MachineDetectionCompleteCallback applicationId(String applicationId) { - this.applicationId = applicationId; return this; } - /** + /** * The id of the application associated with the call. * @return applicationId - **/ + */ @javax.annotation.Nullable public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public MachineDetectionCompleteCallback from(String from) { - this.from = from; return this; } - /** + /** * The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). * @return from - **/ + */ @javax.annotation.Nullable public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public MachineDetectionCompleteCallback to(String to) { - this.to = to; return this; } - /** + /** * The phone number that received the call, in E.164 format (e.g. +15555555555). * @return to - **/ + */ @javax.annotation.Nullable public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public MachineDetectionCompleteCallback direction(CallDirectionEnum direction) { - this.direction = direction; return this; } - /** + /** * Get direction * @return direction - **/ + */ @javax.annotation.Nullable public CallDirectionEnum getDirection() { return direction; } - public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public MachineDetectionCompleteCallback callId(String callId) { - this.callId = callId; return this; } - /** + /** * The call id associated with the event. * @return callId - **/ + */ @javax.annotation.Nullable public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public MachineDetectionCompleteCallback callUrl(URI callUrl) { - this.callUrl = callUrl; return this; } - /** + /** * The URL of the call associated with the event. * @return callUrl - **/ + */ @javax.annotation.Nullable public URI getCallUrl() { return callUrl; } - public void setCallUrl(URI callUrl) { this.callUrl = callUrl; } public MachineDetectionCompleteCallback enqueuedTime(OffsetDateTime enqueuedTime) { - this.enqueuedTime = enqueuedTime; return this; } - /** + /** * (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. * @return enqueuedTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } - public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public MachineDetectionCompleteCallback startTime(OffsetDateTime startTime) { - this.startTime = startTime; return this; } - /** + /** * Time the call was started, in ISO 8601 format. * @return startTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getStartTime() { return startTime; } - public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public MachineDetectionCompleteCallback answerTime(OffsetDateTime answerTime) { - this.answerTime = answerTime; return this; } - /** + /** * Time the call was answered, in ISO 8601 format. * @return answerTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getAnswerTime() { return answerTime; } - public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public MachineDetectionCompleteCallback tag(String tag) { - this.tag = tag; return this; } - /** + /** * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. * @return tag - **/ + */ @javax.annotation.Nullable public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public MachineDetectionCompleteCallback machineDetectionResult(MachineDetectionResult machineDetectionResult) { - this.machineDetectionResult = machineDetectionResult; return this; } - /** + /** * Get machineDetectionResult * @return machineDetectionResult - **/ + */ @javax.annotation.Nullable public MachineDetectionResult getMachineDetectionResult() { return machineDetectionResult; } - public void setMachineDetectionResult(MachineDetectionResult machineDetectionResult) { this.machineDetectionResult = machineDetectionResult; } @@ -557,12 +527,12 @@ private String toIndentedString(Object o) { 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 MachineDetectionCompleteCallback - */ + /** + * 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 MachineDetectionCompleteCallback + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!MachineDetectionCompleteCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -585,6 +555,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti 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())); } + // validate the optional field `direction` + if (jsonObj.get("direction") != null && !jsonObj.get("direction").isJsonNull()) { + CallDirectionEnum.validateJsonElement(jsonObj.get("direction")); + } if ((jsonObj.get("callId") != null && !jsonObj.get("callId").isJsonNull()) && !jsonObj.get("callId").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `callId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callId").toString())); } @@ -628,7 +602,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -667,22 +646,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of MachineDetectionCompleteCallback given an JSON string - * - * @param jsonString JSON string - * @return An instance of MachineDetectionCompleteCallback - * @throws IOException if the JSON string is invalid with respect to MachineDetectionCompleteCallback - */ + /** + * Create an instance of MachineDetectionCompleteCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of MachineDetectionCompleteCallback + * @throws IOException if the JSON string is invalid with respect to MachineDetectionCompleteCallback + */ public static MachineDetectionCompleteCallback fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, MachineDetectionCompleteCallback.class); } - /** - * Convert an instance of MachineDetectionCompleteCallback to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of MachineDetectionCompleteCallback 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/MachineDetectionConfiguration.java b/src/main/java/com/bandwidth/sdk/model/MachineDetectionConfiguration.java index eed86c70..585aaa92 100644 --- a/src/main/java/com/bandwidth/sdk/model/MachineDetectionConfiguration.java +++ b/src/main/java/com/bandwidth/sdk/model/MachineDetectionConfiguration.java @@ -41,12 +41,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -54,7 +52,7 @@ /** * The machine detection request used to perform <a href='/docs/voice/guides/machineDetection'>machine detection</a> on the call. Currently, there is an issue where decimal values are not getting processed correctly. Please use whole number values. We are working to resolve this issue. Please contact Bandwidth Support if you need more information. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class MachineDetectionConfiguration { public static final String SERIALIZED_NAME_MODE = "mode"; @SerializedName(SERIALIZED_NAME_MODE) @@ -120,315 +118,285 @@ public MachineDetectionConfiguration() { } public MachineDetectionConfiguration mode(MachineDetectionModeEnum mode) { - this.mode = mode; return this; } - /** + /** * Get mode * @return mode - **/ + */ @javax.annotation.Nullable public MachineDetectionModeEnum getMode() { return mode; } - public void setMode(MachineDetectionModeEnum mode) { this.mode = mode; } public MachineDetectionConfiguration detectionTimeout(Double detectionTimeout) { - this.detectionTimeout = detectionTimeout; return this; } - /** + /** * The timeout used for the whole operation, in seconds. If no result is determined in this period, a callback with a `timeout` result is sent. * @return detectionTimeout - **/ + */ @javax.annotation.Nullable public Double getDetectionTimeout() { return detectionTimeout; } - public void setDetectionTimeout(Double detectionTimeout) { this.detectionTimeout = detectionTimeout; } public MachineDetectionConfiguration silenceTimeout(Double silenceTimeout) { - this.silenceTimeout = silenceTimeout; return this; } - /** + /** * If no speech is detected in this period, a callback with a 'silence' result is sent. * @return silenceTimeout - **/ + */ @javax.annotation.Nullable public Double getSilenceTimeout() { return silenceTimeout; } - public void setSilenceTimeout(Double silenceTimeout) { this.silenceTimeout = silenceTimeout; } public MachineDetectionConfiguration speechThreshold(Double speechThreshold) { - this.speechThreshold = speechThreshold; return this; } - /** + /** * When speech has ended and a result couldn't be determined based on the audio content itself, this value is used to determine if the speaker is a machine based on the speech duration. If the length of the speech detected is greater than or equal to this threshold, the result will be 'answering-machine'. If the length of speech detected is below this threshold, the result will be 'human'. * @return speechThreshold - **/ + */ @javax.annotation.Nullable public Double getSpeechThreshold() { return speechThreshold; } - public void setSpeechThreshold(Double speechThreshold) { this.speechThreshold = speechThreshold; } public MachineDetectionConfiguration speechEndThreshold(Double speechEndThreshold) { - this.speechEndThreshold = speechEndThreshold; return this; } - /** + /** * Amount of silence (in seconds) before assuming the callee has finished speaking. * @return speechEndThreshold - **/ + */ @javax.annotation.Nullable public Double getSpeechEndThreshold() { return speechEndThreshold; } - public void setSpeechEndThreshold(Double speechEndThreshold) { this.speechEndThreshold = speechEndThreshold; } public MachineDetectionConfiguration machineSpeechEndThreshold(Double machineSpeechEndThreshold) { - this.machineSpeechEndThreshold = machineSpeechEndThreshold; return this; } - /** + /** * When an answering machine is detected, the amount of silence (in seconds) before assuming the message has finished playing. If not provided it will default to the speechEndThreshold value. * @return machineSpeechEndThreshold - **/ + */ @javax.annotation.Nullable public Double getMachineSpeechEndThreshold() { return machineSpeechEndThreshold; } - public void setMachineSpeechEndThreshold(Double machineSpeechEndThreshold) { this.machineSpeechEndThreshold = machineSpeechEndThreshold; } public MachineDetectionConfiguration delayResult(Boolean delayResult) { - this.delayResult = delayResult; return this; } - /** + /** * If set to 'true' and if an answering machine is detected, the 'answering-machine' callback will be delayed until the machine is done speaking, or an end of message tone is detected, or until the 'detectionTimeout' is exceeded. If false, the 'answering-machine' result is sent immediately. * @return delayResult - **/ + */ @javax.annotation.Nullable public Boolean getDelayResult() { return delayResult; } - public void setDelayResult(Boolean delayResult) { this.delayResult = delayResult; } public MachineDetectionConfiguration callbackUrl(URI callbackUrl) { - this.callbackUrl = callbackUrl; return this; } - /** + /** * The URL to send the 'machineDetectionComplete' webhook when the detection is completed. Only for 'async' mode. * @return callbackUrl - **/ + */ @javax.annotation.Nullable public URI getCallbackUrl() { return callbackUrl; } - public void setCallbackUrl(URI callbackUrl) { this.callbackUrl = callbackUrl; } public MachineDetectionConfiguration callbackMethod(CallbackMethodEnum callbackMethod) { - this.callbackMethod = callbackMethod; return this; } - /** + /** * Get callbackMethod * @return callbackMethod - **/ + */ @javax.annotation.Nullable public CallbackMethodEnum getCallbackMethod() { return callbackMethod; } - public void setCallbackMethod(CallbackMethodEnum callbackMethod) { this.callbackMethod = callbackMethod; } public MachineDetectionConfiguration username(String username) { - this.username = username; return this; } - /** + /** * Basic auth username. * @return username - **/ + */ @javax.annotation.Nullable public String getUsername() { return username; } - public void setUsername(String username) { this.username = username; } public MachineDetectionConfiguration password(String password) { - this.password = password; return this; } - /** + /** * Basic auth password. * @return password - **/ + */ @javax.annotation.Nullable public String getPassword() { return password; } - public void setPassword(String password) { this.password = password; } public MachineDetectionConfiguration fallbackUrl(URI fallbackUrl) { - this.fallbackUrl = fallbackUrl; return this; } - /** + /** * A fallback URL which, if provided, will be used to retry the machine detection complete webhook delivery in case `callbackUrl` fails to respond * @return fallbackUrl - **/ + */ @javax.annotation.Nullable public URI getFallbackUrl() { return fallbackUrl; } - public void setFallbackUrl(URI fallbackUrl) { this.fallbackUrl = fallbackUrl; } public MachineDetectionConfiguration fallbackMethod(CallbackMethodEnum fallbackMethod) { - this.fallbackMethod = fallbackMethod; return this; } - /** + /** * Get fallbackMethod * @return fallbackMethod - **/ + */ @javax.annotation.Nullable public CallbackMethodEnum getFallbackMethod() { return fallbackMethod; } - public void setFallbackMethod(CallbackMethodEnum fallbackMethod) { this.fallbackMethod = fallbackMethod; } public MachineDetectionConfiguration fallbackUsername(String fallbackUsername) { - this.fallbackUsername = fallbackUsername; return this; } - /** + /** * Basic auth username. * @return fallbackUsername - **/ + */ @javax.annotation.Nullable public String getFallbackUsername() { return fallbackUsername; } - public void setFallbackUsername(String fallbackUsername) { this.fallbackUsername = fallbackUsername; } public MachineDetectionConfiguration fallbackPassword(String fallbackPassword) { - this.fallbackPassword = fallbackPassword; return this; } - /** + /** * Basic auth password. * @return fallbackPassword - **/ + */ @javax.annotation.Nullable public String getFallbackPassword() { return fallbackPassword; } - public void setFallbackPassword(String fallbackPassword) { this.fallbackPassword = fallbackPassword; } @@ -584,12 +552,12 @@ private String toIndentedString(Object o) { 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 MachineDetectionConfiguration - */ + /** + * 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 MachineDetectionConfiguration + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!MachineDetectionConfiguration.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -597,9 +565,17 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `mode` + if (jsonObj.get("mode") != null && !jsonObj.get("mode").isJsonNull()) { + MachineDetectionModeEnum.validateJsonElement(jsonObj.get("mode")); + } if ((jsonObj.get("callbackUrl") != null && !jsonObj.get("callbackUrl").isJsonNull()) && !jsonObj.get("callbackUrl").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `callbackUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callbackUrl").toString())); } + // validate the optional field `callbackMethod` + if (jsonObj.get("callbackMethod") != null && !jsonObj.get("callbackMethod").isJsonNull()) { + CallbackMethodEnum.validateJsonElement(jsonObj.get("callbackMethod")); + } if ((jsonObj.get("username") != null && !jsonObj.get("username").isJsonNull()) && !jsonObj.get("username").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString())); } @@ -609,6 +585,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if ((jsonObj.get("fallbackUrl") != null && !jsonObj.get("fallbackUrl").isJsonNull()) && !jsonObj.get("fallbackUrl").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `fallbackUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fallbackUrl").toString())); } + // validate the optional field `fallbackMethod` + if (jsonObj.get("fallbackMethod") != null && !jsonObj.get("fallbackMethod").isJsonNull()) { + CallbackMethodEnum.validateJsonElement(jsonObj.get("fallbackMethod")); + } if ((jsonObj.get("fallbackUsername") != null && !jsonObj.get("fallbackUsername").isJsonNull()) && !jsonObj.get("fallbackUsername").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `fallbackUsername` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fallbackUsername").toString())); } @@ -645,7 +625,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -684,22 +669,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of MachineDetectionConfiguration given an JSON string - * - * @param jsonString JSON string - * @return An instance of MachineDetectionConfiguration - * @throws IOException if the JSON string is invalid with respect to MachineDetectionConfiguration - */ + /** + * Create an instance of MachineDetectionConfiguration given an JSON string + * + * @param jsonString JSON string + * @return An instance of MachineDetectionConfiguration + * @throws IOException if the JSON string is invalid with respect to MachineDetectionConfiguration + */ public static MachineDetectionConfiguration fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, MachineDetectionConfiguration.class); } - /** - * Convert an instance of MachineDetectionConfiguration to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of MachineDetectionConfiguration 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/MachineDetectionModeEnum.java b/src/main/java/com/bandwidth/sdk/model/MachineDetectionModeEnum.java index 07bba122..633c38e1 100644 --- a/src/main/java/com/bandwidth/sdk/model/MachineDetectionModeEnum.java +++ b/src/main/java/com/bandwidth/sdk/model/MachineDetectionModeEnum.java @@ -18,6 +18,7 @@ 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; @@ -68,5 +69,10 @@ public MachineDetectionModeEnum read(final JsonReader jsonReader) throws IOExcep return MachineDetectionModeEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + MachineDetectionModeEnum.fromValue(value); + } } diff --git a/src/main/java/com/bandwidth/sdk/model/MachineDetectionResult.java b/src/main/java/com/bandwidth/sdk/model/MachineDetectionResult.java index 135144a7..4f215cb7 100644 --- a/src/main/java/com/bandwidth/sdk/model/MachineDetectionResult.java +++ b/src/main/java/com/bandwidth/sdk/model/MachineDetectionResult.java @@ -37,12 +37,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -50,7 +48,7 @@ /** * (optional) if machine detection was requested in sync mode, the result will be specified here. Possible values are the same as the async counterpart: Machine Detection Complete */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class MachineDetectionResult { public static final String SERIALIZED_NAME_VALUE = "value"; @SerializedName(SERIALIZED_NAME_VALUE) @@ -64,42 +62,38 @@ public MachineDetectionResult() { } public MachineDetectionResult value(String value) { - this.value = value; return this; } - /** + /** * Possible values are answering-machine, human, silence, timeout, or error. * @return value - **/ + */ @javax.annotation.Nullable public String getValue() { return value; } - public void setValue(String value) { this.value = value; } public MachineDetectionResult duration(String duration) { - this.duration = duration; return this; } - /** + /** * The amount of time it took to determine the result. * @return duration - **/ + */ @javax.annotation.Nullable public String getDuration() { return duration; } - public void setDuration(String duration) { this.duration = duration; } @@ -205,12 +199,12 @@ private String toIndentedString(Object o) { 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 MachineDetectionResult - */ + /** + * 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 MachineDetectionResult + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!MachineDetectionResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -254,7 +248,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -293,22 +292,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of MachineDetectionResult given an JSON string - * - * @param jsonString JSON string - * @return An instance of MachineDetectionResult - * @throws IOException if the JSON string is invalid with respect to MachineDetectionResult - */ + /** + * Create an instance of MachineDetectionResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of MachineDetectionResult + * @throws IOException if the JSON string is invalid with respect to MachineDetectionResult + */ public static MachineDetectionResult fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, MachineDetectionResult.class); } - /** - * Convert an instance of MachineDetectionResult to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of MachineDetectionResult 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/Media.java b/src/main/java/com/bandwidth/sdk/model/Media.java index 5465ff98..e2e019cf 100644 --- a/src/main/java/com/bandwidth/sdk/model/Media.java +++ b/src/main/java/com/bandwidth/sdk/model/Media.java @@ -37,12 +37,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -50,7 +48,7 @@ /** * Media */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class Media { public static final String SERIALIZED_NAME_CONTENT = "content"; @SerializedName(SERIALIZED_NAME_CONTENT) @@ -68,63 +66,57 @@ public Media() { } public Media content(String content) { - this.content = content; return this; } - /** + /** * Get content * @return content - **/ + */ @javax.annotation.Nullable public String getContent() { return content; } - public void setContent(String content) { this.content = content; } public Media contentLength(Integer contentLength) { - this.contentLength = contentLength; return this; } - /** + /** * Get contentLength * @return contentLength - **/ + */ @javax.annotation.Nullable public Integer getContentLength() { return contentLength; } - public void setContentLength(Integer contentLength) { this.contentLength = contentLength; } public Media mediaName(String mediaName) { - this.mediaName = mediaName; return this; } - /** + /** * Get mediaName * @return mediaName - **/ + */ @javax.annotation.Nullable public String getMediaName() { return mediaName; } - public void setMediaName(String mediaName) { this.mediaName = mediaName; } @@ -233,12 +225,12 @@ private String toIndentedString(Object o) { 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 Media - */ + /** + * 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 Media + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!Media.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -282,7 +274,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -321,22 +318,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of Media given an JSON string - * - * @param jsonString JSON string - * @return An instance of Media - * @throws IOException if the JSON string is invalid with respect to Media - */ + /** + * Create an instance of Media given an JSON string + * + * @param jsonString JSON string + * @return An instance of Media + * @throws IOException if the JSON string is invalid with respect to Media + */ public static Media fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, Media.class); } - /** - * Convert an instance of Media to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of Media 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/Message.java b/src/main/java/com/bandwidth/sdk/model/Message.java index a6d830dd..1dd79514 100644 --- a/src/main/java/com/bandwidth/sdk/model/Message.java +++ b/src/main/java/com/bandwidth/sdk/model/Message.java @@ -42,12 +42,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -55,7 +53,7 @@ /** * Message */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class Message { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @@ -83,7 +81,7 @@ public class Message { public static final String SERIALIZED_NAME_TO = "to"; @SerializedName(SERIALIZED_NAME_TO) - private Set to; + private Set to = new LinkedHashSet<>(); public static final String SERIALIZED_NAME_FROM = "from"; @SerializedName(SERIALIZED_NAME_FROM) @@ -91,7 +89,7 @@ public class Message { public static final String SERIALIZED_NAME_MEDIA = "media"; @SerializedName(SERIALIZED_NAME_MEDIA) - private Set media; + private Set media = new LinkedHashSet<>(); public static final String SERIALIZED_NAME_TEXT = "text"; @SerializedName(SERIALIZED_NAME_TEXT) @@ -113,133 +111,120 @@ public Message() { } public Message id(String id) { - this.id = id; return this; } - /** + /** * The id of the message. * @return id - **/ + */ @javax.annotation.Nullable public String getId() { return id; } - public void setId(String id) { this.id = id; } public Message owner(String owner) { - this.owner = owner; return this; } - /** + /** * The Bandwidth phone number associated with the message. * @return owner - **/ + */ @javax.annotation.Nullable public String getOwner() { return owner; } - public void setOwner(String owner) { this.owner = owner; } public Message applicationId(String applicationId) { - this.applicationId = applicationId; return this; } - /** + /** * The application ID associated with the message. * @return applicationId - **/ + */ @javax.annotation.Nullable public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public Message time(OffsetDateTime time) { - this.time = time; return this; } - /** + /** * The datetime stamp of the message in ISO 8601 * @return time - **/ + */ @javax.annotation.Nullable public OffsetDateTime getTime() { return time; } - public void setTime(OffsetDateTime time) { this.time = time; } public Message segmentCount(Integer segmentCount) { - this.segmentCount = segmentCount; return this; } - /** + /** * The number of segments the original message from the user is broken into before sending over to carrier networks. * @return segmentCount - **/ + */ @javax.annotation.Nullable public Integer getSegmentCount() { return segmentCount; } - public void setSegmentCount(Integer segmentCount) { this.segmentCount = segmentCount; } public Message direction(MessageDirectionEnum direction) { - this.direction = direction; return this; } - /** + /** * Get direction * @return direction - **/ + */ @javax.annotation.Nullable public MessageDirectionEnum getDirection() { return direction; } - public void setDirection(MessageDirectionEnum direction) { this.direction = direction; } public Message to(Set to) { - this.to = to; return this; } @@ -252,44 +237,40 @@ public Message addToItem(String toItem) { return this; } - /** + /** * The phone number recipients of the message. * @return to - **/ + */ @javax.annotation.Nullable public Set getTo() { return to; } - public void setTo(Set to) { this.to = to; } public Message from(String from) { - this.from = from; return this; } - /** + /** * The phone number the message was sent from. * @return from - **/ + */ @javax.annotation.Nullable public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public Message media(Set media) { - this.media = media; return this; } @@ -302,100 +283,91 @@ public Message addMediaItem(String mediaItem) { return this; } - /** + /** * 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. * @return media - **/ + */ @javax.annotation.Nullable public Set getMedia() { return media; } - public void setMedia(Set media) { this.media = media; } public Message text(String text) { - this.text = text; return this; } - /** + /** * The contents of the message. * @return text - **/ + */ @javax.annotation.Nullable public String getText() { return text; } - public void setText(String text) { this.text = text; } public Message tag(String tag) { - this.tag = tag; return this; } - /** + /** * The custom string set by the user. * @return tag - **/ + */ @javax.annotation.Nullable public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public Message priority(PriorityEnum priority) { - this.priority = priority; return this; } - /** + /** * Get priority * @return priority - **/ + */ @javax.annotation.Nullable public PriorityEnum getPriority() { return priority; } - public void setPriority(PriorityEnum priority) { this.priority = priority; } public Message expiration(OffsetDateTime expiration) { - this.expiration = expiration; return this; } - /** + /** * The expiration date-time set by the user. * @return expiration - **/ + */ @javax.annotation.Nullable public OffsetDateTime getExpiration() { return expiration; } - public void setExpiration(OffsetDateTime expiration) { this.expiration = expiration; } @@ -534,12 +506,12 @@ private String toIndentedString(Object o) { 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 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 Message + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!Message.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -556,6 +528,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti 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 `direction` + if (jsonObj.get("direction") != null && !jsonObj.get("direction").isJsonNull()) { + MessageDirectionEnum.validateJsonElement(jsonObj.get("direction")); + } // ensure the optional json data is an array if present if (jsonObj.get("to") != null && !jsonObj.get("to").isJsonNull() && !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())); @@ -573,6 +549,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti 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 { @@ -603,7 +583,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -642,22 +627,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of Message given an JSON string - * - * @param jsonString JSON string - * @return An instance of Message - * @throws IOException if the JSON string is invalid with respect to Message - */ + /** + * Create an instance of Message given an JSON string + * + * @param jsonString JSON string + * @return An instance of Message + * @throws IOException if the JSON string is invalid with respect to Message + */ public static Message fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, Message.class); } - /** - * Convert an instance of Message to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of Message 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/MessageDeliveredCallback.java b/src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallback.java index 7a3a30c7..335d8efc 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallback.java @@ -39,12 +39,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -52,7 +50,7 @@ /** * Message Delivered Callback */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class MessageDeliveredCallback { public static final String SERIALIZED_NAME_TIME = "time"; @SerializedName(SERIALIZED_NAME_TIME) @@ -78,105 +76,95 @@ public MessageDeliveredCallback() { } public MessageDeliveredCallback time(OffsetDateTime time) { - this.time = time; return this; } - /** + /** * Get time * @return time - **/ + */ @javax.annotation.Nonnull public OffsetDateTime getTime() { return time; } - public void setTime(OffsetDateTime time) { this.time = time; } public MessageDeliveredCallback type(String type) { - this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull public String getType() { return type; } - public void setType(String type) { this.type = type; } public MessageDeliveredCallback to(String to) { - this.to = to; return this; } - /** + /** * Get to * @return to - **/ + */ @javax.annotation.Nonnull public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public MessageDeliveredCallback description(String description) { - this.description = description; return this; } - /** + /** * Get description * @return description - **/ + */ @javax.annotation.Nonnull public String getDescription() { return description; } - public void setDescription(String description) { this.description = description; } public MessageDeliveredCallback message(MessageDeliveredCallbackMessage message) { - this.message = message; return this; } - /** + /** * Get message * @return message - **/ + */ @javax.annotation.Nonnull public MessageDeliveredCallbackMessage getMessage() { return message; } - public void setMessage(MessageDeliveredCallbackMessage message) { this.message = message; } @@ -296,12 +284,12 @@ private String toIndentedString(Object o) { 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 MessageDeliveredCallback - */ + /** + * 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 MessageDeliveredCallback + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!MessageDeliveredCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -357,7 +345,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -396,22 +389,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of MessageDeliveredCallback given an JSON string - * - * @param jsonString JSON string - * @return An instance of MessageDeliveredCallback - * @throws IOException if the JSON string is invalid with respect to MessageDeliveredCallback - */ + /** + * Create an instance of MessageDeliveredCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of MessageDeliveredCallback + * @throws IOException if the JSON string is invalid with respect to MessageDeliveredCallback + */ public static MessageDeliveredCallback fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, MessageDeliveredCallback.class); } - /** - * Convert an instance of MessageDeliveredCallback to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of MessageDeliveredCallback 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/MessageDeliveredCallbackMessage.java b/src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallbackMessage.java index 144c4c0e..5abed798 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallbackMessage.java +++ b/src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallbackMessage.java @@ -45,12 +45,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -58,7 +56,7 @@ /** * Message Delivered Callback Message Schema */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class MessageDeliveredCallbackMessage { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @@ -102,7 +100,7 @@ public class MessageDeliveredCallbackMessage { public static final String SERIALIZED_NAME_MEDIA = "media"; @SerializedName(SERIALIZED_NAME_MEDIA) - private List media; + private List media = new ArrayList<>(); public static final String SERIALIZED_NAME_PRIORITY = "priority"; @SerializedName(SERIALIZED_NAME_PRIORITY) @@ -112,133 +110,120 @@ public MessageDeliveredCallbackMessage() { } public MessageDeliveredCallbackMessage id(String id) { - this.id = id; return this; } - /** + /** * Get id * @return id - **/ + */ @javax.annotation.Nonnull public String getId() { return id; } - public void setId(String id) { this.id = id; } public MessageDeliveredCallbackMessage owner(String owner) { - this.owner = owner; return this; } - /** + /** * Get owner * @return owner - **/ + */ @javax.annotation.Nonnull public String getOwner() { return owner; } - public void setOwner(String owner) { this.owner = owner; } public MessageDeliveredCallbackMessage applicationId(String applicationId) { - this.applicationId = applicationId; return this; } - /** + /** * Get applicationId * @return applicationId - **/ + */ @javax.annotation.Nonnull public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public MessageDeliveredCallbackMessage time(OffsetDateTime time) { - this.time = time; return this; } - /** + /** * Get time * @return time - **/ + */ @javax.annotation.Nonnull public OffsetDateTime getTime() { return time; } - public void setTime(OffsetDateTime time) { this.time = time; } public MessageDeliveredCallbackMessage segmentCount(Integer segmentCount) { - this.segmentCount = segmentCount; return this; } - /** + /** * Get segmentCount * @return segmentCount - **/ + */ @javax.annotation.Nonnull public Integer getSegmentCount() { return segmentCount; } - public void setSegmentCount(Integer segmentCount) { this.segmentCount = segmentCount; } public MessageDeliveredCallbackMessage direction(MessageDirectionEnum direction) { - this.direction = direction; return this; } - /** + /** * Get direction * @return direction - **/ + */ @javax.annotation.Nonnull public MessageDirectionEnum getDirection() { return direction; } - public void setDirection(MessageDirectionEnum direction) { this.direction = direction; } public MessageDeliveredCallbackMessage to(Set to) { - this.to = to; return this; } @@ -251,86 +236,78 @@ public MessageDeliveredCallbackMessage addToItem(String toItem) { return this; } - /** + /** * Get to * @return to - **/ + */ @javax.annotation.Nonnull public Set getTo() { return to; } - public void setTo(Set to) { this.to = to; } public MessageDeliveredCallbackMessage from(String from) { - this.from = from; return this; } - /** + /** * Get from * @return from - **/ + */ @javax.annotation.Nonnull public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public MessageDeliveredCallbackMessage text(String text) { - this.text = text; return this; } - /** + /** * Get text * @return text - **/ + */ @javax.annotation.Nonnull public String getText() { return text; } - public void setText(String text) { this.text = text; } public MessageDeliveredCallbackMessage tag(String tag) { - this.tag = tag; return this; } - /** + /** * Get tag * @return tag - **/ + */ @javax.annotation.Nonnull public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public MessageDeliveredCallbackMessage media(List media) { - this.media = media; return this; } @@ -343,37 +320,34 @@ public MessageDeliveredCallbackMessage addMediaItem(URI mediaItem) { return this; } - /** + /** * Get media * @return media - **/ + */ @javax.annotation.Nullable public List getMedia() { return media; } - public void setMedia(List media) { this.media = media; } public MessageDeliveredCallbackMessage priority(PriorityEnum priority) { - this.priority = priority; return this; } - /** + /** * Get priority * @return priority - **/ + */ @javax.annotation.Nullable public PriorityEnum getPriority() { return priority; } - public void setPriority(PriorityEnum priority) { this.priority = priority; } @@ -519,12 +493,12 @@ private String toIndentedString(Object o) { openapiRequiredFields.add("tag"); } - /** - * 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 MessageDeliveredCallbackMessage - */ + /** + * 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 MessageDeliveredCallbackMessage + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!MessageDeliveredCallbackMessage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -548,6 +522,8 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti 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`"); @@ -567,6 +543,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti 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")); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @@ -597,7 +577,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -636,22 +621,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of MessageDeliveredCallbackMessage given an JSON string - * - * @param jsonString JSON string - * @return An instance of MessageDeliveredCallbackMessage - * @throws IOException if the JSON string is invalid with respect to MessageDeliveredCallbackMessage - */ + /** + * Create an instance of MessageDeliveredCallbackMessage given an JSON string + * + * @param jsonString JSON string + * @return An instance of MessageDeliveredCallbackMessage + * @throws IOException if the JSON string is invalid with respect to MessageDeliveredCallbackMessage + */ public static MessageDeliveredCallbackMessage fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, MessageDeliveredCallbackMessage.class); } - /** - * Convert an instance of MessageDeliveredCallbackMessage to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of MessageDeliveredCallbackMessage 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/MessageDirectionEnum.java b/src/main/java/com/bandwidth/sdk/model/MessageDirectionEnum.java index 4713b361..52886e8a 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessageDirectionEnum.java +++ b/src/main/java/com/bandwidth/sdk/model/MessageDirectionEnum.java @@ -18,6 +18,7 @@ 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; @@ -68,5 +69,10 @@ public MessageDirectionEnum read(final JsonReader jsonReader) throws IOException return MessageDirectionEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + MessageDirectionEnum.fromValue(value); + } } diff --git a/src/main/java/com/bandwidth/sdk/model/MessageFailedCallback.java b/src/main/java/com/bandwidth/sdk/model/MessageFailedCallback.java index 7969be97..a216172b 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessageFailedCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/MessageFailedCallback.java @@ -39,12 +39,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -52,7 +50,7 @@ /** * Message Failed Callback */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class MessageFailedCallback { public static final String SERIALIZED_NAME_TIME = "time"; @SerializedName(SERIALIZED_NAME_TIME) @@ -82,126 +80,114 @@ public MessageFailedCallback() { } public MessageFailedCallback time(OffsetDateTime time) { - this.time = time; return this; } - /** + /** * Get time * @return time - **/ + */ @javax.annotation.Nonnull public OffsetDateTime getTime() { return time; } - public void setTime(OffsetDateTime time) { this.time = time; } public MessageFailedCallback type(String type) { - this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull public String getType() { return type; } - public void setType(String type) { this.type = type; } public MessageFailedCallback to(String to) { - this.to = to; return this; } - /** + /** * Get to * @return to - **/ + */ @javax.annotation.Nonnull public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public MessageFailedCallback description(String description) { - this.description = description; return this; } - /** + /** * Get description * @return description - **/ + */ @javax.annotation.Nonnull public String getDescription() { return description; } - public void setDescription(String description) { this.description = description; } public MessageFailedCallback message(MessageFailedCallbackMessage message) { - this.message = message; return this; } - /** + /** * Get message * @return message - **/ + */ @javax.annotation.Nonnull public MessageFailedCallbackMessage getMessage() { return message; } - public void setMessage(MessageFailedCallbackMessage message) { this.message = message; } public MessageFailedCallback errorCode(Integer errorCode) { - this.errorCode = errorCode; return this; } - /** + /** * Get errorCode * @return errorCode - **/ + */ @javax.annotation.Nonnull public Integer getErrorCode() { return errorCode; } - public void setErrorCode(Integer errorCode) { this.errorCode = errorCode; } @@ -325,12 +311,12 @@ private String toIndentedString(Object o) { openapiRequiredFields.add("errorCode"); } - /** - * 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 MessageFailedCallback - */ + /** + * 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 MessageFailedCallback + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!MessageFailedCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -386,7 +372,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -425,22 +416,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of MessageFailedCallback given an JSON string - * - * @param jsonString JSON string - * @return An instance of MessageFailedCallback - * @throws IOException if the JSON string is invalid with respect to MessageFailedCallback - */ + /** + * Create an instance of MessageFailedCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of MessageFailedCallback + * @throws IOException if the JSON string is invalid with respect to MessageFailedCallback + */ public static MessageFailedCallback fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, MessageFailedCallback.class); } - /** - * Convert an instance of MessageFailedCallback to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of MessageFailedCallback 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/MessageFailedCallbackMessage.java b/src/main/java/com/bandwidth/sdk/model/MessageFailedCallbackMessage.java index 6d65d19f..88733a8d 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessageFailedCallbackMessage.java +++ b/src/main/java/com/bandwidth/sdk/model/MessageFailedCallbackMessage.java @@ -45,12 +45,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -58,7 +56,7 @@ /** * Message Failed Callback Message Schema */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class MessageFailedCallbackMessage { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @@ -102,7 +100,7 @@ public class MessageFailedCallbackMessage { public static final String SERIALIZED_NAME_MEDIA = "media"; @SerializedName(SERIALIZED_NAME_MEDIA) - private List media; + private List media = new ArrayList<>(); public static final String SERIALIZED_NAME_PRIORITY = "priority"; @SerializedName(SERIALIZED_NAME_PRIORITY) @@ -112,133 +110,120 @@ public MessageFailedCallbackMessage() { } public MessageFailedCallbackMessage id(String id) { - this.id = id; return this; } - /** + /** * Get id * @return id - **/ + */ @javax.annotation.Nonnull public String getId() { return id; } - public void setId(String id) { this.id = id; } public MessageFailedCallbackMessage owner(String owner) { - this.owner = owner; return this; } - /** + /** * Get owner * @return owner - **/ + */ @javax.annotation.Nonnull public String getOwner() { return owner; } - public void setOwner(String owner) { this.owner = owner; } public MessageFailedCallbackMessage applicationId(String applicationId) { - this.applicationId = applicationId; return this; } - /** + /** * Get applicationId * @return applicationId - **/ + */ @javax.annotation.Nonnull public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public MessageFailedCallbackMessage time(OffsetDateTime time) { - this.time = time; return this; } - /** + /** * Get time * @return time - **/ + */ @javax.annotation.Nonnull public OffsetDateTime getTime() { return time; } - public void setTime(OffsetDateTime time) { this.time = time; } public MessageFailedCallbackMessage segmentCount(Integer segmentCount) { - this.segmentCount = segmentCount; return this; } - /** + /** * Get segmentCount * @return segmentCount - **/ + */ @javax.annotation.Nonnull public Integer getSegmentCount() { return segmentCount; } - public void setSegmentCount(Integer segmentCount) { this.segmentCount = segmentCount; } public MessageFailedCallbackMessage direction(MessageDirectionEnum direction) { - this.direction = direction; return this; } - /** + /** * Get direction * @return direction - **/ + */ @javax.annotation.Nonnull public MessageDirectionEnum getDirection() { return direction; } - public void setDirection(MessageDirectionEnum direction) { this.direction = direction; } public MessageFailedCallbackMessage to(Set to) { - this.to = to; return this; } @@ -251,86 +236,78 @@ public MessageFailedCallbackMessage addToItem(String toItem) { return this; } - /** + /** * Get to * @return to - **/ + */ @javax.annotation.Nonnull public Set getTo() { return to; } - public void setTo(Set to) { this.to = to; } public MessageFailedCallbackMessage from(String from) { - this.from = from; return this; } - /** + /** * Get from * @return from - **/ + */ @javax.annotation.Nonnull public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public MessageFailedCallbackMessage text(String text) { - this.text = text; return this; } - /** + /** * Get text * @return text - **/ + */ @javax.annotation.Nonnull public String getText() { return text; } - public void setText(String text) { this.text = text; } public MessageFailedCallbackMessage tag(String tag) { - this.tag = tag; return this; } - /** + /** * Get tag * @return tag - **/ + */ @javax.annotation.Nonnull public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public MessageFailedCallbackMessage media(List media) { - this.media = media; return this; } @@ -343,37 +320,34 @@ public MessageFailedCallbackMessage addMediaItem(URI mediaItem) { return this; } - /** + /** * Get media * @return media - **/ + */ @javax.annotation.Nullable public List getMedia() { return media; } - public void setMedia(List media) { this.media = media; } public MessageFailedCallbackMessage priority(PriorityEnum priority) { - this.priority = priority; return this; } - /** + /** * Get priority * @return priority - **/ + */ @javax.annotation.Nonnull public PriorityEnum getPriority() { return priority; } - public void setPriority(PriorityEnum priority) { this.priority = priority; } @@ -520,12 +494,12 @@ private String toIndentedString(Object o) { openapiRequiredFields.add("priority"); } - /** - * 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 MessageFailedCallbackMessage - */ + /** + * 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 MessageFailedCallbackMessage + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!MessageFailedCallbackMessage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -549,6 +523,8 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti 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`"); @@ -568,6 +544,8 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti 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 required field `priority` + PriorityEnum.validateJsonElement(jsonObj.get("priority")); } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @@ -598,7 +576,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -637,22 +620,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of MessageFailedCallbackMessage given an JSON string - * - * @param jsonString JSON string - * @return An instance of MessageFailedCallbackMessage - * @throws IOException if the JSON string is invalid with respect to MessageFailedCallbackMessage - */ + /** + * Create an instance of MessageFailedCallbackMessage given an JSON string + * + * @param jsonString JSON string + * @return An instance of MessageFailedCallbackMessage + * @throws IOException if the JSON string is invalid with respect to MessageFailedCallbackMessage + */ public static MessageFailedCallbackMessage fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, MessageFailedCallbackMessage.class); } - /** - * Convert an instance of MessageFailedCallbackMessage to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of MessageFailedCallbackMessage 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/MessageRequest.java b/src/main/java/com/bandwidth/sdk/model/MessageRequest.java index 8ae0dad4..b87a5dd5 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessageRequest.java +++ b/src/main/java/com/bandwidth/sdk/model/MessageRequest.java @@ -44,12 +44,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -57,7 +55,7 @@ /** * MessageRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class MessageRequest { public static final String SERIALIZED_NAME_APPLICATION_ID = "applicationId"; @SerializedName(SERIALIZED_NAME_APPLICATION_ID) @@ -77,7 +75,7 @@ public class MessageRequest { public static final String SERIALIZED_NAME_MEDIA = "media"; @SerializedName(SERIALIZED_NAME_MEDIA) - private List media; + private List media = new ArrayList<>(); public static final String SERIALIZED_NAME_TAG = "tag"; @SerializedName(SERIALIZED_NAME_TAG) @@ -95,28 +93,25 @@ public MessageRequest() { } public MessageRequest applicationId(String applicationId) { - this.applicationId = applicationId; return this; } - /** + /** * The ID of the Application your from number is associated with in the Bandwidth Phone Number Dashboard. * @return applicationId - **/ + */ @javax.annotation.Nonnull public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public MessageRequest to(Set to) { - this.to = to; return this; } @@ -129,65 +124,59 @@ public MessageRequest addToItem(String toItem) { return this; } - /** + /** * The phone number(s) the message should be sent to in E164 format. * @return to - **/ + */ @javax.annotation.Nonnull public Set getTo() { return to; } - public void setTo(Set to) { this.to = to; } public MessageRequest from(String from) { - this.from = from; return this; } - /** + /** * 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. * @return from - **/ + */ @javax.annotation.Nonnull public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public MessageRequest text(String text) { - this.text = text; return this; } - /** + /** * The contents of the text message. Must be 2048 characters or less. * @return text - **/ + */ @javax.annotation.Nullable public String getText() { return text; } - public void setText(String text) { this.text = text; } public MessageRequest media(List media) { - this.media = media; return this; } @@ -200,79 +189,72 @@ public MessageRequest addMediaItem(URI mediaItem) { return this; } - /** + /** * A list of URLs to include as media attachments as part of the message. Each URL can be at most 4096 characters. * @return media - **/ + */ @javax.annotation.Nullable public List getMedia() { return media; } - public void setMedia(List media) { this.media = media; } public MessageRequest tag(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(String tag) { this.tag = tag; } public MessageRequest priority(PriorityEnum priority) { - this.priority = priority; return this; } - /** + /** * Get priority * @return priority - **/ + */ @javax.annotation.Nullable public PriorityEnum getPriority() { return priority; } - public void setPriority(PriorityEnum priority) { this.priority = priority; } public MessageRequest expiration(OffsetDateTime expiration) { - this.expiration = expiration; return this; } - /** + /** * 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. Not supported on MMS. * @return expiration - **/ + */ @javax.annotation.Nullable public OffsetDateTime getExpiration() { return expiration; } - public void setExpiration(OffsetDateTime expiration) { this.expiration = expiration; } @@ -399,12 +381,12 @@ private String toIndentedString(Object o) { 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 MessageRequest - */ + /** + * 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 MessageRequest + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!MessageRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -441,6 +423,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti 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 { @@ -471,7 +457,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -510,22 +501,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of MessageRequest given an JSON string - * - * @param jsonString JSON string - * @return An instance of MessageRequest - * @throws IOException if the JSON string is invalid with respect to MessageRequest - */ + /** + * Create an instance of MessageRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of MessageRequest + * @throws IOException if the JSON string is invalid with respect to MessageRequest + */ public static MessageRequest fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, MessageRequest.class); } - /** - * Convert an instance of MessageRequest to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of MessageRequest 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/MessageSendingCallback.java b/src/main/java/com/bandwidth/sdk/model/MessageSendingCallback.java index 4be4d232..4e145778 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessageSendingCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/MessageSendingCallback.java @@ -39,12 +39,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -52,7 +50,7 @@ /** * Message Sending Callback */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class MessageSendingCallback { public static final String SERIALIZED_NAME_TIME = "time"; @SerializedName(SERIALIZED_NAME_TIME) @@ -78,105 +76,95 @@ public MessageSendingCallback() { } public MessageSendingCallback time(OffsetDateTime time) { - this.time = time; return this; } - /** + /** * Get time * @return time - **/ + */ @javax.annotation.Nonnull public OffsetDateTime getTime() { return time; } - public void setTime(OffsetDateTime time) { this.time = time; } public MessageSendingCallback type(String type) { - this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull public String getType() { return type; } - public void setType(String type) { this.type = type; } public MessageSendingCallback to(String to) { - this.to = to; return this; } - /** + /** * Get to * @return to - **/ + */ @javax.annotation.Nonnull public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public MessageSendingCallback description(String description) { - this.description = description; return this; } - /** + /** * Get description * @return description - **/ + */ @javax.annotation.Nonnull public String getDescription() { return description; } - public void setDescription(String description) { this.description = description; } public MessageSendingCallback message(MessageSendingCallbackMessage message) { - this.message = message; return this; } - /** + /** * Get message * @return message - **/ + */ @javax.annotation.Nonnull public MessageSendingCallbackMessage getMessage() { return message; } - public void setMessage(MessageSendingCallbackMessage message) { this.message = message; } @@ -296,12 +284,12 @@ private String toIndentedString(Object o) { 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 MessageSendingCallback - */ + /** + * 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 MessageSendingCallback + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!MessageSendingCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -357,7 +345,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -396,22 +389,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of MessageSendingCallback given an JSON string - * - * @param jsonString JSON string - * @return An instance of MessageSendingCallback - * @throws IOException if the JSON string is invalid with respect to MessageSendingCallback - */ + /** + * Create an instance of MessageSendingCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of MessageSendingCallback + * @throws IOException if the JSON string is invalid with respect to MessageSendingCallback + */ public static MessageSendingCallback fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, MessageSendingCallback.class); } - /** - * Convert an instance of MessageSendingCallback to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of MessageSendingCallback 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/MessageSendingCallbackMessage.java b/src/main/java/com/bandwidth/sdk/model/MessageSendingCallbackMessage.java index 1bced475..690760b2 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessageSendingCallbackMessage.java +++ b/src/main/java/com/bandwidth/sdk/model/MessageSendingCallbackMessage.java @@ -45,12 +45,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -58,7 +56,7 @@ /** * Message Sending Callback Message Schema */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class MessageSendingCallbackMessage { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @@ -112,133 +110,120 @@ public MessageSendingCallbackMessage() { } public MessageSendingCallbackMessage id(String id) { - this.id = id; return this; } - /** + /** * Get id * @return id - **/ + */ @javax.annotation.Nonnull public String getId() { return id; } - public void setId(String id) { this.id = id; } public MessageSendingCallbackMessage owner(String owner) { - this.owner = owner; return this; } - /** + /** * Get owner * @return owner - **/ + */ @javax.annotation.Nonnull public String getOwner() { return owner; } - public void setOwner(String owner) { this.owner = owner; } public MessageSendingCallbackMessage applicationId(String applicationId) { - this.applicationId = applicationId; return this; } - /** + /** * Get applicationId * @return applicationId - **/ + */ @javax.annotation.Nonnull public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public MessageSendingCallbackMessage time(OffsetDateTime time) { - this.time = time; return this; } - /** + /** * Get time * @return time - **/ + */ @javax.annotation.Nonnull public OffsetDateTime getTime() { return time; } - public void setTime(OffsetDateTime time) { this.time = time; } public MessageSendingCallbackMessage segmentCount(Integer segmentCount) { - this.segmentCount = segmentCount; return this; } - /** + /** * Get segmentCount * @return segmentCount - **/ + */ @javax.annotation.Nonnull public Integer getSegmentCount() { return segmentCount; } - public void setSegmentCount(Integer segmentCount) { this.segmentCount = segmentCount; } public MessageSendingCallbackMessage direction(MessageDirectionEnum direction) { - this.direction = direction; return this; } - /** + /** * Get direction * @return direction - **/ + */ @javax.annotation.Nonnull public MessageDirectionEnum getDirection() { return direction; } - public void setDirection(MessageDirectionEnum direction) { this.direction = direction; } public MessageSendingCallbackMessage to(Set to) { - this.to = to; return this; } @@ -251,86 +236,78 @@ public MessageSendingCallbackMessage addToItem(String toItem) { return this; } - /** + /** * Get to * @return to - **/ + */ @javax.annotation.Nonnull public Set getTo() { return to; } - public void setTo(Set to) { this.to = to; } public MessageSendingCallbackMessage from(String from) { - this.from = from; return this; } - /** + /** * Get from * @return from - **/ + */ @javax.annotation.Nonnull public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public MessageSendingCallbackMessage text(String text) { - this.text = text; return this; } - /** + /** * Get text * @return text - **/ + */ @javax.annotation.Nonnull public String getText() { return text; } - public void setText(String text) { this.text = text; } public MessageSendingCallbackMessage tag(String tag) { - this.tag = tag; return this; } - /** + /** * Get tag * @return tag - **/ + */ @javax.annotation.Nullable public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public MessageSendingCallbackMessage media(List media) { - this.media = media; return this; } @@ -343,37 +320,34 @@ public MessageSendingCallbackMessage addMediaItem(URI mediaItem) { return this; } - /** + /** * Get media * @return media - **/ + */ @javax.annotation.Nonnull public List getMedia() { return media; } - public void setMedia(List media) { this.media = media; } public MessageSendingCallbackMessage priority(PriorityEnum priority) { - this.priority = priority; return this; } - /** + /** * Get priority * @return priority - **/ + */ @javax.annotation.Nonnull public PriorityEnum getPriority() { return priority; } - public void setPriority(PriorityEnum priority) { this.priority = priority; } @@ -520,12 +494,12 @@ private String toIndentedString(Object o) { openapiRequiredFields.add("priority"); } - /** - * 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 MessageSendingCallbackMessage - */ + /** + * 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 MessageSendingCallbackMessage + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!MessageSendingCallbackMessage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -549,6 +523,8 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti 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`"); @@ -570,6 +546,8 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } else 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 required field `priority` + PriorityEnum.validateJsonElement(jsonObj.get("priority")); } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @@ -600,7 +578,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -639,22 +622,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of MessageSendingCallbackMessage given an JSON string - * - * @param jsonString JSON string - * @return An instance of MessageSendingCallbackMessage - * @throws IOException if the JSON string is invalid with respect to MessageSendingCallbackMessage - */ + /** + * Create an instance of MessageSendingCallbackMessage given an JSON string + * + * @param jsonString JSON string + * @return An instance of MessageSendingCallbackMessage + * @throws IOException if the JSON string is invalid with respect to MessageSendingCallbackMessage + */ public static MessageSendingCallbackMessage fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, MessageSendingCallbackMessage.class); } - /** - * Convert an instance of MessageSendingCallbackMessage to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of MessageSendingCallbackMessage 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/MessageStatusEnum.java b/src/main/java/com/bandwidth/sdk/model/MessageStatusEnum.java index 90a978bf..80760f09 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessageStatusEnum.java +++ b/src/main/java/com/bandwidth/sdk/model/MessageStatusEnum.java @@ -18,6 +18,7 @@ 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; @@ -80,5 +81,10 @@ public MessageStatusEnum read(final JsonReader jsonReader) throws IOException { return MessageStatusEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + MessageStatusEnum.fromValue(value); + } } diff --git a/src/main/java/com/bandwidth/sdk/model/MessageTypeEnum.java b/src/main/java/com/bandwidth/sdk/model/MessageTypeEnum.java index 8ce1bc4b..e12241ca 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessageTypeEnum.java +++ b/src/main/java/com/bandwidth/sdk/model/MessageTypeEnum.java @@ -18,6 +18,7 @@ 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; @@ -68,5 +69,10 @@ public MessageTypeEnum read(final JsonReader jsonReader) throws IOException { return MessageTypeEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + MessageTypeEnum.fromValue(value); + } } diff --git a/src/main/java/com/bandwidth/sdk/model/MessagesList.java b/src/main/java/com/bandwidth/sdk/model/MessagesList.java index 8c40885c..d91ff841 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessagesList.java +++ b/src/main/java/com/bandwidth/sdk/model/MessagesList.java @@ -41,12 +41,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -54,7 +52,7 @@ /** * MessagesList */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class MessagesList { public static final String SERIALIZED_NAME_TOTAL_COUNT = "totalCount"; @SerializedName(SERIALIZED_NAME_TOTAL_COUNT) @@ -66,55 +64,50 @@ public class MessagesList { public static final String SERIALIZED_NAME_MESSAGES = "messages"; @SerializedName(SERIALIZED_NAME_MESSAGES) - private List messages; + private List messages = new ArrayList<>(); public MessagesList() { } public MessagesList totalCount(Integer totalCount) { - this.totalCount = totalCount; return this; } - /** + /** * The total number of messages matched by the search. When the request has limitTotalCount set to true this value is limited to 10,000. * @return totalCount - **/ + */ @javax.annotation.Nullable public Integer getTotalCount() { return totalCount; } - public void setTotalCount(Integer totalCount) { this.totalCount = totalCount; } public MessagesList pageInfo(PageInfo pageInfo) { - this.pageInfo = pageInfo; return this; } - /** + /** * Get pageInfo * @return pageInfo - **/ + */ @javax.annotation.Nullable public PageInfo getPageInfo() { return pageInfo; } - public void setPageInfo(PageInfo pageInfo) { this.pageInfo = pageInfo; } public MessagesList messages(List messages) { - this.messages = messages; return this; } @@ -127,16 +120,15 @@ public MessagesList addMessagesItem(ListMessageItem messagesItem) { return this; } - /** + /** * Get messages * @return messages - **/ + */ @javax.annotation.Nullable public List getMessages() { return messages; } - public void setMessages(List messages) { this.messages = messages; } @@ -245,12 +237,12 @@ private String toIndentedString(Object o) { 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 MessagesList - */ + /** + * 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 MessagesList + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!MessagesList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -306,7 +298,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -345,22 +342,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of MessagesList given an JSON string - * - * @param jsonString JSON string - * @return An instance of MessagesList - * @throws IOException if the JSON string is invalid with respect to MessagesList - */ + /** + * Create an instance of MessagesList given an JSON string + * + * @param jsonString JSON string + * @return An instance of MessagesList + * @throws IOException if the JSON string is invalid with respect to MessagesList + */ public static MessagesList fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, MessagesList.class); } - /** - * Convert an instance of MessagesList to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of MessagesList 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/MessagingCodeResponse.java b/src/main/java/com/bandwidth/sdk/model/MessagingCodeResponse.java index fb5f2e3d..5a032141 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessagingCodeResponse.java +++ b/src/main/java/com/bandwidth/sdk/model/MessagingCodeResponse.java @@ -37,12 +37,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -50,7 +48,7 @@ /** * MessagingCodeResponse */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class MessagingCodeResponse { public static final String SERIALIZED_NAME_MESSAGE_ID = "messageId"; @SerializedName(SERIALIZED_NAME_MESSAGE_ID) @@ -60,21 +58,19 @@ public MessagingCodeResponse() { } public MessagingCodeResponse messageId(String messageId) { - this.messageId = messageId; return this; } - /** + /** * Messaging API Message ID. * @return messageId - **/ + */ @javax.annotation.Nullable public String getMessageId() { return messageId; } - public void setMessageId(String messageId) { this.messageId = messageId; } @@ -177,12 +173,12 @@ private String toIndentedString(Object o) { 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 MessagingCodeResponse - */ + /** + * 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 MessagingCodeResponse + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!MessagingCodeResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -223,7 +219,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -262,22 +263,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of MessagingCodeResponse given an JSON string - * - * @param jsonString JSON string - * @return An instance of MessagingCodeResponse - * @throws IOException if the JSON string is invalid with respect to MessagingCodeResponse - */ + /** + * Create an instance of MessagingCodeResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of MessagingCodeResponse + * @throws IOException if the JSON string is invalid with respect to MessagingCodeResponse + */ public static MessagingCodeResponse fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, MessagingCodeResponse.class); } - /** - * Convert an instance of MessagingCodeResponse to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of MessagingCodeResponse 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/MessagingRequestError.java b/src/main/java/com/bandwidth/sdk/model/MessagingRequestError.java index a0f4af11..a2cf3027 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessagingRequestError.java +++ b/src/main/java/com/bandwidth/sdk/model/MessagingRequestError.java @@ -37,12 +37,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -50,7 +48,7 @@ /** * MessagingRequestError */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class MessagingRequestError { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @@ -64,42 +62,38 @@ public MessagingRequestError() { } public MessagingRequestError type(String type) { - this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nonnull public String getType() { return type; } - public void setType(String type) { this.type = type; } public MessagingRequestError description(String description) { - this.description = description; return this; } - /** + /** * Get description * @return description - **/ + */ @javax.annotation.Nonnull public String getDescription() { return description; } - public void setDescription(String description) { this.description = description; } @@ -207,12 +201,12 @@ private String toIndentedString(Object o) { openapiRequiredFields.add("description"); } - /** - * 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 MessagingRequestError - */ + /** + * 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 MessagingRequestError + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!MessagingRequestError.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -263,7 +257,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -302,22 +301,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of MessagingRequestError given an JSON string - * - * @param jsonString JSON string - * @return An instance of MessagingRequestError - * @throws IOException if the JSON string is invalid with respect to MessagingRequestError - */ + /** + * Create an instance of MessagingRequestError given an JSON string + * + * @param jsonString JSON string + * @return An instance of MessagingRequestError + * @throws IOException if the JSON string is invalid with respect to MessagingRequestError + */ public static MessagingRequestError fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, MessagingRequestError.class); } - /** - * Convert an instance of MessagingRequestError to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of MessagingRequestError 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/MfaForbiddenRequestError.java b/src/main/java/com/bandwidth/sdk/model/MfaForbiddenRequestError.java index 9905efdd..bbaa6394 100644 --- a/src/main/java/com/bandwidth/sdk/model/MfaForbiddenRequestError.java +++ b/src/main/java/com/bandwidth/sdk/model/MfaForbiddenRequestError.java @@ -37,12 +37,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -50,7 +48,7 @@ /** * MfaForbiddenRequestError */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class MfaForbiddenRequestError { public static final String SERIALIZED_NAME_MESSAGE = "message"; @SerializedName(SERIALIZED_NAME_MESSAGE) @@ -60,21 +58,19 @@ public MfaForbiddenRequestError() { } public MfaForbiddenRequestError message(String message) { - this.message = message; return this; } - /** + /** * The message containing the reason behind the request being forbidden. * @return message - **/ + */ @javax.annotation.Nullable public String getMessage() { return message; } - public void setMessage(String message) { this.message = message; } @@ -177,12 +173,12 @@ private String toIndentedString(Object o) { 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 MfaForbiddenRequestError - */ + /** + * 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 MfaForbiddenRequestError + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!MfaForbiddenRequestError.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -223,7 +219,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -262,22 +263,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of MfaForbiddenRequestError given an JSON string - * - * @param jsonString JSON string - * @return An instance of MfaForbiddenRequestError - * @throws IOException if the JSON string is invalid with respect to MfaForbiddenRequestError - */ + /** + * Create an instance of MfaForbiddenRequestError given an JSON string + * + * @param jsonString JSON string + * @return An instance of MfaForbiddenRequestError + * @throws IOException if the JSON string is invalid with respect to MfaForbiddenRequestError + */ public static MfaForbiddenRequestError fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, MfaForbiddenRequestError.class); } - /** - * Convert an instance of MfaForbiddenRequestError to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of MfaForbiddenRequestError 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/MfaRequestError.java b/src/main/java/com/bandwidth/sdk/model/MfaRequestError.java index 84b45f8a..bd89a5f3 100644 --- a/src/main/java/com/bandwidth/sdk/model/MfaRequestError.java +++ b/src/main/java/com/bandwidth/sdk/model/MfaRequestError.java @@ -37,12 +37,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -50,7 +48,7 @@ /** * MfaRequestError */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class MfaRequestError { public static final String SERIALIZED_NAME_ERROR = "error"; @SerializedName(SERIALIZED_NAME_ERROR) @@ -64,42 +62,38 @@ public MfaRequestError() { } public MfaRequestError error(String error) { - this.error = error; return this; } - /** + /** * A message describing the error with your request. * @return error - **/ + */ @javax.annotation.Nullable public String getError() { return error; } - public void setError(String error) { this.error = error; } public MfaRequestError requestId(String requestId) { - this.requestId = requestId; return this; } - /** + /** * The associated requestId from AWS. * @return requestId - **/ + */ @javax.annotation.Nullable public String getRequestId() { return requestId; } - public void setRequestId(String requestId) { this.requestId = requestId; } @@ -205,12 +199,12 @@ private String toIndentedString(Object o) { 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 MfaRequestError - */ + /** + * 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 MfaRequestError + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!MfaRequestError.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -254,7 +248,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -293,22 +292,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of MfaRequestError given an JSON string - * - * @param jsonString JSON string - * @return An instance of MfaRequestError - * @throws IOException if the JSON string is invalid with respect to MfaRequestError - */ + /** + * Create an instance of MfaRequestError given an JSON string + * + * @param jsonString JSON string + * @return An instance of MfaRequestError + * @throws IOException if the JSON string is invalid with respect to MfaRequestError + */ public static MfaRequestError fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, MfaRequestError.class); } - /** - * Convert an instance of MfaRequestError to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of MfaRequestError 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/MfaUnauthorizedRequestError.java b/src/main/java/com/bandwidth/sdk/model/MfaUnauthorizedRequestError.java index 67320cae..66dd0acb 100644 --- a/src/main/java/com/bandwidth/sdk/model/MfaUnauthorizedRequestError.java +++ b/src/main/java/com/bandwidth/sdk/model/MfaUnauthorizedRequestError.java @@ -37,12 +37,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -50,7 +48,7 @@ /** * MfaUnauthorizedRequestError */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class MfaUnauthorizedRequestError { public static final String SERIALIZED_NAME_MESSAGE = "message"; @SerializedName(SERIALIZED_NAME_MESSAGE) @@ -60,21 +58,19 @@ public MfaUnauthorizedRequestError() { } public MfaUnauthorizedRequestError message(String message) { - this.message = message; return this; } - /** + /** * Unauthorized * @return message - **/ + */ @javax.annotation.Nullable public String getMessage() { return message; } - public void setMessage(String message) { this.message = message; } @@ -177,12 +173,12 @@ private String toIndentedString(Object o) { 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 MfaUnauthorizedRequestError - */ + /** + * 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 MfaUnauthorizedRequestError + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!MfaUnauthorizedRequestError.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -223,7 +219,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -262,22 +263,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of MfaUnauthorizedRequestError given an JSON string - * - * @param jsonString JSON string - * @return An instance of MfaUnauthorizedRequestError - * @throws IOException if the JSON string is invalid with respect to MfaUnauthorizedRequestError - */ + /** + * Create an instance of MfaUnauthorizedRequestError given an JSON string + * + * @param jsonString JSON string + * @return An instance of MfaUnauthorizedRequestError + * @throws IOException if the JSON string is invalid with respect to MfaUnauthorizedRequestError + */ public static MfaUnauthorizedRequestError fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, MfaUnauthorizedRequestError.class); } - /** - * Convert an instance of MfaUnauthorizedRequestError to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of MfaUnauthorizedRequestError 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/PageInfo.java b/src/main/java/com/bandwidth/sdk/model/PageInfo.java index a1c5d8fc..3cb89cd6 100644 --- a/src/main/java/com/bandwidth/sdk/model/PageInfo.java +++ b/src/main/java/com/bandwidth/sdk/model/PageInfo.java @@ -37,12 +37,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -50,7 +48,7 @@ /** * PageInfo */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class PageInfo { public static final String SERIALIZED_NAME_PREV_PAGE = "prevPage"; @SerializedName(SERIALIZED_NAME_PREV_PAGE) @@ -72,84 +70,76 @@ public PageInfo() { } public PageInfo prevPage(String prevPage) { - this.prevPage = prevPage; return this; } - /** + /** * The link to the previous page for pagination. * @return prevPage - **/ + */ @javax.annotation.Nullable public String getPrevPage() { return prevPage; } - public void setPrevPage(String prevPage) { this.prevPage = prevPage; } public PageInfo nextPage(String nextPage) { - this.nextPage = nextPage; return this; } - /** + /** * The link to the next page for pagination. * @return nextPage - **/ + */ @javax.annotation.Nullable public String getNextPage() { return nextPage; } - public void setNextPage(String nextPage) { this.nextPage = nextPage; } public PageInfo prevPageToken(String prevPageToken) { - this.prevPageToken = prevPageToken; return this; } - /** + /** * The isolated pagination token for the previous page. * @return prevPageToken - **/ + */ @javax.annotation.Nullable public String getPrevPageToken() { return prevPageToken; } - public void setPrevPageToken(String prevPageToken) { this.prevPageToken = prevPageToken; } public PageInfo nextPageToken(String nextPageToken) { - this.nextPageToken = nextPageToken; return this; } - /** + /** * The isolated pagination token for the next page. * @return nextPageToken - **/ + */ @javax.annotation.Nullable public String getNextPageToken() { return nextPageToken; } - public void setNextPageToken(String nextPageToken) { this.nextPageToken = nextPageToken; } @@ -261,12 +251,12 @@ private String toIndentedString(Object o) { 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 PageInfo - */ + /** + * 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 PageInfo + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!PageInfo.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -316,7 +306,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -355,22 +350,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of PageInfo given an JSON string - * - * @param jsonString JSON string - * @return An instance of PageInfo - * @throws IOException if the JSON string is invalid with respect to PageInfo - */ + /** + * Create an instance of PageInfo given an JSON string + * + * @param jsonString JSON string + * @return An instance of PageInfo + * @throws IOException if the JSON string is invalid with respect to PageInfo + */ public static PageInfo fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, PageInfo.class); } - /** - * Convert an instance of PageInfo to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of PageInfo 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/PriorityEnum.java b/src/main/java/com/bandwidth/sdk/model/PriorityEnum.java index 6200bb49..75f872e1 100644 --- a/src/main/java/com/bandwidth/sdk/model/PriorityEnum.java +++ b/src/main/java/com/bandwidth/sdk/model/PriorityEnum.java @@ -18,6 +18,7 @@ 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; @@ -68,5 +69,10 @@ public PriorityEnum read(final JsonReader jsonReader) throws IOException { return PriorityEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + PriorityEnum.fromValue(value); + } } diff --git a/src/main/java/com/bandwidth/sdk/model/RecordingAvailableCallback.java b/src/main/java/com/bandwidth/sdk/model/RecordingAvailableCallback.java index 65d8f7ec..4b3b196b 100644 --- a/src/main/java/com/bandwidth/sdk/model/RecordingAvailableCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/RecordingAvailableCallback.java @@ -42,12 +42,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -55,7 +53,7 @@ /** * The Recording Available event is sent after a recording has been processed. It indicates that the recording is available for download. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class RecordingAvailableCallback { public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; @SerializedName(SERIALIZED_NAME_EVENT_TYPE) @@ -149,462 +147,418 @@ public RecordingAvailableCallback() { } public RecordingAvailableCallback eventType(String eventType) { - this.eventType = eventType; return this; } - /** + /** * 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. * @return eventType - **/ + */ @javax.annotation.Nullable public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public RecordingAvailableCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } - /** + /** * 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. * @return eventTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public RecordingAvailableCallback accountId(String accountId) { - this.accountId = accountId; return this; } - /** + /** * The user account associated with the call. * @return accountId - **/ + */ @javax.annotation.Nullable public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public RecordingAvailableCallback applicationId(String applicationId) { - this.applicationId = applicationId; return this; } - /** + /** * The id of the application associated with the call. * @return applicationId - **/ + */ @javax.annotation.Nullable public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public RecordingAvailableCallback from(String from) { - this.from = from; return this; } - /** + /** * The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). * @return from - **/ + */ @javax.annotation.Nullable public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public RecordingAvailableCallback to(String to) { - this.to = to; return this; } - /** + /** * The phone number that received the call, in E.164 format (e.g. +15555555555). * @return to - **/ + */ @javax.annotation.Nullable public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public RecordingAvailableCallback direction(CallDirectionEnum direction) { - this.direction = direction; return this; } - /** + /** * Get direction * @return direction - **/ + */ @javax.annotation.Nullable public CallDirectionEnum getDirection() { return direction; } - public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public RecordingAvailableCallback callId(String callId) { - this.callId = callId; return this; } - /** + /** * The call id associated with the event. * @return callId - **/ + */ @javax.annotation.Nullable public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public RecordingAvailableCallback callUrl(URI callUrl) { - this.callUrl = callUrl; return this; } - /** + /** * The URL of the call associated with the event. * @return callUrl - **/ + */ @javax.annotation.Nullable public URI getCallUrl() { return callUrl; } - public void setCallUrl(URI callUrl) { this.callUrl = callUrl; } public RecordingAvailableCallback parentCallId(String parentCallId) { - this.parentCallId = parentCallId; return this; } - /** + /** * (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present. * @return parentCallId - **/ + */ @javax.annotation.Nullable public String getParentCallId() { return parentCallId; } - public void setParentCallId(String parentCallId) { this.parentCallId = parentCallId; } public RecordingAvailableCallback recordingId(String recordingId) { - this.recordingId = recordingId; return this; } - /** + /** * The unique ID of this recording * @return recordingId - **/ + */ @javax.annotation.Nullable public String getRecordingId() { return recordingId; } - public void setRecordingId(String recordingId) { this.recordingId = recordingId; } public RecordingAvailableCallback mediaUrl(URI mediaUrl) { - this.mediaUrl = mediaUrl; return this; } - /** + /** * The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded. * @return mediaUrl - **/ + */ @javax.annotation.Nullable public URI getMediaUrl() { return mediaUrl; } - public void setMediaUrl(URI mediaUrl) { this.mediaUrl = mediaUrl; } public RecordingAvailableCallback enqueuedTime(OffsetDateTime enqueuedTime) { - this.enqueuedTime = enqueuedTime; return this; } - /** + /** * (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. * @return enqueuedTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } - public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public RecordingAvailableCallback startTime(OffsetDateTime startTime) { - this.startTime = startTime; return this; } - /** + /** * Time the call was started, in ISO 8601 format. * @return startTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getStartTime() { return startTime; } - public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public RecordingAvailableCallback endTime(OffsetDateTime endTime) { - this.endTime = endTime; return this; } - /** + /** * The time that the recording ended in ISO-8601 format * @return endTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEndTime() { return endTime; } - public void setEndTime(OffsetDateTime endTime) { this.endTime = endTime; } public RecordingAvailableCallback duration(String duration) { - this.duration = duration; return this; } - /** + /** * The duration of the recording in ISO-8601 format * @return duration - **/ + */ @javax.annotation.Nullable public String getDuration() { return duration; } - public void setDuration(String duration) { this.duration = duration; } public RecordingAvailableCallback fileFormat(FileFormatEnum fileFormat) { - this.fileFormat = fileFormat; return this; } - /** + /** * Get fileFormat * @return fileFormat - **/ + */ @javax.annotation.Nullable public FileFormatEnum getFileFormat() { return fileFormat; } - public void setFileFormat(FileFormatEnum fileFormat) { this.fileFormat = fileFormat; } public RecordingAvailableCallback channels(Integer channels) { - this.channels = channels; return this; } - /** + /** * Always `1` for conference recordings; multi-channel recordings are not supported on conferences. * @return channels - **/ + */ @javax.annotation.Nullable public Integer getChannels() { return channels; } - public void setChannels(Integer channels) { this.channels = channels; } public RecordingAvailableCallback tag(String tag) { - this.tag = tag; return this; } - /** + /** * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. * @return tag - **/ + */ @javax.annotation.Nullable public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public RecordingAvailableCallback status(String status) { - this.status = status; return this; } - /** + /** * 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. * @return status - **/ + */ @javax.annotation.Nullable public String getStatus() { return status; } - public void setStatus(String status) { this.status = status; } public RecordingAvailableCallback transferCallerId(String transferCallerId) { - this.transferCallerId = transferCallerId; return this; } - /** + /** * The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). * @return transferCallerId - **/ + */ @javax.annotation.Nullable public String getTransferCallerId() { return transferCallerId; } - public void setTransferCallerId(String transferCallerId) { this.transferCallerId = transferCallerId; } public RecordingAvailableCallback transferTo(String transferTo) { - this.transferTo = transferTo; return this; } - /** + /** * The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). * @return transferTo - **/ + */ @javax.annotation.Nullable public String getTransferTo() { return transferTo; } - public void setTransferTo(String transferTo) { this.transferTo = transferTo; } @@ -781,12 +735,12 @@ private String toIndentedString(Object o) { 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 RecordingAvailableCallback - */ + /** + * 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 RecordingAvailableCallback + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!RecordingAvailableCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -809,6 +763,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti 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())); } + // validate the optional field `direction` + if (jsonObj.get("direction") != null && !jsonObj.get("direction").isJsonNull()) { + CallDirectionEnum.validateJsonElement(jsonObj.get("direction")); + } if ((jsonObj.get("callId") != null && !jsonObj.get("callId").isJsonNull()) && !jsonObj.get("callId").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `callId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callId").toString())); } @@ -827,6 +785,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if ((jsonObj.get("duration") != null && !jsonObj.get("duration").isJsonNull()) && !jsonObj.get("duration").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `duration` to be a primitive type in the JSON string but got `%s`", jsonObj.get("duration").toString())); } + // validate the optional field `fileFormat` + if (jsonObj.get("fileFormat") != null && !jsonObj.get("fileFormat").isJsonNull()) { + FileFormatEnum.validateJsonElement(jsonObj.get("fileFormat")); + } 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())); } @@ -869,7 +831,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -908,22 +875,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of RecordingAvailableCallback given an JSON string - * - * @param jsonString JSON string - * @return An instance of RecordingAvailableCallback - * @throws IOException if the JSON string is invalid with respect to RecordingAvailableCallback - */ + /** + * Create an instance of RecordingAvailableCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of RecordingAvailableCallback + * @throws IOException if the JSON string is invalid with respect to RecordingAvailableCallback + */ public static RecordingAvailableCallback fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, RecordingAvailableCallback.class); } - /** - * Convert an instance of RecordingAvailableCallback to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of RecordingAvailableCallback 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/RecordingCompleteCallback.java b/src/main/java/com/bandwidth/sdk/model/RecordingCompleteCallback.java index f91683b8..1482039e 100644 --- a/src/main/java/com/bandwidth/sdk/model/RecordingCompleteCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/RecordingCompleteCallback.java @@ -42,12 +42,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -55,7 +53,7 @@ /** * The Record Complete event is sent after a <Record> verb has executed if the call is still active. The BXML returned by this callback is executed next. When the recording is available for download, a Recording Available event will be sent. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class RecordingCompleteCallback { public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; @SerializedName(SERIALIZED_NAME_EVENT_TYPE) @@ -149,462 +147,418 @@ public RecordingCompleteCallback() { } public RecordingCompleteCallback eventType(String eventType) { - this.eventType = eventType; return this; } - /** + /** * 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. * @return eventType - **/ + */ @javax.annotation.Nullable public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public RecordingCompleteCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } - /** + /** * 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. * @return eventTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public RecordingCompleteCallback accountId(String accountId) { - this.accountId = accountId; return this; } - /** + /** * The user account associated with the call. * @return accountId - **/ + */ @javax.annotation.Nullable public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public RecordingCompleteCallback applicationId(String applicationId) { - this.applicationId = applicationId; return this; } - /** + /** * The id of the application associated with the call. * @return applicationId - **/ + */ @javax.annotation.Nullable public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public RecordingCompleteCallback from(String from) { - this.from = from; return this; } - /** + /** * The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). * @return from - **/ + */ @javax.annotation.Nullable public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public RecordingCompleteCallback to(String to) { - this.to = to; return this; } - /** + /** * The phone number that received the call, in E.164 format (e.g. +15555555555). * @return to - **/ + */ @javax.annotation.Nullable public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public RecordingCompleteCallback direction(CallDirectionEnum direction) { - this.direction = direction; return this; } - /** + /** * Get direction * @return direction - **/ + */ @javax.annotation.Nullable public CallDirectionEnum getDirection() { return direction; } - public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public RecordingCompleteCallback callId(String callId) { - this.callId = callId; return this; } - /** + /** * The call id associated with the event. * @return callId - **/ + */ @javax.annotation.Nullable public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public RecordingCompleteCallback callUrl(URI callUrl) { - this.callUrl = callUrl; return this; } - /** + /** * The URL of the call associated with the event. * @return callUrl - **/ + */ @javax.annotation.Nullable public URI getCallUrl() { return callUrl; } - public void setCallUrl(URI callUrl) { this.callUrl = callUrl; } public RecordingCompleteCallback parentCallId(String parentCallId) { - this.parentCallId = parentCallId; return this; } - /** + /** * (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present. * @return parentCallId - **/ + */ @javax.annotation.Nullable public String getParentCallId() { return parentCallId; } - public void setParentCallId(String parentCallId) { this.parentCallId = parentCallId; } public RecordingCompleteCallback recordingId(String recordingId) { - this.recordingId = recordingId; return this; } - /** + /** * The unique ID of this recording * @return recordingId - **/ + */ @javax.annotation.Nullable public String getRecordingId() { return recordingId; } - public void setRecordingId(String recordingId) { this.recordingId = recordingId; } public RecordingCompleteCallback mediaUrl(URI mediaUrl) { - this.mediaUrl = mediaUrl; return this; } - /** + /** * The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded. * @return mediaUrl - **/ + */ @javax.annotation.Nullable public URI getMediaUrl() { return mediaUrl; } - public void setMediaUrl(URI mediaUrl) { this.mediaUrl = mediaUrl; } public RecordingCompleteCallback enqueuedTime(OffsetDateTime enqueuedTime) { - this.enqueuedTime = enqueuedTime; return this; } - /** + /** * (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. * @return enqueuedTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } - public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public RecordingCompleteCallback startTime(OffsetDateTime startTime) { - this.startTime = startTime; return this; } - /** + /** * Time the call was started, in ISO 8601 format. * @return startTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getStartTime() { return startTime; } - public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public RecordingCompleteCallback answerTime(OffsetDateTime answerTime) { - this.answerTime = answerTime; return this; } - /** + /** * Time the call was answered, in ISO 8601 format. * @return answerTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getAnswerTime() { return answerTime; } - public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public RecordingCompleteCallback endTime(OffsetDateTime endTime) { - this.endTime = endTime; return this; } - /** + /** * The time that the recording ended in ISO-8601 format * @return endTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEndTime() { return endTime; } - public void setEndTime(OffsetDateTime endTime) { this.endTime = endTime; } public RecordingCompleteCallback duration(String duration) { - this.duration = duration; return this; } - /** + /** * The duration of the recording in ISO-8601 format * @return duration - **/ + */ @javax.annotation.Nullable public String getDuration() { return duration; } - public void setDuration(String duration) { this.duration = duration; } public RecordingCompleteCallback fileFormat(FileFormatEnum fileFormat) { - this.fileFormat = fileFormat; return this; } - /** + /** * Get fileFormat * @return fileFormat - **/ + */ @javax.annotation.Nullable public FileFormatEnum getFileFormat() { return fileFormat; } - public void setFileFormat(FileFormatEnum fileFormat) { this.fileFormat = fileFormat; } public RecordingCompleteCallback channels(Integer channels) { - this.channels = channels; return this; } - /** + /** * Always `1` for conference recordings; multi-channel recordings are not supported on conferences. * @return channels - **/ + */ @javax.annotation.Nullable public Integer getChannels() { return channels; } - public void setChannels(Integer channels) { this.channels = channels; } public RecordingCompleteCallback tag(String tag) { - this.tag = tag; return this; } - /** + /** * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. * @return tag - **/ + */ @javax.annotation.Nullable public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public RecordingCompleteCallback transferCallerId(String transferCallerId) { - this.transferCallerId = transferCallerId; return this; } - /** + /** * The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). * @return transferCallerId - **/ + */ @javax.annotation.Nullable public String getTransferCallerId() { return transferCallerId; } - public void setTransferCallerId(String transferCallerId) { this.transferCallerId = transferCallerId; } public RecordingCompleteCallback transferTo(String transferTo) { - this.transferTo = transferTo; return this; } - /** + /** * The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). * @return transferTo - **/ + */ @javax.annotation.Nullable public String getTransferTo() { return transferTo; } - public void setTransferTo(String transferTo) { this.transferTo = transferTo; } @@ -781,12 +735,12 @@ private String toIndentedString(Object o) { 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 RecordingCompleteCallback - */ + /** + * 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 RecordingCompleteCallback + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!RecordingCompleteCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -809,6 +763,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti 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())); } + // validate the optional field `direction` + if (jsonObj.get("direction") != null && !jsonObj.get("direction").isJsonNull()) { + CallDirectionEnum.validateJsonElement(jsonObj.get("direction")); + } if ((jsonObj.get("callId") != null && !jsonObj.get("callId").isJsonNull()) && !jsonObj.get("callId").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `callId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callId").toString())); } @@ -827,6 +785,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if ((jsonObj.get("duration") != null && !jsonObj.get("duration").isJsonNull()) && !jsonObj.get("duration").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `duration` to be a primitive type in the JSON string but got `%s`", jsonObj.get("duration").toString())); } + // validate the optional field `fileFormat` + if (jsonObj.get("fileFormat") != null && !jsonObj.get("fileFormat").isJsonNull()) { + FileFormatEnum.validateJsonElement(jsonObj.get("fileFormat")); + } 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())); } @@ -866,7 +828,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -905,22 +872,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of RecordingCompleteCallback given an JSON string - * - * @param jsonString JSON string - * @return An instance of RecordingCompleteCallback - * @throws IOException if the JSON string is invalid with respect to RecordingCompleteCallback - */ + /** + * Create an instance of RecordingCompleteCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of RecordingCompleteCallback + * @throws IOException if the JSON string is invalid with respect to RecordingCompleteCallback + */ public static RecordingCompleteCallback fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, RecordingCompleteCallback.class); } - /** - * Convert an instance of RecordingCompleteCallback to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of RecordingCompleteCallback 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/RecordingStateEnum.java b/src/main/java/com/bandwidth/sdk/model/RecordingStateEnum.java index 9e32ec07..ff3d9507 100644 --- a/src/main/java/com/bandwidth/sdk/model/RecordingStateEnum.java +++ b/src/main/java/com/bandwidth/sdk/model/RecordingStateEnum.java @@ -18,6 +18,7 @@ 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; @@ -68,5 +69,10 @@ public RecordingStateEnum read(final JsonReader jsonReader) throws IOException { return RecordingStateEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + RecordingStateEnum.fromValue(value); + } } diff --git a/src/main/java/com/bandwidth/sdk/model/RecordingTranscriptionMetadata.java b/src/main/java/com/bandwidth/sdk/model/RecordingTranscriptionMetadata.java index 028bc54e..afae64a5 100644 --- a/src/main/java/com/bandwidth/sdk/model/RecordingTranscriptionMetadata.java +++ b/src/main/java/com/bandwidth/sdk/model/RecordingTranscriptionMetadata.java @@ -39,12 +39,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -52,7 +50,7 @@ /** * If the recording was transcribed, metadata about the transcription */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class RecordingTranscriptionMetadata { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @@ -74,84 +72,76 @@ public RecordingTranscriptionMetadata() { } public RecordingTranscriptionMetadata id(String id) { - this.id = id; return this; } - /** + /** * The unique transcription ID * @return id - **/ + */ @javax.annotation.Nullable public String getId() { return id; } - public void setId(String id) { this.id = id; } public RecordingTranscriptionMetadata status(String status) { - this.status = status; return this; } - /** + /** * 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. * @return status - **/ + */ @javax.annotation.Nullable public String getStatus() { return status; } - public void setStatus(String status) { this.status = status; } public RecordingTranscriptionMetadata completedTime(OffsetDateTime completedTime) { - this.completedTime = completedTime; return this; } - /** + /** * The time that the transcription was completed * @return completedTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getCompletedTime() { return completedTime; } - public void setCompletedTime(OffsetDateTime completedTime) { this.completedTime = completedTime; } public RecordingTranscriptionMetadata url(URI url) { - this.url = url; return this; } - /** + /** * The URL of the [transcription](#operation/getCallTranscription) * @return url - **/ + */ @javax.annotation.Nullable public URI getUrl() { return url; } - public void setUrl(URI url) { this.url = url; } @@ -263,12 +253,12 @@ private String toIndentedString(Object o) { 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 RecordingTranscriptionMetadata - */ + /** + * 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 RecordingTranscriptionMetadata + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!RecordingTranscriptionMetadata.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -315,7 +305,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -354,22 +349,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of RecordingTranscriptionMetadata given an JSON string - * - * @param jsonString JSON string - * @return An instance of RecordingTranscriptionMetadata - * @throws IOException if the JSON string is invalid with respect to RecordingTranscriptionMetadata - */ + /** + * Create an instance of RecordingTranscriptionMetadata given an JSON string + * + * @param jsonString JSON string + * @return An instance of RecordingTranscriptionMetadata + * @throws IOException if the JSON string is invalid with respect to RecordingTranscriptionMetadata + */ public static RecordingTranscriptionMetadata fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, RecordingTranscriptionMetadata.class); } - /** - * Convert an instance of RecordingTranscriptionMetadata to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of RecordingTranscriptionMetadata 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/RecordingTranscriptions.java b/src/main/java/com/bandwidth/sdk/model/RecordingTranscriptions.java index 3d66395c..c09377bc 100644 --- a/src/main/java/com/bandwidth/sdk/model/RecordingTranscriptions.java +++ b/src/main/java/com/bandwidth/sdk/model/RecordingTranscriptions.java @@ -40,12 +40,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -53,17 +51,16 @@ /** * RecordingTranscriptions */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class RecordingTranscriptions { public static final String SERIALIZED_NAME_TRANSCRIPTS = "transcripts"; @SerializedName(SERIALIZED_NAME_TRANSCRIPTS) - private List transcripts; + private List transcripts = new ArrayList<>(); public RecordingTranscriptions() { } public RecordingTranscriptions transcripts(List transcripts) { - this.transcripts = transcripts; return this; } @@ -76,16 +73,15 @@ public RecordingTranscriptions addTranscriptsItem(Transcription transcriptsItem) return this; } - /** + /** * Get transcripts * @return transcripts - **/ + */ @javax.annotation.Nullable public List getTranscripts() { return transcripts; } - public void setTranscripts(List transcripts) { this.transcripts = transcripts; } @@ -188,12 +184,12 @@ private String toIndentedString(Object o) { 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 RecordingTranscriptions - */ + /** + * 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 RecordingTranscriptions + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!RecordingTranscriptions.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -245,7 +241,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -284,22 +285,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of RecordingTranscriptions given an JSON string - * - * @param jsonString JSON string - * @return An instance of RecordingTranscriptions - * @throws IOException if the JSON string is invalid with respect to RecordingTranscriptions - */ + /** + * Create an instance of RecordingTranscriptions given an JSON string + * + * @param jsonString JSON string + * @return An instance of RecordingTranscriptions + * @throws IOException if the JSON string is invalid with respect to RecordingTranscriptions + */ public static RecordingTranscriptions fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, RecordingTranscriptions.class); } - /** - * Convert an instance of RecordingTranscriptions to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of RecordingTranscriptions 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/RedirectCallback.java b/src/main/java/com/bandwidth/sdk/model/RedirectCallback.java index 1ea3efdc..4b45963c 100644 --- a/src/main/java/com/bandwidth/sdk/model/RedirectCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/RedirectCallback.java @@ -41,12 +41,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -54,7 +52,7 @@ /** * The Redirect event is fired when a <Redirect> verb is executed. Its purpose is to get the next set of verbs from the calling application. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class RedirectCallback { public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; @SerializedName(SERIALIZED_NAME_EVENT_TYPE) @@ -124,336 +122,304 @@ public RedirectCallback() { } public RedirectCallback eventType(String eventType) { - this.eventType = eventType; return this; } - /** + /** * 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. * @return eventType - **/ + */ @javax.annotation.Nullable public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public RedirectCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } - /** + /** * 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. * @return eventTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public RedirectCallback accountId(String accountId) { - this.accountId = accountId; return this; } - /** + /** * The user account associated with the call. * @return accountId - **/ + */ @javax.annotation.Nullable public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public RedirectCallback applicationId(String applicationId) { - this.applicationId = applicationId; return this; } - /** + /** * The id of the application associated with the call. * @return applicationId - **/ + */ @javax.annotation.Nullable public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public RedirectCallback from(String from) { - this.from = from; return this; } - /** + /** * The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). * @return from - **/ + */ @javax.annotation.Nullable public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public RedirectCallback to(String to) { - this.to = to; return this; } - /** + /** * The phone number that received the call, in E.164 format (e.g. +15555555555). * @return to - **/ + */ @javax.annotation.Nullable public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public RedirectCallback direction(CallDirectionEnum direction) { - this.direction = direction; return this; } - /** + /** * Get direction * @return direction - **/ + */ @javax.annotation.Nullable public CallDirectionEnum getDirection() { return direction; } - public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public RedirectCallback callId(String callId) { - this.callId = callId; return this; } - /** + /** * The call id associated with the event. * @return callId - **/ + */ @javax.annotation.Nullable public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public RedirectCallback callUrl(URI callUrl) { - this.callUrl = callUrl; return this; } - /** + /** * The URL of the call associated with the event. * @return callUrl - **/ + */ @javax.annotation.Nullable public URI getCallUrl() { return callUrl; } - public void setCallUrl(URI callUrl) { this.callUrl = callUrl; } public RedirectCallback parentCallId(String parentCallId) { - this.parentCallId = parentCallId; return this; } - /** + /** * (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present. * @return parentCallId - **/ + */ @javax.annotation.Nullable public String getParentCallId() { return parentCallId; } - public void setParentCallId(String parentCallId) { this.parentCallId = parentCallId; } public RedirectCallback enqueuedTime(OffsetDateTime enqueuedTime) { - this.enqueuedTime = enqueuedTime; return this; } - /** + /** * (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. * @return enqueuedTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } - public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public RedirectCallback startTime(OffsetDateTime startTime) { - this.startTime = startTime; return this; } - /** + /** * Time the call was started, in ISO 8601 format. * @return startTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getStartTime() { return startTime; } - public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public RedirectCallback answerTime(OffsetDateTime answerTime) { - this.answerTime = answerTime; return this; } - /** + /** * Time the call was answered, in ISO 8601 format. * @return answerTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getAnswerTime() { return answerTime; } - public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public RedirectCallback tag(String tag) { - this.tag = tag; return this; } - /** + /** * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. * @return tag - **/ + */ @javax.annotation.Nullable public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public RedirectCallback transferCallerId(String transferCallerId) { - this.transferCallerId = transferCallerId; return this; } - /** + /** * The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). * @return transferCallerId - **/ + */ @javax.annotation.Nullable public String getTransferCallerId() { return transferCallerId; } - public void setTransferCallerId(String transferCallerId) { this.transferCallerId = transferCallerId; } public RedirectCallback transferTo(String transferTo) { - this.transferTo = transferTo; return this; } - /** + /** * The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). * @return transferTo - **/ + */ @javax.annotation.Nullable public String getTransferTo() { return transferTo; } - public void setTransferTo(String transferTo) { this.transferTo = transferTo; } @@ -612,12 +578,12 @@ private String toIndentedString(Object o) { 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 RedirectCallback - */ + /** + * 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 RedirectCallback + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!RedirectCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -640,6 +606,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti 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())); } + // validate the optional field `direction` + if (jsonObj.get("direction") != null && !jsonObj.get("direction").isJsonNull()) { + CallDirectionEnum.validateJsonElement(jsonObj.get("direction")); + } if ((jsonObj.get("callId") != null && !jsonObj.get("callId").isJsonNull()) && !jsonObj.get("callId").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `callId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callId").toString())); } @@ -688,7 +658,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -727,22 +702,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of RedirectCallback given an JSON string - * - * @param jsonString JSON string - * @return An instance of RedirectCallback - * @throws IOException if the JSON string is invalid with respect to RedirectCallback - */ + /** + * Create an instance of RedirectCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of RedirectCallback + * @throws IOException if the JSON string is invalid with respect to RedirectCallback + */ public static RedirectCallback fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, RedirectCallback.class); } - /** - * Convert an instance of RedirectCallback to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of RedirectCallback 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/RedirectMethodEnum.java b/src/main/java/com/bandwidth/sdk/model/RedirectMethodEnum.java index 18c26b22..ef3d6bfd 100644 --- a/src/main/java/com/bandwidth/sdk/model/RedirectMethodEnum.java +++ b/src/main/java/com/bandwidth/sdk/model/RedirectMethodEnum.java @@ -18,6 +18,7 @@ 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; @@ -68,5 +69,10 @@ public RedirectMethodEnum read(final JsonReader jsonReader) throws IOException { return RedirectMethodEnum.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + RedirectMethodEnum.fromValue(value); + } } diff --git a/src/main/java/com/bandwidth/sdk/model/Region.java b/src/main/java/com/bandwidth/sdk/model/Region.java index 10abfe32..46a538a3 100644 --- a/src/main/java/com/bandwidth/sdk/model/Region.java +++ b/src/main/java/com/bandwidth/sdk/model/Region.java @@ -18,6 +18,7 @@ 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; @@ -68,5 +69,10 @@ public Region read(final JsonReader jsonReader) throws IOException { return Region.fromValue(value); } } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + Region.fromValue(value); + } } diff --git a/src/main/java/com/bandwidth/sdk/model/StirShaken.java b/src/main/java/com/bandwidth/sdk/model/StirShaken.java index 37f2ed35..7baea815 100644 --- a/src/main/java/com/bandwidth/sdk/model/StirShaken.java +++ b/src/main/java/com/bandwidth/sdk/model/StirShaken.java @@ -37,12 +37,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -50,7 +48,7 @@ /** * StirShaken */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class StirShaken { public static final String SERIALIZED_NAME_VERSTAT = "verstat"; @SerializedName(SERIALIZED_NAME_VERSTAT) @@ -68,63 +66,57 @@ public StirShaken() { } public StirShaken verstat(String verstat) { - this.verstat = verstat; return this; } - /** + /** * (optional) The verification status indicating whether the verification was successful or not. Possible values are TN-Verification-Passed and TN-Verification-Failed. * @return verstat - **/ + */ @javax.annotation.Nullable public String getVerstat() { return verstat; } - public void setVerstat(String verstat) { this.verstat = verstat; } public StirShaken attestationIndicator(String attestationIndicator) { - this.attestationIndicator = attestationIndicator; return this; } - /** + /** * (optional) The attestation level verified by Bandwidth. Possible values are A (full), B (partial) or C (gateway). * @return attestationIndicator - **/ + */ @javax.annotation.Nullable public String getAttestationIndicator() { return attestationIndicator; } - public void setAttestationIndicator(String attestationIndicator) { this.attestationIndicator = attestationIndicator; } public StirShaken originatingId(String originatingId) { - this.originatingId = originatingId; return this; } - /** + /** * (optional) A unique origination identifier. * @return originatingId - **/ + */ @javax.annotation.Nullable public String getOriginatingId() { return originatingId; } - public void setOriginatingId(String originatingId) { this.originatingId = originatingId; } @@ -233,12 +225,12 @@ private String toIndentedString(Object o) { 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 StirShaken - */ + /** + * 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 StirShaken + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!StirShaken.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -285,7 +277,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -324,22 +321,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of StirShaken given an JSON string - * - * @param jsonString JSON string - * @return An instance of StirShaken - * @throws IOException if the JSON string is invalid with respect to StirShaken - */ + /** + * Create an instance of StirShaken given an JSON string + * + * @param jsonString JSON string + * @return An instance of StirShaken + * @throws IOException if the JSON string is invalid with respect to StirShaken + */ public static StirShaken fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, StirShaken.class); } - /** - * Convert an instance of StirShaken to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of StirShaken 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/Tag.java index 6964e4d8..d34aabd4 100644 --- a/src/main/java/com/bandwidth/sdk/model/Tag.java +++ b/src/main/java/com/bandwidth/sdk/model/Tag.java @@ -37,12 +37,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -50,7 +48,7 @@ /** * Tag */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class Tag { public static final String SERIALIZED_NAME_KEY = "key"; @SerializedName(SERIALIZED_NAME_KEY) @@ -64,42 +62,38 @@ public Tag() { } public Tag key(String key) { - this.key = key; return this; } - /** + /** * Get key * @return key - **/ + */ @javax.annotation.Nullable public String getKey() { return key; } - public void setKey(String key) { this.key = key; } public Tag value(String value) { - this.value = value; return this; } - /** + /** * Get value * @return value - **/ + */ @javax.annotation.Nullable public String getValue() { return value; } - public void setValue(String value) { this.value = value; } @@ -205,12 +199,12 @@ private String toIndentedString(Object o) { 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 Tag - */ + /** + * 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 + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!Tag.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -254,7 +248,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -293,22 +292,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of Tag 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 - */ + /** + * Create an instance of Tag 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 + */ public static Tag fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, Tag.class); } - /** - * Convert an instance of Tag to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of Tag 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/TnLookupRequestError.java b/src/main/java/com/bandwidth/sdk/model/TnLookupRequestError.java index 1cfa0ab4..d7ff7324 100644 --- a/src/main/java/com/bandwidth/sdk/model/TnLookupRequestError.java +++ b/src/main/java/com/bandwidth/sdk/model/TnLookupRequestError.java @@ -37,12 +37,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -50,7 +48,7 @@ /** * TnLookupRequestError */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class TnLookupRequestError { public static final String SERIALIZED_NAME_MESSAGE = "message"; @SerializedName(SERIALIZED_NAME_MESSAGE) @@ -60,21 +58,19 @@ public TnLookupRequestError() { } public TnLookupRequestError message(String message) { - this.message = message; return this; } - /** + /** * A description of what validation error occurred. * @return message - **/ + */ @javax.annotation.Nullable public String getMessage() { return message; } - public void setMessage(String message) { this.message = message; } @@ -177,12 +173,12 @@ private String toIndentedString(Object o) { 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 TnLookupRequestError - */ + /** + * 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 TnLookupRequestError + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!TnLookupRequestError.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -223,7 +219,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -262,22 +263,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of TnLookupRequestError given an JSON string - * - * @param jsonString JSON string - * @return An instance of TnLookupRequestError - * @throws IOException if the JSON string is invalid with respect to TnLookupRequestError - */ + /** + * Create an instance of TnLookupRequestError given an JSON string + * + * @param jsonString JSON string + * @return An instance of TnLookupRequestError + * @throws IOException if the JSON string is invalid with respect to TnLookupRequestError + */ public static TnLookupRequestError fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, TnLookupRequestError.class); } - /** - * Convert an instance of TnLookupRequestError to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of TnLookupRequestError 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/TranscribeRecording.java b/src/main/java/com/bandwidth/sdk/model/TranscribeRecording.java index f5680890..f3eba021 100644 --- a/src/main/java/com/bandwidth/sdk/model/TranscribeRecording.java +++ b/src/main/java/com/bandwidth/sdk/model/TranscribeRecording.java @@ -40,12 +40,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -53,7 +51,7 @@ /** * TranscribeRecording */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class TranscribeRecording { public static final String SERIALIZED_NAME_CALLBACK_URL = "callbackUrl"; @SerializedName(SERIALIZED_NAME_CALLBACK_URL) @@ -87,149 +85,135 @@ public TranscribeRecording() { } public TranscribeRecording callbackUrl(URI callbackUrl) { - this.callbackUrl = callbackUrl; return this; } - /** + /** * The URL to send the [TranscriptionAvailable](/docs/voice/webhooks/transcriptionAvailable) event to. You should not include sensitive or personally-identifiable information in the callbackUrl field! Always use the proper username and password fields for authorization. * @return callbackUrl - **/ + */ @javax.annotation.Nullable public URI getCallbackUrl() { return callbackUrl; } - public void setCallbackUrl(URI callbackUrl) { this.callbackUrl = callbackUrl; } public TranscribeRecording callbackMethod(CallbackMethodEnum callbackMethod) { - this.callbackMethod = callbackMethod; return this; } - /** + /** * Get callbackMethod * @return callbackMethod - **/ + */ @javax.annotation.Nullable public CallbackMethodEnum getCallbackMethod() { return callbackMethod; } - public void setCallbackMethod(CallbackMethodEnum callbackMethod) { this.callbackMethod = callbackMethod; } public TranscribeRecording username(String username) { - this.username = username; return this; } - /** + /** * Basic auth username. * @return username - **/ + */ @javax.annotation.Nullable public String getUsername() { return username; } - public void setUsername(String username) { this.username = username; } public TranscribeRecording password(String password) { - this.password = password; return this; } - /** + /** * Basic auth password. * @return password - **/ + */ @javax.annotation.Nullable public String getPassword() { return password; } - public void setPassword(String password) { this.password = password; } public TranscribeRecording tag(String tag) { - this.tag = tag; return this; } - /** + /** * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. * @return tag - **/ + */ @javax.annotation.Nullable public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public TranscribeRecording callbackTimeout(Double callbackTimeout) { - this.callbackTimeout = callbackTimeout; return this; } - /** + /** * This is the timeout (in seconds) to use when delivering the webhook to `callbackUrl`. Can be any numeric value (including decimals) between 1 and 25. * minimum: 1 * maximum: 25 * @return callbackTimeout - **/ + */ @javax.annotation.Nullable public Double getCallbackTimeout() { return callbackTimeout; } - public void setCallbackTimeout(Double callbackTimeout) { this.callbackTimeout = callbackTimeout; } public TranscribeRecording detectLanguage(Boolean detectLanguage) { - this.detectLanguage = detectLanguage; return this; } - /** + /** * A boolean value to indicate that the recording may not be in English, and the transcription service will need to detect the dominant language the recording is in and transcribe accordingly. Current supported languages are English, French, and Spanish. * @return detectLanguage - **/ + */ @javax.annotation.Nullable public Boolean getDetectLanguage() { return detectLanguage; } - public void setDetectLanguage(Boolean detectLanguage) { this.detectLanguage = detectLanguage; } @@ -361,12 +345,12 @@ private String toIndentedString(Object o) { 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 TranscribeRecording - */ + /** + * 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 TranscribeRecording + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!TranscribeRecording.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -377,6 +361,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if ((jsonObj.get("callbackUrl") != null && !jsonObj.get("callbackUrl").isJsonNull()) && !jsonObj.get("callbackUrl").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `callbackUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callbackUrl").toString())); } + // validate the optional field `callbackMethod` + if (jsonObj.get("callbackMethod") != null && !jsonObj.get("callbackMethod").isJsonNull()) { + CallbackMethodEnum.validateJsonElement(jsonObj.get("callbackMethod")); + } if ((jsonObj.get("username") != null && !jsonObj.get("username").isJsonNull()) && !jsonObj.get("username").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString())); } @@ -416,7 +404,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -455,22 +448,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of TranscribeRecording given an JSON string - * - * @param jsonString JSON string - * @return An instance of TranscribeRecording - * @throws IOException if the JSON string is invalid with respect to TranscribeRecording - */ + /** + * Create an instance of TranscribeRecording given an JSON string + * + * @param jsonString JSON string + * @return An instance of TranscribeRecording + * @throws IOException if the JSON string is invalid with respect to TranscribeRecording + */ public static TranscribeRecording fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, TranscribeRecording.class); } - /** - * Convert an instance of TranscribeRecording to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of TranscribeRecording 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/Transcription.java b/src/main/java/com/bandwidth/sdk/model/Transcription.java index dc3f1c32..a99672e9 100644 --- a/src/main/java/com/bandwidth/sdk/model/Transcription.java +++ b/src/main/java/com/bandwidth/sdk/model/Transcription.java @@ -37,12 +37,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -50,7 +48,7 @@ /** * Transcription */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class Transcription { public static final String SERIALIZED_NAME_TEXT = "text"; @SerializedName(SERIALIZED_NAME_TEXT) @@ -64,42 +62,38 @@ public Transcription() { } public Transcription text(String text) { - this.text = text; return this; } - /** + /** * The transcribed text * @return text - **/ + */ @javax.annotation.Nullable public String getText() { return text; } - public void setText(String text) { this.text = text; } public Transcription confidence(Double confidence) { - this.confidence = confidence; return this; } - /** + /** * The confidence on the recognized content, ranging from `0.0` to `1.0` with `1.0` being the highest confidence. * @return confidence - **/ + */ @javax.annotation.Nullable public Double getConfidence() { return confidence; } - public void setConfidence(Double confidence) { this.confidence = confidence; } @@ -205,12 +199,12 @@ private String toIndentedString(Object o) { 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 Transcription - */ + /** + * 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 Transcription + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!Transcription.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -251,7 +245,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -290,22 +289,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of Transcription given an JSON string - * - * @param jsonString JSON string - * @return An instance of Transcription - * @throws IOException if the JSON string is invalid with respect to Transcription - */ + /** + * Create an instance of Transcription given an JSON string + * + * @param jsonString JSON string + * @return An instance of Transcription + * @throws IOException if the JSON string is invalid with respect to Transcription + */ public static Transcription fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, Transcription.class); } - /** - * Convert an instance of Transcription to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of Transcription 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/TranscriptionAvailableCallback.java b/src/main/java/com/bandwidth/sdk/model/TranscriptionAvailableCallback.java index 467d85e0..30acbb65 100644 --- a/src/main/java/com/bandwidth/sdk/model/TranscriptionAvailableCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/TranscriptionAvailableCallback.java @@ -43,12 +43,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -56,7 +54,7 @@ /** * The Transcription Available event is sent when the recording transcription is available to be downloaded. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class TranscriptionAvailableCallback { public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; @SerializedName(SERIALIZED_NAME_EVENT_TYPE) @@ -146,441 +144,399 @@ public TranscriptionAvailableCallback() { } public TranscriptionAvailableCallback eventType(String eventType) { - this.eventType = eventType; return this; } - /** + /** * 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. * @return eventType - **/ + */ @javax.annotation.Nullable public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public TranscriptionAvailableCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } - /** + /** * 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. * @return eventTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public TranscriptionAvailableCallback accountId(String accountId) { - this.accountId = accountId; return this; } - /** + /** * The user account associated with the call. * @return accountId - **/ + */ @javax.annotation.Nullable public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public TranscriptionAvailableCallback applicationId(String applicationId) { - this.applicationId = applicationId; return this; } - /** + /** * The id of the application associated with the call. * @return applicationId - **/ + */ @javax.annotation.Nullable public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public TranscriptionAvailableCallback from(String from) { - this.from = from; return this; } - /** + /** * The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). * @return from - **/ + */ @javax.annotation.Nullable public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public TranscriptionAvailableCallback to(String to) { - this.to = to; return this; } - /** + /** * The phone number that received the call, in E.164 format (e.g. +15555555555). * @return to - **/ + */ @javax.annotation.Nullable public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public TranscriptionAvailableCallback direction(CallDirectionEnum direction) { - this.direction = direction; return this; } - /** + /** * Get direction * @return direction - **/ + */ @javax.annotation.Nullable public CallDirectionEnum getDirection() { return direction; } - public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public TranscriptionAvailableCallback callId(String callId) { - this.callId = callId; return this; } - /** + /** * The call id associated with the event. * @return callId - **/ + */ @javax.annotation.Nullable public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public TranscriptionAvailableCallback callUrl(URI callUrl) { - this.callUrl = callUrl; return this; } - /** + /** * The URL of the call associated with the event. * @return callUrl - **/ + */ @javax.annotation.Nullable public URI getCallUrl() { return callUrl; } - public void setCallUrl(URI callUrl) { this.callUrl = callUrl; } public TranscriptionAvailableCallback mediaUrl(URI mediaUrl) { - this.mediaUrl = mediaUrl; return this; } - /** + /** * The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded. * @return mediaUrl - **/ + */ @javax.annotation.Nullable public URI getMediaUrl() { return mediaUrl; } - public void setMediaUrl(URI mediaUrl) { this.mediaUrl = mediaUrl; } public TranscriptionAvailableCallback parentCallId(String parentCallId) { - this.parentCallId = parentCallId; return this; } - /** + /** * (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present. * @return parentCallId - **/ + */ @javax.annotation.Nullable public String getParentCallId() { return parentCallId; } - public void setParentCallId(String parentCallId) { this.parentCallId = parentCallId; } public TranscriptionAvailableCallback recordingId(String recordingId) { - this.recordingId = recordingId; return this; } - /** + /** * The unique ID of this recording * @return recordingId - **/ + */ @javax.annotation.Nullable public String getRecordingId() { return recordingId; } - public void setRecordingId(String recordingId) { this.recordingId = recordingId; } public TranscriptionAvailableCallback enqueuedTime(OffsetDateTime enqueuedTime) { - this.enqueuedTime = enqueuedTime; return this; } - /** + /** * (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. * @return enqueuedTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } - public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public TranscriptionAvailableCallback startTime(OffsetDateTime startTime) { - this.startTime = startTime; return this; } - /** + /** * Time the call was started, in ISO 8601 format. * @return startTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getStartTime() { return startTime; } - public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public TranscriptionAvailableCallback endTime(OffsetDateTime endTime) { - this.endTime = endTime; return this; } - /** + /** * The time that the recording ended in ISO-8601 format * @return endTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEndTime() { return endTime; } - public void setEndTime(OffsetDateTime endTime) { this.endTime = endTime; } public TranscriptionAvailableCallback duration(String duration) { - this.duration = duration; return this; } - /** + /** * The duration of the recording in ISO-8601 format * @return duration - **/ + */ @javax.annotation.Nullable public String getDuration() { return duration; } - public void setDuration(String duration) { this.duration = duration; } public TranscriptionAvailableCallback fileFormat(FileFormatEnum fileFormat) { - this.fileFormat = fileFormat; return this; } - /** + /** * Get fileFormat * @return fileFormat - **/ + */ @javax.annotation.Nullable public FileFormatEnum getFileFormat() { return fileFormat; } - public void setFileFormat(FileFormatEnum fileFormat) { this.fileFormat = fileFormat; } public TranscriptionAvailableCallback tag(String tag) { - this.tag = tag; return this; } - /** + /** * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. * @return tag - **/ + */ @javax.annotation.Nullable public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public TranscriptionAvailableCallback transcription(Transcription transcription) { - this.transcription = transcription; return this; } - /** + /** * Get transcription * @return transcription - **/ + */ @javax.annotation.Nullable public Transcription getTranscription() { return transcription; } - public void setTranscription(Transcription transcription) { this.transcription = transcription; } public TranscriptionAvailableCallback transferCallerId(String transferCallerId) { - this.transferCallerId = transferCallerId; return this; } - /** + /** * The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). * @return transferCallerId - **/ + */ @javax.annotation.Nullable public String getTransferCallerId() { return transferCallerId; } - public void setTransferCallerId(String transferCallerId) { this.transferCallerId = transferCallerId; } public TranscriptionAvailableCallback transferTo(String transferTo) { - this.transferTo = transferTo; return this; } - /** + /** * The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). * @return transferTo - **/ + */ @javax.annotation.Nullable public String getTransferTo() { return transferTo; } - public void setTransferTo(String transferTo) { this.transferTo = transferTo; } @@ -754,12 +710,12 @@ private String toIndentedString(Object o) { 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 TranscriptionAvailableCallback - */ + /** + * 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 TranscriptionAvailableCallback + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!TranscriptionAvailableCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -782,6 +738,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti 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())); } + // validate the optional field `direction` + if (jsonObj.get("direction") != null && !jsonObj.get("direction").isJsonNull()) { + CallDirectionEnum.validateJsonElement(jsonObj.get("direction")); + } if ((jsonObj.get("callId") != null && !jsonObj.get("callId").isJsonNull()) && !jsonObj.get("callId").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `callId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callId").toString())); } @@ -800,6 +760,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if ((jsonObj.get("duration") != null && !jsonObj.get("duration").isJsonNull()) && !jsonObj.get("duration").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `duration` to be a primitive type in the JSON string but got `%s`", jsonObj.get("duration").toString())); } + // validate the optional field `fileFormat` + if (jsonObj.get("fileFormat") != null && !jsonObj.get("fileFormat").isJsonNull()) { + FileFormatEnum.validateJsonElement(jsonObj.get("fileFormat")); + } 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())); } @@ -843,7 +807,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -882,22 +851,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of TranscriptionAvailableCallback given an JSON string - * - * @param jsonString JSON string - * @return An instance of TranscriptionAvailableCallback - * @throws IOException if the JSON string is invalid with respect to TranscriptionAvailableCallback - */ + /** + * Create an instance of TranscriptionAvailableCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of TranscriptionAvailableCallback + * @throws IOException if the JSON string is invalid with respect to TranscriptionAvailableCallback + */ public static TranscriptionAvailableCallback fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, TranscriptionAvailableCallback.class); } - /** - * Convert an instance of TranscriptionAvailableCallback to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of TranscriptionAvailableCallback 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/TransferAnswerCallback.java b/src/main/java/com/bandwidth/sdk/model/TransferAnswerCallback.java index 8211e368..ec82efab 100644 --- a/src/main/java/com/bandwidth/sdk/model/TransferAnswerCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/TransferAnswerCallback.java @@ -41,12 +41,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -54,7 +52,7 @@ /** * When processing a <Transfer> verb, this event is sent when a called party (B-leg) answers. The event is sent to the endpoint specified in the transferAnswerUrl attribute of the <PhoneNumber> tag that answered. BXML returned by this callback will be executed for the called party only. After all BXML has been executed, the called party will be bridged to the original call. Most BXML verbs are allowed in response to a transferAnswer event, but some are not allowed. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class TransferAnswerCallback { public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; @SerializedName(SERIALIZED_NAME_EVENT_TYPE) @@ -120,315 +118,285 @@ public TransferAnswerCallback() { } public TransferAnswerCallback eventType(String eventType) { - this.eventType = eventType; return this; } - /** + /** * 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. * @return eventType - **/ + */ @javax.annotation.Nullable public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public TransferAnswerCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } - /** + /** * 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. * @return eventTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public TransferAnswerCallback accountId(String accountId) { - this.accountId = accountId; return this; } - /** + /** * The user account associated with the call. * @return accountId - **/ + */ @javax.annotation.Nullable public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public TransferAnswerCallback applicationId(String applicationId) { - this.applicationId = applicationId; return this; } - /** + /** * The id of the application associated with the call. * @return applicationId - **/ + */ @javax.annotation.Nullable public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public TransferAnswerCallback from(String from) { - this.from = from; return this; } - /** + /** * The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). * @return from - **/ + */ @javax.annotation.Nullable public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public TransferAnswerCallback to(String to) { - this.to = to; return this; } - /** + /** * The phone number that received the call, in E.164 format (e.g. +15555555555). * @return to - **/ + */ @javax.annotation.Nullable public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public TransferAnswerCallback direction(CallDirectionEnum direction) { - this.direction = direction; return this; } - /** + /** * Get direction * @return direction - **/ + */ @javax.annotation.Nullable public CallDirectionEnum getDirection() { return direction; } - public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public TransferAnswerCallback callId(String callId) { - this.callId = callId; return this; } - /** + /** * The call id associated with the event. * @return callId - **/ + */ @javax.annotation.Nullable public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public TransferAnswerCallback callUrl(URI callUrl) { - this.callUrl = callUrl; return this; } - /** + /** * The URL of the call associated with the event. * @return callUrl - **/ + */ @javax.annotation.Nullable public URI getCallUrl() { return callUrl; } - public void setCallUrl(URI callUrl) { this.callUrl = callUrl; } public TransferAnswerCallback enqueuedTime(OffsetDateTime enqueuedTime) { - this.enqueuedTime = enqueuedTime; return this; } - /** + /** * (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. * @return enqueuedTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } - public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public TransferAnswerCallback startTime(OffsetDateTime startTime) { - this.startTime = startTime; return this; } - /** + /** * Time the call was started, in ISO 8601 format. * @return startTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getStartTime() { return startTime; } - public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public TransferAnswerCallback answerTime(OffsetDateTime answerTime) { - this.answerTime = answerTime; return this; } - /** + /** * Time the call was answered, in ISO 8601 format. * @return answerTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getAnswerTime() { return answerTime; } - public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public TransferAnswerCallback tag(String tag) { - this.tag = tag; return this; } - /** + /** * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. * @return tag - **/ + */ @javax.annotation.Nullable public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public TransferAnswerCallback transferCallerId(String transferCallerId) { - this.transferCallerId = transferCallerId; return this; } - /** + /** * The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). * @return transferCallerId - **/ + */ @javax.annotation.Nullable public String getTransferCallerId() { return transferCallerId; } - public void setTransferCallerId(String transferCallerId) { this.transferCallerId = transferCallerId; } public TransferAnswerCallback transferTo(String transferTo) { - this.transferTo = transferTo; return this; } - /** + /** * The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). * @return transferTo - **/ + */ @javax.annotation.Nullable public String getTransferTo() { return transferTo; } - public void setTransferTo(String transferTo) { this.transferTo = transferTo; } @@ -584,12 +552,12 @@ private String toIndentedString(Object o) { 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 TransferAnswerCallback - */ + /** + * 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 TransferAnswerCallback + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!TransferAnswerCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -612,6 +580,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti 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())); } + // validate the optional field `direction` + if (jsonObj.get("direction") != null && !jsonObj.get("direction").isJsonNull()) { + CallDirectionEnum.validateJsonElement(jsonObj.get("direction")); + } if ((jsonObj.get("callId") != null && !jsonObj.get("callId").isJsonNull()) && !jsonObj.get("callId").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `callId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callId").toString())); } @@ -657,7 +629,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -696,22 +673,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of TransferAnswerCallback given an JSON string - * - * @param jsonString JSON string - * @return An instance of TransferAnswerCallback - * @throws IOException if the JSON string is invalid with respect to TransferAnswerCallback - */ + /** + * Create an instance of TransferAnswerCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of TransferAnswerCallback + * @throws IOException if the JSON string is invalid with respect to TransferAnswerCallback + */ public static TransferAnswerCallback fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, TransferAnswerCallback.class); } - /** - * Convert an instance of TransferAnswerCallback to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of TransferAnswerCallback 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/TransferCompleteCallback.java b/src/main/java/com/bandwidth/sdk/model/TransferCompleteCallback.java index d394b1e9..580a9708 100644 --- a/src/main/java/com/bandwidth/sdk/model/TransferCompleteCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/TransferCompleteCallback.java @@ -41,12 +41,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -54,7 +52,7 @@ /** * This event is sent to the transferCompleteUrl of the A-leg's <Transfer> verb when the transferred call (B-leg) completes. In a simultaneous ringing scenario, only one B-leg succeeds and this event corresponds to that successful leg. If none of the calls were answered, the transferComplete event corresponds to one of the legs. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class TransferCompleteCallback { public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; @SerializedName(SERIALIZED_NAME_EVENT_TYPE) @@ -132,378 +130,342 @@ public TransferCompleteCallback() { } public TransferCompleteCallback eventType(String eventType) { - this.eventType = eventType; return this; } - /** + /** * 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. * @return eventType - **/ + */ @javax.annotation.Nullable public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public TransferCompleteCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } - /** + /** * 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. * @return eventTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public TransferCompleteCallback accountId(String accountId) { - this.accountId = accountId; return this; } - /** + /** * The user account associated with the call. * @return accountId - **/ + */ @javax.annotation.Nullable public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public TransferCompleteCallback applicationId(String applicationId) { - this.applicationId = applicationId; return this; } - /** + /** * The id of the application associated with the call. * @return applicationId - **/ + */ @javax.annotation.Nullable public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public TransferCompleteCallback from(String from) { - this.from = from; return this; } - /** + /** * The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). * @return from - **/ + */ @javax.annotation.Nullable public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public TransferCompleteCallback to(String to) { - this.to = to; return this; } - /** + /** * The phone number that received the call, in E.164 format (e.g. +15555555555). * @return to - **/ + */ @javax.annotation.Nullable public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public TransferCompleteCallback direction(CallDirectionEnum direction) { - this.direction = direction; return this; } - /** + /** * Get direction * @return direction - **/ + */ @javax.annotation.Nullable public CallDirectionEnum getDirection() { return direction; } - public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public TransferCompleteCallback callId(String callId) { - this.callId = callId; return this; } - /** + /** * The call id associated with the event. * @return callId - **/ + */ @javax.annotation.Nullable public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public TransferCompleteCallback callUrl(URI callUrl) { - this.callUrl = callUrl; return this; } - /** + /** * The URL of the call associated with the event. * @return callUrl - **/ + */ @javax.annotation.Nullable public URI getCallUrl() { return callUrl; } - public void setCallUrl(URI callUrl) { this.callUrl = callUrl; } public TransferCompleteCallback enqueuedTime(OffsetDateTime enqueuedTime) { - this.enqueuedTime = enqueuedTime; return this; } - /** + /** * (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. * @return enqueuedTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } - public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public TransferCompleteCallback startTime(OffsetDateTime startTime) { - this.startTime = startTime; return this; } - /** + /** * Time the call was started, in ISO 8601 format. * @return startTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getStartTime() { return startTime; } - public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public TransferCompleteCallback answerTime(OffsetDateTime answerTime) { - this.answerTime = answerTime; return this; } - /** + /** * Time the call was answered, in ISO 8601 format. * @return answerTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getAnswerTime() { return answerTime; } - public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public TransferCompleteCallback tag(String tag) { - this.tag = tag; return this; } - /** + /** * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. * @return tag - **/ + */ @javax.annotation.Nullable public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public TransferCompleteCallback transferCallerId(String transferCallerId) { - this.transferCallerId = transferCallerId; return this; } - /** + /** * The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). * @return transferCallerId - **/ + */ @javax.annotation.Nullable public String getTransferCallerId() { return transferCallerId; } - public void setTransferCallerId(String transferCallerId) { this.transferCallerId = transferCallerId; } public TransferCompleteCallback transferTo(String transferTo) { - this.transferTo = transferTo; return this; } - /** + /** * The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). * @return transferTo - **/ + */ @javax.annotation.Nullable public String getTransferTo() { return transferTo; } - public void setTransferTo(String transferTo) { this.transferTo = transferTo; } public TransferCompleteCallback cause(String cause) { - this.cause = cause; return this; } - /** + /** * Reason the call failed - hangup, busy, timeout, cancel, rejected, callback-error, invalid-bxml, application-error, account-limit, node-capacity-exceeded, error, or unknown. * @return cause - **/ + */ @javax.annotation.Nullable public String getCause() { return cause; } - public void setCause(String cause) { this.cause = cause; } public TransferCompleteCallback errorMessage(String errorMessage) { - this.errorMessage = errorMessage; return this; } - /** + /** * Text explaining the reason that caused the call to fail in case of errors. * @return errorMessage - **/ + */ @javax.annotation.Nullable public String getErrorMessage() { return errorMessage; } - public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; } public TransferCompleteCallback errorId(String errorId) { - this.errorId = errorId; return this; } - /** + /** * Bandwidth's internal id that references the error event. * @return errorId - **/ + */ @javax.annotation.Nullable public String getErrorId() { return errorId; } - public void setErrorId(String errorId) { this.errorId = errorId; } @@ -668,12 +630,12 @@ private String toIndentedString(Object o) { 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 TransferCompleteCallback - */ + /** + * 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 TransferCompleteCallback + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!TransferCompleteCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -696,6 +658,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti 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())); } + // validate the optional field `direction` + if (jsonObj.get("direction") != null && !jsonObj.get("direction").isJsonNull()) { + CallDirectionEnum.validateJsonElement(jsonObj.get("direction")); + } if ((jsonObj.get("callId") != null && !jsonObj.get("callId").isJsonNull()) && !jsonObj.get("callId").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `callId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callId").toString())); } @@ -750,7 +716,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -789,22 +760,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of TransferCompleteCallback given an JSON string - * - * @param jsonString JSON string - * @return An instance of TransferCompleteCallback - * @throws IOException if the JSON string is invalid with respect to TransferCompleteCallback - */ + /** + * Create an instance of TransferCompleteCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of TransferCompleteCallback + * @throws IOException if the JSON string is invalid with respect to TransferCompleteCallback + */ public static TransferCompleteCallback fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, TransferCompleteCallback.class); } - /** - * Convert an instance of TransferCompleteCallback to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of TransferCompleteCallback 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/TransferDisconnectCallback.java b/src/main/java/com/bandwidth/sdk/model/TransferDisconnectCallback.java index aa2ad876..20e7149b 100644 --- a/src/main/java/com/bandwidth/sdk/model/TransferDisconnectCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/TransferDisconnectCallback.java @@ -41,12 +41,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -54,7 +52,7 @@ /** * This event is sent to the transferDisconnectUrl of each <PhoneNumber> tag when its respective call leg ends for any reason. The event is sent in the normal case, when the transferred leg is answered and later hung up, but is also sent if the new leg was never answered in the first place, if it was rejected, and if the original call leg hung up before the transferred leg. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class TransferDisconnectCallback { public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; @SerializedName(SERIALIZED_NAME_EVENT_TYPE) @@ -140,420 +138,380 @@ public TransferDisconnectCallback() { } public TransferDisconnectCallback eventType(String eventType) { - this.eventType = eventType; return this; } - /** + /** * 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. * @return eventType - **/ + */ @javax.annotation.Nullable public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public TransferDisconnectCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } - /** + /** * 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. * @return eventTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public TransferDisconnectCallback accountId(String accountId) { - this.accountId = accountId; return this; } - /** + /** * The user account associated with the call. * @return accountId - **/ + */ @javax.annotation.Nullable public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public TransferDisconnectCallback applicationId(String applicationId) { - this.applicationId = applicationId; return this; } - /** + /** * The id of the application associated with the call. * @return applicationId - **/ + */ @javax.annotation.Nullable public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public TransferDisconnectCallback from(String from) { - this.from = from; return this; } - /** + /** * The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). * @return from - **/ + */ @javax.annotation.Nullable public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public TransferDisconnectCallback to(String to) { - this.to = to; return this; } - /** + /** * The phone number that received the call, in E.164 format (e.g. +15555555555). * @return to - **/ + */ @javax.annotation.Nullable public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public TransferDisconnectCallback direction(CallDirectionEnum direction) { - this.direction = direction; return this; } - /** + /** * Get direction * @return direction - **/ + */ @javax.annotation.Nullable public CallDirectionEnum getDirection() { return direction; } - public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public TransferDisconnectCallback callId(String callId) { - this.callId = callId; return this; } - /** + /** * The call id associated with the event. * @return callId - **/ + */ @javax.annotation.Nullable public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public TransferDisconnectCallback callUrl(URI callUrl) { - this.callUrl = callUrl; return this; } - /** + /** * The URL of the call associated with the event. * @return callUrl - **/ + */ @javax.annotation.Nullable public URI getCallUrl() { return callUrl; } - public void setCallUrl(URI callUrl) { this.callUrl = callUrl; } public TransferDisconnectCallback parentCallId(String parentCallId) { - this.parentCallId = parentCallId; return this; } - /** + /** * (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present. * @return parentCallId - **/ + */ @javax.annotation.Nullable public String getParentCallId() { return parentCallId; } - public void setParentCallId(String parentCallId) { this.parentCallId = parentCallId; } public TransferDisconnectCallback enqueuedTime(OffsetDateTime enqueuedTime) { - this.enqueuedTime = enqueuedTime; return this; } - /** + /** * (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. * @return enqueuedTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } - public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public TransferDisconnectCallback startTime(OffsetDateTime startTime) { - this.startTime = startTime; return this; } - /** + /** * Time the call was started, in ISO 8601 format. * @return startTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getStartTime() { return startTime; } - public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public TransferDisconnectCallback answerTime(OffsetDateTime answerTime) { - this.answerTime = answerTime; return this; } - /** + /** * Time the call was answered, in ISO 8601 format. * @return answerTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getAnswerTime() { return answerTime; } - public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public TransferDisconnectCallback endTime(OffsetDateTime endTime) { - this.endTime = endTime; return this; } - /** + /** * The time that the recording ended in ISO-8601 format * @return endTime - **/ + */ @javax.annotation.Nullable public OffsetDateTime getEndTime() { return endTime; } - public void setEndTime(OffsetDateTime endTime) { this.endTime = endTime; } public TransferDisconnectCallback tag(String tag) { - this.tag = tag; return this; } - /** + /** * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. * @return tag - **/ + */ @javax.annotation.Nullable public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public TransferDisconnectCallback transferCallerId(String transferCallerId) { - this.transferCallerId = transferCallerId; return this; } - /** + /** * The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). * @return transferCallerId - **/ + */ @javax.annotation.Nullable public String getTransferCallerId() { return transferCallerId; } - public void setTransferCallerId(String transferCallerId) { this.transferCallerId = transferCallerId; } public TransferDisconnectCallback transferTo(String transferTo) { - this.transferTo = transferTo; return this; } - /** + /** * The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). * @return transferTo - **/ + */ @javax.annotation.Nullable public String getTransferTo() { return transferTo; } - public void setTransferTo(String transferTo) { this.transferTo = transferTo; } public TransferDisconnectCallback cause(String cause) { - this.cause = cause; return this; } - /** + /** * Reason the call failed - hangup, busy, timeout, cancel, rejected, callback-error, invalid-bxml, application-error, account-limit, node-capacity-exceeded, error, or unknown. * @return cause - **/ + */ @javax.annotation.Nullable public String getCause() { return cause; } - public void setCause(String cause) { this.cause = cause; } public TransferDisconnectCallback errorMessage(String errorMessage) { - this.errorMessage = errorMessage; return this; } - /** + /** * Text explaining the reason that caused the call to fail in case of errors. * @return errorMessage - **/ + */ @javax.annotation.Nullable public String getErrorMessage() { return errorMessage; } - public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; } public TransferDisconnectCallback errorId(String errorId) { - this.errorId = errorId; return this; } - /** + /** * Bandwidth's internal id that references the error event. * @return errorId - **/ + */ @javax.annotation.Nullable public String getErrorId() { return errorId; } - public void setErrorId(String errorId) { this.errorId = errorId; } @@ -724,12 +682,12 @@ private String toIndentedString(Object o) { 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 TransferDisconnectCallback - */ + /** + * 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 TransferDisconnectCallback + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!TransferDisconnectCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -752,6 +710,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti 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())); } + // validate the optional field `direction` + if (jsonObj.get("direction") != null && !jsonObj.get("direction").isJsonNull()) { + CallDirectionEnum.validateJsonElement(jsonObj.get("direction")); + } if ((jsonObj.get("callId") != null && !jsonObj.get("callId").isJsonNull()) && !jsonObj.get("callId").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `callId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callId").toString())); } @@ -809,7 +771,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -848,22 +815,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of TransferDisconnectCallback given an JSON string - * - * @param jsonString JSON string - * @return An instance of TransferDisconnectCallback - * @throws IOException if the JSON string is invalid with respect to TransferDisconnectCallback - */ + /** + * Create an instance of TransferDisconnectCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of TransferDisconnectCallback + * @throws IOException if the JSON string is invalid with respect to TransferDisconnectCallback + */ public static TransferDisconnectCallback fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, TransferDisconnectCallback.class); } - /** - * Convert an instance of TransferDisconnectCallback to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of TransferDisconnectCallback 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/UpdateCall.java b/src/main/java/com/bandwidth/sdk/model/UpdateCall.java index c367471e..08abb6b4 100644 --- a/src/main/java/com/bandwidth/sdk/model/UpdateCall.java +++ b/src/main/java/com/bandwidth/sdk/model/UpdateCall.java @@ -41,12 +41,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -54,7 +52,7 @@ /** * UpdateCall */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class UpdateCall { public static final String SERIALIZED_NAME_STATE = "state"; @SerializedName(SERIALIZED_NAME_STATE) @@ -100,210 +98,190 @@ public UpdateCall() { } public UpdateCall state(CallStateEnum state) { - this.state = state; return this; } - /** + /** * Get state * @return state - **/ + */ @javax.annotation.Nullable public CallStateEnum getState() { return state; } - public void setState(CallStateEnum state) { this.state = state; } public UpdateCall redirectUrl(URI redirectUrl) { - this.redirectUrl = redirectUrl; return this; } - /** + /** * The URL to send the [Redirect](/docs/voice/bxml/redirect) event to which will provide new BXML. Required if `state` is `active`. Not allowed if `state` is `completed`. * @return redirectUrl - **/ + */ @javax.annotation.Nullable public URI getRedirectUrl() { return redirectUrl; } - public void setRedirectUrl(URI redirectUrl) { this.redirectUrl = redirectUrl; } public UpdateCall redirectMethod(RedirectMethodEnum redirectMethod) { - this.redirectMethod = redirectMethod; return this; } - /** + /** * Get redirectMethod * @return redirectMethod - **/ + */ @javax.annotation.Nullable public RedirectMethodEnum getRedirectMethod() { return redirectMethod; } - public void setRedirectMethod(RedirectMethodEnum redirectMethod) { this.redirectMethod = redirectMethod; } public UpdateCall username(String username) { - this.username = username; return this; } - /** + /** * Basic auth username. * @return username - **/ + */ @javax.annotation.Nullable public String getUsername() { return username; } - public void setUsername(String username) { this.username = username; } public UpdateCall password(String password) { - this.password = password; return this; } - /** + /** * Basic auth password. * @return password - **/ + */ @javax.annotation.Nullable public String getPassword() { return password; } - public void setPassword(String password) { this.password = password; } public UpdateCall redirectFallbackUrl(URI redirectFallbackUrl) { - this.redirectFallbackUrl = redirectFallbackUrl; return this; } - /** + /** * A fallback url which, if provided, will be used to retry the redirect callback delivery in case `redirectUrl` fails to respond. * @return redirectFallbackUrl - **/ + */ @javax.annotation.Nullable public URI getRedirectFallbackUrl() { return redirectFallbackUrl; } - public void setRedirectFallbackUrl(URI redirectFallbackUrl) { this.redirectFallbackUrl = redirectFallbackUrl; } public UpdateCall redirectFallbackMethod(RedirectMethodEnum redirectFallbackMethod) { - this.redirectFallbackMethod = redirectFallbackMethod; return this; } - /** + /** * Get redirectFallbackMethod * @return redirectFallbackMethod - **/ + */ @javax.annotation.Nullable public RedirectMethodEnum getRedirectFallbackMethod() { return redirectFallbackMethod; } - public void setRedirectFallbackMethod(RedirectMethodEnum redirectFallbackMethod) { this.redirectFallbackMethod = redirectFallbackMethod; } public UpdateCall fallbackUsername(String fallbackUsername) { - this.fallbackUsername = fallbackUsername; return this; } - /** + /** * Basic auth username. * @return fallbackUsername - **/ + */ @javax.annotation.Nullable public String getFallbackUsername() { return fallbackUsername; } - public void setFallbackUsername(String fallbackUsername) { this.fallbackUsername = fallbackUsername; } public UpdateCall fallbackPassword(String fallbackPassword) { - this.fallbackPassword = fallbackPassword; return this; } - /** + /** * Basic auth password. * @return fallbackPassword - **/ + */ @javax.annotation.Nullable public String getFallbackPassword() { return fallbackPassword; } - public void setFallbackPassword(String fallbackPassword) { this.fallbackPassword = fallbackPassword; } public UpdateCall tag(String tag) { - this.tag = tag; return this; } - /** + /** * A custom string that will be sent with this and all future callbacks unless overwritten by a future `tag` attribute or [`<Tag>`](/docs/voice/bxml/tag) verb, or cleared. May be cleared by setting `tag=\"\"`. Max length 256 characters. Not allowed if `state` is `completed`. * @return tag - **/ + */ @javax.annotation.Nullable public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } @@ -444,12 +422,12 @@ private String toIndentedString(Object o) { 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 UpdateCall - */ + /** + * 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 UpdateCall + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!UpdateCall.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -457,9 +435,17 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `state` + if (jsonObj.get("state") != null && !jsonObj.get("state").isJsonNull()) { + CallStateEnum.validateJsonElement(jsonObj.get("state")); + } if ((jsonObj.get("redirectUrl") != null && !jsonObj.get("redirectUrl").isJsonNull()) && !jsonObj.get("redirectUrl").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `redirectUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("redirectUrl").toString())); } + // validate the optional field `redirectMethod` + if (jsonObj.get("redirectMethod") != null && !jsonObj.get("redirectMethod").isJsonNull()) { + RedirectMethodEnum.validateJsonElement(jsonObj.get("redirectMethod")); + } if ((jsonObj.get("username") != null && !jsonObj.get("username").isJsonNull()) && !jsonObj.get("username").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString())); } @@ -469,6 +455,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if ((jsonObj.get("redirectFallbackUrl") != null && !jsonObj.get("redirectFallbackUrl").isJsonNull()) && !jsonObj.get("redirectFallbackUrl").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `redirectFallbackUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("redirectFallbackUrl").toString())); } + // validate the optional field `redirectFallbackMethod` + if (jsonObj.get("redirectFallbackMethod") != null && !jsonObj.get("redirectFallbackMethod").isJsonNull()) { + RedirectMethodEnum.validateJsonElement(jsonObj.get("redirectFallbackMethod")); + } if ((jsonObj.get("fallbackUsername") != null && !jsonObj.get("fallbackUsername").isJsonNull()) && !jsonObj.get("fallbackUsername").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `fallbackUsername` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fallbackUsername").toString())); } @@ -508,7 +498,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -547,22 +542,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of UpdateCall given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateCall - * @throws IOException if the JSON string is invalid with respect to UpdateCall - */ + /** + * Create an instance of UpdateCall given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateCall + * @throws IOException if the JSON string is invalid with respect to UpdateCall + */ public static UpdateCall fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, UpdateCall.class); } - /** - * Convert an instance of UpdateCall to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of UpdateCall 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/UpdateCallRecording.java b/src/main/java/com/bandwidth/sdk/model/UpdateCallRecording.java index 90e9148f..fa9d3621 100644 --- a/src/main/java/com/bandwidth/sdk/model/UpdateCallRecording.java +++ b/src/main/java/com/bandwidth/sdk/model/UpdateCallRecording.java @@ -38,12 +38,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -51,7 +49,7 @@ /** * UpdateCallRecording */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class UpdateCallRecording { public static final String SERIALIZED_NAME_STATE = "state"; @SerializedName(SERIALIZED_NAME_STATE) @@ -61,21 +59,19 @@ public UpdateCallRecording() { } public UpdateCallRecording state(RecordingStateEnum state) { - this.state = state; return this; } - /** + /** * Get state * @return state - **/ + */ @javax.annotation.Nonnull public RecordingStateEnum getState() { return state; } - public void setState(RecordingStateEnum state) { this.state = state; } @@ -179,12 +175,12 @@ private String toIndentedString(Object o) { openapiRequiredFields.add("state"); } - /** - * 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 UpdateCallRecording - */ + /** + * 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 UpdateCallRecording + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!UpdateCallRecording.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -199,6 +195,8 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `state` + RecordingStateEnum.validateJsonElement(jsonObj.get("state")); } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @@ -229,7 +227,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -268,22 +271,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of UpdateCallRecording given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateCallRecording - * @throws IOException if the JSON string is invalid with respect to UpdateCallRecording - */ + /** + * Create an instance of UpdateCallRecording given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateCallRecording + * @throws IOException if the JSON string is invalid with respect to UpdateCallRecording + */ public static UpdateCallRecording fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, UpdateCallRecording.class); } - /** - * Convert an instance of UpdateCallRecording to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of UpdateCallRecording 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/UpdateConference.java b/src/main/java/com/bandwidth/sdk/model/UpdateConference.java index afa2ae1c..513093a1 100644 --- a/src/main/java/com/bandwidth/sdk/model/UpdateConference.java +++ b/src/main/java/com/bandwidth/sdk/model/UpdateConference.java @@ -41,12 +41,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -54,7 +52,7 @@ /** * UpdateConference */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class UpdateConference { public static final String SERIALIZED_NAME_STATUS = "status"; @SerializedName(SERIALIZED_NAME_STATUS) @@ -96,189 +94,171 @@ public UpdateConference() { } public UpdateConference status(ConferenceStateEnum status) { - this.status = status; return this; } - /** + /** * Get status * @return status - **/ + */ @javax.annotation.Nullable public ConferenceStateEnum getStatus() { return status; } - public void setStatus(ConferenceStateEnum status) { this.status = status; } public UpdateConference redirectUrl(URI redirectUrl) { - this.redirectUrl = redirectUrl; return this; } - /** + /** * The URL to send the [conferenceRedirect](/docs/voice/webhooks/conferenceRedirect) event which will provide new BXML. Not allowed if `state` is `completed`, but required if `state` is `active`. * @return redirectUrl - **/ + */ @javax.annotation.Nullable public URI getRedirectUrl() { return redirectUrl; } - public void setRedirectUrl(URI redirectUrl) { this.redirectUrl = redirectUrl; } public UpdateConference redirectMethod(RedirectMethodEnum redirectMethod) { - this.redirectMethod = redirectMethod; return this; } - /** + /** * Get redirectMethod * @return redirectMethod - **/ + */ @javax.annotation.Nullable public RedirectMethodEnum getRedirectMethod() { return redirectMethod; } - public void setRedirectMethod(RedirectMethodEnum redirectMethod) { this.redirectMethod = redirectMethod; } public UpdateConference username(String username) { - this.username = username; return this; } - /** + /** * Basic auth username. * @return username - **/ + */ @javax.annotation.Nullable public String getUsername() { return username; } - public void setUsername(String username) { this.username = username; } public UpdateConference password(String password) { - this.password = password; return this; } - /** + /** * Basic auth password. * @return password - **/ + */ @javax.annotation.Nullable public String getPassword() { return password; } - public void setPassword(String password) { this.password = password; } public UpdateConference redirectFallbackUrl(URI redirectFallbackUrl) { - this.redirectFallbackUrl = redirectFallbackUrl; return this; } - /** + /** * A fallback url which, if provided, will be used to retry the `conferenceRedirect` webhook delivery in case `redirectUrl` fails to respond. Not allowed if `state` is `completed`. * @return redirectFallbackUrl - **/ + */ @javax.annotation.Nullable public URI getRedirectFallbackUrl() { return redirectFallbackUrl; } - public void setRedirectFallbackUrl(URI redirectFallbackUrl) { this.redirectFallbackUrl = redirectFallbackUrl; } public UpdateConference redirectFallbackMethod(RedirectMethodEnum redirectFallbackMethod) { - this.redirectFallbackMethod = redirectFallbackMethod; return this; } - /** + /** * Get redirectFallbackMethod * @return redirectFallbackMethod - **/ + */ @javax.annotation.Nullable public RedirectMethodEnum getRedirectFallbackMethod() { return redirectFallbackMethod; } - public void setRedirectFallbackMethod(RedirectMethodEnum redirectFallbackMethod) { this.redirectFallbackMethod = redirectFallbackMethod; } public UpdateConference fallbackUsername(String fallbackUsername) { - this.fallbackUsername = fallbackUsername; return this; } - /** + /** * Basic auth username. * @return fallbackUsername - **/ + */ @javax.annotation.Nullable public String getFallbackUsername() { return fallbackUsername; } - public void setFallbackUsername(String fallbackUsername) { this.fallbackUsername = fallbackUsername; } public UpdateConference fallbackPassword(String fallbackPassword) { - this.fallbackPassword = fallbackPassword; return this; } - /** + /** * Basic auth password. * @return fallbackPassword - **/ + */ @javax.annotation.Nullable public String getFallbackPassword() { return fallbackPassword; } - public void setFallbackPassword(String fallbackPassword) { this.fallbackPassword = fallbackPassword; } @@ -416,12 +396,12 @@ private String toIndentedString(Object o) { 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 UpdateConference - */ + /** + * 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 UpdateConference + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!UpdateConference.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -429,9 +409,17 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + ConferenceStateEnum.validateJsonElement(jsonObj.get("status")); + } if ((jsonObj.get("redirectUrl") != null && !jsonObj.get("redirectUrl").isJsonNull()) && !jsonObj.get("redirectUrl").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `redirectUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("redirectUrl").toString())); } + // validate the optional field `redirectMethod` + if (jsonObj.get("redirectMethod") != null && !jsonObj.get("redirectMethod").isJsonNull()) { + RedirectMethodEnum.validateJsonElement(jsonObj.get("redirectMethod")); + } if ((jsonObj.get("username") != null && !jsonObj.get("username").isJsonNull()) && !jsonObj.get("username").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString())); } @@ -441,6 +429,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if ((jsonObj.get("redirectFallbackUrl") != null && !jsonObj.get("redirectFallbackUrl").isJsonNull()) && !jsonObj.get("redirectFallbackUrl").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `redirectFallbackUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("redirectFallbackUrl").toString())); } + // validate the optional field `redirectFallbackMethod` + if (jsonObj.get("redirectFallbackMethod") != null && !jsonObj.get("redirectFallbackMethod").isJsonNull()) { + RedirectMethodEnum.validateJsonElement(jsonObj.get("redirectFallbackMethod")); + } if ((jsonObj.get("fallbackUsername") != null && !jsonObj.get("fallbackUsername").isJsonNull()) && !jsonObj.get("fallbackUsername").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `fallbackUsername` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fallbackUsername").toString())); } @@ -477,7 +469,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -516,22 +513,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of UpdateConference given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateConference - * @throws IOException if the JSON string is invalid with respect to UpdateConference - */ + /** + * Create an instance of UpdateConference given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateConference + * @throws IOException if the JSON string is invalid with respect to UpdateConference + */ public static UpdateConference fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, UpdateConference.class); } - /** - * Convert an instance of UpdateConference to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of UpdateConference 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/UpdateConferenceMember.java b/src/main/java/com/bandwidth/sdk/model/UpdateConferenceMember.java index 00cffd4f..e48f5d0c 100644 --- a/src/main/java/com/bandwidth/sdk/model/UpdateConferenceMember.java +++ b/src/main/java/com/bandwidth/sdk/model/UpdateConferenceMember.java @@ -40,12 +40,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -53,7 +51,7 @@ /** * UpdateConferenceMember */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class UpdateConferenceMember { public static final String SERIALIZED_NAME_MUTE = "mute"; @SerializedName(SERIALIZED_NAME_MUTE) @@ -71,49 +69,44 @@ public UpdateConferenceMember() { } public UpdateConferenceMember mute(Boolean mute) { - this.mute = mute; return this; } - /** + /** * Whether or not this member is currently muted. Members who are muted are still able to hear other participants. Updates this member's mute status. Has no effect if omitted. * @return mute - **/ + */ @javax.annotation.Nullable public Boolean getMute() { return mute; } - public void setMute(Boolean mute) { this.mute = mute; } public UpdateConferenceMember hold(Boolean hold) { - this.hold = hold; return this; } - /** + /** * Whether or not this member is currently on hold. Members who are on hold are not able to hear or speak in the conference. Updates this member's hold status. Has no effect if omitted. * @return hold - **/ + */ @javax.annotation.Nullable public Boolean getHold() { return hold; } - public void setHold(Boolean hold) { this.hold = hold; } public UpdateConferenceMember callIdsToCoach(List callIdsToCoach) { - this.callIdsToCoach = callIdsToCoach; return this; } @@ -126,16 +119,15 @@ public UpdateConferenceMember addCallIdsToCoachItem(String callIdsToCoachItem) { return this; } - /** + /** * If this member had a value set for `callIdsToCoach` in its [Conference](/docs/voice/bxml/conference) verb or this list was added with a previous PUT request to modify the member, this is that list of calls. Modifies the calls that this member is coaching. Has no effect if omitted. See the documentation for the [Conference](/docs/voice/bxml/conference) verb for more details about coaching. Note that this will not add the matching calls to the conference; each call must individually execute a Conference verb to join. * @return callIdsToCoach - **/ + */ @javax.annotation.Nullable public List getCallIdsToCoach() { return callIdsToCoach; } - public void setCallIdsToCoach(List callIdsToCoach) { this.callIdsToCoach = callIdsToCoach; } @@ -255,12 +247,12 @@ private String toIndentedString(Object o) { 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 UpdateConferenceMember - */ + /** + * 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 UpdateConferenceMember + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!UpdateConferenceMember.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -302,7 +294,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -341,22 +338,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of UpdateConferenceMember given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateConferenceMember - * @throws IOException if the JSON string is invalid with respect to UpdateConferenceMember - */ + /** + * Create an instance of UpdateConferenceMember given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateConferenceMember + * @throws IOException if the JSON string is invalid with respect to UpdateConferenceMember + */ public static UpdateConferenceMember fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, UpdateConferenceMember.class); } - /** - * Convert an instance of UpdateConferenceMember to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of UpdateConferenceMember 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/VerifyCodeRequest.java b/src/main/java/com/bandwidth/sdk/model/VerifyCodeRequest.java index 87c6d224..199065c5 100644 --- a/src/main/java/com/bandwidth/sdk/model/VerifyCodeRequest.java +++ b/src/main/java/com/bandwidth/sdk/model/VerifyCodeRequest.java @@ -38,12 +38,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -51,7 +49,7 @@ /** * VerifyCodeRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class VerifyCodeRequest { public static final String SERIALIZED_NAME_TO = "to"; @SerializedName(SERIALIZED_NAME_TO) @@ -73,86 +71,78 @@ public VerifyCodeRequest() { } public VerifyCodeRequest to(String to) { - this.to = to; return this; } - /** + /** * The phone number to send the mfa code to. * @return to - **/ + */ @javax.annotation.Nonnull public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public VerifyCodeRequest scope(String scope) { - this.scope = scope; return this; } - /** + /** * An optional field to denote what scope or action the mfa code is addressing. If not supplied, defaults to \"2FA\". * @return scope - **/ + */ @javax.annotation.Nullable public String getScope() { return scope; } - public void setScope(String scope) { this.scope = scope; } public VerifyCodeRequest expirationTimeInMinutes(BigDecimal expirationTimeInMinutes) { - this.expirationTimeInMinutes = expirationTimeInMinutes; return this; } - /** + /** * The time period, in minutes, to validate the mfa code. By setting this to 3 minutes, it will mean any code generated within the last 3 minutes are still valid. The valid range for expiration time is between 0 and 15 minutes, exclusively and inclusively, respectively. * minimum: 1 * maximum: 15 * @return expirationTimeInMinutes - **/ + */ @javax.annotation.Nonnull public BigDecimal getExpirationTimeInMinutes() { return expirationTimeInMinutes; } - public void setExpirationTimeInMinutes(BigDecimal expirationTimeInMinutes) { this.expirationTimeInMinutes = expirationTimeInMinutes; } public VerifyCodeRequest code(String code) { - this.code = code; return this; } - /** + /** * The generated mfa code to check if valid. * @return code - **/ + */ @javax.annotation.Nonnull public String getCode() { return code; } - public void setCode(String code) { this.code = code; } @@ -267,12 +257,12 @@ private String toIndentedString(Object o) { openapiRequiredFields.add("code"); } - /** - * 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 VerifyCodeRequest - */ + /** + * 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 VerifyCodeRequest + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!VerifyCodeRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -326,7 +316,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -365,22 +360,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of VerifyCodeRequest given an JSON string - * - * @param jsonString JSON string - * @return An instance of VerifyCodeRequest - * @throws IOException if the JSON string is invalid with respect to VerifyCodeRequest - */ + /** + * Create an instance of VerifyCodeRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of VerifyCodeRequest + * @throws IOException if the JSON string is invalid with respect to VerifyCodeRequest + */ public static VerifyCodeRequest fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, VerifyCodeRequest.class); } - /** - * Convert an instance of VerifyCodeRequest to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of VerifyCodeRequest 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/VerifyCodeResponse.java b/src/main/java/com/bandwidth/sdk/model/VerifyCodeResponse.java index 595c8057..8d48ef17 100644 --- a/src/main/java/com/bandwidth/sdk/model/VerifyCodeResponse.java +++ b/src/main/java/com/bandwidth/sdk/model/VerifyCodeResponse.java @@ -37,12 +37,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -50,7 +48,7 @@ /** * VerifyCodeResponse */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class VerifyCodeResponse { public static final String SERIALIZED_NAME_VALID = "valid"; @SerializedName(SERIALIZED_NAME_VALID) @@ -60,21 +58,19 @@ public VerifyCodeResponse() { } public VerifyCodeResponse valid(Boolean valid) { - this.valid = valid; return this; } - /** + /** * Whether or not the supplied code is valid. * @return valid - **/ + */ @javax.annotation.Nullable public Boolean getValid() { return valid; } - public void setValid(Boolean valid) { this.valid = valid; } @@ -177,12 +173,12 @@ private String toIndentedString(Object o) { 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 VerifyCodeResponse - */ + /** + * 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 VerifyCodeResponse + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!VerifyCodeResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -220,7 +216,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -259,22 +260,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of VerifyCodeResponse given an JSON string - * - * @param jsonString JSON string - * @return An instance of VerifyCodeResponse - * @throws IOException if the JSON string is invalid with respect to VerifyCodeResponse - */ + /** + * Create an instance of VerifyCodeResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of VerifyCodeResponse + * @throws IOException if the JSON string is invalid with respect to VerifyCodeResponse + */ public static VerifyCodeResponse fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, VerifyCodeResponse.class); } - /** - * Convert an instance of VerifyCodeResponse to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of VerifyCodeResponse 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/VoiceApiError.java b/src/main/java/com/bandwidth/sdk/model/VoiceApiError.java index 905ebfcd..4c8aa0b9 100644 --- a/src/main/java/com/bandwidth/sdk/model/VoiceApiError.java +++ b/src/main/java/com/bandwidth/sdk/model/VoiceApiError.java @@ -38,12 +38,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -51,7 +49,7 @@ /** * VoiceApiError */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class VoiceApiError { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @@ -69,63 +67,57 @@ public VoiceApiError() { } public VoiceApiError type(String type) { - this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nullable public String getType() { return type; } - public void setType(String type) { this.type = type; } public VoiceApiError description(String description) { - this.description = description; return this; } - /** + /** * Get description * @return description - **/ + */ @javax.annotation.Nullable public String getDescription() { return description; } - public void setDescription(String description) { this.description = description; } public VoiceApiError id(String id) { - this.id = id; return this; } - /** + /** * Get id * @return id - **/ + */ @javax.annotation.Nullable public String getId() { return id; } - public void setId(String id) { this.id = id; } @@ -245,12 +237,12 @@ private String toIndentedString(Object o) { 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 VoiceApiError - */ + /** + * 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 VoiceApiError + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!VoiceApiError.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -297,7 +289,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -336,22 +333,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of VoiceApiError given an JSON string - * - * @param jsonString JSON string - * @return An instance of VoiceApiError - * @throws IOException if the JSON string is invalid with respect to VoiceApiError - */ + /** + * Create an instance of VoiceApiError given an JSON string + * + * @param jsonString JSON string + * @return An instance of VoiceApiError + * @throws IOException if the JSON string is invalid with respect to VoiceApiError + */ public static VoiceApiError fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, VoiceApiError.class); } - /** - * Convert an instance of VoiceApiError to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of VoiceApiError 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/VoiceCodeResponse.java b/src/main/java/com/bandwidth/sdk/model/VoiceCodeResponse.java index e63e8932..17e4ced7 100644 --- a/src/main/java/com/bandwidth/sdk/model/VoiceCodeResponse.java +++ b/src/main/java/com/bandwidth/sdk/model/VoiceCodeResponse.java @@ -37,12 +37,10 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.bandwidth.sdk.JSON; @@ -50,7 +48,7 @@ /** * VoiceCodeResponse */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") public class VoiceCodeResponse { public static final String SERIALIZED_NAME_CALL_ID = "callId"; @SerializedName(SERIALIZED_NAME_CALL_ID) @@ -60,21 +58,19 @@ public VoiceCodeResponse() { } public VoiceCodeResponse callId(String callId) { - this.callId = callId; return this; } - /** + /** * Programmable Voice API Call ID. * @return callId - **/ + */ @javax.annotation.Nullable public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } @@ -177,12 +173,12 @@ private String toIndentedString(Object o) { 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 VoiceCodeResponse - */ + /** + * 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 VoiceCodeResponse + */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!VoiceCodeResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null @@ -223,7 +219,12 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } } } } @@ -262,22 +263,22 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } } - /** - * Create an instance of VoiceCodeResponse given an JSON string - * - * @param jsonString JSON string - * @return An instance of VoiceCodeResponse - * @throws IOException if the JSON string is invalid with respect to VoiceCodeResponse - */ + /** + * Create an instance of VoiceCodeResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of VoiceCodeResponse + * @throws IOException if the JSON string is invalid with respect to VoiceCodeResponse + */ public static VoiceCodeResponse fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, VoiceCodeResponse.class); } - /** - * Convert an instance of VoiceCodeResponse to an JSON string - * - * @return JSON string - */ + /** + * Convert an instance of VoiceCodeResponse to an JSON string + * + * @return JSON string + */ public String toJson() { return JSON.getGson().toJson(this); }