From 6378d0915dcaa2a104f6da14359a375fe509cf07 Mon Sep 17 00:00:00 2001 From: Brian Date: Sat, 10 Feb 2024 20:01:28 -0500 Subject: [PATCH 1/2] SWI-4236 Updating generator to 7.3.0 --- .openapi-generator/VERSION | 2 +- README.md | 6 +- api/openapi.yaml | 266 ++++++++++-------- build.gradle | 10 +- build.sbt | 4 +- openapi-config.yml | 2 +- openapitools.json | 2 +- pom.xml | 2 +- .../java/com/bandwidth/sdk/ApiClient.java | 3 +- .../java/com/bandwidth/sdk/ApiException.java | 2 + .../java/com/bandwidth/sdk/Configuration.java | 2 +- src/main/java/com/bandwidth/sdk/JSON.java | 19 +- .../java/com/bandwidth/sdk/api/MediaApi.java | 12 +- .../bandwidth/sdk/auth/HttpBearerAuth.java | 20 +- .../sdk/model/AbstractOpenApiSchema.java | 2 - .../sdk/model/AccountStatistics.java | 12 +- .../bandwidth/sdk/model/AnswerCallback.java | 40 +-- .../sdk/model/BridgeCompleteCallback.java | 44 +-- .../model/BridgeTargetCompleteCallback.java | 38 +-- .../sdk/model/CallDirectionEnum.java | 6 + .../sdk/model/CallRecordingMetadata.java | 52 +--- .../com/bandwidth/sdk/model/CallState.java | 48 +--- .../bandwidth/sdk/model/CallStateEnum.java | 6 + .../sdk/model/CallbackMethodEnum.java | 6 + .../com/bandwidth/sdk/model/CodeRequest.java | 20 +- .../com/bandwidth/sdk/model/Conference.java | 28 +- .../model/ConferenceCompletedCallback.java | 18 +- .../sdk/model/ConferenceCreatedCallback.java | 18 +- .../bandwidth/sdk/model/ConferenceMember.java | 20 +- .../model/ConferenceMemberExitCallback.java | 24 +- .../model/ConferenceMemberJoinCallback.java | 24 +- .../ConferenceRecordingAvailableCallback.java | 40 +-- .../model/ConferenceRecordingMetadata.java | 34 +-- .../sdk/model/ConferenceRedirectCallback.java | 18 +- .../sdk/model/ConferenceStateEnum.java | 6 + .../com/bandwidth/sdk/model/CreateCall.java | 60 ++-- .../sdk/model/CreateCallResponse.java | 58 +--- .../sdk/model/CreateLookupResponse.java | 16 +- .../sdk/model/CreateMessageRequestError.java | 14 +- .../bandwidth/sdk/model/DeferredResult.java | 12 +- .../sdk/model/DisconnectCallback.java | 46 +-- .../com/bandwidth/sdk/model/Diversion.java | 22 +- .../com/bandwidth/sdk/model/DtmfCallback.java | 46 +-- .../com/bandwidth/sdk/model/FieldError.java | 12 +- .../bandwidth/sdk/model/FileFormatEnum.java | 6 + .../bandwidth/sdk/model/GatherCallback.java | 48 +--- .../sdk/model/InboundMessageCallback.java | 18 +- .../model/InboundMessageCallbackMessage.java | 38 +-- .../bandwidth/sdk/model/InitiateCallback.java | 36 +-- .../sdk/model/ListMessageDirectionEnum.java | 6 + .../bandwidth/sdk/model/ListMessageItem.java | 54 ++-- .../bandwidth/sdk/model/LookupRequest.java | 10 +- .../com/bandwidth/sdk/model/LookupResult.java | 26 +- .../com/bandwidth/sdk/model/LookupStatus.java | 20 +- .../bandwidth/sdk/model/LookupStatusEnum.java | 6 + .../MachineDetectionCompleteCallback.java | 40 +-- .../model/MachineDetectionConfiguration.java | 50 ++-- .../sdk/model/MachineDetectionModeEnum.java | 6 + .../sdk/model/MachineDetectionResult.java | 12 +- .../java/com/bandwidth/sdk/model/Media.java | 14 +- .../java/com/bandwidth/sdk/model/Message.java | 42 +-- .../sdk/model/MessageDeliveredCallback.java | 18 +- .../MessageDeliveredCallbackMessage.java | 38 +-- .../sdk/model/MessageDirectionEnum.java | 6 + .../sdk/model/MessageFailedCallback.java | 20 +- .../model/MessageFailedCallbackMessage.java | 36 +-- .../bandwidth/sdk/model/MessageRequest.java | 28 +- .../sdk/model/MessageSendingCallback.java | 18 +- .../model/MessageSendingCallbackMessage.java | 36 +-- .../sdk/model/MessageStatusEnum.java | 6 + .../bandwidth/sdk/model/MessageTypeEnum.java | 6 + .../com/bandwidth/sdk/model/MessagesList.java | 14 +- .../sdk/model/MessagingCodeResponse.java | 10 +- .../sdk/model/MessagingRequestError.java | 12 +- .../sdk/model/MfaForbiddenRequestError.java | 10 +- .../bandwidth/sdk/model/MfaRequestError.java | 12 +- .../model/MfaUnauthorizedRequestError.java | 10 +- .../com/bandwidth/sdk/model/PageInfo.java | 16 +- .../com/bandwidth/sdk/model/PriorityEnum.java | 6 + .../sdk/model/RecordingAvailableCallback.java | 60 +--- .../sdk/model/RecordingCompleteCallback.java | 60 +--- .../sdk/model/RecordingStateEnum.java | 6 + .../bandwidth/sdk/model/RedirectCallback.java | 44 +-- .../sdk/model/RedirectMethodEnum.java | 6 + .../com/bandwidth/sdk/model/StirShaken.java | 14 +- .../java/com/bandwidth/sdk/model/Tag.java | 12 +- .../sdk/model/TnLookupRequestError.java | 10 +- .../sdk/model/TranscribeRecording.java | 26 +- .../bandwidth/sdk/model/Transcription.java | 12 +- .../model/TranscriptionAvailableCallback.java | 58 +--- .../sdk/model/TranscriptionList.java | 10 +- .../sdk/model/TranscriptionMetadata.java | 16 +- .../sdk/model/TransferAnswerCallback.java | 42 +-- .../sdk/model/TransferCompleteCallback.java | 48 +--- .../sdk/model/TransferDisconnectCallback.java | 52 +--- .../com/bandwidth/sdk/model/UpdateCall.java | 40 ++- .../sdk/model/UpdateCallRecording.java | 12 +- .../bandwidth/sdk/model/UpdateConference.java | 38 ++- .../sdk/model/UpdateConferenceMember.java | 14 +- .../sdk/model/VerifyCodeRequest.java | 16 +- .../sdk/model/VerifyCodeResponse.java | 10 +- .../bandwidth/sdk/model/VoiceApiError.java | 14 +- .../sdk/model/VoiceCodeResponse.java | 10 +- .../com/bandwidth/sdk/api/MediaApiTest.java | 2 +- 104 files changed, 941 insertions(+), 1567 deletions(-) diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION index 41225218..8b23b8d4 100644 --- a/.openapi-generator/VERSION +++ b/.openapi-generator/VERSION @@ -1 +1 @@ -7.0.0 \ No newline at end of file +7.3.0 \ No newline at end of file diff --git a/README.md b/README.md index 78682df6..f1907f2d 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ Add this dependency to your project's POM: com.bandwidth.sdk bandwidth-sdk - 9.1.1 + 9.1.2 compile ``` @@ -56,7 +56,7 @@ Add this dependency to your project's build file: } dependencies { - implementation "com.bandwidth.sdk:bandwidth-sdk:9.1.1" + implementation "com.bandwidth.sdk:bandwidth-sdk:9.1.2" } ``` @@ -70,7 +70,7 @@ mvn clean package Then manually install the following JARs: -* `target/bandwidth-sdk-9.1.1.jar` +* `target/bandwidth-sdk-9.1.2.jar` * `target/lib/*.jar` ## Getting Started diff --git a/api/openapi.yaml b/api/openapi.yaml index e4c10f35..3d8d02a8 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -280,7 +280,7 @@ 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. @@ -2484,7 +2484,7 @@ 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 @@ -3362,7 +3362,7 @@ 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 @@ -4271,8 +4271,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 @@ -4347,13 +4347,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: @@ -4365,7 +4365,7 @@ components: requestId: 004223a0-8b17-41b1-bf81-20732adf5590 status: FAILED failedTelephoneNumbers: - - +191955512345 + - "+191955512345" lookupSingleNumberCompleteExample: summary: Example Single Number Lookup Complete Response value: @@ -4374,7 +4374,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 @@ -4389,7 +4389,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 @@ -4398,7 +4398,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 @@ -4413,7 +4413,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 @@ -4421,7 +4421,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: @@ -4430,7 +4430,7 @@ components: result: - Response Code: 3 Message: NXDOMAIN - E.164 Format: +19195550000 + E.164 Format: "+19195550000" Formatted: (919) 555-0000 Country: US parameters: @@ -5607,6 +5607,10 @@ components: example: sms 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 @@ -5626,12 +5630,12 @@ 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 @@ -5643,12 +5647,12 @@ components: 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 @@ -5677,12 +5681,12 @@ 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 @@ -5705,11 +5709,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' @@ -5793,6 +5797,9 @@ components: title: PageInfo type: object messagingRequestError: + example: + description: description + type: type properties: type: type: string @@ -5804,6 +5811,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 @@ -5850,17 +5867,17 @@ 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 @@ -5872,7 +5889,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. @@ -5893,14 +5910,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` @@ -5940,8 +5957,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 @@ -5954,7 +5971,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 @@ -6005,7 +6022,7 @@ components: example: message-received type: string to: - example: +15552223333 + example: "+15552223333" type: string description: example: Incoming message received @@ -6026,7 +6043,7 @@ components: example: 1661365814859loidf7mcwd4qacn7 type: string owner: - example: +15553332222 + example: "+15553332222" type: string applicationId: example: 93de2206-9669-4e07-948d-329f4b722ee2 @@ -6042,13 +6059,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 @@ -6088,7 +6105,7 @@ components: example: message-sending type: string to: - example: +15552223333 + example: "+15552223333" type: string description: example: Message is sending to carrier @@ -6109,7 +6126,7 @@ components: example: 1661365814859loidf7mcwd4qacn7 type: string owner: - example: +15553332222 + example: "+15553332222" type: string applicationId: example: 93de2206-9669-4e07-948d-329f4b722ee2 @@ -6125,13 +6142,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 @@ -6173,7 +6190,7 @@ components: example: message-delivered type: string to: - example: +15552223333 + example: "+15552223333" type: string description: example: Message delivered to carrier. @@ -6194,7 +6211,7 @@ components: example: 1661365814859loidf7mcwd4qacn7 type: string owner: - example: +15553332222 + example: "+15553332222" type: string applicationId: example: 93de2206-9669-4e07-948d-329f4b722ee2 @@ -6210,13 +6227,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 @@ -6257,7 +6274,7 @@ components: example: message-failed type: string to: - example: +15552223333 + example: "+15552223333" type: string description: example: rejected-unallocated-from-number @@ -6282,7 +6299,7 @@ components: example: 1661365814859loidf7mcwd4qacn7 type: string owner: - example: +15553332222 + example: "+15553332222" type: string applicationId: example: 93de2206-9669-4e07-948d-329f4b722ee2 @@ -6298,13 +6315,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 @@ -6423,14 +6440,14 @@ 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`, or be one of the following strings: `Restricted`, `Anonymous`, `Private`, or `Unavailable`). - example: +19195554321 + example: "+19195554321" type: string displayName: description: "The caller display name to use when the call is created. \n\ @@ -6591,9 +6608,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 @@ -6613,11 +6630,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. @@ -6727,7 +6744,7 @@ components: originatingId: abc123 from: "19195554321" startTime: 2022-06-16T13:15:07.16Z - to: +19195551234 + to: "+19195551234" state: disconnected endTime: 2022-06-16T13:15:18.314Z errorId: errorId @@ -6755,7 +6772,7 @@ 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.\ @@ -6967,14 +6984,14 @@ components: url: https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/recordings/r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/transcription status: completed parentCallId: c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d - transferCallerId: +15555555555 + transferCallerId: "+15555555555" transferTo: +15555555555) duration: PT13.67S accountId: "920012" 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 @@ -7007,19 +7024,19 @@ 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: can be a phone number\ \ in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable,\ \ or Anonymous." - 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) or one of Restricted, Anonymous,\ \ Private, or Unavailable." - example: +15555555555 + example: "+15555555555" type: string transferTo: description: "The phone number used as the to field of the B-leg call, in\ @@ -7551,6 +7568,10 @@ components: type: string type: object voiceApiError: + example: + description: description + id: id + type: type properties: type: type: string @@ -7592,12 +7613,12 @@ components: description: "The provided identifier of the caller: can be a phone number\ \ in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable,\ \ or Anonymous." - 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' @@ -7671,12 +7692,12 @@ components: description: "The provided identifier of the caller: can be a phone number\ \ in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable,\ \ or Anonymous." - 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' @@ -7765,12 +7786,12 @@ components: description: "The provided identifier of the caller: can be a phone number\ \ in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable,\ \ or Anonymous." - 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' @@ -7928,12 +7949,12 @@ components: description: "The provided identifier of the caller: can be a phone number\ \ in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable,\ \ or Anonymous." - 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. @@ -7984,12 +8005,12 @@ components: description: "The provided identifier of the caller: can be a phone number\ \ in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable,\ \ or Anonymous." - 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. @@ -8152,12 +8173,12 @@ components: description: "The provided identifier of the caller: can be a phone number\ \ in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable,\ \ or Anonymous." - 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. @@ -8249,12 +8270,12 @@ components: description: "The provided identifier of the caller: can be a phone number\ \ in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable,\ \ or Anonymous." - 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. @@ -8298,7 +8319,7 @@ components: description: "The phone number used as the from field of the B-leg call,\ \ in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous,\ \ Private, or Unavailable." - example: +15555555555 + example: "+15555555555" type: string transferTo: description: "The phone number used as the to field of the B-leg call, in\ @@ -8344,12 +8365,12 @@ components: description: "The provided identifier of the caller: can be a phone number\ \ in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable,\ \ or Anonymous." - 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' @@ -8400,7 +8421,7 @@ components: description: "The phone number used as the from field of the B-leg call,\ \ in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous,\ \ Private, or Unavailable." - example: +15555555555 + example: "+15555555555" type: string transferTo: description: "The phone number used as the to field of the B-leg call, in\ @@ -8448,12 +8469,12 @@ components: description: "The provided identifier of the caller: can be a phone number\ \ in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable,\ \ or Anonymous." - 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' @@ -8509,12 +8530,12 @@ components: description: "The provided identifier of the caller: can be a phone number\ \ in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable,\ \ or Anonymous." - 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' @@ -8587,12 +8608,12 @@ components: description: "The provided identifier of the caller: can be a phone number\ \ in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable,\ \ or Anonymous." - 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' @@ -8666,7 +8687,7 @@ components: description: "The phone number used as the from field of the B-leg call,\ \ in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous,\ \ Private, or Unavailable." - example: +15555555555 + example: "+15555555555" type: string transferTo: description: "The phone number used as the to field of the B-leg call, in\ @@ -8706,12 +8727,12 @@ components: description: "The provided identifier of the caller: can be a phone number\ \ in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable,\ \ or Anonymous." - 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' @@ -8791,7 +8812,7 @@ components: description: "The phone number used as the from field of the B-leg call,\ \ in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous,\ \ Private, or Unavailable." - example: +15555555555 + example: "+15555555555" type: string transferTo: description: "The phone number used as the to field of the B-leg call, in\ @@ -8831,12 +8852,12 @@ components: description: "The provided identifier of the caller: can be a phone number\ \ in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable,\ \ or Anonymous." - 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' @@ -8882,7 +8903,7 @@ components: description: "The phone number used as the from field of the B-leg call,\ \ in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous,\ \ Private, or Unavailable." - example: +15555555555 + example: "+15555555555" type: string transferTo: description: "The phone number used as the to field of the B-leg call, in\ @@ -8922,12 +8943,12 @@ components: description: "The provided identifier of the caller: can be a phone number\ \ in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable,\ \ or Anonymous." - 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' @@ -8991,7 +9012,7 @@ components: description: "The phone number used as the from field of the B-leg call,\ \ in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous,\ \ Private, or Unavailable." - example: +15555555555 + example: "+15555555555" type: string transferTo: description: "The phone number used as the to field of the B-leg call, in\ @@ -9036,12 +9057,12 @@ components: description: "The provided identifier of the caller: can be a phone number\ \ in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable,\ \ or Anonymous." - 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' @@ -9081,7 +9102,7 @@ components: description: "The phone number used as the from field of the B-leg call,\ \ in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous,\ \ Private, or Unavailable." - example: +15555555555 + example: "+15555555555" type: string transferTo: description: "The phone number used as the to field of the B-leg call, in\ @@ -9124,12 +9145,12 @@ components: description: "The provided identifier of the caller: can be a phone number\ \ in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable,\ \ or Anonymous." - 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' @@ -9169,7 +9190,7 @@ components: description: "The phone number used as the from field of the B-leg call,\ \ in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous,\ \ Private, or Unavailable." - example: +15555555555 + example: "+15555555555" type: string transferTo: description: "The phone number used as the to field of the B-leg call, in\ @@ -9231,12 +9252,12 @@ components: description: "The provided identifier of the caller: can be a phone number\ \ in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable,\ \ or Anonymous." - 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' @@ -9287,7 +9308,7 @@ components: description: "The phone number used as the from field of the B-leg call,\ \ in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous,\ \ Private, or Unavailable." - example: +15555555555 + example: "+15555555555" type: string transferTo: description: "The phone number used as the to field of the B-leg call, in\ @@ -9340,13 +9361,13 @@ 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: can be a phone number in\ \ E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable,\ \ or Anonymous." - example: +15555555555 + example: "+15555555555" type: string conferenceId: description: "The unique, Bandwidth-generated ID of the conference that was\ @@ -9422,7 +9443,7 @@ components: description: "The phone number used as the from field of the B-leg call, in\ \ E.164 format (e.g. +15555555555) or one of Restricted, Anonymous, Private,\ \ or Unavailable." - example: +15555555555 + example: "+15555555555" type: string transferTo: description: "The phone number used as the to field of the B-leg call, in E.164\ @@ -9523,7 +9544,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: @@ -9564,12 +9585,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 @@ -9631,7 +9652,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: @@ -9669,6 +9690,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. @@ -9680,6 +9704,8 @@ components: type: string type: object mfaUnauthorizedRequestError: + example: + message: Unauthorized properties: message: description: Unauthorized @@ -9687,6 +9713,8 @@ components: type: string type: object mfaForbiddenRequestError: + example: + message: Missing Authentication Token properties: message: description: The message containing the reason behind the request being @@ -9735,7 +9763,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 @@ -9744,7 +9772,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 @@ -9755,7 +9783,7 @@ components: Response Code: 0 requestId: 004223a0-8b17-41b1-bf81-20732adf5590 failedTelephoneNumbers: - - +191955512345 + - "+191955512345" status: COMPLETE properties: requestId: @@ -9773,7 +9801,7 @@ components: failedTelephoneNumbers: description: The telephone numbers whose lookup failed. example: - - +191955512345 + - "+191955512345" items: type: string type: array @@ -9781,7 +9809,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 @@ -9801,7 +9829,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. @@ -9829,6 +9857,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 a1bb6174..e642c655 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ apply plugin: 'java' apply plugin: 'com.diffplug.spotless' group = 'com.bandwidth.sdk' -version = '9.1.1' +version = '9.1.2' buildscript { repositories { @@ -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) } } @@ -111,7 +111,7 @@ dependencies { implementation 'com.squareup.okhttp3:okhttp:4.10.0' implementation 'com.squareup.okhttp3:logging-interceptor:4.10.0' implementation 'com.google.code.gson:gson:2.9.1' - implementation 'io.gsonfire:gson-fire:1.8.5' + implementation 'io.gsonfire:gson-fire:1.9.0' implementation 'javax.ws.rs:jsr311-api:1.1.1' implementation 'javax.ws.rs:javax.ws.rs-api:2.1.1' implementation 'org.openapitools:jackson-databind-nullable:0.2.6' diff --git a/build.sbt b/build.sbt index 922f61f0..ddf9fff4 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ lazy val root = (project in file(".")). settings( organization := "com.bandwidth.sdk", name := "bandwidth-sdk", - version := "9.1.1", + version := "9.1.2", scalaVersion := "2.11.4", scalacOptions ++= Seq("-feature"), javacOptions in compile ++= Seq("-Xlint:deprecation"), @@ -17,7 +17,7 @@ lazy val root = (project in file(".")). "javax.ws.rs" % "jsr311-api" % "1.1.1", "javax.ws.rs" % "javax.ws.rs-api" % "2.1.1", "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", diff --git a/openapi-config.yml b/openapi-config.yml index a54c05fe..491900e5 100644 --- a/openapi-config.yml +++ b/openapi-config.yml @@ -1,5 +1,5 @@ artifactId: bandwidth-sdk -artifactVersion: 9.1.1 +artifactVersion: 9.1.2 artifactDescription: The official client SDK for Bandwidth's Voice, Messaging, MFA, and WebRTC APIs artifactUrl: https://github.com/Bandwidth/java-sdk developerEmail: dx@bandwidth.com diff --git a/openapitools.json b/openapitools.json index 3015568c..9841a49b 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.3.0" } } diff --git a/pom.xml b/pom.xml index e4630b3c..9c644dd0 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ bandwidth-sdk jar bandwidth-sdk - 9.1.1 + 9.1.2 https://github.com/Bandwidth/java-sdk The official client SDK for Bandwidth's Voice, Messaging, MFA, and WebRTC APIs diff --git a/src/main/java/com/bandwidth/sdk/ApiClient.java b/src/main/java/com/bandwidth/sdk/ApiClient.java index 7a60f90e..8b20bd78 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; @@ -140,7 +141,7 @@ private void init() { json = new JSON(); // Set default User-Agent. - setUserAgent("OpenAPI-Generator/9.1.1/java"); + setUserAgent("OpenAPI-Generator/9.1.2/java"); authentications = new HashMap(); } diff --git a/src/main/java/com/bandwidth/sdk/ApiException.java b/src/main/java/com/bandwidth/sdk/ApiException.java index 55fe2953..7d0e7fb5 100644 --- a/src/main/java/com/bandwidth/sdk/ApiException.java +++ b/src/main/java/com/bandwidth/sdk/ApiException.java @@ -23,6 +23,8 @@ @SuppressWarnings("serial") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") 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 1d13dbdc..9777e46d 100644 --- a/src/main/java/com/bandwidth/sdk/Configuration.java +++ b/src/main/java/com/bandwidth/sdk/Configuration.java @@ -15,7 +15,7 @@ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class Configuration { - public static final String VERSION = "9.1.1"; + public static final String VERSION = "9.1.2"; private static ApiClient defaultApiClient = new ApiClient(); diff --git a/src/main/java/com/bandwidth/sdk/JSON.java b/src/main/java/com/bandwidth/sdk/JSON.java index 7dd1f987..028dcf6e 100644 --- a/src/main/java/com/bandwidth/sdk/JSON.java +++ b/src/main/java/com/bandwidth/sdk/JSON.java @@ -13,11 +13,11 @@ package com.bandwidth.sdk; +import com.fasterxml.jackson.databind.util.StdDateFormat; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonParseException; import com.google.gson.TypeAdapter; -import com.google.gson.internal.bind.util.ISO8601Utils; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.google.gson.JsonElement; @@ -31,14 +31,16 @@ import java.lang.reflect.Type; import java.text.DateFormat; import java.text.ParseException; -import java.text.ParsePosition; import java.time.LocalDate; import java.time.OffsetDateTime; +import java.time.ZoneId; +import java.time.ZoneOffset; import java.time.format.DateTimeFormatter; import java.util.Date; import java.util.Locale; import java.util.Map; import java.util.HashMap; +import java.util.TimeZone; /* * A JSON utility class @@ -55,6 +57,11 @@ public class JSON { private static LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); private static ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); + private static final StdDateFormat sdf = new StdDateFormat() + .withTimeZone(TimeZone.getTimeZone(ZoneId.systemDefault())) + .withColonInTimeZone(true); + private static final DateTimeFormatter dtf = DateTimeFormatter.ISO_OFFSET_DATE_TIME; + @SuppressWarnings("unchecked") public static GsonBuilder createGson() { GsonFireBuilder fireBuilder = new GsonFireBuilder() @@ -399,7 +406,7 @@ public java.sql.Date read(JsonReader in) throws IOException { if (dateFormat != null) { return new java.sql.Date(dateFormat.parse(date).getTime()); } - return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); + return new java.sql.Date(sdf.parse(date).getTime()); } catch (ParseException e) { throw new JsonParseException(e); } @@ -409,7 +416,7 @@ public java.sql.Date read(JsonReader in) throws IOException { /** * Gson TypeAdapter for java.util.Date type - * If the dateFormat is null, ISO8601Utils will be used. + * If the dateFormat is null, DateTimeFormatter will be used. */ public static class DateTypeAdapter extends TypeAdapter { @@ -434,7 +441,7 @@ public void write(JsonWriter out, Date date) throws IOException { if (dateFormat != null) { value = dateFormat.format(date); } else { - value = ISO8601Utils.format(date, true); + value = date.toInstant().atOffset(ZoneOffset.UTC).format(dtf); } out.value(value); } @@ -453,7 +460,7 @@ public Date read(JsonReader in) throws IOException { if (dateFormat != null) { return dateFormat.parse(date); } - return ISO8601Utils.parse(date, new ParsePosition(0)); + return sdf.parse(date); } catch (ParseException e) { throw new JsonParseException(e); } diff --git a/src/main/java/com/bandwidth/sdk/api/MediaApi.java b/src/main/java/com/bandwidth/sdk/api/MediaApi.java index b1075f58..77a60cb3 100644 --- a/src/main/java/com/bandwidth/sdk/api/MediaApi.java +++ b/src/main/java/com/bandwidth/sdk/api/MediaApi.java @@ -677,12 +677,12 @@ public okhttp3.Call uploadMediaCall(String accountId, String mediaId, File body, "video/webm", "video/x-ms-wmv" }; - if (contentType == null) { - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - }; + if (contentType == null) { + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + } String[] localVarAuthNames = new String[] { "Basic" }; return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); diff --git a/src/main/java/com/bandwidth/sdk/auth/HttpBearerAuth.java b/src/main/java/com/bandwidth/sdk/auth/HttpBearerAuth.java index 8773cf97..18b22cdd 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") 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..be6f0672 100644 --- a/src/main/java/com/bandwidth/sdk/model/AbstractOpenApiSchema.java +++ b/src/main/java/com/bandwidth/sdk/model/AbstractOpenApiSchema.java @@ -18,8 +18,6 @@ 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 */ diff --git a/src/main/java/com/bandwidth/sdk/model/AccountStatistics.java b/src/main/java/com/bandwidth/sdk/model/AccountStatistics.java index b27df3b4..42fbc8e6 100644 --- a/src/main/java/com/bandwidth/sdk/model/AccountStatistics.java +++ b/src/main/java/com/bandwidth/sdk/model/AccountStatistics.java @@ -42,7 +42,6 @@ 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; @@ -64,7 +63,6 @@ public AccountStatistics() { } public AccountStatistics currentCallQueueSize(Integer currentCallQueueSize) { - this.currentCallQueueSize = currentCallQueueSize; return this; } @@ -78,14 +76,12 @@ public Integer getCurrentCallQueueSize() { return currentCallQueueSize; } - public void setCurrentCallQueueSize(Integer currentCallQueueSize) { this.currentCallQueueSize = currentCallQueueSize; } public AccountStatistics maxCallQueueSize(Integer maxCallQueueSize) { - this.maxCallQueueSize = maxCallQueueSize; return this; } @@ -99,7 +95,6 @@ public Integer getMaxCallQueueSize() { return maxCallQueueSize; } - public void setMaxCallQueueSize(Integer maxCallQueueSize) { this.maxCallQueueSize = maxCallQueueSize; } @@ -248,7 +243,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/AnswerCallback.java b/src/main/java/com/bandwidth/sdk/model/AnswerCallback.java index 7e585c86..0ebabfcc 100644 --- a/src/main/java/com/bandwidth/sdk/model/AnswerCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/AnswerCallback.java @@ -46,7 +46,6 @@ 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; @@ -116,7 +115,6 @@ public AnswerCallback() { } public AnswerCallback eventType(String eventType) { - this.eventType = eventType; return this; } @@ -130,14 +128,12 @@ public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public AnswerCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } @@ -151,14 +147,12 @@ public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public AnswerCallback accountId(String accountId) { - this.accountId = accountId; return this; } @@ -172,14 +166,12 @@ public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public AnswerCallback applicationId(String applicationId) { - this.applicationId = applicationId; return this; } @@ -193,14 +185,12 @@ public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public AnswerCallback from(String from) { - this.from = from; return this; } @@ -214,14 +204,12 @@ public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public AnswerCallback to(String to) { - this.to = to; return this; } @@ -235,14 +223,12 @@ public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public AnswerCallback direction(CallDirectionEnum direction) { - this.direction = direction; return this; } @@ -256,14 +242,12 @@ public CallDirectionEnum getDirection() { return direction; } - public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public AnswerCallback callId(String callId) { - this.callId = callId; return this; } @@ -277,14 +261,12 @@ public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public AnswerCallback callUrl(String callUrl) { - this.callUrl = callUrl; return this; } @@ -298,14 +280,12 @@ public String getCallUrl() { return callUrl; } - public void setCallUrl(String callUrl) { this.callUrl = callUrl; } public AnswerCallback enqueuedTime(OffsetDateTime enqueuedTime) { - this.enqueuedTime = enqueuedTime; return this; } @@ -319,14 +299,12 @@ public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } - public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public AnswerCallback startTime(OffsetDateTime startTime) { - this.startTime = startTime; return this; } @@ -340,14 +318,12 @@ public OffsetDateTime getStartTime() { return startTime; } - public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public AnswerCallback answerTime(OffsetDateTime answerTime) { - this.answerTime = answerTime; return this; } @@ -361,14 +337,12 @@ public OffsetDateTime getAnswerTime() { return answerTime; } - public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public AnswerCallback tag(String tag) { - this.tag = tag; return this; } @@ -382,14 +356,12 @@ public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public AnswerCallback machineDetectionResult(MachineDetectionResult machineDetectionResult) { - this.machineDetectionResult = machineDetectionResult; return this; } @@ -403,7 +375,6 @@ public MachineDetectionResult getMachineDetectionResult() { return machineDetectionResult; } - public void setMachineDetectionResult(MachineDetectionResult machineDetectionResult) { this.machineDetectionResult = machineDetectionResult; } @@ -584,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())); } @@ -627,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/BridgeCompleteCallback.java b/src/main/java/com/bandwidth/sdk/model/BridgeCompleteCallback.java index bfc6619f..7bc25303 100644 --- a/src/main/java/com/bandwidth/sdk/model/BridgeCompleteCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/BridgeCompleteCallback.java @@ -45,7 +45,6 @@ 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; @@ -123,7 +122,6 @@ public BridgeCompleteCallback() { } public BridgeCompleteCallback eventType(String eventType) { - this.eventType = eventType; return this; } @@ -137,14 +135,12 @@ public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public BridgeCompleteCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } @@ -158,14 +154,12 @@ public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public BridgeCompleteCallback accountId(String accountId) { - this.accountId = accountId; return this; } @@ -179,14 +173,12 @@ public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public BridgeCompleteCallback applicationId(String applicationId) { - this.applicationId = applicationId; return this; } @@ -200,14 +192,12 @@ public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public BridgeCompleteCallback from(String from) { - this.from = from; return this; } @@ -221,14 +211,12 @@ public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public BridgeCompleteCallback to(String to) { - this.to = to; return this; } @@ -242,14 +230,12 @@ public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public BridgeCompleteCallback direction(CallDirectionEnum direction) { - this.direction = direction; return this; } @@ -263,14 +249,12 @@ public CallDirectionEnum getDirection() { return direction; } - public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public BridgeCompleteCallback callId(String callId) { - this.callId = callId; return this; } @@ -284,14 +268,12 @@ public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public BridgeCompleteCallback callUrl(String callUrl) { - this.callUrl = callUrl; return this; } @@ -305,14 +287,12 @@ public String getCallUrl() { return callUrl; } - public void setCallUrl(String callUrl) { this.callUrl = callUrl; } public BridgeCompleteCallback enqueuedTime(OffsetDateTime enqueuedTime) { - this.enqueuedTime = enqueuedTime; return this; } @@ -326,14 +306,12 @@ public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } - public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public BridgeCompleteCallback startTime(OffsetDateTime startTime) { - this.startTime = startTime; return this; } @@ -347,14 +325,12 @@ public OffsetDateTime getStartTime() { return startTime; } - public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public BridgeCompleteCallback answerTime(OffsetDateTime answerTime) { - this.answerTime = answerTime; return this; } @@ -368,14 +344,12 @@ public OffsetDateTime getAnswerTime() { return answerTime; } - public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public BridgeCompleteCallback tag(String tag) { - this.tag = tag; return this; } @@ -389,14 +363,12 @@ public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public BridgeCompleteCallback cause(String cause) { - this.cause = cause; return this; } @@ -410,14 +382,12 @@ public String getCause() { return cause; } - public void setCause(String cause) { this.cause = cause; } public BridgeCompleteCallback errorMessage(String errorMessage) { - this.errorMessage = errorMessage; return this; } @@ -431,14 +401,12 @@ public String getErrorMessage() { return errorMessage; } - public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; } public BridgeCompleteCallback errorId(String errorId) { - this.errorId = errorId; return this; } @@ -452,7 +420,6 @@ public String getErrorId() { return errorId; } - public void setErrorId(String errorId) { this.errorId = errorId; } @@ -639,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())); } @@ -687,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/BridgeTargetCompleteCallback.java b/src/main/java/com/bandwidth/sdk/model/BridgeTargetCompleteCallback.java index 5d4f996e..c4ad58b6 100644 --- a/src/main/java/com/bandwidth/sdk/model/BridgeTargetCompleteCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/BridgeTargetCompleteCallback.java @@ -45,7 +45,6 @@ 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; @@ -111,7 +110,6 @@ public BridgeTargetCompleteCallback() { } public BridgeTargetCompleteCallback eventType(String eventType) { - this.eventType = eventType; return this; } @@ -125,14 +123,12 @@ public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public BridgeTargetCompleteCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } @@ -146,14 +142,12 @@ public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public BridgeTargetCompleteCallback accountId(String accountId) { - this.accountId = accountId; return this; } @@ -167,14 +161,12 @@ public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public BridgeTargetCompleteCallback applicationId(String applicationId) { - this.applicationId = applicationId; return this; } @@ -188,14 +180,12 @@ public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public BridgeTargetCompleteCallback from(String from) { - this.from = from; return this; } @@ -209,14 +199,12 @@ public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public BridgeTargetCompleteCallback to(String to) { - this.to = to; return this; } @@ -230,14 +218,12 @@ public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public BridgeTargetCompleteCallback direction(CallDirectionEnum direction) { - this.direction = direction; return this; } @@ -251,14 +237,12 @@ public CallDirectionEnum getDirection() { return direction; } - public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public BridgeTargetCompleteCallback callId(String callId) { - this.callId = callId; return this; } @@ -272,14 +256,12 @@ public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public BridgeTargetCompleteCallback callUrl(String callUrl) { - this.callUrl = callUrl; return this; } @@ -293,14 +275,12 @@ public String getCallUrl() { return callUrl; } - public void setCallUrl(String callUrl) { this.callUrl = callUrl; } public BridgeTargetCompleteCallback enqueuedTime(OffsetDateTime enqueuedTime) { - this.enqueuedTime = enqueuedTime; return this; } @@ -314,14 +294,12 @@ public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } - public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public BridgeTargetCompleteCallback startTime(OffsetDateTime startTime) { - this.startTime = startTime; return this; } @@ -335,14 +313,12 @@ public OffsetDateTime getStartTime() { return startTime; } - public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public BridgeTargetCompleteCallback answerTime(OffsetDateTime answerTime) { - this.answerTime = answerTime; return this; } @@ -356,14 +332,12 @@ public OffsetDateTime getAnswerTime() { return answerTime; } - public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public BridgeTargetCompleteCallback tag(String tag) { - this.tag = tag; return this; } @@ -377,7 +351,6 @@ public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } @@ -555,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())); } @@ -594,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/CallDirectionEnum.java b/src/main/java/com/bandwidth/sdk/model/CallDirectionEnum.java index c6e3ed0e..4fb49d6d 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 f5649459..eacbaeca 100644 --- a/src/main/java/com/bandwidth/sdk/model/CallRecordingMetadata.java +++ b/src/main/java/com/bandwidth/sdk/model/CallRecordingMetadata.java @@ -48,7 +48,6 @@ 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; @@ -134,7 +133,6 @@ public CallRecordingMetadata() { } public CallRecordingMetadata applicationId(String applicationId) { - this.applicationId = applicationId; return this; } @@ -148,14 +146,12 @@ public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public CallRecordingMetadata accountId(String accountId) { - this.accountId = accountId; return this; } @@ -169,14 +165,12 @@ public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public CallRecordingMetadata callId(String callId) { - this.callId = callId; return this; } @@ -190,14 +184,12 @@ public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public CallRecordingMetadata parentCallId(String parentCallId) { - this.parentCallId = parentCallId; return this; } @@ -211,14 +203,12 @@ public String getParentCallId() { return parentCallId; } - public void setParentCallId(String parentCallId) { this.parentCallId = parentCallId; } public CallRecordingMetadata recordingId(String recordingId) { - this.recordingId = recordingId; return this; } @@ -232,14 +222,12 @@ public String getRecordingId() { return recordingId; } - public void setRecordingId(String recordingId) { this.recordingId = recordingId; } public CallRecordingMetadata to(String to) { - this.to = to; return this; } @@ -253,14 +241,12 @@ public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public CallRecordingMetadata from(String from) { - this.from = from; return this; } @@ -274,14 +260,12 @@ public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public CallRecordingMetadata transferCallerId(String transferCallerId) { - this.transferCallerId = transferCallerId; return this; } @@ -295,14 +279,12 @@ public String getTransferCallerId() { return transferCallerId; } - public void setTransferCallerId(String transferCallerId) { this.transferCallerId = transferCallerId; } public CallRecordingMetadata transferTo(String transferTo) { - this.transferTo = transferTo; return this; } @@ -316,14 +298,12 @@ public String getTransferTo() { return transferTo; } - public void setTransferTo(String transferTo) { this.transferTo = transferTo; } public CallRecordingMetadata duration(String duration) { - this.duration = duration; return this; } @@ -337,14 +317,12 @@ public String getDuration() { return duration; } - public void setDuration(String duration) { this.duration = duration; } public CallRecordingMetadata direction(CallDirectionEnum direction) { - this.direction = direction; return this; } @@ -358,14 +336,12 @@ public CallDirectionEnum getDirection() { return direction; } - public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public CallRecordingMetadata channels(Integer channels) { - this.channels = channels; return this; } @@ -379,14 +355,12 @@ public Integer getChannels() { return channels; } - public void setChannels(Integer channels) { this.channels = channels; } public CallRecordingMetadata startTime(OffsetDateTime startTime) { - this.startTime = startTime; return this; } @@ -400,14 +374,12 @@ public OffsetDateTime getStartTime() { return startTime; } - public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public CallRecordingMetadata endTime(OffsetDateTime endTime) { - this.endTime = endTime; return this; } @@ -421,14 +393,12 @@ public OffsetDateTime getEndTime() { return endTime; } - public void setEndTime(OffsetDateTime endTime) { this.endTime = endTime; } public CallRecordingMetadata fileFormat(FileFormatEnum fileFormat) { - this.fileFormat = fileFormat; return this; } @@ -442,14 +412,12 @@ public FileFormatEnum getFileFormat() { return fileFormat; } - public void setFileFormat(FileFormatEnum fileFormat) { this.fileFormat = fileFormat; } public CallRecordingMetadata status(String status) { - this.status = status; return this; } @@ -463,14 +431,12 @@ public String getStatus() { return status; } - public void setStatus(String status) { this.status = status; } public CallRecordingMetadata mediaUrl(URI mediaUrl) { - this.mediaUrl = mediaUrl; return this; } @@ -484,14 +450,12 @@ public URI getMediaUrl() { return mediaUrl; } - public void setMediaUrl(URI mediaUrl) { this.mediaUrl = mediaUrl; } public CallRecordingMetadata transcription(TranscriptionMetadata transcription) { - this.transcription = transcription; return this; } @@ -505,7 +469,6 @@ public TranscriptionMetadata getTranscription() { return transcription; } - public void setTranscription(TranscriptionMetadata transcription) { this.transcription = transcription; } @@ -713,6 +676,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())); } @@ -753,7 +724,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/CallState.java b/src/main/java/com/bandwidth/sdk/model/CallState.java index f9f2d025..ba260adc 100644 --- a/src/main/java/com/bandwidth/sdk/model/CallState.java +++ b/src/main/java/com/bandwidth/sdk/model/CallState.java @@ -47,7 +47,6 @@ 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; @@ -133,7 +132,6 @@ public CallState() { } public CallState applicationId(String applicationId) { - this.applicationId = applicationId; return this; } @@ -147,14 +145,12 @@ public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public CallState accountId(String accountId) { - this.accountId = accountId; return this; } @@ -168,14 +164,12 @@ public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public CallState callId(String callId) { - this.callId = callId; return this; } @@ -189,14 +183,12 @@ public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public CallState parentCallId(String parentCallId) { - this.parentCallId = parentCallId; return this; } @@ -210,14 +202,12 @@ public String getParentCallId() { return parentCallId; } - public void setParentCallId(String parentCallId) { this.parentCallId = parentCallId; } public CallState to(String to) { - this.to = to; return this; } @@ -231,14 +221,12 @@ public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public CallState from(String from) { - this.from = from; return this; } @@ -252,14 +240,12 @@ public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public CallState direction(CallDirectionEnum direction) { - this.direction = direction; return this; } @@ -273,14 +259,12 @@ public CallDirectionEnum getDirection() { return direction; } - public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public CallState state(String state) { - this.state = state; return this; } @@ -294,14 +278,12 @@ public String getState() { return state; } - public void setState(String state) { this.state = state; } public CallState stirShaken(Map stirShaken) { - this.stirShaken = stirShaken; return this; } @@ -323,14 +305,12 @@ public Map getStirShaken() { return stirShaken; } - public void setStirShaken(Map stirShaken) { this.stirShaken = stirShaken; } public CallState identity(String identity) { - this.identity = identity; return this; } @@ -344,14 +324,12 @@ public String getIdentity() { return identity; } - public void setIdentity(String identity) { this.identity = identity; } public CallState enqueuedTime(OffsetDateTime enqueuedTime) { - this.enqueuedTime = enqueuedTime; return this; } @@ -365,14 +343,12 @@ public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } - public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public CallState startTime(OffsetDateTime startTime) { - this.startTime = startTime; return this; } @@ -386,14 +362,12 @@ public OffsetDateTime getStartTime() { return startTime; } - public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public CallState answerTime(OffsetDateTime answerTime) { - this.answerTime = answerTime; return this; } @@ -407,14 +381,12 @@ public OffsetDateTime getAnswerTime() { return answerTime; } - public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public CallState endTime(OffsetDateTime endTime) { - this.endTime = endTime; return this; } @@ -428,14 +400,12 @@ public OffsetDateTime getEndTime() { return endTime; } - public void setEndTime(OffsetDateTime endTime) { this.endTime = endTime; } public CallState disconnectCause(String disconnectCause) { - this.disconnectCause = disconnectCause; return this; } @@ -449,14 +419,12 @@ public String getDisconnectCause() { return disconnectCause; } - public void setDisconnectCause(String disconnectCause) { this.disconnectCause = disconnectCause; } public CallState errorMessage(String errorMessage) { - this.errorMessage = errorMessage; return this; } @@ -470,14 +438,12 @@ public String getErrorMessage() { return errorMessage; } - public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; } public CallState errorId(String errorId) { - this.errorId = errorId; return this; } @@ -491,14 +457,12 @@ public String getErrorId() { return errorId; } - public void setErrorId(String errorId) { this.errorId = errorId; } public CallState lastUpdate(OffsetDateTime lastUpdate) { - this.lastUpdate = lastUpdate; return this; } @@ -512,7 +476,6 @@ public OffsetDateTime getLastUpdate() { return lastUpdate; } - public void setLastUpdate(OffsetDateTime lastUpdate) { this.lastUpdate = lastUpdate; } @@ -708,6 +671,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 +720,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/CallStateEnum.java b/src/main/java/com/bandwidth/sdk/model/CallStateEnum.java index ce57cbb3..fc05a9d4 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/CallbackMethodEnum.java b/src/main/java/com/bandwidth/sdk/model/CallbackMethodEnum.java index f571f1a4..3bb13518 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..b4f53075 100644 --- a/src/main/java/com/bandwidth/sdk/model/CodeRequest.java +++ b/src/main/java/com/bandwidth/sdk/model/CodeRequest.java @@ -42,7 +42,6 @@ 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; @@ -80,7 +79,6 @@ public CodeRequest() { } public CodeRequest to(String to) { - this.to = to; return this; } @@ -94,14 +92,12 @@ public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public CodeRequest from(String from) { - this.from = from; return this; } @@ -115,14 +111,12 @@ public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public CodeRequest applicationId(String applicationId) { - this.applicationId = applicationId; return this; } @@ -136,14 +130,12 @@ public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public CodeRequest scope(String scope) { - this.scope = scope; return this; } @@ -157,14 +149,12 @@ public String getScope() { return scope; } - public void setScope(String scope) { this.scope = scope; } public CodeRequest message(String message) { - this.message = message; return this; } @@ -178,14 +168,12 @@ public String getMessage() { return message; } - public void setMessage(String message) { this.message = message; } public CodeRequest digits(Integer digits) { - this.digits = digits; return this; } @@ -201,7 +189,6 @@ public Integer getDigits() { return digits; } - public void setDigits(Integer digits) { this.digits = digits; } @@ -389,7 +376,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/Conference.java b/src/main/java/com/bandwidth/sdk/model/Conference.java index 91f59645..6fcfc83f 100644 --- a/src/main/java/com/bandwidth/sdk/model/Conference.java +++ b/src/main/java/com/bandwidth/sdk/model/Conference.java @@ -49,7 +49,6 @@ 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; @@ -95,7 +94,6 @@ public Conference() { } public Conference id(String id) { - this.id = id; return this; } @@ -109,14 +107,12 @@ public String getId() { return id; } - public void setId(String id) { this.id = id; } public Conference name(String name) { - this.name = name; return this; } @@ -130,14 +126,12 @@ public String getName() { return name; } - public void setName(String name) { this.name = name; } public Conference createdTime(OffsetDateTime createdTime) { - this.createdTime = createdTime; return this; } @@ -151,14 +145,12 @@ public OffsetDateTime getCreatedTime() { return createdTime; } - public void setCreatedTime(OffsetDateTime createdTime) { this.createdTime = createdTime; } public Conference completedTime(OffsetDateTime completedTime) { - this.completedTime = completedTime; return this; } @@ -172,14 +164,12 @@ public OffsetDateTime getCompletedTime() { return completedTime; } - public void setCompletedTime(OffsetDateTime completedTime) { this.completedTime = completedTime; } public Conference conferenceEventUrl(URI conferenceEventUrl) { - this.conferenceEventUrl = conferenceEventUrl; return this; } @@ -193,14 +183,12 @@ public URI getConferenceEventUrl() { return conferenceEventUrl; } - public void setConferenceEventUrl(URI conferenceEventUrl) { this.conferenceEventUrl = conferenceEventUrl; } public Conference conferenceEventMethod(CallbackMethodEnum conferenceEventMethod) { - this.conferenceEventMethod = conferenceEventMethod; return this; } @@ -214,14 +202,12 @@ public CallbackMethodEnum getConferenceEventMethod() { return conferenceEventMethod; } - public void setConferenceEventMethod(CallbackMethodEnum conferenceEventMethod) { this.conferenceEventMethod = conferenceEventMethod; } public Conference tag(String tag) { - this.tag = tag; return this; } @@ -235,14 +221,12 @@ public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public Conference activeMembers(List activeMembers) { - this.activeMembers = activeMembers; return this; } @@ -264,7 +248,6 @@ public List getActiveMembers() { return activeMembers; } - public void setActiveMembers(List activeMembers) { this.activeMembers = activeMembers; } @@ -421,6 +404,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 +455,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/ConferenceCompletedCallback.java b/src/main/java/com/bandwidth/sdk/model/ConferenceCompletedCallback.java index d0987304..d84dcb2a 100644 --- a/src/main/java/com/bandwidth/sdk/model/ConferenceCompletedCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/ConferenceCompletedCallback.java @@ -44,7 +44,6 @@ 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; @@ -78,7 +77,6 @@ public ConferenceCompletedCallback() { } public ConferenceCompletedCallback eventType(String eventType) { - this.eventType = eventType; return this; } @@ -92,14 +90,12 @@ public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public ConferenceCompletedCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } @@ -113,14 +109,12 @@ public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public ConferenceCompletedCallback conferenceId(String conferenceId) { - this.conferenceId = conferenceId; return this; } @@ -134,14 +128,12 @@ public String getConferenceId() { return conferenceId; } - public void setConferenceId(String conferenceId) { this.conferenceId = conferenceId; } public ConferenceCompletedCallback name(String name) { - this.name = name; return this; } @@ -155,14 +147,12 @@ public String getName() { return name; } - public void setName(String name) { this.name = name; } public ConferenceCompletedCallback tag(String tag) { - this.tag = tag; return this; } @@ -176,7 +166,6 @@ public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } @@ -357,7 +346,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/ConferenceCreatedCallback.java b/src/main/java/com/bandwidth/sdk/model/ConferenceCreatedCallback.java index 705be5c1..8543c224 100644 --- a/src/main/java/com/bandwidth/sdk/model/ConferenceCreatedCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/ConferenceCreatedCallback.java @@ -44,7 +44,6 @@ 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; @@ -78,7 +77,6 @@ public ConferenceCreatedCallback() { } public ConferenceCreatedCallback eventType(String eventType) { - this.eventType = eventType; return this; } @@ -92,14 +90,12 @@ public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public ConferenceCreatedCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } @@ -113,14 +109,12 @@ public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public ConferenceCreatedCallback conferenceId(String conferenceId) { - this.conferenceId = conferenceId; return this; } @@ -134,14 +128,12 @@ public String getConferenceId() { return conferenceId; } - public void setConferenceId(String conferenceId) { this.conferenceId = conferenceId; } public ConferenceCreatedCallback name(String name) { - this.name = name; return this; } @@ -155,14 +147,12 @@ public String getName() { return name; } - public void setName(String name) { this.name = name; } public ConferenceCreatedCallback tag(String tag) { - this.tag = tag; return this; } @@ -176,7 +166,6 @@ public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } @@ -357,7 +346,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/ConferenceMember.java b/src/main/java/com/bandwidth/sdk/model/ConferenceMember.java index c599189f..fe364c78 100644 --- a/src/main/java/com/bandwidth/sdk/model/ConferenceMember.java +++ b/src/main/java/com/bandwidth/sdk/model/ConferenceMember.java @@ -45,7 +45,6 @@ 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; @@ -83,7 +82,6 @@ public ConferenceMember() { } public ConferenceMember callId(String callId) { - this.callId = callId; return this; } @@ -97,14 +95,12 @@ public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public ConferenceMember conferenceId(String conferenceId) { - this.conferenceId = conferenceId; return this; } @@ -118,14 +114,12 @@ public String getConferenceId() { return conferenceId; } - public void setConferenceId(String conferenceId) { this.conferenceId = conferenceId; } public ConferenceMember memberUrl(String memberUrl) { - this.memberUrl = memberUrl; return this; } @@ -139,14 +133,12 @@ public String getMemberUrl() { return memberUrl; } - public void setMemberUrl(String memberUrl) { this.memberUrl = memberUrl; } public ConferenceMember mute(Boolean mute) { - this.mute = mute; return this; } @@ -160,14 +152,12 @@ public Boolean getMute() { return mute; } - public void setMute(Boolean mute) { this.mute = mute; } public ConferenceMember hold(Boolean hold) { - this.hold = hold; return this; } @@ -181,14 +171,12 @@ public Boolean getHold() { return hold; } - public void setHold(Boolean hold) { this.hold = hold; } public ConferenceMember callIdsToCoach(List callIdsToCoach) { - this.callIdsToCoach = callIdsToCoach; return this; } @@ -210,7 +198,6 @@ public List getCallIdsToCoach() { return callIdsToCoach; } - public void setCallIdsToCoach(List callIdsToCoach) { this.callIdsToCoach = callIdsToCoach; } @@ -395,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/ConferenceMemberExitCallback.java b/src/main/java/com/bandwidth/sdk/model/ConferenceMemberExitCallback.java index ac74ee38..950fb522 100644 --- a/src/main/java/com/bandwidth/sdk/model/ConferenceMemberExitCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/ConferenceMemberExitCallback.java @@ -44,7 +44,6 @@ 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; @@ -90,7 +89,6 @@ public ConferenceMemberExitCallback() { } public ConferenceMemberExitCallback eventType(String eventType) { - this.eventType = eventType; return this; } @@ -104,14 +102,12 @@ public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public ConferenceMemberExitCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } @@ -125,14 +121,12 @@ public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public ConferenceMemberExitCallback conferenceId(String conferenceId) { - this.conferenceId = conferenceId; return this; } @@ -146,14 +140,12 @@ public String getConferenceId() { return conferenceId; } - public void setConferenceId(String conferenceId) { this.conferenceId = conferenceId; } public ConferenceMemberExitCallback name(String name) { - this.name = name; return this; } @@ -167,14 +159,12 @@ public String getName() { return name; } - public void setName(String name) { this.name = name; } public ConferenceMemberExitCallback from(String from) { - this.from = from; return this; } @@ -188,14 +178,12 @@ public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public ConferenceMemberExitCallback to(String to) { - this.to = to; return this; } @@ -209,14 +197,12 @@ public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public ConferenceMemberExitCallback callId(String callId) { - this.callId = callId; return this; } @@ -230,14 +216,12 @@ public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public ConferenceMemberExitCallback tag(String tag) { - this.tag = tag; return this; } @@ -251,7 +235,6 @@ public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } @@ -450,7 +433,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/ConferenceMemberJoinCallback.java b/src/main/java/com/bandwidth/sdk/model/ConferenceMemberJoinCallback.java index 1524aa62..6d3b9b06 100644 --- a/src/main/java/com/bandwidth/sdk/model/ConferenceMemberJoinCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/ConferenceMemberJoinCallback.java @@ -44,7 +44,6 @@ 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; @@ -90,7 +89,6 @@ public ConferenceMemberJoinCallback() { } public ConferenceMemberJoinCallback eventType(String eventType) { - this.eventType = eventType; return this; } @@ -104,14 +102,12 @@ public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public ConferenceMemberJoinCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } @@ -125,14 +121,12 @@ public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public ConferenceMemberJoinCallback conferenceId(String conferenceId) { - this.conferenceId = conferenceId; return this; } @@ -146,14 +140,12 @@ public String getConferenceId() { return conferenceId; } - public void setConferenceId(String conferenceId) { this.conferenceId = conferenceId; } public ConferenceMemberJoinCallback name(String name) { - this.name = name; return this; } @@ -167,14 +159,12 @@ public String getName() { return name; } - public void setName(String name) { this.name = name; } public ConferenceMemberJoinCallback from(String from) { - this.from = from; return this; } @@ -188,14 +178,12 @@ public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public ConferenceMemberJoinCallback to(String to) { - this.to = to; return this; } @@ -209,14 +197,12 @@ public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public ConferenceMemberJoinCallback callId(String callId) { - this.callId = callId; return this; } @@ -230,14 +216,12 @@ public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public ConferenceMemberJoinCallback tag(String tag) { - this.tag = tag; return this; } @@ -251,7 +235,6 @@ public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } @@ -450,7 +433,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/ConferenceRecordingAvailableCallback.java b/src/main/java/com/bandwidth/sdk/model/ConferenceRecordingAvailableCallback.java index c0785daf..eec5e1e7 100644 --- a/src/main/java/com/bandwidth/sdk/model/ConferenceRecordingAvailableCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/ConferenceRecordingAvailableCallback.java @@ -46,7 +46,6 @@ 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; @@ -116,7 +115,6 @@ public ConferenceRecordingAvailableCallback() { } public ConferenceRecordingAvailableCallback eventType(String eventType) { - this.eventType = eventType; return this; } @@ -130,14 +128,12 @@ public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public ConferenceRecordingAvailableCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } @@ -151,14 +147,12 @@ public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public ConferenceRecordingAvailableCallback conferenceId(String conferenceId) { - this.conferenceId = conferenceId; return this; } @@ -172,14 +166,12 @@ public String getConferenceId() { return conferenceId; } - public void setConferenceId(String conferenceId) { this.conferenceId = conferenceId; } public ConferenceRecordingAvailableCallback name(String name) { - this.name = name; return this; } @@ -193,14 +185,12 @@ public String getName() { return name; } - public void setName(String name) { this.name = name; } public ConferenceRecordingAvailableCallback accountId(String accountId) { - this.accountId = accountId; return this; } @@ -214,14 +204,12 @@ public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public ConferenceRecordingAvailableCallback recordingId(String recordingId) { - this.recordingId = recordingId; return this; } @@ -235,14 +223,12 @@ public String getRecordingId() { return recordingId; } - public void setRecordingId(String recordingId) { this.recordingId = recordingId; } public ConferenceRecordingAvailableCallback channels(Integer channels) { - this.channels = channels; return this; } @@ -256,14 +242,12 @@ public Integer getChannels() { return channels; } - public void setChannels(Integer channels) { this.channels = channels; } public ConferenceRecordingAvailableCallback startTime(OffsetDateTime startTime) { - this.startTime = startTime; return this; } @@ -277,14 +261,12 @@ public OffsetDateTime getStartTime() { return startTime; } - public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public ConferenceRecordingAvailableCallback endTime(OffsetDateTime endTime) { - this.endTime = endTime; return this; } @@ -298,14 +280,12 @@ public OffsetDateTime getEndTime() { return endTime; } - public void setEndTime(OffsetDateTime endTime) { this.endTime = endTime; } public ConferenceRecordingAvailableCallback duration(String duration) { - this.duration = duration; return this; } @@ -319,14 +299,12 @@ public String getDuration() { return duration; } - public void setDuration(String duration) { this.duration = duration; } public ConferenceRecordingAvailableCallback fileFormat(FileFormatEnum fileFormat) { - this.fileFormat = fileFormat; return this; } @@ -340,14 +318,12 @@ public FileFormatEnum getFileFormat() { return fileFormat; } - public void setFileFormat(FileFormatEnum fileFormat) { this.fileFormat = fileFormat; } public ConferenceRecordingAvailableCallback mediaUrl(URI mediaUrl) { - this.mediaUrl = mediaUrl; return this; } @@ -361,14 +337,12 @@ public URI getMediaUrl() { return mediaUrl; } - public void setMediaUrl(URI mediaUrl) { this.mediaUrl = mediaUrl; } public ConferenceRecordingAvailableCallback tag(String tag) { - this.tag = tag; return this; } @@ -382,14 +356,12 @@ public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public ConferenceRecordingAvailableCallback status(String status) { - this.status = status; return this; } @@ -403,7 +375,6 @@ public String getStatus() { return status; } - public void setStatus(String status) { this.status = status; } @@ -587,6 +558,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 +601,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/ConferenceRecordingMetadata.java b/src/main/java/com/bandwidth/sdk/model/ConferenceRecordingMetadata.java index 17e88457..01c5b260 100644 --- a/src/main/java/com/bandwidth/sdk/model/ConferenceRecordingMetadata.java +++ b/src/main/java/com/bandwidth/sdk/model/ConferenceRecordingMetadata.java @@ -46,7 +46,6 @@ 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; @@ -104,7 +103,6 @@ public ConferenceRecordingMetadata() { } public ConferenceRecordingMetadata accountId(String accountId) { - this.accountId = accountId; return this; } @@ -118,14 +116,12 @@ public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public ConferenceRecordingMetadata conferenceId(String conferenceId) { - this.conferenceId = conferenceId; return this; } @@ -139,14 +135,12 @@ public String getConferenceId() { return conferenceId; } - public void setConferenceId(String conferenceId) { this.conferenceId = conferenceId; } public ConferenceRecordingMetadata name(String name) { - this.name = name; return this; } @@ -160,14 +154,12 @@ public String getName() { return name; } - public void setName(String name) { this.name = name; } public ConferenceRecordingMetadata recordingId(String recordingId) { - this.recordingId = recordingId; return this; } @@ -181,14 +173,12 @@ public String getRecordingId() { return recordingId; } - public void setRecordingId(String recordingId) { this.recordingId = recordingId; } public ConferenceRecordingMetadata duration(String duration) { - this.duration = duration; return this; } @@ -202,14 +192,12 @@ public String getDuration() { return duration; } - public void setDuration(String duration) { this.duration = duration; } public ConferenceRecordingMetadata channels(Integer channels) { - this.channels = channels; return this; } @@ -223,14 +211,12 @@ public Integer getChannels() { return channels; } - public void setChannels(Integer channels) { this.channels = channels; } public ConferenceRecordingMetadata startTime(OffsetDateTime startTime) { - this.startTime = startTime; return this; } @@ -244,14 +230,12 @@ public OffsetDateTime getStartTime() { return startTime; } - public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public ConferenceRecordingMetadata endTime(OffsetDateTime endTime) { - this.endTime = endTime; return this; } @@ -265,14 +249,12 @@ public OffsetDateTime getEndTime() { return endTime; } - public void setEndTime(OffsetDateTime endTime) { this.endTime = endTime; } public ConferenceRecordingMetadata fileFormat(FileFormatEnum fileFormat) { - this.fileFormat = fileFormat; return this; } @@ -286,14 +268,12 @@ public FileFormatEnum getFileFormat() { return fileFormat; } - public void setFileFormat(FileFormatEnum fileFormat) { this.fileFormat = fileFormat; } public ConferenceRecordingMetadata status(String status) { - this.status = status; return this; } @@ -307,14 +287,12 @@ public String getStatus() { return status; } - public void setStatus(String status) { this.status = status; } public ConferenceRecordingMetadata mediaUrl(URI mediaUrl) { - this.mediaUrl = mediaUrl; return this; } @@ -328,7 +306,6 @@ public URI getMediaUrl() { return mediaUrl; } - public void setMediaUrl(URI mediaUrl) { this.mediaUrl = mediaUrl; } @@ -500,6 +477,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())); } @@ -536,7 +517,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/ConferenceRedirectCallback.java b/src/main/java/com/bandwidth/sdk/model/ConferenceRedirectCallback.java index 6158fcbf..71e83f34 100644 --- a/src/main/java/com/bandwidth/sdk/model/ConferenceRedirectCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/ConferenceRedirectCallback.java @@ -44,7 +44,6 @@ 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; @@ -78,7 +77,6 @@ public ConferenceRedirectCallback() { } public ConferenceRedirectCallback eventType(String eventType) { - this.eventType = eventType; return this; } @@ -92,14 +90,12 @@ public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public ConferenceRedirectCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } @@ -113,14 +109,12 @@ public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public ConferenceRedirectCallback conferenceId(String conferenceId) { - this.conferenceId = conferenceId; return this; } @@ -134,14 +128,12 @@ public String getConferenceId() { return conferenceId; } - public void setConferenceId(String conferenceId) { this.conferenceId = conferenceId; } public ConferenceRedirectCallback name(String name) { - this.name = name; return this; } @@ -155,14 +147,12 @@ public String getName() { return name; } - public void setName(String name) { this.name = name; } public ConferenceRedirectCallback tag(String tag) { - this.tag = tag; return this; } @@ -176,7 +166,6 @@ public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } @@ -357,7 +346,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/ConferenceStateEnum.java b/src/main/java/com/bandwidth/sdk/model/ConferenceStateEnum.java index 91161993..cc15b6cb 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 a965c1d7..10a6d3a1 100644 --- a/src/main/java/com/bandwidth/sdk/model/CreateCall.java +++ b/src/main/java/com/bandwidth/sdk/model/CreateCall.java @@ -46,7 +46,6 @@ 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; @@ -140,7 +139,6 @@ public CreateCall() { } public CreateCall to(String to) { - this.to = to; return this; } @@ -154,14 +152,12 @@ public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public CreateCall from(String from) { - this.from = from; return this; } @@ -175,14 +171,12 @@ public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public CreateCall displayName(String displayName) { - this.displayName = displayName; return this; } @@ -196,14 +190,12 @@ public String getDisplayName() { return displayName; } - public void setDisplayName(String displayName) { this.displayName = displayName; } public CreateCall uui(String uui) { - this.uui = uui; return this; } @@ -217,14 +209,12 @@ public String getUui() { return uui; } - public void setUui(String uui) { this.uui = uui; } public CreateCall applicationId(String applicationId) { - this.applicationId = applicationId; return this; } @@ -238,14 +228,12 @@ public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public CreateCall answerUrl(URI answerUrl) { - this.answerUrl = answerUrl; return this; } @@ -259,14 +247,12 @@ public URI getAnswerUrl() { return answerUrl; } - public void setAnswerUrl(URI answerUrl) { this.answerUrl = answerUrl; } public CreateCall answerMethod(CallbackMethodEnum answerMethod) { - this.answerMethod = answerMethod; return this; } @@ -280,14 +266,12 @@ public CallbackMethodEnum getAnswerMethod() { return answerMethod; } - public void setAnswerMethod(CallbackMethodEnum answerMethod) { this.answerMethod = answerMethod; } public CreateCall username(String username) { - this.username = username; return this; } @@ -301,14 +285,12 @@ public String getUsername() { return username; } - public void setUsername(String username) { this.username = username; } public CreateCall password(String password) { - this.password = password; return this; } @@ -322,14 +304,12 @@ public String getPassword() { return password; } - public void setPassword(String password) { this.password = password; } public CreateCall answerFallbackUrl(URI answerFallbackUrl) { - this.answerFallbackUrl = answerFallbackUrl; return this; } @@ -343,14 +323,12 @@ public URI getAnswerFallbackUrl() { return answerFallbackUrl; } - public void setAnswerFallbackUrl(URI answerFallbackUrl) { this.answerFallbackUrl = answerFallbackUrl; } public CreateCall answerFallbackMethod(CallbackMethodEnum answerFallbackMethod) { - this.answerFallbackMethod = answerFallbackMethod; return this; } @@ -364,14 +342,12 @@ public CallbackMethodEnum getAnswerFallbackMethod() { return answerFallbackMethod; } - public void setAnswerFallbackMethod(CallbackMethodEnum answerFallbackMethod) { this.answerFallbackMethod = answerFallbackMethod; } public CreateCall fallbackUsername(String fallbackUsername) { - this.fallbackUsername = fallbackUsername; return this; } @@ -385,14 +361,12 @@ public String getFallbackUsername() { return fallbackUsername; } - public void setFallbackUsername(String fallbackUsername) { this.fallbackUsername = fallbackUsername; } public CreateCall fallbackPassword(String fallbackPassword) { - this.fallbackPassword = fallbackPassword; return this; } @@ -406,14 +380,12 @@ public String getFallbackPassword() { return fallbackPassword; } - public void setFallbackPassword(String fallbackPassword) { this.fallbackPassword = fallbackPassword; } public CreateCall disconnectUrl(URI disconnectUrl) { - this.disconnectUrl = disconnectUrl; return this; } @@ -427,14 +399,12 @@ public URI getDisconnectUrl() { return disconnectUrl; } - public void setDisconnectUrl(URI disconnectUrl) { this.disconnectUrl = disconnectUrl; } public CreateCall disconnectMethod(CallbackMethodEnum disconnectMethod) { - this.disconnectMethod = disconnectMethod; return this; } @@ -448,14 +418,12 @@ public CallbackMethodEnum getDisconnectMethod() { return disconnectMethod; } - public void setDisconnectMethod(CallbackMethodEnum disconnectMethod) { this.disconnectMethod = disconnectMethod; } public CreateCall callTimeout(Double callTimeout) { - this.callTimeout = callTimeout; return this; } @@ -471,14 +439,12 @@ public Double getCallTimeout() { return callTimeout; } - public void setCallTimeout(Double callTimeout) { this.callTimeout = callTimeout; } public CreateCall callbackTimeout(Double callbackTimeout) { - this.callbackTimeout = callbackTimeout; return this; } @@ -494,14 +460,12 @@ public Double getCallbackTimeout() { return callbackTimeout; } - public void setCallbackTimeout(Double callbackTimeout) { this.callbackTimeout = callbackTimeout; } public CreateCall machineDetection(MachineDetectionConfiguration machineDetection) { - this.machineDetection = machineDetection; return this; } @@ -515,14 +479,12 @@ public MachineDetectionConfiguration getMachineDetection() { return machineDetection; } - public void setMachineDetection(MachineDetectionConfiguration machineDetection) { this.machineDetection = machineDetection; } public CreateCall priority(Integer priority) { - this.priority = priority; return this; } @@ -538,14 +500,12 @@ public Integer getPriority() { return priority; } - public void setPriority(Integer priority) { this.priority = priority; } public CreateCall tag(String tag) { - this.tag = tag; return this; } @@ -559,7 +519,6 @@ public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } @@ -772,6 +731,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())); } @@ -781,6 +744,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())); } @@ -790,6 +757,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")); @@ -827,7 +798,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/CreateCallResponse.java b/src/main/java/com/bandwidth/sdk/model/CreateCallResponse.java index e99359cc..a4d79525 100644 --- a/src/main/java/com/bandwidth/sdk/model/CreateCallResponse.java +++ b/src/main/java/com/bandwidth/sdk/model/CreateCallResponse.java @@ -46,7 +46,6 @@ 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; @@ -144,7 +143,6 @@ public CreateCallResponse() { } public CreateCallResponse applicationId(String applicationId) { - this.applicationId = applicationId; return this; } @@ -158,14 +156,12 @@ public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public CreateCallResponse accountId(String accountId) { - this.accountId = accountId; return this; } @@ -179,14 +175,12 @@ public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public CreateCallResponse callId(String callId) { - this.callId = callId; return this; } @@ -200,14 +194,12 @@ public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public CreateCallResponse to(String to) { - this.to = to; return this; } @@ -221,14 +213,12 @@ public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public CreateCallResponse from(String from) { - this.from = from; return this; } @@ -242,14 +232,12 @@ public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public CreateCallResponse enqueuedTime(OffsetDateTime enqueuedTime) { - this.enqueuedTime = enqueuedTime; return this; } @@ -263,14 +251,12 @@ public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } - public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public CreateCallResponse callUrl(URI callUrl) { - this.callUrl = callUrl; return this; } @@ -284,14 +270,12 @@ public URI getCallUrl() { return callUrl; } - public void setCallUrl(URI callUrl) { this.callUrl = callUrl; } public CreateCallResponse callTimeout(Double callTimeout) { - this.callTimeout = callTimeout; return this; } @@ -305,14 +289,12 @@ public Double getCallTimeout() { return callTimeout; } - public void setCallTimeout(Double callTimeout) { this.callTimeout = callTimeout; } public CreateCallResponse callbackTimeout(Double callbackTimeout) { - this.callbackTimeout = callbackTimeout; return this; } @@ -326,14 +308,12 @@ public Double getCallbackTimeout() { return callbackTimeout; } - public void setCallbackTimeout(Double callbackTimeout) { this.callbackTimeout = callbackTimeout; } public CreateCallResponse tag(String tag) { - this.tag = tag; return this; } @@ -347,14 +327,12 @@ public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public CreateCallResponse answerMethod(CallbackMethodEnum answerMethod) { - this.answerMethod = answerMethod; return this; } @@ -368,14 +346,12 @@ public CallbackMethodEnum getAnswerMethod() { return answerMethod; } - public void setAnswerMethod(CallbackMethodEnum answerMethod) { this.answerMethod = answerMethod; } public CreateCallResponse answerUrl(URI answerUrl) { - this.answerUrl = answerUrl; return this; } @@ -389,14 +365,12 @@ public URI getAnswerUrl() { return answerUrl; } - public void setAnswerUrl(URI answerUrl) { this.answerUrl = answerUrl; } public CreateCallResponse answerFallbackMethod(CallbackMethodEnum answerFallbackMethod) { - this.answerFallbackMethod = answerFallbackMethod; return this; } @@ -410,14 +384,12 @@ public CallbackMethodEnum getAnswerFallbackMethod() { return answerFallbackMethod; } - public void setAnswerFallbackMethod(CallbackMethodEnum answerFallbackMethod) { this.answerFallbackMethod = answerFallbackMethod; } public CreateCallResponse answerFallbackUrl(URI answerFallbackUrl) { - this.answerFallbackUrl = answerFallbackUrl; return this; } @@ -431,14 +403,12 @@ public URI getAnswerFallbackUrl() { return answerFallbackUrl; } - public void setAnswerFallbackUrl(URI answerFallbackUrl) { this.answerFallbackUrl = answerFallbackUrl; } public CreateCallResponse disconnectMethod(CallbackMethodEnum disconnectMethod) { - this.disconnectMethod = disconnectMethod; return this; } @@ -452,14 +422,12 @@ public CallbackMethodEnum getDisconnectMethod() { return disconnectMethod; } - public void setDisconnectMethod(CallbackMethodEnum disconnectMethod) { this.disconnectMethod = disconnectMethod; } public CreateCallResponse disconnectUrl(URI disconnectUrl) { - this.disconnectUrl = disconnectUrl; return this; } @@ -473,14 +441,12 @@ public URI getDisconnectUrl() { return disconnectUrl; } - public void setDisconnectUrl(URI disconnectUrl) { this.disconnectUrl = disconnectUrl; } public CreateCallResponse username(String username) { - this.username = username; return this; } @@ -494,14 +460,12 @@ public String getUsername() { return username; } - public void setUsername(String username) { this.username = username; } public CreateCallResponse password(String password) { - this.password = password; return this; } @@ -515,14 +479,12 @@ public String getPassword() { return password; } - public void setPassword(String password) { this.password = password; } public CreateCallResponse fallbackUsername(String fallbackUsername) { - this.fallbackUsername = fallbackUsername; return this; } @@ -536,14 +498,12 @@ public String getFallbackUsername() { return fallbackUsername; } - public void setFallbackUsername(String fallbackUsername) { this.fallbackUsername = fallbackUsername; } public CreateCallResponse fallbackPassword(String fallbackPassword) { - this.fallbackPassword = fallbackPassword; return this; } @@ -557,14 +517,12 @@ public String getFallbackPassword() { return fallbackPassword; } - public void setFallbackPassword(String fallbackPassword) { this.fallbackPassword = fallbackPassword; } public CreateCallResponse priority(Integer priority) { - this.priority = priority; return this; } @@ -578,7 +536,6 @@ public Integer getPriority() { return priority; } - public void setPriority(Integer priority) { this.priority = priority; } @@ -802,12 +759,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 +818,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/CreateLookupResponse.java b/src/main/java/com/bandwidth/sdk/model/CreateLookupResponse.java index 5a9bdcab..72635523 100644 --- a/src/main/java/com/bandwidth/sdk/model/CreateLookupResponse.java +++ b/src/main/java/com/bandwidth/sdk/model/CreateLookupResponse.java @@ -43,7 +43,6 @@ 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; @@ -65,7 +64,6 @@ public CreateLookupResponse() { } public CreateLookupResponse requestId(String requestId) { - this.requestId = requestId; return this; } @@ -79,14 +77,12 @@ public String getRequestId() { return requestId; } - public void setRequestId(String requestId) { this.requestId = requestId; } public CreateLookupResponse status(LookupStatusEnum status) { - this.status = status; return this; } @@ -100,7 +96,6 @@ public LookupStatusEnum getStatus() { return status; } - public void setStatus(LookupStatusEnum status) { this.status = status; } @@ -222,6 +217,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 +251,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/CreateMessageRequestError.java b/src/main/java/com/bandwidth/sdk/model/CreateMessageRequestError.java index a54042d2..7289d0d2 100644 --- a/src/main/java/com/bandwidth/sdk/model/CreateMessageRequestError.java +++ b/src/main/java/com/bandwidth/sdk/model/CreateMessageRequestError.java @@ -45,7 +45,6 @@ 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; @@ -71,7 +70,6 @@ public CreateMessageRequestError() { } public CreateMessageRequestError type(String type) { - this.type = type; return this; } @@ -85,14 +83,12 @@ public String getType() { return type; } - public void setType(String type) { this.type = type; } public CreateMessageRequestError description(String description) { - this.description = description; return this; } @@ -106,14 +102,12 @@ public String getDescription() { return description; } - public void setDescription(String description) { this.description = description; } public CreateMessageRequestError fieldErrors(List fieldErrors) { - this.fieldErrors = fieldErrors; return this; } @@ -135,7 +129,6 @@ public List getFieldErrors() { return fieldErrors; } - public void setFieldErrors(List fieldErrors) { this.fieldErrors = fieldErrors; } @@ -316,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/DeferredResult.java b/src/main/java/com/bandwidth/sdk/model/DeferredResult.java index 2a480d08..b9f7fc69 100644 --- a/src/main/java/com/bandwidth/sdk/model/DeferredResult.java +++ b/src/main/java/com/bandwidth/sdk/model/DeferredResult.java @@ -42,7 +42,6 @@ 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; @@ -64,7 +63,6 @@ public DeferredResult() { } public DeferredResult result(Object result) { - this.result = result; return this; } @@ -78,14 +76,12 @@ public Object getResult() { return result; } - public void setResult(Object result) { this.result = result; } public DeferredResult setOrExpired(Boolean setOrExpired) { - this.setOrExpired = setOrExpired; return this; } @@ -99,7 +95,6 @@ public Boolean getSetOrExpired() { return setOrExpired; } - public void setSetOrExpired(Boolean setOrExpired) { this.setOrExpired = setOrExpired; } @@ -248,7 +243,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/DisconnectCallback.java b/src/main/java/com/bandwidth/sdk/model/DisconnectCallback.java index f0e11ec8..a6869eec 100644 --- a/src/main/java/com/bandwidth/sdk/model/DisconnectCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/DisconnectCallback.java @@ -45,7 +45,6 @@ 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; @@ -127,7 +126,6 @@ public DisconnectCallback() { } public DisconnectCallback eventType(String eventType) { - this.eventType = eventType; return this; } @@ -141,14 +139,12 @@ public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public DisconnectCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } @@ -162,14 +158,12 @@ public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public DisconnectCallback accountId(String accountId) { - this.accountId = accountId; return this; } @@ -183,14 +177,12 @@ public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public DisconnectCallback applicationId(String applicationId) { - this.applicationId = applicationId; return this; } @@ -204,14 +196,12 @@ public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public DisconnectCallback from(String from) { - this.from = from; return this; } @@ -225,14 +215,12 @@ public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public DisconnectCallback to(String to) { - this.to = to; return this; } @@ -246,14 +234,12 @@ public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public DisconnectCallback callId(String callId) { - this.callId = callId; return this; } @@ -267,14 +253,12 @@ public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public DisconnectCallback direction(CallDirectionEnum direction) { - this.direction = direction; return this; } @@ -288,14 +272,12 @@ public CallDirectionEnum getDirection() { return direction; } - public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public DisconnectCallback callUrl(String callUrl) { - this.callUrl = callUrl; return this; } @@ -309,14 +291,12 @@ public String getCallUrl() { return callUrl; } - public void setCallUrl(String callUrl) { this.callUrl = callUrl; } public DisconnectCallback enqueuedTime(OffsetDateTime enqueuedTime) { - this.enqueuedTime = enqueuedTime; return this; } @@ -330,14 +310,12 @@ public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } - public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public DisconnectCallback startTime(OffsetDateTime startTime) { - this.startTime = startTime; return this; } @@ -351,14 +329,12 @@ public OffsetDateTime getStartTime() { return startTime; } - public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public DisconnectCallback answerTime(OffsetDateTime answerTime) { - this.answerTime = answerTime; return this; } @@ -372,14 +348,12 @@ public OffsetDateTime getAnswerTime() { return answerTime; } - public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public DisconnectCallback endTime(OffsetDateTime endTime) { - this.endTime = endTime; return this; } @@ -393,14 +367,12 @@ public OffsetDateTime getEndTime() { return endTime; } - public void setEndTime(OffsetDateTime endTime) { this.endTime = endTime; } public DisconnectCallback cause(String cause) { - this.cause = cause; return this; } @@ -414,14 +386,12 @@ public String getCause() { return cause; } - public void setCause(String cause) { this.cause = cause; } public DisconnectCallback errorMessage(String errorMessage) { - this.errorMessage = errorMessage; return this; } @@ -435,14 +405,12 @@ public String getErrorMessage() { return errorMessage; } - public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; } public DisconnectCallback errorId(String errorId) { - this.errorId = errorId; return this; } @@ -456,14 +424,12 @@ public String getErrorId() { return errorId; } - public void setErrorId(String errorId) { this.errorId = errorId; } public DisconnectCallback tag(String tag) { - this.tag = tag; return this; } @@ -477,7 +443,6 @@ public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } @@ -670,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())); } @@ -715,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/Diversion.java b/src/main/java/com/bandwidth/sdk/model/Diversion.java index 78fc646b..11ea34b7 100644 --- a/src/main/java/com/bandwidth/sdk/model/Diversion.java +++ b/src/main/java/com/bandwidth/sdk/model/Diversion.java @@ -42,7 +42,6 @@ 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; @@ -84,7 +83,6 @@ public Diversion() { } public Diversion reason(String reason) { - this.reason = reason; return this; } @@ -98,14 +96,12 @@ public String getReason() { return reason; } - public void setReason(String reason) { this.reason = reason; } public Diversion privacy(String privacy) { - this.privacy = privacy; return this; } @@ -119,14 +115,12 @@ public String getPrivacy() { return privacy; } - public void setPrivacy(String privacy) { this.privacy = privacy; } public Diversion screen(String screen) { - this.screen = screen; return this; } @@ -140,14 +134,12 @@ public String getScreen() { return screen; } - public void setScreen(String screen) { this.screen = screen; } public Diversion counter(String counter) { - this.counter = counter; return this; } @@ -161,14 +153,12 @@ public String getCounter() { return counter; } - public void setCounter(String counter) { this.counter = counter; } public Diversion limit(String limit) { - this.limit = limit; return this; } @@ -182,14 +172,12 @@ public String getLimit() { return limit; } - public void setLimit(String limit) { this.limit = limit; } public Diversion unknown(String unknown) { - this.unknown = unknown; return this; } @@ -203,14 +191,12 @@ public String getUnknown() { return unknown; } - public void setUnknown(String unknown) { this.unknown = unknown; } public Diversion origTo(String origTo) { - this.origTo = origTo; return this; } @@ -224,7 +210,6 @@ public String getOrigTo() { return origTo; } - public void setOrigTo(String origTo) { this.origTo = origTo; } @@ -409,7 +394,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/DtmfCallback.java b/src/main/java/com/bandwidth/sdk/model/DtmfCallback.java index 73fd1608..61a3ae3c 100644 --- a/src/main/java/com/bandwidth/sdk/model/DtmfCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/DtmfCallback.java @@ -45,7 +45,6 @@ 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; @@ -127,7 +126,6 @@ public DtmfCallback() { } public DtmfCallback eventType(String eventType) { - this.eventType = eventType; return this; } @@ -141,14 +139,12 @@ public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public DtmfCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } @@ -162,14 +158,12 @@ public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public DtmfCallback accountId(String accountId) { - this.accountId = accountId; return this; } @@ -183,14 +177,12 @@ public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public DtmfCallback applicationId(String applicationId) { - this.applicationId = applicationId; return this; } @@ -204,14 +196,12 @@ public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public DtmfCallback from(String from) { - this.from = from; return this; } @@ -225,14 +215,12 @@ public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public DtmfCallback to(String to) { - this.to = to; return this; } @@ -246,14 +234,12 @@ public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public DtmfCallback callId(String callId) { - this.callId = callId; return this; } @@ -267,14 +253,12 @@ public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public DtmfCallback direction(CallDirectionEnum direction) { - this.direction = direction; return this; } @@ -288,14 +272,12 @@ public CallDirectionEnum getDirection() { return direction; } - public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public DtmfCallback digit(String digit) { - this.digit = digit; return this; } @@ -309,14 +291,12 @@ public String getDigit() { return digit; } - public void setDigit(String digit) { this.digit = digit; } public DtmfCallback callUrl(String callUrl) { - this.callUrl = callUrl; return this; } @@ -330,14 +310,12 @@ public String getCallUrl() { return callUrl; } - public void setCallUrl(String callUrl) { this.callUrl = callUrl; } public DtmfCallback enqueuedTime(OffsetDateTime enqueuedTime) { - this.enqueuedTime = enqueuedTime; return this; } @@ -351,14 +329,12 @@ public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } - public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public DtmfCallback startTime(OffsetDateTime startTime) { - this.startTime = startTime; return this; } @@ -372,14 +348,12 @@ public OffsetDateTime getStartTime() { return startTime; } - public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public DtmfCallback answerTime(OffsetDateTime answerTime) { - this.answerTime = answerTime; return this; } @@ -393,14 +367,12 @@ public OffsetDateTime getAnswerTime() { return answerTime; } - public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public DtmfCallback parentCallId(String parentCallId) { - this.parentCallId = parentCallId; return this; } @@ -414,14 +386,12 @@ public String getParentCallId() { return parentCallId; } - public void setParentCallId(String parentCallId) { this.parentCallId = parentCallId; } public DtmfCallback transferCallerId(String transferCallerId) { - this.transferCallerId = transferCallerId; return this; } @@ -435,14 +405,12 @@ public String getTransferCallerId() { return transferCallerId; } - public void setTransferCallerId(String transferCallerId) { this.transferCallerId = transferCallerId; } public DtmfCallback transferTo(String transferTo) { - this.transferTo = transferTo; return this; } @@ -456,14 +424,12 @@ public String getTransferTo() { return transferTo; } - public void setTransferTo(String transferTo) { this.transferTo = transferTo; } public DtmfCallback tag(String tag) { - this.tag = tag; return this; } @@ -477,7 +443,6 @@ public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } @@ -670,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())); } @@ -718,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/FieldError.java b/src/main/java/com/bandwidth/sdk/model/FieldError.java index 46618903..4ebd11a5 100644 --- a/src/main/java/com/bandwidth/sdk/model/FieldError.java +++ b/src/main/java/com/bandwidth/sdk/model/FieldError.java @@ -42,7 +42,6 @@ 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; @@ -64,7 +63,6 @@ public FieldError() { } public FieldError fieldName(String fieldName) { - this.fieldName = fieldName; return this; } @@ -78,14 +76,12 @@ public String getFieldName() { return fieldName; } - public void setFieldName(String fieldName) { this.fieldName = fieldName; } public FieldError description(String description) { - this.description = description; return this; } @@ -99,7 +95,6 @@ public String getDescription() { return description; } - public void setDescription(String description) { this.description = description; } @@ -254,7 +249,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/FileFormatEnum.java b/src/main/java/com/bandwidth/sdk/model/FileFormatEnum.java index 43aaf62c..28fdbe91 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 8ac36f91..8141bd97 100644 --- a/src/main/java/com/bandwidth/sdk/model/GatherCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/GatherCallback.java @@ -45,7 +45,6 @@ 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; @@ -131,7 +130,6 @@ public GatherCallback() { } public GatherCallback eventType(String eventType) { - this.eventType = eventType; return this; } @@ -145,14 +143,12 @@ public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public GatherCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } @@ -166,14 +162,12 @@ public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public GatherCallback accountId(String accountId) { - this.accountId = accountId; return this; } @@ -187,14 +181,12 @@ public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public GatherCallback applicationId(String applicationId) { - this.applicationId = applicationId; return this; } @@ -208,14 +200,12 @@ public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public GatherCallback from(String from) { - this.from = from; return this; } @@ -229,14 +219,12 @@ public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public GatherCallback to(String to) { - this.to = to; return this; } @@ -250,14 +238,12 @@ public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public GatherCallback direction(CallDirectionEnum direction) { - this.direction = direction; return this; } @@ -271,14 +257,12 @@ public CallDirectionEnum getDirection() { return direction; } - public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public GatherCallback callId(String callId) { - this.callId = callId; return this; } @@ -292,14 +276,12 @@ public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public GatherCallback digits(String digits) { - this.digits = digits; return this; } @@ -313,14 +295,12 @@ public String getDigits() { return digits; } - public void setDigits(String digits) { this.digits = digits; } public GatherCallback callUrl(String callUrl) { - this.callUrl = callUrl; return this; } @@ -334,14 +314,12 @@ public String getCallUrl() { return callUrl; } - public void setCallUrl(String callUrl) { this.callUrl = callUrl; } public GatherCallback enqueuedTime(OffsetDateTime enqueuedTime) { - this.enqueuedTime = enqueuedTime; return this; } @@ -355,14 +333,12 @@ public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } - public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public GatherCallback startTime(OffsetDateTime startTime) { - this.startTime = startTime; return this; } @@ -376,14 +352,12 @@ public OffsetDateTime getStartTime() { return startTime; } - public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public GatherCallback answerTime(OffsetDateTime answerTime) { - this.answerTime = answerTime; return this; } @@ -397,14 +371,12 @@ public OffsetDateTime getAnswerTime() { return answerTime; } - public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public GatherCallback parentCallId(String parentCallId) { - this.parentCallId = parentCallId; return this; } @@ -418,14 +390,12 @@ public String getParentCallId() { return parentCallId; } - public void setParentCallId(String parentCallId) { this.parentCallId = parentCallId; } public GatherCallback terminatingDigit(String terminatingDigit) { - this.terminatingDigit = terminatingDigit; return this; } @@ -439,14 +409,12 @@ public String getTerminatingDigit() { return terminatingDigit; } - public void setTerminatingDigit(String terminatingDigit) { this.terminatingDigit = terminatingDigit; } public GatherCallback transferCallerId(String transferCallerId) { - this.transferCallerId = transferCallerId; return this; } @@ -460,14 +428,12 @@ public String getTransferCallerId() { return transferCallerId; } - public void setTransferCallerId(String transferCallerId) { this.transferCallerId = transferCallerId; } public GatherCallback transferTo(String transferTo) { - this.transferTo = transferTo; return this; } @@ -481,14 +447,12 @@ public String getTransferTo() { return transferTo; } - public void setTransferTo(String transferTo) { this.transferTo = transferTo; } public GatherCallback tag(String tag) { - this.tag = tag; return this; } @@ -502,7 +466,6 @@ public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } @@ -695,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())); } @@ -749,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/InboundMessageCallback.java b/src/main/java/com/bandwidth/sdk/model/InboundMessageCallback.java index 1ba464ec..05c05577 100644 --- a/src/main/java/com/bandwidth/sdk/model/InboundMessageCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/InboundMessageCallback.java @@ -44,7 +44,6 @@ 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; @@ -78,7 +77,6 @@ public InboundMessageCallback() { } public InboundMessageCallback time(OffsetDateTime time) { - this.time = time; return this; } @@ -92,14 +90,12 @@ public OffsetDateTime getTime() { return time; } - public void setTime(OffsetDateTime time) { this.time = time; } public InboundMessageCallback type(String type) { - this.type = type; return this; } @@ -113,14 +109,12 @@ public String getType() { return type; } - public void setType(String type) { this.type = type; } public InboundMessageCallback to(String to) { - this.to = to; return this; } @@ -134,14 +128,12 @@ public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public InboundMessageCallback description(String description) { - this.description = description; return this; } @@ -155,14 +147,12 @@ public String getDescription() { return description; } - public void setDescription(String description) { this.description = description; } public InboundMessageCallback message(InboundMessageCallbackMessage message) { - this.message = message; return this; } @@ -176,7 +166,6 @@ public InboundMessageCallbackMessage getMessage() { return message; } - public void setMessage(InboundMessageCallbackMessage message) { this.message = message; } @@ -357,7 +346,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/InboundMessageCallbackMessage.java b/src/main/java/com/bandwidth/sdk/model/InboundMessageCallbackMessage.java index 9d5d99d9..d88c356a 100644 --- a/src/main/java/com/bandwidth/sdk/model/InboundMessageCallbackMessage.java +++ b/src/main/java/com/bandwidth/sdk/model/InboundMessageCallbackMessage.java @@ -50,7 +50,6 @@ 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; @@ -112,7 +111,6 @@ public InboundMessageCallbackMessage() { } public InboundMessageCallbackMessage id(String id) { - this.id = id; return this; } @@ -126,14 +124,12 @@ public String getId() { return id; } - public void setId(String id) { this.id = id; } public InboundMessageCallbackMessage owner(String owner) { - this.owner = owner; return this; } @@ -147,14 +143,12 @@ public String getOwner() { return owner; } - public void setOwner(String owner) { this.owner = owner; } public InboundMessageCallbackMessage applicationId(String applicationId) { - this.applicationId = applicationId; return this; } @@ -168,14 +162,12 @@ public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public InboundMessageCallbackMessage time(OffsetDateTime time) { - this.time = time; return this; } @@ -189,14 +181,12 @@ public OffsetDateTime getTime() { return time; } - public void setTime(OffsetDateTime time) { this.time = time; } public InboundMessageCallbackMessage segmentCount(Integer segmentCount) { - this.segmentCount = segmentCount; return this; } @@ -210,14 +200,12 @@ public Integer getSegmentCount() { return segmentCount; } - public void setSegmentCount(Integer segmentCount) { this.segmentCount = segmentCount; } public InboundMessageCallbackMessage direction(MessageDirectionEnum direction) { - this.direction = direction; return this; } @@ -231,14 +219,12 @@ public MessageDirectionEnum getDirection() { return direction; } - public void setDirection(MessageDirectionEnum direction) { this.direction = direction; } public InboundMessageCallbackMessage to(Set to) { - this.to = to; return this; } @@ -260,14 +246,12 @@ public Set getTo() { return to; } - public void setTo(Set to) { this.to = to; } public InboundMessageCallbackMessage from(String from) { - this.from = from; return this; } @@ -281,14 +265,12 @@ public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public InboundMessageCallbackMessage text(String text) { - this.text = text; return this; } @@ -302,14 +284,12 @@ public String getText() { return text; } - public void setText(String text) { this.text = text; } public InboundMessageCallbackMessage tag(String tag) { - this.tag = tag; return this; } @@ -323,14 +303,12 @@ public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public InboundMessageCallbackMessage media(List media) { - this.media = media; return this; } @@ -352,14 +330,12 @@ public List getMedia() { return media; } - public void setMedia(List media) { this.media = media; } public InboundMessageCallbackMessage priority(PriorityEnum priority) { - this.priority = priority; return this; } @@ -373,7 +349,6 @@ public PriorityEnum getPriority() { return priority; } - public void setPriority(PriorityEnum priority) { this.priority = priority; } @@ -547,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`"); @@ -566,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 { @@ -596,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/InitiateCallback.java b/src/main/java/com/bandwidth/sdk/model/InitiateCallback.java index ed3e6394..cbb5c651 100644 --- a/src/main/java/com/bandwidth/sdk/model/InitiateCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/InitiateCallback.java @@ -46,7 +46,6 @@ 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; @@ -108,7 +107,6 @@ public InitiateCallback() { } public InitiateCallback eventType(String eventType) { - this.eventType = eventType; return this; } @@ -122,14 +120,12 @@ public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public InitiateCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } @@ -143,14 +139,12 @@ public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public InitiateCallback accountId(String accountId) { - this.accountId = accountId; return this; } @@ -164,14 +158,12 @@ public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public InitiateCallback applicationId(String applicationId) { - this.applicationId = applicationId; return this; } @@ -185,14 +177,12 @@ public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public InitiateCallback from(String from) { - this.from = from; return this; } @@ -206,14 +196,12 @@ public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public InitiateCallback to(String to) { - this.to = to; return this; } @@ -227,14 +215,12 @@ public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public InitiateCallback direction(CallDirectionEnum direction) { - this.direction = direction; return this; } @@ -248,14 +234,12 @@ public CallDirectionEnum getDirection() { return direction; } - public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public InitiateCallback callId(String callId) { - this.callId = callId; return this; } @@ -269,14 +253,12 @@ public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public InitiateCallback callUrl(String callUrl) { - this.callUrl = callUrl; return this; } @@ -290,14 +272,12 @@ public String getCallUrl() { return callUrl; } - public void setCallUrl(String callUrl) { this.callUrl = callUrl; } public InitiateCallback startTime(OffsetDateTime startTime) { - this.startTime = startTime; return this; } @@ -311,14 +291,12 @@ public OffsetDateTime getStartTime() { return startTime; } - public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public InitiateCallback diversion(Diversion diversion) { - this.diversion = diversion; return this; } @@ -332,14 +310,12 @@ public Diversion getDiversion() { return diversion; } - public void setDiversion(Diversion diversion) { this.diversion = diversion; } public InitiateCallback stirShaken(StirShaken stirShaken) { - this.stirShaken = stirShaken; return this; } @@ -353,7 +329,6 @@ public StirShaken getStirShaken() { return stirShaken; } - public void setStirShaken(StirShaken stirShaken) { this.stirShaken = stirShaken; } @@ -517,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())); } @@ -561,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/ListMessageDirectionEnum.java b/src/main/java/com/bandwidth/sdk/model/ListMessageDirectionEnum.java index 600543bf..632ff5c4 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..2ba9635d 100644 --- a/src/main/java/com/bandwidth/sdk/model/ListMessageItem.java +++ b/src/main/java/com/bandwidth/sdk/model/ListMessageItem.java @@ -47,7 +47,6 @@ 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; @@ -129,7 +128,6 @@ public ListMessageItem() { } public ListMessageItem messageId(String messageId) { - this.messageId = messageId; return this; } @@ -143,14 +141,12 @@ public String getMessageId() { return messageId; } - public void setMessageId(String messageId) { this.messageId = messageId; } public ListMessageItem accountId(String accountId) { - this.accountId = accountId; return this; } @@ -164,14 +160,12 @@ public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public ListMessageItem sourceTn(String sourceTn) { - this.sourceTn = sourceTn; return this; } @@ -185,14 +179,12 @@ public String getSourceTn() { return sourceTn; } - public void setSourceTn(String sourceTn) { this.sourceTn = sourceTn; } public ListMessageItem destinationTn(String destinationTn) { - this.destinationTn = destinationTn; return this; } @@ -206,14 +198,12 @@ public String getDestinationTn() { return destinationTn; } - public void setDestinationTn(String destinationTn) { this.destinationTn = destinationTn; } public ListMessageItem messageStatus(MessageStatusEnum messageStatus) { - this.messageStatus = messageStatus; return this; } @@ -227,14 +217,12 @@ public MessageStatusEnum getMessageStatus() { return messageStatus; } - public void setMessageStatus(MessageStatusEnum messageStatus) { this.messageStatus = messageStatus; } public ListMessageItem messageDirection(ListMessageDirectionEnum messageDirection) { - this.messageDirection = messageDirection; return this; } @@ -248,14 +236,12 @@ public ListMessageDirectionEnum getMessageDirection() { return messageDirection; } - public void setMessageDirection(ListMessageDirectionEnum messageDirection) { this.messageDirection = messageDirection; } public ListMessageItem messageType(MessageTypeEnum messageType) { - this.messageType = messageType; return this; } @@ -269,14 +255,12 @@ public MessageTypeEnum getMessageType() { return messageType; } - public void setMessageType(MessageTypeEnum messageType) { this.messageType = messageType; } public ListMessageItem segmentCount(Integer segmentCount) { - this.segmentCount = segmentCount; return this; } @@ -290,14 +274,12 @@ public Integer getSegmentCount() { return segmentCount; } - public void setSegmentCount(Integer segmentCount) { this.segmentCount = segmentCount; } public ListMessageItem errorCode(Integer errorCode) { - this.errorCode = errorCode; return this; } @@ -311,14 +293,12 @@ public Integer getErrorCode() { return errorCode; } - public void setErrorCode(Integer errorCode) { this.errorCode = errorCode; } public ListMessageItem receiveTime(OffsetDateTime receiveTime) { - this.receiveTime = receiveTime; return this; } @@ -332,14 +312,12 @@ public OffsetDateTime getReceiveTime() { return receiveTime; } - public void setReceiveTime(OffsetDateTime receiveTime) { this.receiveTime = receiveTime; } public ListMessageItem carrierName(String carrierName) { - this.carrierName = carrierName; return this; } @@ -353,14 +331,12 @@ public String getCarrierName() { return carrierName; } - public void setCarrierName(String carrierName) { this.carrierName = carrierName; } public ListMessageItem messageSize(Integer messageSize) { - this.messageSize = messageSize; return this; } @@ -374,14 +350,12 @@ public Integer getMessageSize() { return messageSize; } - public void setMessageSize(Integer messageSize) { this.messageSize = messageSize; } public ListMessageItem messageLength(Integer messageLength) { - this.messageLength = messageLength; return this; } @@ -395,14 +369,12 @@ public Integer getMessageLength() { return messageLength; } - public void setMessageLength(Integer messageLength) { this.messageLength = messageLength; } public ListMessageItem attachmentCount(Integer attachmentCount) { - this.attachmentCount = attachmentCount; return this; } @@ -416,14 +388,12 @@ public Integer getAttachmentCount() { return attachmentCount; } - public void setAttachmentCount(Integer attachmentCount) { this.attachmentCount = attachmentCount; } public ListMessageItem recipientCount(Integer recipientCount) { - this.recipientCount = recipientCount; return this; } @@ -437,14 +407,12 @@ public Integer getRecipientCount() { return recipientCount; } - public void setRecipientCount(Integer recipientCount) { this.recipientCount = recipientCount; } public ListMessageItem campaignClass(String campaignClass) { - this.campaignClass = campaignClass; return this; } @@ -458,14 +426,12 @@ public String getCampaignClass() { return campaignClass; } - public void setCampaignClass(String campaignClass) { this.campaignClass = campaignClass; } public ListMessageItem campaignId(String campaignId) { - this.campaignId = campaignId; return this; } @@ -479,7 +445,6 @@ public String getCampaignId() { return campaignId; } - public void setCampaignId(String campaignId) { this.campaignId = campaignId; } @@ -666,6 +631,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 +682,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/LookupRequest.java b/src/main/java/com/bandwidth/sdk/model/LookupRequest.java index f41a7f01..79ab25b9 100644 --- a/src/main/java/com/bandwidth/sdk/model/LookupRequest.java +++ b/src/main/java/com/bandwidth/sdk/model/LookupRequest.java @@ -44,7 +44,6 @@ 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; @@ -62,7 +61,6 @@ public LookupRequest() { } public LookupRequest tns(List tns) { - this.tns = tns; return this; } @@ -84,7 +82,6 @@ public List getTns() { return tns; } - public void setTns(List tns) { this.tns = tns; } @@ -244,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/LookupResult.java b/src/main/java/com/bandwidth/sdk/model/LookupResult.java index 7238b192..0d353417 100644 --- a/src/main/java/com/bandwidth/sdk/model/LookupResult.java +++ b/src/main/java/com/bandwidth/sdk/model/LookupResult.java @@ -42,7 +42,6 @@ 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; @@ -92,7 +91,6 @@ public LookupResult() { } public LookupResult responseCode(Integer responseCode) { - this.responseCode = responseCode; return this; } @@ -106,14 +104,12 @@ public Integer getResponseCode() { return responseCode; } - public void setResponseCode(Integer responseCode) { this.responseCode = responseCode; } public LookupResult message(String message) { - this.message = message; return this; } @@ -127,14 +123,12 @@ public String getMessage() { return message; } - public void setMessage(String message) { this.message = message; } public LookupResult e164Format(String e164Format) { - this.e164Format = e164Format; return this; } @@ -148,14 +142,12 @@ public String getE164Format() { return e164Format; } - public void setE164Format(String e164Format) { this.e164Format = e164Format; } public LookupResult formatted(String formatted) { - this.formatted = formatted; return this; } @@ -169,14 +161,12 @@ public String getFormatted() { return formatted; } - public void setFormatted(String formatted) { this.formatted = formatted; } public LookupResult country(String country) { - this.country = country; return this; } @@ -190,14 +180,12 @@ public String getCountry() { return country; } - public void setCountry(String country) { this.country = country; } public LookupResult lineType(String lineType) { - this.lineType = lineType; return this; } @@ -211,14 +199,12 @@ public String getLineType() { return lineType; } - public void setLineType(String lineType) { this.lineType = lineType; } public LookupResult lineProvider(String lineProvider) { - this.lineProvider = lineProvider; return this; } @@ -232,14 +218,12 @@ public String getLineProvider() { return lineProvider; } - public void setLineProvider(String lineProvider) { this.lineProvider = lineProvider; } public LookupResult mobileCountryCode(String mobileCountryCode) { - this.mobileCountryCode = mobileCountryCode; return this; } @@ -253,14 +237,12 @@ public String getMobileCountryCode() { return mobileCountryCode; } - public void setMobileCountryCode(String mobileCountryCode) { this.mobileCountryCode = mobileCountryCode; } public LookupResult mobileNetworkCode(String mobileNetworkCode) { - this.mobileNetworkCode = mobileNetworkCode; return this; } @@ -274,7 +256,6 @@ public String getMobileNetworkCode() { return mobileNetworkCode; } - public void setMobileNetworkCode(String mobileNetworkCode) { this.mobileNetworkCode = mobileNetworkCode; } @@ -468,7 +449,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/LookupStatus.java b/src/main/java/com/bandwidth/sdk/model/LookupStatus.java index 227b1bd3..f438c752 100644 --- a/src/main/java/com/bandwidth/sdk/model/LookupStatus.java +++ b/src/main/java/com/bandwidth/sdk/model/LookupStatus.java @@ -46,7 +46,6 @@ 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; @@ -76,7 +75,6 @@ public LookupStatus() { } public LookupStatus requestId(String requestId) { - this.requestId = requestId; return this; } @@ -90,14 +88,12 @@ public String getRequestId() { return requestId; } - public void setRequestId(String requestId) { this.requestId = requestId; } public LookupStatus status(LookupStatusEnum status) { - this.status = status; return this; } @@ -111,14 +107,12 @@ public LookupStatusEnum getStatus() { return status; } - public void setStatus(LookupStatusEnum status) { this.status = status; } public LookupStatus result(List result) { - this.result = result; return this; } @@ -140,14 +134,12 @@ public List getResult() { return result; } - public void setResult(List result) { this.result = result; } public LookupStatus failedTelephoneNumbers(List failedTelephoneNumbers) { - this.failedTelephoneNumbers = failedTelephoneNumbers; return this; } @@ -169,7 +161,6 @@ public List getFailedTelephoneNumbers() { return failedTelephoneNumbers; } - public void setFailedTelephoneNumbers(List failedTelephoneNumbers) { this.failedTelephoneNumbers = failedTelephoneNumbers; } @@ -297,6 +288,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 +340,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/LookupStatusEnum.java b/src/main/java/com/bandwidth/sdk/model/LookupStatusEnum.java index 205bb514..5fa41466 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 1e3e414f..7d380947 100644 --- a/src/main/java/com/bandwidth/sdk/model/MachineDetectionCompleteCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/MachineDetectionCompleteCallback.java @@ -46,7 +46,6 @@ 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; @@ -116,7 +115,6 @@ public MachineDetectionCompleteCallback() { } public MachineDetectionCompleteCallback eventType(String eventType) { - this.eventType = eventType; return this; } @@ -130,14 +128,12 @@ public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public MachineDetectionCompleteCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } @@ -151,14 +147,12 @@ public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public MachineDetectionCompleteCallback accountId(String accountId) { - this.accountId = accountId; return this; } @@ -172,14 +166,12 @@ public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public MachineDetectionCompleteCallback applicationId(String applicationId) { - this.applicationId = applicationId; return this; } @@ -193,14 +185,12 @@ public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public MachineDetectionCompleteCallback from(String from) { - this.from = from; return this; } @@ -214,14 +204,12 @@ public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public MachineDetectionCompleteCallback to(String to) { - this.to = to; return this; } @@ -235,14 +223,12 @@ public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public MachineDetectionCompleteCallback direction(CallDirectionEnum direction) { - this.direction = direction; return this; } @@ -256,14 +242,12 @@ public CallDirectionEnum getDirection() { return direction; } - public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public MachineDetectionCompleteCallback callId(String callId) { - this.callId = callId; return this; } @@ -277,14 +261,12 @@ public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public MachineDetectionCompleteCallback callUrl(String callUrl) { - this.callUrl = callUrl; return this; } @@ -298,14 +280,12 @@ public String getCallUrl() { return callUrl; } - public void setCallUrl(String callUrl) { this.callUrl = callUrl; } public MachineDetectionCompleteCallback enqueuedTime(OffsetDateTime enqueuedTime) { - this.enqueuedTime = enqueuedTime; return this; } @@ -319,14 +299,12 @@ public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } - public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public MachineDetectionCompleteCallback startTime(OffsetDateTime startTime) { - this.startTime = startTime; return this; } @@ -340,14 +318,12 @@ public OffsetDateTime getStartTime() { return startTime; } - public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public MachineDetectionCompleteCallback answerTime(OffsetDateTime answerTime) { - this.answerTime = answerTime; return this; } @@ -361,14 +337,12 @@ public OffsetDateTime getAnswerTime() { return answerTime; } - public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public MachineDetectionCompleteCallback tag(String tag) { - this.tag = tag; return this; } @@ -382,14 +356,12 @@ public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public MachineDetectionCompleteCallback machineDetectionResult(MachineDetectionResult machineDetectionResult) { - this.machineDetectionResult = machineDetectionResult; return this; } @@ -403,7 +375,6 @@ public MachineDetectionResult getMachineDetectionResult() { return machineDetectionResult; } - public void setMachineDetectionResult(MachineDetectionResult machineDetectionResult) { this.machineDetectionResult = machineDetectionResult; } @@ -584,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())); } @@ -627,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/MachineDetectionConfiguration.java b/src/main/java/com/bandwidth/sdk/model/MachineDetectionConfiguration.java index 041100f6..1a08054f 100644 --- a/src/main/java/com/bandwidth/sdk/model/MachineDetectionConfiguration.java +++ b/src/main/java/com/bandwidth/sdk/model/MachineDetectionConfiguration.java @@ -46,7 +46,6 @@ 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; @@ -120,7 +119,6 @@ public MachineDetectionConfiguration() { } public MachineDetectionConfiguration mode(MachineDetectionModeEnum mode) { - this.mode = mode; return this; } @@ -134,14 +132,12 @@ public MachineDetectionModeEnum getMode() { return mode; } - public void setMode(MachineDetectionModeEnum mode) { this.mode = mode; } public MachineDetectionConfiguration detectionTimeout(Double detectionTimeout) { - this.detectionTimeout = detectionTimeout; return this; } @@ -155,14 +151,12 @@ public Double getDetectionTimeout() { return detectionTimeout; } - public void setDetectionTimeout(Double detectionTimeout) { this.detectionTimeout = detectionTimeout; } public MachineDetectionConfiguration silenceTimeout(Double silenceTimeout) { - this.silenceTimeout = silenceTimeout; return this; } @@ -176,14 +170,12 @@ public Double getSilenceTimeout() { return silenceTimeout; } - public void setSilenceTimeout(Double silenceTimeout) { this.silenceTimeout = silenceTimeout; } public MachineDetectionConfiguration speechThreshold(Double speechThreshold) { - this.speechThreshold = speechThreshold; return this; } @@ -197,14 +189,12 @@ public Double getSpeechThreshold() { return speechThreshold; } - public void setSpeechThreshold(Double speechThreshold) { this.speechThreshold = speechThreshold; } public MachineDetectionConfiguration speechEndThreshold(Double speechEndThreshold) { - this.speechEndThreshold = speechEndThreshold; return this; } @@ -218,14 +208,12 @@ public Double getSpeechEndThreshold() { return speechEndThreshold; } - public void setSpeechEndThreshold(Double speechEndThreshold) { this.speechEndThreshold = speechEndThreshold; } public MachineDetectionConfiguration machineSpeechEndThreshold(Double machineSpeechEndThreshold) { - this.machineSpeechEndThreshold = machineSpeechEndThreshold; return this; } @@ -239,14 +227,12 @@ public Double getMachineSpeechEndThreshold() { return machineSpeechEndThreshold; } - public void setMachineSpeechEndThreshold(Double machineSpeechEndThreshold) { this.machineSpeechEndThreshold = machineSpeechEndThreshold; } public MachineDetectionConfiguration delayResult(Boolean delayResult) { - this.delayResult = delayResult; return this; } @@ -260,14 +246,12 @@ public Boolean getDelayResult() { return delayResult; } - public void setDelayResult(Boolean delayResult) { this.delayResult = delayResult; } public MachineDetectionConfiguration callbackUrl(URI callbackUrl) { - this.callbackUrl = callbackUrl; return this; } @@ -281,14 +265,12 @@ public URI getCallbackUrl() { return callbackUrl; } - public void setCallbackUrl(URI callbackUrl) { this.callbackUrl = callbackUrl; } public MachineDetectionConfiguration callbackMethod(CallbackMethodEnum callbackMethod) { - this.callbackMethod = callbackMethod; return this; } @@ -302,14 +284,12 @@ public CallbackMethodEnum getCallbackMethod() { return callbackMethod; } - public void setCallbackMethod(CallbackMethodEnum callbackMethod) { this.callbackMethod = callbackMethod; } public MachineDetectionConfiguration username(String username) { - this.username = username; return this; } @@ -323,14 +303,12 @@ public String getUsername() { return username; } - public void setUsername(String username) { this.username = username; } public MachineDetectionConfiguration password(String password) { - this.password = password; return this; } @@ -344,14 +322,12 @@ public String getPassword() { return password; } - public void setPassword(String password) { this.password = password; } public MachineDetectionConfiguration fallbackUrl(URI fallbackUrl) { - this.fallbackUrl = fallbackUrl; return this; } @@ -365,14 +341,12 @@ public URI getFallbackUrl() { return fallbackUrl; } - public void setFallbackUrl(URI fallbackUrl) { this.fallbackUrl = fallbackUrl; } public MachineDetectionConfiguration fallbackMethod(CallbackMethodEnum fallbackMethod) { - this.fallbackMethod = fallbackMethod; return this; } @@ -386,14 +360,12 @@ public CallbackMethodEnum getFallbackMethod() { return fallbackMethod; } - public void setFallbackMethod(CallbackMethodEnum fallbackMethod) { this.fallbackMethod = fallbackMethod; } public MachineDetectionConfiguration fallbackUsername(String fallbackUsername) { - this.fallbackUsername = fallbackUsername; return this; } @@ -407,14 +379,12 @@ public String getFallbackUsername() { return fallbackUsername; } - public void setFallbackUsername(String fallbackUsername) { this.fallbackUsername = fallbackUsername; } public MachineDetectionConfiguration fallbackPassword(String fallbackPassword) { - this.fallbackPassword = fallbackPassword; return this; } @@ -428,7 +398,6 @@ public String getFallbackPassword() { return fallbackPassword; } - public void setFallbackPassword(String fallbackPassword) { this.fallbackPassword = fallbackPassword; } @@ -597,9 +566,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 +586,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 +626,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/MachineDetectionModeEnum.java b/src/main/java/com/bandwidth/sdk/model/MachineDetectionModeEnum.java index a8dfc31b..69c43ccb 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..49e7b798 100644 --- a/src/main/java/com/bandwidth/sdk/model/MachineDetectionResult.java +++ b/src/main/java/com/bandwidth/sdk/model/MachineDetectionResult.java @@ -42,7 +42,6 @@ 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; @@ -64,7 +63,6 @@ public MachineDetectionResult() { } public MachineDetectionResult value(String value) { - this.value = value; return this; } @@ -78,14 +76,12 @@ public String getValue() { return value; } - public void setValue(String value) { this.value = value; } public MachineDetectionResult duration(String duration) { - this.duration = duration; return this; } @@ -99,7 +95,6 @@ public String getDuration() { return duration; } - public void setDuration(String duration) { this.duration = duration; } @@ -254,7 +249,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/Media.java b/src/main/java/com/bandwidth/sdk/model/Media.java index 5465ff98..223d1fc7 100644 --- a/src/main/java/com/bandwidth/sdk/model/Media.java +++ b/src/main/java/com/bandwidth/sdk/model/Media.java @@ -42,7 +42,6 @@ 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; @@ -68,7 +67,6 @@ public Media() { } public Media content(String content) { - this.content = content; return this; } @@ -82,14 +80,12 @@ public String getContent() { return content; } - public void setContent(String content) { this.content = content; } public Media contentLength(Integer contentLength) { - this.contentLength = contentLength; return this; } @@ -103,14 +99,12 @@ public Integer getContentLength() { return contentLength; } - public void setContentLength(Integer contentLength) { this.contentLength = contentLength; } public Media mediaName(String mediaName) { - this.mediaName = mediaName; return this; } @@ -124,7 +118,6 @@ public String getMediaName() { return mediaName; } - public void setMediaName(String mediaName) { this.mediaName = mediaName; } @@ -282,7 +275,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/Message.java b/src/main/java/com/bandwidth/sdk/model/Message.java index a6d830dd..1a6e0e71 100644 --- a/src/main/java/com/bandwidth/sdk/model/Message.java +++ b/src/main/java/com/bandwidth/sdk/model/Message.java @@ -47,7 +47,6 @@ 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; @@ -113,7 +112,6 @@ public Message() { } public Message id(String id) { - this.id = id; return this; } @@ -127,14 +125,12 @@ public String getId() { return id; } - public void setId(String id) { this.id = id; } public Message owner(String owner) { - this.owner = owner; return this; } @@ -148,14 +144,12 @@ public String getOwner() { return owner; } - public void setOwner(String owner) { this.owner = owner; } public Message applicationId(String applicationId) { - this.applicationId = applicationId; return this; } @@ -169,14 +163,12 @@ public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public Message time(OffsetDateTime time) { - this.time = time; return this; } @@ -190,14 +182,12 @@ public OffsetDateTime getTime() { return time; } - public void setTime(OffsetDateTime time) { this.time = time; } public Message segmentCount(Integer segmentCount) { - this.segmentCount = segmentCount; return this; } @@ -211,14 +201,12 @@ public Integer getSegmentCount() { return segmentCount; } - public void setSegmentCount(Integer segmentCount) { this.segmentCount = segmentCount; } public Message direction(MessageDirectionEnum direction) { - this.direction = direction; return this; } @@ -232,14 +220,12 @@ public MessageDirectionEnum getDirection() { return direction; } - public void setDirection(MessageDirectionEnum direction) { this.direction = direction; } public Message to(Set to) { - this.to = to; return this; } @@ -261,14 +247,12 @@ public Set getTo() { return to; } - public void setTo(Set to) { this.to = to; } public Message from(String from) { - this.from = from; return this; } @@ -282,14 +266,12 @@ public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public Message media(Set media) { - this.media = media; return this; } @@ -311,14 +293,12 @@ public Set getMedia() { return media; } - public void setMedia(Set media) { this.media = media; } public Message text(String text) { - this.text = text; return this; } @@ -332,14 +312,12 @@ public String getText() { return text; } - public void setText(String text) { this.text = text; } public Message tag(String tag) { - this.tag = tag; return this; } @@ -353,14 +331,12 @@ public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public Message priority(PriorityEnum priority) { - this.priority = priority; return this; } @@ -374,14 +350,12 @@ public PriorityEnum getPriority() { return priority; } - public void setPriority(PriorityEnum priority) { this.priority = priority; } public Message expiration(OffsetDateTime expiration) { - this.expiration = expiration; return this; } @@ -395,7 +369,6 @@ public OffsetDateTime getExpiration() { return expiration; } - public void setExpiration(OffsetDateTime expiration) { this.expiration = expiration; } @@ -556,6 +529,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 +550,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 +584,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallback.java b/src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallback.java index 7a3a30c7..22e3d23e 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallback.java @@ -44,7 +44,6 @@ 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; @@ -78,7 +77,6 @@ public MessageDeliveredCallback() { } public MessageDeliveredCallback time(OffsetDateTime time) { - this.time = time; return this; } @@ -92,14 +90,12 @@ public OffsetDateTime getTime() { return time; } - public void setTime(OffsetDateTime time) { this.time = time; } public MessageDeliveredCallback type(String type) { - this.type = type; return this; } @@ -113,14 +109,12 @@ public String getType() { return type; } - public void setType(String type) { this.type = type; } public MessageDeliveredCallback to(String to) { - this.to = to; return this; } @@ -134,14 +128,12 @@ public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public MessageDeliveredCallback description(String description) { - this.description = description; return this; } @@ -155,14 +147,12 @@ public String getDescription() { return description; } - public void setDescription(String description) { this.description = description; } public MessageDeliveredCallback message(MessageDeliveredCallbackMessage message) { - this.message = message; return this; } @@ -176,7 +166,6 @@ public MessageDeliveredCallbackMessage getMessage() { return message; } - public void setMessage(MessageDeliveredCallbackMessage message) { this.message = message; } @@ -357,7 +346,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallbackMessage.java b/src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallbackMessage.java index 144c4c0e..eda66577 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallbackMessage.java +++ b/src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallbackMessage.java @@ -50,7 +50,6 @@ 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; @@ -112,7 +111,6 @@ public MessageDeliveredCallbackMessage() { } public MessageDeliveredCallbackMessage id(String id) { - this.id = id; return this; } @@ -126,14 +124,12 @@ public String getId() { return id; } - public void setId(String id) { this.id = id; } public MessageDeliveredCallbackMessage owner(String owner) { - this.owner = owner; return this; } @@ -147,14 +143,12 @@ public String getOwner() { return owner; } - public void setOwner(String owner) { this.owner = owner; } public MessageDeliveredCallbackMessage applicationId(String applicationId) { - this.applicationId = applicationId; return this; } @@ -168,14 +162,12 @@ public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public MessageDeliveredCallbackMessage time(OffsetDateTime time) { - this.time = time; return this; } @@ -189,14 +181,12 @@ public OffsetDateTime getTime() { return time; } - public void setTime(OffsetDateTime time) { this.time = time; } public MessageDeliveredCallbackMessage segmentCount(Integer segmentCount) { - this.segmentCount = segmentCount; return this; } @@ -210,14 +200,12 @@ public Integer getSegmentCount() { return segmentCount; } - public void setSegmentCount(Integer segmentCount) { this.segmentCount = segmentCount; } public MessageDeliveredCallbackMessage direction(MessageDirectionEnum direction) { - this.direction = direction; return this; } @@ -231,14 +219,12 @@ public MessageDirectionEnum getDirection() { return direction; } - public void setDirection(MessageDirectionEnum direction) { this.direction = direction; } public MessageDeliveredCallbackMessage to(Set to) { - this.to = to; return this; } @@ -260,14 +246,12 @@ public Set getTo() { return to; } - public void setTo(Set to) { this.to = to; } public MessageDeliveredCallbackMessage from(String from) { - this.from = from; return this; } @@ -281,14 +265,12 @@ public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public MessageDeliveredCallbackMessage text(String text) { - this.text = text; return this; } @@ -302,14 +284,12 @@ public String getText() { return text; } - public void setText(String text) { this.text = text; } public MessageDeliveredCallbackMessage tag(String tag) { - this.tag = tag; return this; } @@ -323,14 +303,12 @@ public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public MessageDeliveredCallbackMessage media(List media) { - this.media = media; return this; } @@ -352,14 +330,12 @@ public List getMedia() { return media; } - public void setMedia(List media) { this.media = media; } public MessageDeliveredCallbackMessage priority(PriorityEnum priority) { - this.priority = priority; return this; } @@ -373,7 +349,6 @@ public PriorityEnum getPriority() { return priority; } - public void setPriority(PriorityEnum priority) { this.priority = priority; } @@ -548,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`"); @@ -567,6 +544,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 +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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/MessageDirectionEnum.java b/src/main/java/com/bandwidth/sdk/model/MessageDirectionEnum.java index 16e61c8a..467f82e6 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..44358a45 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessageFailedCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/MessageFailedCallback.java @@ -44,7 +44,6 @@ 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; @@ -82,7 +81,6 @@ public MessageFailedCallback() { } public MessageFailedCallback time(OffsetDateTime time) { - this.time = time; return this; } @@ -96,14 +94,12 @@ public OffsetDateTime getTime() { return time; } - public void setTime(OffsetDateTime time) { this.time = time; } public MessageFailedCallback type(String type) { - this.type = type; return this; } @@ -117,14 +113,12 @@ public String getType() { return type; } - public void setType(String type) { this.type = type; } public MessageFailedCallback to(String to) { - this.to = to; return this; } @@ -138,14 +132,12 @@ public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public MessageFailedCallback description(String description) { - this.description = description; return this; } @@ -159,14 +151,12 @@ public String getDescription() { return description; } - public void setDescription(String description) { this.description = description; } public MessageFailedCallback message(MessageFailedCallbackMessage message) { - this.message = message; return this; } @@ -180,14 +170,12 @@ public MessageFailedCallbackMessage getMessage() { return message; } - public void setMessage(MessageFailedCallbackMessage message) { this.message = message; } public MessageFailedCallback errorCode(Integer errorCode) { - this.errorCode = errorCode; return this; } @@ -201,7 +189,6 @@ public Integer getErrorCode() { return errorCode; } - public void setErrorCode(Integer errorCode) { this.errorCode = errorCode; } @@ -386,7 +373,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/MessageFailedCallbackMessage.java b/src/main/java/com/bandwidth/sdk/model/MessageFailedCallbackMessage.java index 6d65d19f..a1bf8a14 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessageFailedCallbackMessage.java +++ b/src/main/java/com/bandwidth/sdk/model/MessageFailedCallbackMessage.java @@ -50,7 +50,6 @@ 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; @@ -112,7 +111,6 @@ public MessageFailedCallbackMessage() { } public MessageFailedCallbackMessage id(String id) { - this.id = id; return this; } @@ -126,14 +124,12 @@ public String getId() { return id; } - public void setId(String id) { this.id = id; } public MessageFailedCallbackMessage owner(String owner) { - this.owner = owner; return this; } @@ -147,14 +143,12 @@ public String getOwner() { return owner; } - public void setOwner(String owner) { this.owner = owner; } public MessageFailedCallbackMessage applicationId(String applicationId) { - this.applicationId = applicationId; return this; } @@ -168,14 +162,12 @@ public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public MessageFailedCallbackMessage time(OffsetDateTime time) { - this.time = time; return this; } @@ -189,14 +181,12 @@ public OffsetDateTime getTime() { return time; } - public void setTime(OffsetDateTime time) { this.time = time; } public MessageFailedCallbackMessage segmentCount(Integer segmentCount) { - this.segmentCount = segmentCount; return this; } @@ -210,14 +200,12 @@ public Integer getSegmentCount() { return segmentCount; } - public void setSegmentCount(Integer segmentCount) { this.segmentCount = segmentCount; } public MessageFailedCallbackMessage direction(MessageDirectionEnum direction) { - this.direction = direction; return this; } @@ -231,14 +219,12 @@ public MessageDirectionEnum getDirection() { return direction; } - public void setDirection(MessageDirectionEnum direction) { this.direction = direction; } public MessageFailedCallbackMessage to(Set to) { - this.to = to; return this; } @@ -260,14 +246,12 @@ public Set getTo() { return to; } - public void setTo(Set to) { this.to = to; } public MessageFailedCallbackMessage from(String from) { - this.from = from; return this; } @@ -281,14 +265,12 @@ public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public MessageFailedCallbackMessage text(String text) { - this.text = text; return this; } @@ -302,14 +284,12 @@ public String getText() { return text; } - public void setText(String text) { this.text = text; } public MessageFailedCallbackMessage tag(String tag) { - this.tag = tag; return this; } @@ -323,14 +303,12 @@ public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public MessageFailedCallbackMessage media(List media) { - this.media = media; return this; } @@ -352,14 +330,12 @@ public List getMedia() { return media; } - public void setMedia(List media) { this.media = media; } public MessageFailedCallbackMessage priority(PriorityEnum priority) { - this.priority = priority; return this; } @@ -373,7 +349,6 @@ public PriorityEnum getPriority() { return priority; } - public void setPriority(PriorityEnum priority) { this.priority = priority; } @@ -549,6 +524,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 +545,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 +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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/MessageRequest.java b/src/main/java/com/bandwidth/sdk/model/MessageRequest.java index 8ae0dad4..4be77b2f 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessageRequest.java +++ b/src/main/java/com/bandwidth/sdk/model/MessageRequest.java @@ -49,7 +49,6 @@ 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; @@ -95,7 +94,6 @@ public MessageRequest() { } public MessageRequest applicationId(String applicationId) { - this.applicationId = applicationId; return this; } @@ -109,14 +107,12 @@ public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public MessageRequest to(Set to) { - this.to = to; return this; } @@ -138,14 +134,12 @@ public Set getTo() { return to; } - public void setTo(Set to) { this.to = to; } public MessageRequest from(String from) { - this.from = from; return this; } @@ -159,14 +153,12 @@ public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public MessageRequest text(String text) { - this.text = text; return this; } @@ -180,14 +172,12 @@ public String getText() { return text; } - public void setText(String text) { this.text = text; } public MessageRequest media(List media) { - this.media = media; return this; } @@ -209,14 +199,12 @@ public List getMedia() { return media; } - public void setMedia(List media) { this.media = media; } public MessageRequest tag(String tag) { - this.tag = tag; return this; } @@ -230,14 +218,12 @@ public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public MessageRequest priority(PriorityEnum priority) { - this.priority = priority; return this; } @@ -251,14 +237,12 @@ public PriorityEnum getPriority() { return priority; } - public void setPriority(PriorityEnum priority) { this.priority = priority; } public MessageRequest expiration(OffsetDateTime expiration) { - this.expiration = expiration; return this; } @@ -272,7 +256,6 @@ public OffsetDateTime getExpiration() { return expiration; } - public void setExpiration(OffsetDateTime expiration) { this.expiration = expiration; } @@ -441,6 +424,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 +458,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/MessageSendingCallback.java b/src/main/java/com/bandwidth/sdk/model/MessageSendingCallback.java index 4be4d232..1bc60314 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessageSendingCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/MessageSendingCallback.java @@ -44,7 +44,6 @@ 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; @@ -78,7 +77,6 @@ public MessageSendingCallback() { } public MessageSendingCallback time(OffsetDateTime time) { - this.time = time; return this; } @@ -92,14 +90,12 @@ public OffsetDateTime getTime() { return time; } - public void setTime(OffsetDateTime time) { this.time = time; } public MessageSendingCallback type(String type) { - this.type = type; return this; } @@ -113,14 +109,12 @@ public String getType() { return type; } - public void setType(String type) { this.type = type; } public MessageSendingCallback to(String to) { - this.to = to; return this; } @@ -134,14 +128,12 @@ public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public MessageSendingCallback description(String description) { - this.description = description; return this; } @@ -155,14 +147,12 @@ public String getDescription() { return description; } - public void setDescription(String description) { this.description = description; } public MessageSendingCallback message(MessageSendingCallbackMessage message) { - this.message = message; return this; } @@ -176,7 +166,6 @@ public MessageSendingCallbackMessage getMessage() { return message; } - public void setMessage(MessageSendingCallbackMessage message) { this.message = message; } @@ -357,7 +346,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/MessageSendingCallbackMessage.java b/src/main/java/com/bandwidth/sdk/model/MessageSendingCallbackMessage.java index 1bced475..bc98b2d8 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessageSendingCallbackMessage.java +++ b/src/main/java/com/bandwidth/sdk/model/MessageSendingCallbackMessage.java @@ -50,7 +50,6 @@ 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; @@ -112,7 +111,6 @@ public MessageSendingCallbackMessage() { } public MessageSendingCallbackMessage id(String id) { - this.id = id; return this; } @@ -126,14 +124,12 @@ public String getId() { return id; } - public void setId(String id) { this.id = id; } public MessageSendingCallbackMessage owner(String owner) { - this.owner = owner; return this; } @@ -147,14 +143,12 @@ public String getOwner() { return owner; } - public void setOwner(String owner) { this.owner = owner; } public MessageSendingCallbackMessage applicationId(String applicationId) { - this.applicationId = applicationId; return this; } @@ -168,14 +162,12 @@ public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public MessageSendingCallbackMessage time(OffsetDateTime time) { - this.time = time; return this; } @@ -189,14 +181,12 @@ public OffsetDateTime getTime() { return time; } - public void setTime(OffsetDateTime time) { this.time = time; } public MessageSendingCallbackMessage segmentCount(Integer segmentCount) { - this.segmentCount = segmentCount; return this; } @@ -210,14 +200,12 @@ public Integer getSegmentCount() { return segmentCount; } - public void setSegmentCount(Integer segmentCount) { this.segmentCount = segmentCount; } public MessageSendingCallbackMessage direction(MessageDirectionEnum direction) { - this.direction = direction; return this; } @@ -231,14 +219,12 @@ public MessageDirectionEnum getDirection() { return direction; } - public void setDirection(MessageDirectionEnum direction) { this.direction = direction; } public MessageSendingCallbackMessage to(Set to) { - this.to = to; return this; } @@ -260,14 +246,12 @@ public Set getTo() { return to; } - public void setTo(Set to) { this.to = to; } public MessageSendingCallbackMessage from(String from) { - this.from = from; return this; } @@ -281,14 +265,12 @@ public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public MessageSendingCallbackMessage text(String text) { - this.text = text; return this; } @@ -302,14 +284,12 @@ public String getText() { return text; } - public void setText(String text) { this.text = text; } public MessageSendingCallbackMessage tag(String tag) { - this.tag = tag; return this; } @@ -323,14 +303,12 @@ public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public MessageSendingCallbackMessage media(List media) { - this.media = media; return this; } @@ -352,14 +330,12 @@ public List getMedia() { return media; } - public void setMedia(List media) { this.media = media; } public MessageSendingCallbackMessage priority(PriorityEnum priority) { - this.priority = priority; return this; } @@ -373,7 +349,6 @@ public PriorityEnum getPriority() { return priority; } - public void setPriority(PriorityEnum priority) { this.priority = priority; } @@ -549,6 +524,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 +547,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 +579,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/MessageStatusEnum.java b/src/main/java/com/bandwidth/sdk/model/MessageStatusEnum.java index c21f19c4..b91559c4 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 268f4c42..1c630edb 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..62ce1bae 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessagesList.java +++ b/src/main/java/com/bandwidth/sdk/model/MessagesList.java @@ -46,7 +46,6 @@ 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; @@ -72,7 +71,6 @@ public MessagesList() { } public MessagesList totalCount(Integer totalCount) { - this.totalCount = totalCount; return this; } @@ -86,14 +84,12 @@ public Integer getTotalCount() { return totalCount; } - public void setTotalCount(Integer totalCount) { this.totalCount = totalCount; } public MessagesList pageInfo(PageInfo pageInfo) { - this.pageInfo = pageInfo; return this; } @@ -107,14 +103,12 @@ public PageInfo getPageInfo() { return pageInfo; } - public void setPageInfo(PageInfo pageInfo) { this.pageInfo = pageInfo; } public MessagesList messages(List messages) { - this.messages = messages; return this; } @@ -136,7 +130,6 @@ public List getMessages() { return messages; } - public void setMessages(List messages) { this.messages = messages; } @@ -306,7 +299,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/MessagingCodeResponse.java b/src/main/java/com/bandwidth/sdk/model/MessagingCodeResponse.java index fb5f2e3d..f4964937 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessagingCodeResponse.java +++ b/src/main/java/com/bandwidth/sdk/model/MessagingCodeResponse.java @@ -42,7 +42,6 @@ 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; @@ -60,7 +59,6 @@ public MessagingCodeResponse() { } public MessagingCodeResponse messageId(String messageId) { - this.messageId = messageId; return this; } @@ -74,7 +72,6 @@ public String getMessageId() { return messageId; } - public void setMessageId(String messageId) { this.messageId = messageId; } @@ -223,7 +220,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/MessagingRequestError.java b/src/main/java/com/bandwidth/sdk/model/MessagingRequestError.java index a0f4af11..3a2b4b72 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessagingRequestError.java +++ b/src/main/java/com/bandwidth/sdk/model/MessagingRequestError.java @@ -42,7 +42,6 @@ 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; @@ -64,7 +63,6 @@ public MessagingRequestError() { } public MessagingRequestError type(String type) { - this.type = type; return this; } @@ -78,14 +76,12 @@ public String getType() { return type; } - public void setType(String type) { this.type = type; } public MessagingRequestError description(String description) { - this.description = description; return this; } @@ -99,7 +95,6 @@ public String getDescription() { return description; } - public void setDescription(String description) { this.description = description; } @@ -263,7 +258,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/MfaForbiddenRequestError.java b/src/main/java/com/bandwidth/sdk/model/MfaForbiddenRequestError.java index 9905efdd..1e106166 100644 --- a/src/main/java/com/bandwidth/sdk/model/MfaForbiddenRequestError.java +++ b/src/main/java/com/bandwidth/sdk/model/MfaForbiddenRequestError.java @@ -42,7 +42,6 @@ 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; @@ -60,7 +59,6 @@ public MfaForbiddenRequestError() { } public MfaForbiddenRequestError message(String message) { - this.message = message; return this; } @@ -74,7 +72,6 @@ public String getMessage() { return message; } - public void setMessage(String message) { this.message = message; } @@ -223,7 +220,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/MfaRequestError.java b/src/main/java/com/bandwidth/sdk/model/MfaRequestError.java index 84b45f8a..c2d56a44 100644 --- a/src/main/java/com/bandwidth/sdk/model/MfaRequestError.java +++ b/src/main/java/com/bandwidth/sdk/model/MfaRequestError.java @@ -42,7 +42,6 @@ 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; @@ -64,7 +63,6 @@ public MfaRequestError() { } public MfaRequestError error(String error) { - this.error = error; return this; } @@ -78,14 +76,12 @@ public String getError() { return error; } - public void setError(String error) { this.error = error; } public MfaRequestError requestId(String requestId) { - this.requestId = requestId; return this; } @@ -99,7 +95,6 @@ public String getRequestId() { return requestId; } - public void setRequestId(String requestId) { this.requestId = requestId; } @@ -254,7 +249,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/MfaUnauthorizedRequestError.java b/src/main/java/com/bandwidth/sdk/model/MfaUnauthorizedRequestError.java index 67320cae..61de33df 100644 --- a/src/main/java/com/bandwidth/sdk/model/MfaUnauthorizedRequestError.java +++ b/src/main/java/com/bandwidth/sdk/model/MfaUnauthorizedRequestError.java @@ -42,7 +42,6 @@ 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; @@ -60,7 +59,6 @@ public MfaUnauthorizedRequestError() { } public MfaUnauthorizedRequestError message(String message) { - this.message = message; return this; } @@ -74,7 +72,6 @@ public String getMessage() { return message; } - public void setMessage(String message) { this.message = message; } @@ -223,7 +220,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/PageInfo.java b/src/main/java/com/bandwidth/sdk/model/PageInfo.java index a1c5d8fc..717c80da 100644 --- a/src/main/java/com/bandwidth/sdk/model/PageInfo.java +++ b/src/main/java/com/bandwidth/sdk/model/PageInfo.java @@ -42,7 +42,6 @@ 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; @@ -72,7 +71,6 @@ public PageInfo() { } public PageInfo prevPage(String prevPage) { - this.prevPage = prevPage; return this; } @@ -86,14 +84,12 @@ public String getPrevPage() { return prevPage; } - public void setPrevPage(String prevPage) { this.prevPage = prevPage; } public PageInfo nextPage(String nextPage) { - this.nextPage = nextPage; return this; } @@ -107,14 +103,12 @@ public String getNextPage() { return nextPage; } - public void setNextPage(String nextPage) { this.nextPage = nextPage; } public PageInfo prevPageToken(String prevPageToken) { - this.prevPageToken = prevPageToken; return this; } @@ -128,14 +122,12 @@ public String getPrevPageToken() { return prevPageToken; } - public void setPrevPageToken(String prevPageToken) { this.prevPageToken = prevPageToken; } public PageInfo nextPageToken(String nextPageToken) { - this.nextPageToken = nextPageToken; return this; } @@ -149,7 +141,6 @@ public String getNextPageToken() { return nextPageToken; } - public void setNextPageToken(String nextPageToken) { this.nextPageToken = nextPageToken; } @@ -316,7 +307,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/PriorityEnum.java b/src/main/java/com/bandwidth/sdk/model/PriorityEnum.java index b50b8e8b..fcf7e1e5 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 3523315e..0ac0a4a8 100644 --- a/src/main/java/com/bandwidth/sdk/model/RecordingAvailableCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/RecordingAvailableCallback.java @@ -47,7 +47,6 @@ 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; @@ -149,7 +148,6 @@ public RecordingAvailableCallback() { } public RecordingAvailableCallback eventType(String eventType) { - this.eventType = eventType; return this; } @@ -163,14 +161,12 @@ public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public RecordingAvailableCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } @@ -184,14 +180,12 @@ public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public RecordingAvailableCallback accountId(String accountId) { - this.accountId = accountId; return this; } @@ -205,14 +199,12 @@ public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public RecordingAvailableCallback applicationId(String applicationId) { - this.applicationId = applicationId; return this; } @@ -226,14 +218,12 @@ public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public RecordingAvailableCallback from(String from) { - this.from = from; return this; } @@ -247,14 +237,12 @@ public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public RecordingAvailableCallback to(String to) { - this.to = to; return this; } @@ -268,14 +256,12 @@ public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public RecordingAvailableCallback direction(CallDirectionEnum direction) { - this.direction = direction; return this; } @@ -289,14 +275,12 @@ public CallDirectionEnum getDirection() { return direction; } - public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public RecordingAvailableCallback callId(String callId) { - this.callId = callId; return this; } @@ -310,14 +294,12 @@ public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public RecordingAvailableCallback callUrl(String callUrl) { - this.callUrl = callUrl; return this; } @@ -331,14 +313,12 @@ public String getCallUrl() { return callUrl; } - public void setCallUrl(String callUrl) { this.callUrl = callUrl; } public RecordingAvailableCallback parentCallId(String parentCallId) { - this.parentCallId = parentCallId; return this; } @@ -352,14 +332,12 @@ public String getParentCallId() { return parentCallId; } - public void setParentCallId(String parentCallId) { this.parentCallId = parentCallId; } public RecordingAvailableCallback recordingId(String recordingId) { - this.recordingId = recordingId; return this; } @@ -373,14 +351,12 @@ public String getRecordingId() { return recordingId; } - public void setRecordingId(String recordingId) { this.recordingId = recordingId; } public RecordingAvailableCallback mediaUrl(URI mediaUrl) { - this.mediaUrl = mediaUrl; return this; } @@ -394,14 +370,12 @@ public URI getMediaUrl() { return mediaUrl; } - public void setMediaUrl(URI mediaUrl) { this.mediaUrl = mediaUrl; } public RecordingAvailableCallback enqueuedTime(OffsetDateTime enqueuedTime) { - this.enqueuedTime = enqueuedTime; return this; } @@ -415,14 +389,12 @@ public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } - public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public RecordingAvailableCallback startTime(OffsetDateTime startTime) { - this.startTime = startTime; return this; } @@ -436,14 +408,12 @@ public OffsetDateTime getStartTime() { return startTime; } - public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public RecordingAvailableCallback endTime(OffsetDateTime endTime) { - this.endTime = endTime; return this; } @@ -457,14 +427,12 @@ public OffsetDateTime getEndTime() { return endTime; } - public void setEndTime(OffsetDateTime endTime) { this.endTime = endTime; } public RecordingAvailableCallback duration(String duration) { - this.duration = duration; return this; } @@ -478,14 +446,12 @@ public String getDuration() { return duration; } - public void setDuration(String duration) { this.duration = duration; } public RecordingAvailableCallback fileFormat(FileFormatEnum fileFormat) { - this.fileFormat = fileFormat; return this; } @@ -499,14 +465,12 @@ public FileFormatEnum getFileFormat() { return fileFormat; } - public void setFileFormat(FileFormatEnum fileFormat) { this.fileFormat = fileFormat; } public RecordingAvailableCallback channels(String channels) { - this.channels = channels; return this; } @@ -520,14 +484,12 @@ public String getChannels() { return channels; } - public void setChannels(String channels) { this.channels = channels; } public RecordingAvailableCallback tag(String tag) { - this.tag = tag; return this; } @@ -541,14 +503,12 @@ public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public RecordingAvailableCallback status(String status) { - this.status = status; return this; } @@ -562,14 +522,12 @@ public String getStatus() { return status; } - public void setStatus(String status) { this.status = status; } public RecordingAvailableCallback transferCallerId(String transferCallerId) { - this.transferCallerId = transferCallerId; return this; } @@ -583,14 +541,12 @@ public String getTransferCallerId() { return transferCallerId; } - public void setTransferCallerId(String transferCallerId) { this.transferCallerId = transferCallerId; } public RecordingAvailableCallback transferTo(String transferTo) { - this.transferTo = transferTo; return this; } @@ -604,7 +560,6 @@ public String getTransferTo() { return transferTo; } - public void setTransferTo(String transferTo) { this.transferTo = transferTo; } @@ -809,6 +764,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 +786,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("channels") != null && !jsonObj.get("channels").isJsonNull()) && !jsonObj.get("channels").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `channels` to be a primitive type in the JSON string but got `%s`", jsonObj.get("channels").toString())); } @@ -872,7 +835,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/RecordingCompleteCallback.java b/src/main/java/com/bandwidth/sdk/model/RecordingCompleteCallback.java index 02e92e37..4325aaf1 100644 --- a/src/main/java/com/bandwidth/sdk/model/RecordingCompleteCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/RecordingCompleteCallback.java @@ -47,7 +47,6 @@ 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; @@ -149,7 +148,6 @@ public RecordingCompleteCallback() { } public RecordingCompleteCallback eventType(String eventType) { - this.eventType = eventType; return this; } @@ -163,14 +161,12 @@ public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public RecordingCompleteCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } @@ -184,14 +180,12 @@ public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public RecordingCompleteCallback accountId(String accountId) { - this.accountId = accountId; return this; } @@ -205,14 +199,12 @@ public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public RecordingCompleteCallback applicationId(String applicationId) { - this.applicationId = applicationId; return this; } @@ -226,14 +218,12 @@ public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public RecordingCompleteCallback from(String from) { - this.from = from; return this; } @@ -247,14 +237,12 @@ public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public RecordingCompleteCallback to(String to) { - this.to = to; return this; } @@ -268,14 +256,12 @@ public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public RecordingCompleteCallback direction(CallDirectionEnum direction) { - this.direction = direction; return this; } @@ -289,14 +275,12 @@ public CallDirectionEnum getDirection() { return direction; } - public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public RecordingCompleteCallback callId(String callId) { - this.callId = callId; return this; } @@ -310,14 +294,12 @@ public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public RecordingCompleteCallback callUrl(String callUrl) { - this.callUrl = callUrl; return this; } @@ -331,14 +313,12 @@ public String getCallUrl() { return callUrl; } - public void setCallUrl(String callUrl) { this.callUrl = callUrl; } public RecordingCompleteCallback parentCallId(String parentCallId) { - this.parentCallId = parentCallId; return this; } @@ -352,14 +332,12 @@ public String getParentCallId() { return parentCallId; } - public void setParentCallId(String parentCallId) { this.parentCallId = parentCallId; } public RecordingCompleteCallback recordingId(String recordingId) { - this.recordingId = recordingId; return this; } @@ -373,14 +351,12 @@ public String getRecordingId() { return recordingId; } - public void setRecordingId(String recordingId) { this.recordingId = recordingId; } public RecordingCompleteCallback mediaUrl(URI mediaUrl) { - this.mediaUrl = mediaUrl; return this; } @@ -394,14 +370,12 @@ public URI getMediaUrl() { return mediaUrl; } - public void setMediaUrl(URI mediaUrl) { this.mediaUrl = mediaUrl; } public RecordingCompleteCallback enqueuedTime(OffsetDateTime enqueuedTime) { - this.enqueuedTime = enqueuedTime; return this; } @@ -415,14 +389,12 @@ public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } - public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public RecordingCompleteCallback startTime(OffsetDateTime startTime) { - this.startTime = startTime; return this; } @@ -436,14 +408,12 @@ public OffsetDateTime getStartTime() { return startTime; } - public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public RecordingCompleteCallback answerTime(OffsetDateTime answerTime) { - this.answerTime = answerTime; return this; } @@ -457,14 +427,12 @@ public OffsetDateTime getAnswerTime() { return answerTime; } - public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public RecordingCompleteCallback endTime(OffsetDateTime endTime) { - this.endTime = endTime; return this; } @@ -478,14 +446,12 @@ public OffsetDateTime getEndTime() { return endTime; } - public void setEndTime(OffsetDateTime endTime) { this.endTime = endTime; } public RecordingCompleteCallback duration(String duration) { - this.duration = duration; return this; } @@ -499,14 +465,12 @@ public String getDuration() { return duration; } - public void setDuration(String duration) { this.duration = duration; } public RecordingCompleteCallback fileFormat(FileFormatEnum fileFormat) { - this.fileFormat = fileFormat; return this; } @@ -520,14 +484,12 @@ public FileFormatEnum getFileFormat() { return fileFormat; } - public void setFileFormat(FileFormatEnum fileFormat) { this.fileFormat = fileFormat; } public RecordingCompleteCallback channels(Integer channels) { - this.channels = channels; return this; } @@ -541,14 +503,12 @@ public Integer getChannels() { return channels; } - public void setChannels(Integer channels) { this.channels = channels; } public RecordingCompleteCallback tag(String tag) { - this.tag = tag; return this; } @@ -562,14 +522,12 @@ public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public RecordingCompleteCallback transferCallerId(String transferCallerId) { - this.transferCallerId = transferCallerId; return this; } @@ -583,14 +541,12 @@ public String getTransferCallerId() { return transferCallerId; } - public void setTransferCallerId(String transferCallerId) { this.transferCallerId = transferCallerId; } public RecordingCompleteCallback transferTo(String transferTo) { - this.transferTo = transferTo; return this; } @@ -604,7 +560,6 @@ public String getTransferTo() { return transferTo; } - public void setTransferTo(String transferTo) { this.transferTo = transferTo; } @@ -809,6 +764,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 +786,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 +829,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/RecordingStateEnum.java b/src/main/java/com/bandwidth/sdk/model/RecordingStateEnum.java index ef78e6d6..2a9d633d 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/RedirectCallback.java b/src/main/java/com/bandwidth/sdk/model/RedirectCallback.java index 1cb5b0e2..dab359ac 100644 --- a/src/main/java/com/bandwidth/sdk/model/RedirectCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/RedirectCallback.java @@ -45,7 +45,6 @@ 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; @@ -123,7 +122,6 @@ public RedirectCallback() { } public RedirectCallback eventType(String eventType) { - this.eventType = eventType; return this; } @@ -137,14 +135,12 @@ public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public RedirectCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } @@ -158,14 +154,12 @@ public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public RedirectCallback accountId(String accountId) { - this.accountId = accountId; return this; } @@ -179,14 +173,12 @@ public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public RedirectCallback applicationId(String applicationId) { - this.applicationId = applicationId; return this; } @@ -200,14 +192,12 @@ public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public RedirectCallback from(String from) { - this.from = from; return this; } @@ -221,14 +211,12 @@ public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public RedirectCallback to(String to) { - this.to = to; return this; } @@ -242,14 +230,12 @@ public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public RedirectCallback direction(CallDirectionEnum direction) { - this.direction = direction; return this; } @@ -263,14 +249,12 @@ public CallDirectionEnum getDirection() { return direction; } - public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public RedirectCallback callId(String callId) { - this.callId = callId; return this; } @@ -284,14 +268,12 @@ public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public RedirectCallback callUrl(String callUrl) { - this.callUrl = callUrl; return this; } @@ -305,14 +287,12 @@ public String getCallUrl() { return callUrl; } - public void setCallUrl(String callUrl) { this.callUrl = callUrl; } public RedirectCallback parentCallId(String parentCallId) { - this.parentCallId = parentCallId; return this; } @@ -326,14 +306,12 @@ public String getParentCallId() { return parentCallId; } - public void setParentCallId(String parentCallId) { this.parentCallId = parentCallId; } public RedirectCallback enqueuedTime(OffsetDateTime enqueuedTime) { - this.enqueuedTime = enqueuedTime; return this; } @@ -347,14 +325,12 @@ public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } - public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public RedirectCallback startTime(OffsetDateTime startTime) { - this.startTime = startTime; return this; } @@ -368,14 +344,12 @@ public OffsetDateTime getStartTime() { return startTime; } - public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public RedirectCallback answerTime(OffsetDateTime answerTime) { - this.answerTime = answerTime; return this; } @@ -389,14 +363,12 @@ public OffsetDateTime getAnswerTime() { return answerTime; } - public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public RedirectCallback tag(String tag) { - this.tag = tag; return this; } @@ -410,14 +382,12 @@ public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public RedirectCallback transferCallerId(String transferCallerId) { - this.transferCallerId = transferCallerId; return this; } @@ -431,14 +401,12 @@ public String getTransferCallerId() { return transferCallerId; } - public void setTransferCallerId(String transferCallerId) { this.transferCallerId = transferCallerId; } public RedirectCallback transferTo(String transferTo) { - this.transferTo = transferTo; return this; } @@ -452,7 +420,6 @@ public String getTransferTo() { return transferTo; } - public void setTransferTo(String transferTo) { this.transferTo = transferTo; } @@ -639,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())); } @@ -687,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/RedirectMethodEnum.java b/src/main/java/com/bandwidth/sdk/model/RedirectMethodEnum.java index 2a524bc8..0f4b944c 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/StirShaken.java b/src/main/java/com/bandwidth/sdk/model/StirShaken.java index 37f2ed35..1b0e0ecc 100644 --- a/src/main/java/com/bandwidth/sdk/model/StirShaken.java +++ b/src/main/java/com/bandwidth/sdk/model/StirShaken.java @@ -42,7 +42,6 @@ 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; @@ -68,7 +67,6 @@ public StirShaken() { } public StirShaken verstat(String verstat) { - this.verstat = verstat; return this; } @@ -82,14 +80,12 @@ public String getVerstat() { return verstat; } - public void setVerstat(String verstat) { this.verstat = verstat; } public StirShaken attestationIndicator(String attestationIndicator) { - this.attestationIndicator = attestationIndicator; return this; } @@ -103,14 +99,12 @@ public String getAttestationIndicator() { return attestationIndicator; } - public void setAttestationIndicator(String attestationIndicator) { this.attestationIndicator = attestationIndicator; } public StirShaken originatingId(String originatingId) { - this.originatingId = originatingId; return this; } @@ -124,7 +118,6 @@ public String getOriginatingId() { return originatingId; } - public void setOriginatingId(String originatingId) { this.originatingId = originatingId; } @@ -285,7 +278,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/Tag.java b/src/main/java/com/bandwidth/sdk/model/Tag.java index 6964e4d8..6dc61cde 100644 --- a/src/main/java/com/bandwidth/sdk/model/Tag.java +++ b/src/main/java/com/bandwidth/sdk/model/Tag.java @@ -42,7 +42,6 @@ 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; @@ -64,7 +63,6 @@ public Tag() { } public Tag key(String key) { - this.key = key; return this; } @@ -78,14 +76,12 @@ public String getKey() { return key; } - public void setKey(String key) { this.key = key; } public Tag value(String value) { - this.value = value; return this; } @@ -99,7 +95,6 @@ public String getValue() { return value; } - public void setValue(String value) { this.value = value; } @@ -254,7 +249,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/TnLookupRequestError.java b/src/main/java/com/bandwidth/sdk/model/TnLookupRequestError.java index 1cfa0ab4..948becc4 100644 --- a/src/main/java/com/bandwidth/sdk/model/TnLookupRequestError.java +++ b/src/main/java/com/bandwidth/sdk/model/TnLookupRequestError.java @@ -42,7 +42,6 @@ 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; @@ -60,7 +59,6 @@ public TnLookupRequestError() { } public TnLookupRequestError message(String message) { - this.message = message; return this; } @@ -74,7 +72,6 @@ public String getMessage() { return message; } - public void setMessage(String message) { this.message = message; } @@ -223,7 +220,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/TranscribeRecording.java b/src/main/java/com/bandwidth/sdk/model/TranscribeRecording.java index f5680890..7a95598e 100644 --- a/src/main/java/com/bandwidth/sdk/model/TranscribeRecording.java +++ b/src/main/java/com/bandwidth/sdk/model/TranscribeRecording.java @@ -45,7 +45,6 @@ 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; @@ -87,7 +86,6 @@ public TranscribeRecording() { } public TranscribeRecording callbackUrl(URI callbackUrl) { - this.callbackUrl = callbackUrl; return this; } @@ -101,14 +99,12 @@ public URI getCallbackUrl() { return callbackUrl; } - public void setCallbackUrl(URI callbackUrl) { this.callbackUrl = callbackUrl; } public TranscribeRecording callbackMethod(CallbackMethodEnum callbackMethod) { - this.callbackMethod = callbackMethod; return this; } @@ -122,14 +118,12 @@ public CallbackMethodEnum getCallbackMethod() { return callbackMethod; } - public void setCallbackMethod(CallbackMethodEnum callbackMethod) { this.callbackMethod = callbackMethod; } public TranscribeRecording username(String username) { - this.username = username; return this; } @@ -143,14 +137,12 @@ public String getUsername() { return username; } - public void setUsername(String username) { this.username = username; } public TranscribeRecording password(String password) { - this.password = password; return this; } @@ -164,14 +156,12 @@ public String getPassword() { return password; } - public void setPassword(String password) { this.password = password; } public TranscribeRecording tag(String tag) { - this.tag = tag; return this; } @@ -185,14 +175,12 @@ public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public TranscribeRecording callbackTimeout(Double callbackTimeout) { - this.callbackTimeout = callbackTimeout; return this; } @@ -208,14 +196,12 @@ public Double getCallbackTimeout() { return callbackTimeout; } - public void setCallbackTimeout(Double callbackTimeout) { this.callbackTimeout = callbackTimeout; } public TranscribeRecording detectLanguage(Boolean detectLanguage) { - this.detectLanguage = detectLanguage; return this; } @@ -229,7 +215,6 @@ public Boolean getDetectLanguage() { return detectLanguage; } - public void setDetectLanguage(Boolean detectLanguage) { this.detectLanguage = detectLanguage; } @@ -377,6 +362,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 +405,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/Transcription.java b/src/main/java/com/bandwidth/sdk/model/Transcription.java index dc3f1c32..1a8e531e 100644 --- a/src/main/java/com/bandwidth/sdk/model/Transcription.java +++ b/src/main/java/com/bandwidth/sdk/model/Transcription.java @@ -42,7 +42,6 @@ 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; @@ -64,7 +63,6 @@ public Transcription() { } public Transcription text(String text) { - this.text = text; return this; } @@ -78,14 +76,12 @@ public String getText() { return text; } - public void setText(String text) { this.text = text; } public Transcription confidence(Double confidence) { - this.confidence = confidence; return this; } @@ -99,7 +95,6 @@ public Double getConfidence() { return confidence; } - public void setConfidence(Double confidence) { this.confidence = confidence; } @@ -251,7 +246,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/TranscriptionAvailableCallback.java b/src/main/java/com/bandwidth/sdk/model/TranscriptionAvailableCallback.java index 9b40b70f..446e4ea6 100644 --- a/src/main/java/com/bandwidth/sdk/model/TranscriptionAvailableCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/TranscriptionAvailableCallback.java @@ -48,7 +48,6 @@ 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; @@ -146,7 +145,6 @@ public TranscriptionAvailableCallback() { } public TranscriptionAvailableCallback eventType(String eventType) { - this.eventType = eventType; return this; } @@ -160,14 +158,12 @@ public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public TranscriptionAvailableCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } @@ -181,14 +177,12 @@ public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public TranscriptionAvailableCallback accountId(String accountId) { - this.accountId = accountId; return this; } @@ -202,14 +196,12 @@ public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public TranscriptionAvailableCallback applicationId(String applicationId) { - this.applicationId = applicationId; return this; } @@ -223,14 +215,12 @@ public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public TranscriptionAvailableCallback from(String from) { - this.from = from; return this; } @@ -244,14 +234,12 @@ public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public TranscriptionAvailableCallback to(String to) { - this.to = to; return this; } @@ -265,14 +253,12 @@ public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public TranscriptionAvailableCallback direction(CallDirectionEnum direction) { - this.direction = direction; return this; } @@ -286,14 +272,12 @@ public CallDirectionEnum getDirection() { return direction; } - public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public TranscriptionAvailableCallback callId(String callId) { - this.callId = callId; return this; } @@ -307,14 +291,12 @@ public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public TranscriptionAvailableCallback callUrl(String callUrl) { - this.callUrl = callUrl; return this; } @@ -328,14 +310,12 @@ public String getCallUrl() { return callUrl; } - public void setCallUrl(String callUrl) { this.callUrl = callUrl; } public TranscriptionAvailableCallback mediaUrl(URI mediaUrl) { - this.mediaUrl = mediaUrl; return this; } @@ -349,14 +329,12 @@ public URI getMediaUrl() { return mediaUrl; } - public void setMediaUrl(URI mediaUrl) { this.mediaUrl = mediaUrl; } public TranscriptionAvailableCallback parentCallId(String parentCallId) { - this.parentCallId = parentCallId; return this; } @@ -370,14 +348,12 @@ public String getParentCallId() { return parentCallId; } - public void setParentCallId(String parentCallId) { this.parentCallId = parentCallId; } public TranscriptionAvailableCallback recordingId(String recordingId) { - this.recordingId = recordingId; return this; } @@ -391,14 +367,12 @@ public String getRecordingId() { return recordingId; } - public void setRecordingId(String recordingId) { this.recordingId = recordingId; } public TranscriptionAvailableCallback enqueuedTime(OffsetDateTime enqueuedTime) { - this.enqueuedTime = enqueuedTime; return this; } @@ -412,14 +386,12 @@ public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } - public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public TranscriptionAvailableCallback startTime(OffsetDateTime startTime) { - this.startTime = startTime; return this; } @@ -433,14 +405,12 @@ public OffsetDateTime getStartTime() { return startTime; } - public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public TranscriptionAvailableCallback endTime(OffsetDateTime endTime) { - this.endTime = endTime; return this; } @@ -454,14 +424,12 @@ public OffsetDateTime getEndTime() { return endTime; } - public void setEndTime(OffsetDateTime endTime) { this.endTime = endTime; } public TranscriptionAvailableCallback duration(String duration) { - this.duration = duration; return this; } @@ -475,14 +443,12 @@ public String getDuration() { return duration; } - public void setDuration(String duration) { this.duration = duration; } public TranscriptionAvailableCallback fileFormat(FileFormatEnum fileFormat) { - this.fileFormat = fileFormat; return this; } @@ -496,14 +462,12 @@ public FileFormatEnum getFileFormat() { return fileFormat; } - public void setFileFormat(FileFormatEnum fileFormat) { this.fileFormat = fileFormat; } public TranscriptionAvailableCallback tag(String tag) { - this.tag = tag; return this; } @@ -517,14 +481,12 @@ public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public TranscriptionAvailableCallback transcription(Transcription transcription) { - this.transcription = transcription; return this; } @@ -538,14 +500,12 @@ public Transcription getTranscription() { return transcription; } - public void setTranscription(Transcription transcription) { this.transcription = transcription; } public TranscriptionAvailableCallback transferCallerId(String transferCallerId) { - this.transferCallerId = transferCallerId; return this; } @@ -559,14 +519,12 @@ public String getTransferCallerId() { return transferCallerId; } - public void setTransferCallerId(String transferCallerId) { this.transferCallerId = transferCallerId; } public TranscriptionAvailableCallback transferTo(String transferTo) { - this.transferTo = transferTo; return this; } @@ -580,7 +538,6 @@ public String getTransferTo() { return transferTo; } - public void setTransferTo(String transferTo) { this.transferTo = transferTo; } @@ -782,6 +739,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 +761,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 +808,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/TranscriptionList.java b/src/main/java/com/bandwidth/sdk/model/TranscriptionList.java index b7fedd5a..fb569dcc 100644 --- a/src/main/java/com/bandwidth/sdk/model/TranscriptionList.java +++ b/src/main/java/com/bandwidth/sdk/model/TranscriptionList.java @@ -45,7 +45,6 @@ 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; @@ -63,7 +62,6 @@ public TranscriptionList() { } public TranscriptionList transcripts(List transcripts) { - this.transcripts = transcripts; return this; } @@ -85,7 +83,6 @@ public List getTranscripts() { return transcripts; } - public void setTranscripts(List transcripts) { this.transcripts = transcripts; } @@ -245,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/TranscriptionMetadata.java b/src/main/java/com/bandwidth/sdk/model/TranscriptionMetadata.java index ede152d6..1a3ccdaa 100644 --- a/src/main/java/com/bandwidth/sdk/model/TranscriptionMetadata.java +++ b/src/main/java/com/bandwidth/sdk/model/TranscriptionMetadata.java @@ -43,7 +43,6 @@ 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; @@ -73,7 +72,6 @@ public TranscriptionMetadata() { } public TranscriptionMetadata id(String id) { - this.id = id; return this; } @@ -87,14 +85,12 @@ public String getId() { return id; } - public void setId(String id) { this.id = id; } public TranscriptionMetadata status(String status) { - this.status = status; return this; } @@ -108,14 +104,12 @@ public String getStatus() { return status; } - public void setStatus(String status) { this.status = status; } public TranscriptionMetadata completedTime(String completedTime) { - this.completedTime = completedTime; return this; } @@ -129,14 +123,12 @@ public String getCompletedTime() { return completedTime; } - public void setCompletedTime(String completedTime) { this.completedTime = completedTime; } public TranscriptionMetadata url(URI url) { - this.url = url; return this; } @@ -150,7 +142,6 @@ public URI getUrl() { return url; } - public void setUrl(URI url) { this.url = url; } @@ -317,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/TransferAnswerCallback.java b/src/main/java/com/bandwidth/sdk/model/TransferAnswerCallback.java index 9ea43ba9..32333989 100644 --- a/src/main/java/com/bandwidth/sdk/model/TransferAnswerCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/TransferAnswerCallback.java @@ -45,7 +45,6 @@ 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; @@ -119,7 +118,6 @@ public TransferAnswerCallback() { } public TransferAnswerCallback eventType(String eventType) { - this.eventType = eventType; return this; } @@ -133,14 +131,12 @@ public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public TransferAnswerCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } @@ -154,14 +150,12 @@ public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public TransferAnswerCallback accountId(String accountId) { - this.accountId = accountId; return this; } @@ -175,14 +169,12 @@ public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public TransferAnswerCallback applicationId(String applicationId) { - this.applicationId = applicationId; return this; } @@ -196,14 +188,12 @@ public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public TransferAnswerCallback from(String from) { - this.from = from; return this; } @@ -217,14 +207,12 @@ public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public TransferAnswerCallback to(String to) { - this.to = to; return this; } @@ -238,14 +226,12 @@ public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public TransferAnswerCallback direction(CallDirectionEnum direction) { - this.direction = direction; return this; } @@ -259,14 +245,12 @@ public CallDirectionEnum getDirection() { return direction; } - public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public TransferAnswerCallback callId(String callId) { - this.callId = callId; return this; } @@ -280,14 +264,12 @@ public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public TransferAnswerCallback callUrl(String callUrl) { - this.callUrl = callUrl; return this; } @@ -301,14 +283,12 @@ public String getCallUrl() { return callUrl; } - public void setCallUrl(String callUrl) { this.callUrl = callUrl; } public TransferAnswerCallback enqueuedTime(OffsetDateTime enqueuedTime) { - this.enqueuedTime = enqueuedTime; return this; } @@ -322,14 +302,12 @@ public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } - public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public TransferAnswerCallback startTime(OffsetDateTime startTime) { - this.startTime = startTime; return this; } @@ -343,14 +321,12 @@ public OffsetDateTime getStartTime() { return startTime; } - public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public TransferAnswerCallback answerTime(OffsetDateTime answerTime) { - this.answerTime = answerTime; return this; } @@ -364,14 +340,12 @@ public OffsetDateTime getAnswerTime() { return answerTime; } - public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public TransferAnswerCallback tag(String tag) { - this.tag = tag; return this; } @@ -385,14 +359,12 @@ public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public TransferAnswerCallback transferCallerId(String transferCallerId) { - this.transferCallerId = transferCallerId; return this; } @@ -406,14 +378,12 @@ public String getTransferCallerId() { return transferCallerId; } - public void setTransferCallerId(String transferCallerId) { this.transferCallerId = transferCallerId; } public TransferAnswerCallback transferTo(String transferTo) { - this.transferTo = transferTo; return this; } @@ -427,7 +397,6 @@ public String getTransferTo() { return transferTo; } - public void setTransferTo(String transferTo) { this.transferTo = transferTo; } @@ -611,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())); } @@ -656,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/TransferCompleteCallback.java b/src/main/java/com/bandwidth/sdk/model/TransferCompleteCallback.java index 7b8c772b..19d9a4b4 100644 --- a/src/main/java/com/bandwidth/sdk/model/TransferCompleteCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/TransferCompleteCallback.java @@ -45,7 +45,6 @@ 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; @@ -131,7 +130,6 @@ public TransferCompleteCallback() { } public TransferCompleteCallback eventType(String eventType) { - this.eventType = eventType; return this; } @@ -145,14 +143,12 @@ public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public TransferCompleteCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } @@ -166,14 +162,12 @@ public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public TransferCompleteCallback accountId(String accountId) { - this.accountId = accountId; return this; } @@ -187,14 +181,12 @@ public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public TransferCompleteCallback applicationId(String applicationId) { - this.applicationId = applicationId; return this; } @@ -208,14 +200,12 @@ public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public TransferCompleteCallback from(String from) { - this.from = from; return this; } @@ -229,14 +219,12 @@ public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public TransferCompleteCallback to(String to) { - this.to = to; return this; } @@ -250,14 +238,12 @@ public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public TransferCompleteCallback direction(CallDirectionEnum direction) { - this.direction = direction; return this; } @@ -271,14 +257,12 @@ public CallDirectionEnum getDirection() { return direction; } - public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public TransferCompleteCallback callId(String callId) { - this.callId = callId; return this; } @@ -292,14 +276,12 @@ public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public TransferCompleteCallback callUrl(String callUrl) { - this.callUrl = callUrl; return this; } @@ -313,14 +295,12 @@ public String getCallUrl() { return callUrl; } - public void setCallUrl(String callUrl) { this.callUrl = callUrl; } public TransferCompleteCallback enqueuedTime(OffsetDateTime enqueuedTime) { - this.enqueuedTime = enqueuedTime; return this; } @@ -334,14 +314,12 @@ public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } - public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public TransferCompleteCallback startTime(OffsetDateTime startTime) { - this.startTime = startTime; return this; } @@ -355,14 +333,12 @@ public OffsetDateTime getStartTime() { return startTime; } - public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public TransferCompleteCallback answerTime(OffsetDateTime answerTime) { - this.answerTime = answerTime; return this; } @@ -376,14 +352,12 @@ public OffsetDateTime getAnswerTime() { return answerTime; } - public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public TransferCompleteCallback tag(String tag) { - this.tag = tag; return this; } @@ -397,14 +371,12 @@ public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public TransferCompleteCallback transferCallerId(String transferCallerId) { - this.transferCallerId = transferCallerId; return this; } @@ -418,14 +390,12 @@ public String getTransferCallerId() { return transferCallerId; } - public void setTransferCallerId(String transferCallerId) { this.transferCallerId = transferCallerId; } public TransferCompleteCallback transferTo(String transferTo) { - this.transferTo = transferTo; return this; } @@ -439,14 +409,12 @@ public String getTransferTo() { return transferTo; } - public void setTransferTo(String transferTo) { this.transferTo = transferTo; } public TransferCompleteCallback cause(String cause) { - this.cause = cause; return this; } @@ -460,14 +428,12 @@ public String getCause() { return cause; } - public void setCause(String cause) { this.cause = cause; } public TransferCompleteCallback errorMessage(String errorMessage) { - this.errorMessage = errorMessage; return this; } @@ -481,14 +447,12 @@ public String getErrorMessage() { return errorMessage; } - public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; } public TransferCompleteCallback errorId(String errorId) { - this.errorId = errorId; return this; } @@ -502,7 +466,6 @@ public String getErrorId() { return errorId; } - public void setErrorId(String errorId) { this.errorId = errorId; } @@ -695,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())); } @@ -749,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/TransferDisconnectCallback.java b/src/main/java/com/bandwidth/sdk/model/TransferDisconnectCallback.java index 05ccefd5..c9e438ae 100644 --- a/src/main/java/com/bandwidth/sdk/model/TransferDisconnectCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/TransferDisconnectCallback.java @@ -45,7 +45,6 @@ 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; @@ -139,7 +138,6 @@ public TransferDisconnectCallback() { } public TransferDisconnectCallback eventType(String eventType) { - this.eventType = eventType; return this; } @@ -153,14 +151,12 @@ public String getEventType() { return eventType; } - public void setEventType(String eventType) { this.eventType = eventType; } public TransferDisconnectCallback eventTime(OffsetDateTime eventTime) { - this.eventTime = eventTime; return this; } @@ -174,14 +170,12 @@ public OffsetDateTime getEventTime() { return eventTime; } - public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public TransferDisconnectCallback accountId(String accountId) { - this.accountId = accountId; return this; } @@ -195,14 +189,12 @@ public String getAccountId() { return accountId; } - public void setAccountId(String accountId) { this.accountId = accountId; } public TransferDisconnectCallback applicationId(String applicationId) { - this.applicationId = applicationId; return this; } @@ -216,14 +208,12 @@ public String getApplicationId() { return applicationId; } - public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public TransferDisconnectCallback from(String from) { - this.from = from; return this; } @@ -237,14 +227,12 @@ public String getFrom() { return from; } - public void setFrom(String from) { this.from = from; } public TransferDisconnectCallback to(String to) { - this.to = to; return this; } @@ -258,14 +246,12 @@ public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public TransferDisconnectCallback direction(CallDirectionEnum direction) { - this.direction = direction; return this; } @@ -279,14 +265,12 @@ public CallDirectionEnum getDirection() { return direction; } - public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public TransferDisconnectCallback callId(String callId) { - this.callId = callId; return this; } @@ -300,14 +284,12 @@ public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } public TransferDisconnectCallback callUrl(String callUrl) { - this.callUrl = callUrl; return this; } @@ -321,14 +303,12 @@ public String getCallUrl() { return callUrl; } - public void setCallUrl(String callUrl) { this.callUrl = callUrl; } public TransferDisconnectCallback parentCallId(String parentCallId) { - this.parentCallId = parentCallId; return this; } @@ -342,14 +322,12 @@ public String getParentCallId() { return parentCallId; } - public void setParentCallId(String parentCallId) { this.parentCallId = parentCallId; } public TransferDisconnectCallback enqueuedTime(OffsetDateTime enqueuedTime) { - this.enqueuedTime = enqueuedTime; return this; } @@ -363,14 +341,12 @@ public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } - public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public TransferDisconnectCallback startTime(OffsetDateTime startTime) { - this.startTime = startTime; return this; } @@ -384,14 +360,12 @@ public OffsetDateTime getStartTime() { return startTime; } - public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public TransferDisconnectCallback answerTime(OffsetDateTime answerTime) { - this.answerTime = answerTime; return this; } @@ -405,14 +379,12 @@ public OffsetDateTime getAnswerTime() { return answerTime; } - public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public TransferDisconnectCallback endTime(OffsetDateTime endTime) { - this.endTime = endTime; return this; } @@ -426,14 +398,12 @@ public OffsetDateTime getEndTime() { return endTime; } - public void setEndTime(OffsetDateTime endTime) { this.endTime = endTime; } public TransferDisconnectCallback tag(String tag) { - this.tag = tag; return this; } @@ -447,14 +417,12 @@ public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } public TransferDisconnectCallback transferCallerId(String transferCallerId) { - this.transferCallerId = transferCallerId; return this; } @@ -468,14 +436,12 @@ public String getTransferCallerId() { return transferCallerId; } - public void setTransferCallerId(String transferCallerId) { this.transferCallerId = transferCallerId; } public TransferDisconnectCallback transferTo(String transferTo) { - this.transferTo = transferTo; return this; } @@ -489,14 +455,12 @@ public String getTransferTo() { return transferTo; } - public void setTransferTo(String transferTo) { this.transferTo = transferTo; } public TransferDisconnectCallback cause(String cause) { - this.cause = cause; return this; } @@ -510,14 +474,12 @@ public String getCause() { return cause; } - public void setCause(String cause) { this.cause = cause; } public TransferDisconnectCallback errorMessage(String errorMessage) { - this.errorMessage = errorMessage; return this; } @@ -531,14 +493,12 @@ public String getErrorMessage() { return errorMessage; } - public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; } public TransferDisconnectCallback errorId(String errorId) { - this.errorId = errorId; return this; } @@ -552,7 +512,6 @@ public String getErrorId() { return errorId; } - public void setErrorId(String errorId) { this.errorId = errorId; } @@ -751,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())); } @@ -808,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/UpdateCall.java b/src/main/java/com/bandwidth/sdk/model/UpdateCall.java index c367471e..afa0dfc7 100644 --- a/src/main/java/com/bandwidth/sdk/model/UpdateCall.java +++ b/src/main/java/com/bandwidth/sdk/model/UpdateCall.java @@ -46,7 +46,6 @@ 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; @@ -100,7 +99,6 @@ public UpdateCall() { } public UpdateCall state(CallStateEnum state) { - this.state = state; return this; } @@ -114,14 +112,12 @@ public CallStateEnum getState() { return state; } - public void setState(CallStateEnum state) { this.state = state; } public UpdateCall redirectUrl(URI redirectUrl) { - this.redirectUrl = redirectUrl; return this; } @@ -135,14 +131,12 @@ public URI getRedirectUrl() { return redirectUrl; } - public void setRedirectUrl(URI redirectUrl) { this.redirectUrl = redirectUrl; } public UpdateCall redirectMethod(RedirectMethodEnum redirectMethod) { - this.redirectMethod = redirectMethod; return this; } @@ -156,14 +150,12 @@ public RedirectMethodEnum getRedirectMethod() { return redirectMethod; } - public void setRedirectMethod(RedirectMethodEnum redirectMethod) { this.redirectMethod = redirectMethod; } public UpdateCall username(String username) { - this.username = username; return this; } @@ -177,14 +169,12 @@ public String getUsername() { return username; } - public void setUsername(String username) { this.username = username; } public UpdateCall password(String password) { - this.password = password; return this; } @@ -198,14 +188,12 @@ public String getPassword() { return password; } - public void setPassword(String password) { this.password = password; } public UpdateCall redirectFallbackUrl(URI redirectFallbackUrl) { - this.redirectFallbackUrl = redirectFallbackUrl; return this; } @@ -219,14 +207,12 @@ public URI getRedirectFallbackUrl() { return redirectFallbackUrl; } - public void setRedirectFallbackUrl(URI redirectFallbackUrl) { this.redirectFallbackUrl = redirectFallbackUrl; } public UpdateCall redirectFallbackMethod(RedirectMethodEnum redirectFallbackMethod) { - this.redirectFallbackMethod = redirectFallbackMethod; return this; } @@ -240,14 +226,12 @@ public RedirectMethodEnum getRedirectFallbackMethod() { return redirectFallbackMethod; } - public void setRedirectFallbackMethod(RedirectMethodEnum redirectFallbackMethod) { this.redirectFallbackMethod = redirectFallbackMethod; } public UpdateCall fallbackUsername(String fallbackUsername) { - this.fallbackUsername = fallbackUsername; return this; } @@ -261,14 +245,12 @@ public String getFallbackUsername() { return fallbackUsername; } - public void setFallbackUsername(String fallbackUsername) { this.fallbackUsername = fallbackUsername; } public UpdateCall fallbackPassword(String fallbackPassword) { - this.fallbackPassword = fallbackPassword; return this; } @@ -282,14 +264,12 @@ public String getFallbackPassword() { return fallbackPassword; } - public void setFallbackPassword(String fallbackPassword) { this.fallbackPassword = fallbackPassword; } public UpdateCall tag(String tag) { - this.tag = tag; return this; } @@ -303,7 +283,6 @@ public String getTag() { return tag; } - public void setTag(String tag) { this.tag = tag; } @@ -457,9 +436,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 +456,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 +499,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/UpdateCallRecording.java b/src/main/java/com/bandwidth/sdk/model/UpdateCallRecording.java index 90e9148f..58f982c4 100644 --- a/src/main/java/com/bandwidth/sdk/model/UpdateCallRecording.java +++ b/src/main/java/com/bandwidth/sdk/model/UpdateCallRecording.java @@ -43,7 +43,6 @@ 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; @@ -61,7 +60,6 @@ public UpdateCallRecording() { } public UpdateCallRecording state(RecordingStateEnum state) { - this.state = state; return this; } @@ -75,7 +73,6 @@ public RecordingStateEnum getState() { return state; } - public void setState(RecordingStateEnum state) { this.state = state; } @@ -199,6 +196,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 +228,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/UpdateConference.java b/src/main/java/com/bandwidth/sdk/model/UpdateConference.java index afa2ae1c..7aa26838 100644 --- a/src/main/java/com/bandwidth/sdk/model/UpdateConference.java +++ b/src/main/java/com/bandwidth/sdk/model/UpdateConference.java @@ -46,7 +46,6 @@ 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; @@ -96,7 +95,6 @@ public UpdateConference() { } public UpdateConference status(ConferenceStateEnum status) { - this.status = status; return this; } @@ -110,14 +108,12 @@ public ConferenceStateEnum getStatus() { return status; } - public void setStatus(ConferenceStateEnum status) { this.status = status; } public UpdateConference redirectUrl(URI redirectUrl) { - this.redirectUrl = redirectUrl; return this; } @@ -131,14 +127,12 @@ public URI getRedirectUrl() { return redirectUrl; } - public void setRedirectUrl(URI redirectUrl) { this.redirectUrl = redirectUrl; } public UpdateConference redirectMethod(RedirectMethodEnum redirectMethod) { - this.redirectMethod = redirectMethod; return this; } @@ -152,14 +146,12 @@ public RedirectMethodEnum getRedirectMethod() { return redirectMethod; } - public void setRedirectMethod(RedirectMethodEnum redirectMethod) { this.redirectMethod = redirectMethod; } public UpdateConference username(String username) { - this.username = username; return this; } @@ -173,14 +165,12 @@ public String getUsername() { return username; } - public void setUsername(String username) { this.username = username; } public UpdateConference password(String password) { - this.password = password; return this; } @@ -194,14 +184,12 @@ public String getPassword() { return password; } - public void setPassword(String password) { this.password = password; } public UpdateConference redirectFallbackUrl(URI redirectFallbackUrl) { - this.redirectFallbackUrl = redirectFallbackUrl; return this; } @@ -215,14 +203,12 @@ public URI getRedirectFallbackUrl() { return redirectFallbackUrl; } - public void setRedirectFallbackUrl(URI redirectFallbackUrl) { this.redirectFallbackUrl = redirectFallbackUrl; } public UpdateConference redirectFallbackMethod(RedirectMethodEnum redirectFallbackMethod) { - this.redirectFallbackMethod = redirectFallbackMethod; return this; } @@ -236,14 +222,12 @@ public RedirectMethodEnum getRedirectFallbackMethod() { return redirectFallbackMethod; } - public void setRedirectFallbackMethod(RedirectMethodEnum redirectFallbackMethod) { this.redirectFallbackMethod = redirectFallbackMethod; } public UpdateConference fallbackUsername(String fallbackUsername) { - this.fallbackUsername = fallbackUsername; return this; } @@ -257,14 +241,12 @@ public String getFallbackUsername() { return fallbackUsername; } - public void setFallbackUsername(String fallbackUsername) { this.fallbackUsername = fallbackUsername; } public UpdateConference fallbackPassword(String fallbackPassword) { - this.fallbackPassword = fallbackPassword; return this; } @@ -278,7 +260,6 @@ public String getFallbackPassword() { return fallbackPassword; } - public void setFallbackPassword(String fallbackPassword) { this.fallbackPassword = fallbackPassword; } @@ -429,9 +410,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 +430,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 +470,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/UpdateConferenceMember.java b/src/main/java/com/bandwidth/sdk/model/UpdateConferenceMember.java index 00cffd4f..deeae0bf 100644 --- a/src/main/java/com/bandwidth/sdk/model/UpdateConferenceMember.java +++ b/src/main/java/com/bandwidth/sdk/model/UpdateConferenceMember.java @@ -45,7 +45,6 @@ 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; @@ -71,7 +70,6 @@ public UpdateConferenceMember() { } public UpdateConferenceMember mute(Boolean mute) { - this.mute = mute; return this; } @@ -85,14 +83,12 @@ public Boolean getMute() { return mute; } - public void setMute(Boolean mute) { this.mute = mute; } public UpdateConferenceMember hold(Boolean hold) { - this.hold = hold; return this; } @@ -106,14 +102,12 @@ public Boolean getHold() { return hold; } - public void setHold(Boolean hold) { this.hold = hold; } public UpdateConferenceMember callIdsToCoach(List callIdsToCoach) { - this.callIdsToCoach = callIdsToCoach; return this; } @@ -135,7 +129,6 @@ public List getCallIdsToCoach() { return callIdsToCoach; } - public void setCallIdsToCoach(List callIdsToCoach) { this.callIdsToCoach = callIdsToCoach; } @@ -302,7 +295,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/VerifyCodeRequest.java b/src/main/java/com/bandwidth/sdk/model/VerifyCodeRequest.java index 87c6d224..4a7eee10 100644 --- a/src/main/java/com/bandwidth/sdk/model/VerifyCodeRequest.java +++ b/src/main/java/com/bandwidth/sdk/model/VerifyCodeRequest.java @@ -43,7 +43,6 @@ 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; @@ -73,7 +72,6 @@ public VerifyCodeRequest() { } public VerifyCodeRequest to(String to) { - this.to = to; return this; } @@ -87,14 +85,12 @@ public String getTo() { return to; } - public void setTo(String to) { this.to = to; } public VerifyCodeRequest scope(String scope) { - this.scope = scope; return this; } @@ -108,14 +104,12 @@ public String getScope() { return scope; } - public void setScope(String scope) { this.scope = scope; } public VerifyCodeRequest expirationTimeInMinutes(BigDecimal expirationTimeInMinutes) { - this.expirationTimeInMinutes = expirationTimeInMinutes; return this; } @@ -131,14 +125,12 @@ public BigDecimal getExpirationTimeInMinutes() { return expirationTimeInMinutes; } - public void setExpirationTimeInMinutes(BigDecimal expirationTimeInMinutes) { this.expirationTimeInMinutes = expirationTimeInMinutes; } public VerifyCodeRequest code(String code) { - this.code = code; return this; } @@ -152,7 +144,6 @@ public String getCode() { return code; } - public void setCode(String code) { this.code = code; } @@ -326,7 +317,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/VerifyCodeResponse.java b/src/main/java/com/bandwidth/sdk/model/VerifyCodeResponse.java index 595c8057..b6f2707c 100644 --- a/src/main/java/com/bandwidth/sdk/model/VerifyCodeResponse.java +++ b/src/main/java/com/bandwidth/sdk/model/VerifyCodeResponse.java @@ -42,7 +42,6 @@ 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; @@ -60,7 +59,6 @@ public VerifyCodeResponse() { } public VerifyCodeResponse valid(Boolean valid) { - this.valid = valid; return this; } @@ -74,7 +72,6 @@ public Boolean getValid() { return valid; } - public void setValid(Boolean valid) { this.valid = valid; } @@ -220,7 +217,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/VoiceApiError.java b/src/main/java/com/bandwidth/sdk/model/VoiceApiError.java index 905ebfcd..a6ece3fc 100644 --- a/src/main/java/com/bandwidth/sdk/model/VoiceApiError.java +++ b/src/main/java/com/bandwidth/sdk/model/VoiceApiError.java @@ -43,7 +43,6 @@ 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; @@ -69,7 +68,6 @@ public VoiceApiError() { } public VoiceApiError type(String type) { - this.type = type; return this; } @@ -83,14 +81,12 @@ public String getType() { return type; } - public void setType(String type) { this.type = type; } public VoiceApiError description(String description) { - this.description = description; return this; } @@ -104,14 +100,12 @@ public String getDescription() { return description; } - public void setDescription(String description) { this.description = description; } public VoiceApiError id(String id) { - this.id = id; return this; } @@ -125,7 +119,6 @@ public String getId() { return id; } - public void setId(String id) { this.id = id; } @@ -297,7 +290,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()); + } } } } diff --git a/src/main/java/com/bandwidth/sdk/model/VoiceCodeResponse.java b/src/main/java/com/bandwidth/sdk/model/VoiceCodeResponse.java index e63e8932..636618b3 100644 --- a/src/main/java/com/bandwidth/sdk/model/VoiceCodeResponse.java +++ b/src/main/java/com/bandwidth/sdk/model/VoiceCodeResponse.java @@ -42,7 +42,6 @@ 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; @@ -60,7 +59,6 @@ public VoiceCodeResponse() { } public VoiceCodeResponse callId(String callId) { - this.callId = callId; return this; } @@ -74,7 +72,6 @@ public String getCallId() { return callId; } - public void setCallId(String callId) { this.callId = callId; } @@ -223,7 +220,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()); + } } } } diff --git a/src/test/java/com/bandwidth/sdk/api/MediaApiTest.java b/src/test/java/com/bandwidth/sdk/api/MediaApiTest.java index 710a81a2..8ea77da5 100644 --- a/src/test/java/com/bandwidth/sdk/api/MediaApiTest.java +++ b/src/test/java/com/bandwidth/sdk/api/MediaApiTest.java @@ -27,7 +27,7 @@ public class MediaApiTest { ApiClient defaultClient = Configuration.getDefaultApiClient(); HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); - private final MediaApi api = new MediaApi(defaultClient); + private final MediaApi api = new MediaApi(defaultClient.setDebugging(true)); private static String mediaPath = "src/test/java/com/bandwidth/sdk/fixtures/"; private static String mediaFile = "java_cat.jpeg"; From ae60bf042e069263be53d7e044d1c4f8c2eec0a3 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 12 Feb 2024 23:45:03 -0500 Subject: [PATCH 2/2] SWI-4236 Adding Tests for ContentType --- src/main/java/com/bandwidth/sdk/api/MediaApi.java | 4 ++-- src/test/java/com/bandwidth/sdk/api/MediaApiTest.java | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/bandwidth/sdk/api/MediaApi.java b/src/main/java/com/bandwidth/sdk/api/MediaApi.java index 77a60cb3..b8eda7e9 100644 --- a/src/main/java/com/bandwidth/sdk/api/MediaApi.java +++ b/src/main/java/com/bandwidth/sdk/api/MediaApi.java @@ -682,14 +682,14 @@ public okhttp3.Call uploadMediaCall(String accountId, String mediaId, File body, if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - } + }; String[] localVarAuthNames = new String[] { "Basic" }; return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call uploadMediaValidateBeforeCall(String accountId, String mediaId, File body, String contentType, String cacheControl, final ApiCallback _callback) throws ApiException { + public okhttp3.Call uploadMediaValidateBeforeCall(String accountId, String mediaId, File body, String contentType, String cacheControl, final ApiCallback _callback) throws ApiException { // verify the required parameter 'accountId' is set if (accountId == null) { throw new ApiException("Missing the required parameter 'accountId' when calling uploadMedia(Async)"); diff --git a/src/test/java/com/bandwidth/sdk/api/MediaApiTest.java b/src/test/java/com/bandwidth/sdk/api/MediaApiTest.java index 8ea77da5..2852fa00 100644 --- a/src/test/java/com/bandwidth/sdk/api/MediaApiTest.java +++ b/src/test/java/com/bandwidth/sdk/api/MediaApiTest.java @@ -20,6 +20,7 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.containsString; import static com.bandwidth.sdk.utils.TestingEnvironmentVariables.*; @@ -27,7 +28,7 @@ public class MediaApiTest { ApiClient defaultClient = Configuration.getDefaultApiClient(); HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); - private final MediaApi api = new MediaApi(defaultClient.setDebugging(true)); + private final MediaApi api = new MediaApi(defaultClient); private static String mediaPath = "src/test/java/com/bandwidth/sdk/fixtures/"; private static String mediaFile = "java_cat.jpeg"; @@ -49,11 +50,15 @@ public void uploadMedia() throws ApiException { Basic.setUsername(BW_USERNAME); Basic.setPassword(BW_PASSWORD); + + + okhttp3.Call call = api.uploadMediaValidateBeforeCall(BW_ACCOUNT_ID, mediaId, media, contentType, cacheControl, null); ApiResponse response = api.uploadMediaWithHttpInfo(BW_ACCOUNT_ID, mediaId, media, contentType, cacheControl); assertThat(response.getStatusCode(), is(204)); + assertThat(call.request().toString(), containsString(contentType)); } @Test