diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION index 8b23b8d4..41225218 100644 --- a/.openapi-generator/VERSION +++ b/.openapi-generator/VERSION @@ -1 +1 @@ -7.3.0 \ No newline at end of file +7.0.0 \ No newline at end of file diff --git a/api/openapi.yaml b/api/openapi.yaml index 3d8d02a8..e4c10f35 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -280,7 +280,7 @@ paths: summary: Get Media tags: - Media - x-accepts: "application/json,application/octet-stream" + x-accepts: application/json 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,audio/mpeg,audio/vnd.wave" + x-accepts: application/json servers: - description: Production url: https://voice.bandwidth.com/api/v2 @@ -3362,7 +3362,7 @@ paths: summary: Download Recording tags: - Recordings - x-accepts: "application/json,audio/mpeg,audio/vnd.wave" + x-accepts: application/json 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,10 +5607,6 @@ 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 @@ -5630,12 +5626,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 @@ -5647,12 +5643,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 @@ -5681,12 +5677,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 @@ -5709,11 +5705,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' @@ -5797,9 +5793,6 @@ components: title: PageInfo type: object messagingRequestError: - example: - description: description - type: type properties: type: type: string @@ -5811,16 +5804,6 @@ 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 @@ -5867,17 +5850,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 @@ -5889,7 +5872,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. @@ -5910,14 +5893,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` @@ -5957,8 +5940,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 @@ -5971,7 +5954,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 @@ -6022,7 +6005,7 @@ components: example: message-received type: string to: - example: "+15552223333" + example: +15552223333 type: string description: example: Incoming message received @@ -6043,7 +6026,7 @@ components: example: 1661365814859loidf7mcwd4qacn7 type: string owner: - example: "+15553332222" + example: +15553332222 type: string applicationId: example: 93de2206-9669-4e07-948d-329f4b722ee2 @@ -6059,13 +6042,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 @@ -6105,7 +6088,7 @@ components: example: message-sending type: string to: - example: "+15552223333" + example: +15552223333 type: string description: example: Message is sending to carrier @@ -6126,7 +6109,7 @@ components: example: 1661365814859loidf7mcwd4qacn7 type: string owner: - example: "+15553332222" + example: +15553332222 type: string applicationId: example: 93de2206-9669-4e07-948d-329f4b722ee2 @@ -6142,13 +6125,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 @@ -6190,7 +6173,7 @@ components: example: message-delivered type: string to: - example: "+15552223333" + example: +15552223333 type: string description: example: Message delivered to carrier. @@ -6211,7 +6194,7 @@ components: example: 1661365814859loidf7mcwd4qacn7 type: string owner: - example: "+15553332222" + example: +15553332222 type: string applicationId: example: 93de2206-9669-4e07-948d-329f4b722ee2 @@ -6227,13 +6210,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 @@ -6274,7 +6257,7 @@ components: example: message-failed type: string to: - example: "+15552223333" + example: +15552223333 type: string description: example: rejected-unallocated-from-number @@ -6299,7 +6282,7 @@ components: example: 1661365814859loidf7mcwd4qacn7 type: string owner: - example: "+15553332222" + example: +15553332222 type: string applicationId: example: 93de2206-9669-4e07-948d-329f4b722ee2 @@ -6315,13 +6298,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 @@ -6440,14 +6423,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\ @@ -6608,9 +6591,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 @@ -6630,11 +6613,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. @@ -6744,7 +6727,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 @@ -6772,7 +6755,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.\ @@ -6984,14 +6967,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 @@ -7024,19 +7007,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\ @@ -7568,10 +7551,6 @@ components: type: string type: object voiceApiError: - example: - description: description - id: id - type: type properties: type: type: string @@ -7613,12 +7592,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' @@ -7692,12 +7671,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' @@ -7786,12 +7765,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' @@ -7949,12 +7928,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. @@ -8005,12 +7984,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. @@ -8173,12 +8152,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. @@ -8270,12 +8249,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. @@ -8319,7 +8298,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\ @@ -8365,12 +8344,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' @@ -8421,7 +8400,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\ @@ -8469,12 +8448,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' @@ -8530,12 +8509,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' @@ -8608,12 +8587,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' @@ -8687,7 +8666,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\ @@ -8727,12 +8706,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' @@ -8812,7 +8791,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\ @@ -8852,12 +8831,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' @@ -8903,7 +8882,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\ @@ -8943,12 +8922,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' @@ -9012,7 +8991,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\ @@ -9057,12 +9036,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' @@ -9102,7 +9081,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\ @@ -9145,12 +9124,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' @@ -9190,7 +9169,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\ @@ -9252,12 +9231,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' @@ -9308,7 +9287,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\ @@ -9361,13 +9340,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\ @@ -9443,7 +9422,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\ @@ -9544,7 +9523,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: @@ -9585,12 +9564,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 @@ -9652,7 +9631,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: @@ -9690,9 +9669,6 @@ 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. @@ -9704,8 +9680,6 @@ components: type: string type: object mfaUnauthorizedRequestError: - example: - message: Unauthorized properties: message: description: Unauthorized @@ -9713,8 +9687,6 @@ components: type: string type: object mfaForbiddenRequestError: - example: - message: Missing Authentication Token properties: message: description: The message containing the reason behind the request being @@ -9763,7 +9735,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 @@ -9772,7 +9744,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 @@ -9783,7 +9755,7 @@ components: Response Code: 0 requestId: 004223a0-8b17-41b1-bf81-20732adf5590 failedTelephoneNumbers: - - "+191955512345" + - +191955512345 status: COMPLETE properties: requestId: @@ -9801,7 +9773,7 @@ components: failedTelephoneNumbers: description: The telephone numbers whose lookup failed. example: - - "+191955512345" + - +191955512345 items: type: string type: array @@ -9809,7 +9781,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 @@ -9829,7 +9801,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. @@ -9857,8 +9829,6 @@ 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 107ec296..41856cec 100644 --- a/build.gradle +++ b/build.gradle @@ -62,9 +62,9 @@ if(hasProperty('target') && target == 'android') { def task = project.tasks.create "jar${variant.name.capitalize()}", Jar task.description = "Create jar artifact for ${variant.name}" task.dependsOn variant.javaCompile - task.from variant.javaCompile.destinationDirectory - task.destinationDirectory = project.file("${project.buildDir}/outputs/jar") - task.archiveFileName = "${project.name}-${variant.baseName}-${version}.jar" + task.from variant.javaCompile.destinationDir + task.destinationDir = project.file("${project.buildDir}/outputs/jar") + task.archiveName = "${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.9.0' + implementation 'io.gsonfire:gson-fire:1.8.5' implementation 'javax.ws.rs:jsr311-api:1.1.1' implementation 'javax.ws.rs:javax.ws.rs-api:2.1.1' implementation 'org.openapitools:jackson-databind-nullable:0.2.6' diff --git a/build.sbt b/build.sbt index 6fd82031..c9f2a93d 100644 --- a/build.sbt +++ b/build.sbt @@ -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.9.0" % "compile", + "io.gsonfire" % "gson-fire" % "1.8.5" % "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/openapitools.json b/openapitools.json index 9841a49b..3015568c 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.3.0" + "version": "7.0.0" } } diff --git a/src/main/java/com/bandwidth/sdk/ApiClient.java b/src/main/java/com/bandwidth/sdk/ApiClient.java index a714adbe..a98a6f4a 100644 --- a/src/main/java/com/bandwidth/sdk/ApiClient.java +++ b/src/main/java/com/bandwidth/sdk/ApiClient.java @@ -47,7 +47,6 @@ 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; diff --git a/src/main/java/com/bandwidth/sdk/ApiException.java b/src/main/java/com/bandwidth/sdk/ApiException.java index 7d0e7fb5..55fe2953 100644 --- a/src/main/java/com/bandwidth/sdk/ApiException.java +++ b/src/main/java/com/bandwidth/sdk/ApiException.java @@ -23,8 +23,6 @@ @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/JSON.java b/src/main/java/com/bandwidth/sdk/JSON.java index 028dcf6e..7dd1f987 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,16 +31,14 @@ 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 @@ -57,11 +55,6 @@ 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() @@ -406,7 +399,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(sdf.parse(date).getTime()); + return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); } catch (ParseException e) { throw new JsonParseException(e); } @@ -416,7 +409,7 @@ public java.sql.Date read(JsonReader in) throws IOException { /** * Gson TypeAdapter for java.util.Date type - * If the dateFormat is null, DateTimeFormatter will be used. + * If the dateFormat is null, ISO8601Utils will be used. */ public static class DateTypeAdapter extends TypeAdapter { @@ -441,7 +434,7 @@ public void write(JsonWriter out, Date date) throws IOException { if (dateFormat != null) { value = dateFormat.format(date); } else { - value = date.toInstant().atOffset(ZoneOffset.UTC).format(dtf); + value = ISO8601Utils.format(date, true); } out.value(value); } @@ -460,7 +453,7 @@ public Date read(JsonReader in) throws IOException { if (dateFormat != null) { return dateFormat.parse(date); } - return sdf.parse(date); + return ISO8601Utils.parse(date, new ParsePosition(0)); } 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 b8eda7e9..33b0008a 100644 --- a/src/main/java/com/bandwidth/sdk/api/MediaApi.java +++ b/src/main/java/com/bandwidth/sdk/api/MediaApi.java @@ -677,19 +677,17 @@ 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); - } - }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } String[] localVarAuthNames = new String[] { "Basic" }; return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - public okhttp3.Call uploadMediaValidateBeforeCall(String accountId, String mediaId, File body, String contentType, String cacheControl, final ApiCallback _callback) throws ApiException { + private 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/main/java/com/bandwidth/sdk/auth/HttpBearerAuth.java b/src/main/java/com/bandwidth/sdk/auth/HttpBearerAuth.java index 18b22cdd..8773cf97 100644 --- a/src/main/java/com/bandwidth/sdk/auth/HttpBearerAuth.java +++ b/src/main/java/com/bandwidth/sdk/auth/HttpBearerAuth.java @@ -17,15 +17,13 @@ import com.bandwidth.sdk.Pair; import java.net.URI; -import java.util.List; import java.util.Map; -import java.util.Optional; -import java.util.function.Supplier; +import java.util.List; @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class HttpBearerAuth implements Authentication { private final String scheme; - private Supplier tokenSupplier; + private String bearerToken; public HttpBearerAuth(String scheme) { this.scheme = scheme; @@ -37,7 +35,7 @@ public HttpBearerAuth(String scheme) { * @return The bearer token */ public String getBearerToken() { - return tokenSupplier.get(); + return bearerToken; } /** @@ -46,22 +44,12 @@ public String getBearerToken() { * @param bearerToken The bearer token to send in the Authorization header */ public void setBearerToken(String 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; + this.bearerToken = bearerToken; } @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 be6f0672..dbe969d8 100644 --- a/src/main/java/com/bandwidth/sdk/model/AbstractOpenApiSchema.java +++ b/src/main/java/com/bandwidth/sdk/model/AbstractOpenApiSchema.java @@ -18,6 +18,8 @@ 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 42fbc8e6..b27df3b4 100644 --- a/src/main/java/com/bandwidth/sdk/model/AccountStatistics.java +++ b/src/main/java/com/bandwidth/sdk/model/AccountStatistics.java @@ -42,6 +42,7 @@ 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,6 +64,7 @@ public AccountStatistics() { } public AccountStatistics currentCallQueueSize(Integer currentCallQueueSize) { + this.currentCallQueueSize = currentCallQueueSize; return this; } @@ -76,12 +78,14 @@ public Integer getCurrentCallQueueSize() { return currentCallQueueSize; } + public void setCurrentCallQueueSize(Integer currentCallQueueSize) { this.currentCallQueueSize = currentCallQueueSize; } public AccountStatistics maxCallQueueSize(Integer maxCallQueueSize) { + this.maxCallQueueSize = maxCallQueueSize; return this; } @@ -95,6 +99,7 @@ public Integer getMaxCallQueueSize() { return maxCallQueueSize; } + public void setMaxCallQueueSize(Integer maxCallQueueSize) { this.maxCallQueueSize = maxCallQueueSize; } @@ -243,12 +248,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/AnswerCallback.java b/src/main/java/com/bandwidth/sdk/model/AnswerCallback.java index 0ebabfcc..7e585c86 100644 --- a/src/main/java/com/bandwidth/sdk/model/AnswerCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/AnswerCallback.java @@ -46,6 +46,7 @@ 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; @@ -115,6 +116,7 @@ public AnswerCallback() { } public AnswerCallback eventType(String eventType) { + this.eventType = eventType; return this; } @@ -128,12 +130,14 @@ public String getEventType() { return eventType; } + public void setEventType(String eventType) { this.eventType = eventType; } public AnswerCallback eventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; return this; } @@ -147,12 +151,14 @@ public OffsetDateTime getEventTime() { return eventTime; } + public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public AnswerCallback accountId(String accountId) { + this.accountId = accountId; return this; } @@ -166,12 +172,14 @@ public String getAccountId() { return accountId; } + public void setAccountId(String accountId) { this.accountId = accountId; } public AnswerCallback applicationId(String applicationId) { + this.applicationId = applicationId; return this; } @@ -185,12 +193,14 @@ public String getApplicationId() { return applicationId; } + public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public AnswerCallback from(String from) { + this.from = from; return this; } @@ -204,12 +214,14 @@ public String getFrom() { return from; } + public void setFrom(String from) { this.from = from; } public AnswerCallback to(String to) { + this.to = to; return this; } @@ -223,12 +235,14 @@ public String getTo() { return to; } + public void setTo(String to) { this.to = to; } public AnswerCallback direction(CallDirectionEnum direction) { + this.direction = direction; return this; } @@ -242,12 +256,14 @@ public CallDirectionEnum getDirection() { return direction; } + public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public AnswerCallback callId(String callId) { + this.callId = callId; return this; } @@ -261,12 +277,14 @@ public String getCallId() { return callId; } + public void setCallId(String callId) { this.callId = callId; } public AnswerCallback callUrl(String callUrl) { + this.callUrl = callUrl; return this; } @@ -280,12 +298,14 @@ public String getCallUrl() { return callUrl; } + public void setCallUrl(String callUrl) { this.callUrl = callUrl; } public AnswerCallback enqueuedTime(OffsetDateTime enqueuedTime) { + this.enqueuedTime = enqueuedTime; return this; } @@ -299,12 +319,14 @@ public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } + public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public AnswerCallback startTime(OffsetDateTime startTime) { + this.startTime = startTime; return this; } @@ -318,12 +340,14 @@ public OffsetDateTime getStartTime() { return startTime; } + public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public AnswerCallback answerTime(OffsetDateTime answerTime) { + this.answerTime = answerTime; return this; } @@ -337,12 +361,14 @@ public OffsetDateTime getAnswerTime() { return answerTime; } + public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public AnswerCallback tag(String tag) { + this.tag = tag; return this; } @@ -356,12 +382,14 @@ public String getTag() { return tag; } + public void setTag(String tag) { this.tag = tag; } public AnswerCallback machineDetectionResult(MachineDetectionResult machineDetectionResult) { + this.machineDetectionResult = machineDetectionResult; return this; } @@ -375,6 +403,7 @@ public MachineDetectionResult getMachineDetectionResult() { return machineDetectionResult; } + public void setMachineDetectionResult(MachineDetectionResult machineDetectionResult) { this.machineDetectionResult = machineDetectionResult; } @@ -555,10 +584,6 @@ 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())); } @@ -602,12 +627,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/BridgeCompleteCallback.java b/src/main/java/com/bandwidth/sdk/model/BridgeCompleteCallback.java index 7bc25303..bfc6619f 100644 --- a/src/main/java/com/bandwidth/sdk/model/BridgeCompleteCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/BridgeCompleteCallback.java @@ -45,6 +45,7 @@ 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; @@ -122,6 +123,7 @@ public BridgeCompleteCallback() { } public BridgeCompleteCallback eventType(String eventType) { + this.eventType = eventType; return this; } @@ -135,12 +137,14 @@ public String getEventType() { return eventType; } + public void setEventType(String eventType) { this.eventType = eventType; } public BridgeCompleteCallback eventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; return this; } @@ -154,12 +158,14 @@ public OffsetDateTime getEventTime() { return eventTime; } + public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public BridgeCompleteCallback accountId(String accountId) { + this.accountId = accountId; return this; } @@ -173,12 +179,14 @@ public String getAccountId() { return accountId; } + public void setAccountId(String accountId) { this.accountId = accountId; } public BridgeCompleteCallback applicationId(String applicationId) { + this.applicationId = applicationId; return this; } @@ -192,12 +200,14 @@ public String getApplicationId() { return applicationId; } + public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public BridgeCompleteCallback from(String from) { + this.from = from; return this; } @@ -211,12 +221,14 @@ public String getFrom() { return from; } + public void setFrom(String from) { this.from = from; } public BridgeCompleteCallback to(String to) { + this.to = to; return this; } @@ -230,12 +242,14 @@ public String getTo() { return to; } + public void setTo(String to) { this.to = to; } public BridgeCompleteCallback direction(CallDirectionEnum direction) { + this.direction = direction; return this; } @@ -249,12 +263,14 @@ public CallDirectionEnum getDirection() { return direction; } + public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public BridgeCompleteCallback callId(String callId) { + this.callId = callId; return this; } @@ -268,12 +284,14 @@ public String getCallId() { return callId; } + public void setCallId(String callId) { this.callId = callId; } public BridgeCompleteCallback callUrl(String callUrl) { + this.callUrl = callUrl; return this; } @@ -287,12 +305,14 @@ public String getCallUrl() { return callUrl; } + public void setCallUrl(String callUrl) { this.callUrl = callUrl; } public BridgeCompleteCallback enqueuedTime(OffsetDateTime enqueuedTime) { + this.enqueuedTime = enqueuedTime; return this; } @@ -306,12 +326,14 @@ public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } + public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public BridgeCompleteCallback startTime(OffsetDateTime startTime) { + this.startTime = startTime; return this; } @@ -325,12 +347,14 @@ public OffsetDateTime getStartTime() { return startTime; } + public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public BridgeCompleteCallback answerTime(OffsetDateTime answerTime) { + this.answerTime = answerTime; return this; } @@ -344,12 +368,14 @@ public OffsetDateTime getAnswerTime() { return answerTime; } + public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public BridgeCompleteCallback tag(String tag) { + this.tag = tag; return this; } @@ -363,12 +389,14 @@ public String getTag() { return tag; } + public void setTag(String tag) { this.tag = tag; } public BridgeCompleteCallback cause(String cause) { + this.cause = cause; return this; } @@ -382,12 +410,14 @@ public String getCause() { return cause; } + public void setCause(String cause) { this.cause = cause; } public BridgeCompleteCallback errorMessage(String errorMessage) { + this.errorMessage = errorMessage; return this; } @@ -401,12 +431,14 @@ public String getErrorMessage() { return errorMessage; } + public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; } public BridgeCompleteCallback errorId(String errorId) { + this.errorId = errorId; return this; } @@ -420,6 +452,7 @@ public String getErrorId() { return errorId; } + public void setErrorId(String errorId) { this.errorId = errorId; } @@ -606,10 +639,6 @@ 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())); } @@ -658,12 +687,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/BridgeTargetCompleteCallback.java b/src/main/java/com/bandwidth/sdk/model/BridgeTargetCompleteCallback.java index c4ad58b6..5d4f996e 100644 --- a/src/main/java/com/bandwidth/sdk/model/BridgeTargetCompleteCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/BridgeTargetCompleteCallback.java @@ -45,6 +45,7 @@ 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; @@ -110,6 +111,7 @@ public BridgeTargetCompleteCallback() { } public BridgeTargetCompleteCallback eventType(String eventType) { + this.eventType = eventType; return this; } @@ -123,12 +125,14 @@ public String getEventType() { return eventType; } + public void setEventType(String eventType) { this.eventType = eventType; } public BridgeTargetCompleteCallback eventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; return this; } @@ -142,12 +146,14 @@ public OffsetDateTime getEventTime() { return eventTime; } + public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public BridgeTargetCompleteCallback accountId(String accountId) { + this.accountId = accountId; return this; } @@ -161,12 +167,14 @@ public String getAccountId() { return accountId; } + public void setAccountId(String accountId) { this.accountId = accountId; } public BridgeTargetCompleteCallback applicationId(String applicationId) { + this.applicationId = applicationId; return this; } @@ -180,12 +188,14 @@ public String getApplicationId() { return applicationId; } + public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public BridgeTargetCompleteCallback from(String from) { + this.from = from; return this; } @@ -199,12 +209,14 @@ public String getFrom() { return from; } + public void setFrom(String from) { this.from = from; } public BridgeTargetCompleteCallback to(String to) { + this.to = to; return this; } @@ -218,12 +230,14 @@ public String getTo() { return to; } + public void setTo(String to) { this.to = to; } public BridgeTargetCompleteCallback direction(CallDirectionEnum direction) { + this.direction = direction; return this; } @@ -237,12 +251,14 @@ public CallDirectionEnum getDirection() { return direction; } + public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public BridgeTargetCompleteCallback callId(String callId) { + this.callId = callId; return this; } @@ -256,12 +272,14 @@ public String getCallId() { return callId; } + public void setCallId(String callId) { this.callId = callId; } public BridgeTargetCompleteCallback callUrl(String callUrl) { + this.callUrl = callUrl; return this; } @@ -275,12 +293,14 @@ public String getCallUrl() { return callUrl; } + public void setCallUrl(String callUrl) { this.callUrl = callUrl; } public BridgeTargetCompleteCallback enqueuedTime(OffsetDateTime enqueuedTime) { + this.enqueuedTime = enqueuedTime; return this; } @@ -294,12 +314,14 @@ public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } + public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public BridgeTargetCompleteCallback startTime(OffsetDateTime startTime) { + this.startTime = startTime; return this; } @@ -313,12 +335,14 @@ public OffsetDateTime getStartTime() { return startTime; } + public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public BridgeTargetCompleteCallback answerTime(OffsetDateTime answerTime) { + this.answerTime = answerTime; return this; } @@ -332,12 +356,14 @@ public OffsetDateTime getAnswerTime() { return answerTime; } + public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public BridgeTargetCompleteCallback tag(String tag) { + this.tag = tag; return this; } @@ -351,6 +377,7 @@ public String getTag() { return tag; } + public void setTag(String tag) { this.tag = tag; } @@ -528,10 +555,6 @@ 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())); } @@ -571,12 +594,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/CallDirectionEnum.java b/src/main/java/com/bandwidth/sdk/model/CallDirectionEnum.java index ddf8bbde..f0891c9c 100644 --- a/src/main/java/com/bandwidth/sdk/model/CallDirectionEnum.java +++ b/src/main/java/com/bandwidth/sdk/model/CallDirectionEnum.java @@ -18,7 +18,6 @@ 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; @@ -69,10 +68,5 @@ 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 eacbaeca..f5649459 100644 --- a/src/main/java/com/bandwidth/sdk/model/CallRecordingMetadata.java +++ b/src/main/java/com/bandwidth/sdk/model/CallRecordingMetadata.java @@ -48,6 +48,7 @@ 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,6 +134,7 @@ public CallRecordingMetadata() { } public CallRecordingMetadata applicationId(String applicationId) { + this.applicationId = applicationId; return this; } @@ -146,12 +148,14 @@ public String getApplicationId() { return applicationId; } + public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public CallRecordingMetadata accountId(String accountId) { + this.accountId = accountId; return this; } @@ -165,12 +169,14 @@ public String getAccountId() { return accountId; } + public void setAccountId(String accountId) { this.accountId = accountId; } public CallRecordingMetadata callId(String callId) { + this.callId = callId; return this; } @@ -184,12 +190,14 @@ public String getCallId() { return callId; } + public void setCallId(String callId) { this.callId = callId; } public CallRecordingMetadata parentCallId(String parentCallId) { + this.parentCallId = parentCallId; return this; } @@ -203,12 +211,14 @@ public String getParentCallId() { return parentCallId; } + public void setParentCallId(String parentCallId) { this.parentCallId = parentCallId; } public CallRecordingMetadata recordingId(String recordingId) { + this.recordingId = recordingId; return this; } @@ -222,12 +232,14 @@ public String getRecordingId() { return recordingId; } + public void setRecordingId(String recordingId) { this.recordingId = recordingId; } public CallRecordingMetadata to(String to) { + this.to = to; return this; } @@ -241,12 +253,14 @@ public String getTo() { return to; } + public void setTo(String to) { this.to = to; } public CallRecordingMetadata from(String from) { + this.from = from; return this; } @@ -260,12 +274,14 @@ public String getFrom() { return from; } + public void setFrom(String from) { this.from = from; } public CallRecordingMetadata transferCallerId(String transferCallerId) { + this.transferCallerId = transferCallerId; return this; } @@ -279,12 +295,14 @@ public String getTransferCallerId() { return transferCallerId; } + public void setTransferCallerId(String transferCallerId) { this.transferCallerId = transferCallerId; } public CallRecordingMetadata transferTo(String transferTo) { + this.transferTo = transferTo; return this; } @@ -298,12 +316,14 @@ public String getTransferTo() { return transferTo; } + public void setTransferTo(String transferTo) { this.transferTo = transferTo; } public CallRecordingMetadata duration(String duration) { + this.duration = duration; return this; } @@ -317,12 +337,14 @@ public String getDuration() { return duration; } + public void setDuration(String duration) { this.duration = duration; } public CallRecordingMetadata direction(CallDirectionEnum direction) { + this.direction = direction; return this; } @@ -336,12 +358,14 @@ public CallDirectionEnum getDirection() { return direction; } + public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public CallRecordingMetadata channels(Integer channels) { + this.channels = channels; return this; } @@ -355,12 +379,14 @@ public Integer getChannels() { return channels; } + public void setChannels(Integer channels) { this.channels = channels; } public CallRecordingMetadata startTime(OffsetDateTime startTime) { + this.startTime = startTime; return this; } @@ -374,12 +400,14 @@ public OffsetDateTime getStartTime() { return startTime; } + public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public CallRecordingMetadata endTime(OffsetDateTime endTime) { + this.endTime = endTime; return this; } @@ -393,12 +421,14 @@ public OffsetDateTime getEndTime() { return endTime; } + public void setEndTime(OffsetDateTime endTime) { this.endTime = endTime; } public CallRecordingMetadata fileFormat(FileFormatEnum fileFormat) { + this.fileFormat = fileFormat; return this; } @@ -412,12 +442,14 @@ public FileFormatEnum getFileFormat() { return fileFormat; } + public void setFileFormat(FileFormatEnum fileFormat) { this.fileFormat = fileFormat; } public CallRecordingMetadata status(String status) { + this.status = status; return this; } @@ -431,12 +463,14 @@ public String getStatus() { return status; } + public void setStatus(String status) { this.status = status; } public CallRecordingMetadata mediaUrl(URI mediaUrl) { + this.mediaUrl = mediaUrl; return this; } @@ -450,12 +484,14 @@ public URI getMediaUrl() { return mediaUrl; } + public void setMediaUrl(URI mediaUrl) { this.mediaUrl = mediaUrl; } public CallRecordingMetadata transcription(TranscriptionMetadata transcription) { + this.transcription = transcription; return this; } @@ -469,6 +505,7 @@ public TranscriptionMetadata getTranscription() { return transcription; } + public void setTranscription(TranscriptionMetadata transcription) { this.transcription = transcription; } @@ -676,14 +713,6 @@ 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())); } @@ -724,12 +753,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/CallState.java b/src/main/java/com/bandwidth/sdk/model/CallState.java index ba260adc..f9f2d025 100644 --- a/src/main/java/com/bandwidth/sdk/model/CallState.java +++ b/src/main/java/com/bandwidth/sdk/model/CallState.java @@ -47,6 +47,7 @@ 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; @@ -132,6 +133,7 @@ public CallState() { } public CallState applicationId(String applicationId) { + this.applicationId = applicationId; return this; } @@ -145,12 +147,14 @@ public String getApplicationId() { return applicationId; } + public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public CallState accountId(String accountId) { + this.accountId = accountId; return this; } @@ -164,12 +168,14 @@ public String getAccountId() { return accountId; } + public void setAccountId(String accountId) { this.accountId = accountId; } public CallState callId(String callId) { + this.callId = callId; return this; } @@ -183,12 +189,14 @@ public String getCallId() { return callId; } + public void setCallId(String callId) { this.callId = callId; } public CallState parentCallId(String parentCallId) { + this.parentCallId = parentCallId; return this; } @@ -202,12 +210,14 @@ public String getParentCallId() { return parentCallId; } + public void setParentCallId(String parentCallId) { this.parentCallId = parentCallId; } public CallState to(String to) { + this.to = to; return this; } @@ -221,12 +231,14 @@ public String getTo() { return to; } + public void setTo(String to) { this.to = to; } public CallState from(String from) { + this.from = from; return this; } @@ -240,12 +252,14 @@ public String getFrom() { return from; } + public void setFrom(String from) { this.from = from; } public CallState direction(CallDirectionEnum direction) { + this.direction = direction; return this; } @@ -259,12 +273,14 @@ public CallDirectionEnum getDirection() { return direction; } + public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public CallState state(String state) { + this.state = state; return this; } @@ -278,12 +294,14 @@ public String getState() { return state; } + public void setState(String state) { this.state = state; } public CallState stirShaken(Map stirShaken) { + this.stirShaken = stirShaken; return this; } @@ -305,12 +323,14 @@ public Map getStirShaken() { return stirShaken; } + public void setStirShaken(Map stirShaken) { this.stirShaken = stirShaken; } public CallState identity(String identity) { + this.identity = identity; return this; } @@ -324,12 +344,14 @@ public String getIdentity() { return identity; } + public void setIdentity(String identity) { this.identity = identity; } public CallState enqueuedTime(OffsetDateTime enqueuedTime) { + this.enqueuedTime = enqueuedTime; return this; } @@ -343,12 +365,14 @@ public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } + public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public CallState startTime(OffsetDateTime startTime) { + this.startTime = startTime; return this; } @@ -362,12 +386,14 @@ public OffsetDateTime getStartTime() { return startTime; } + public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public CallState answerTime(OffsetDateTime answerTime) { + this.answerTime = answerTime; return this; } @@ -381,12 +407,14 @@ public OffsetDateTime getAnswerTime() { return answerTime; } + public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public CallState endTime(OffsetDateTime endTime) { + this.endTime = endTime; return this; } @@ -400,12 +428,14 @@ public OffsetDateTime getEndTime() { return endTime; } + public void setEndTime(OffsetDateTime endTime) { this.endTime = endTime; } public CallState disconnectCause(String disconnectCause) { + this.disconnectCause = disconnectCause; return this; } @@ -419,12 +449,14 @@ public String getDisconnectCause() { return disconnectCause; } + public void setDisconnectCause(String disconnectCause) { this.disconnectCause = disconnectCause; } public CallState errorMessage(String errorMessage) { + this.errorMessage = errorMessage; return this; } @@ -438,12 +470,14 @@ public String getErrorMessage() { return errorMessage; } + public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; } public CallState errorId(String errorId) { + this.errorId = errorId; return this; } @@ -457,12 +491,14 @@ public String getErrorId() { return errorId; } + public void setErrorId(String errorId) { this.errorId = errorId; } public CallState lastUpdate(OffsetDateTime lastUpdate) { + this.lastUpdate = lastUpdate; return this; } @@ -476,6 +512,7 @@ public OffsetDateTime getLastUpdate() { return lastUpdate; } + public void setLastUpdate(OffsetDateTime lastUpdate) { this.lastUpdate = lastUpdate; } @@ -671,10 +708,6 @@ 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())); } @@ -720,12 +753,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/CallStateEnum.java b/src/main/java/com/bandwidth/sdk/model/CallStateEnum.java index 64fd1045..24b1224c 100644 --- a/src/main/java/com/bandwidth/sdk/model/CallStateEnum.java +++ b/src/main/java/com/bandwidth/sdk/model/CallStateEnum.java @@ -18,7 +18,6 @@ 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; @@ -69,10 +68,5 @@ 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 3e169433..fef1dcce 100644 --- a/src/main/java/com/bandwidth/sdk/model/CallbackMethodEnum.java +++ b/src/main/java/com/bandwidth/sdk/model/CallbackMethodEnum.java @@ -18,7 +18,6 @@ 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; @@ -69,10 +68,5 @@ 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 b4f53075..5f0253ee 100644 --- a/src/main/java/com/bandwidth/sdk/model/CodeRequest.java +++ b/src/main/java/com/bandwidth/sdk/model/CodeRequest.java @@ -42,6 +42,7 @@ 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; @@ -79,6 +80,7 @@ public CodeRequest() { } public CodeRequest to(String to) { + this.to = to; return this; } @@ -92,12 +94,14 @@ public String getTo() { return to; } + public void setTo(String to) { this.to = to; } public CodeRequest from(String from) { + this.from = from; return this; } @@ -111,12 +115,14 @@ public String getFrom() { return from; } + public void setFrom(String from) { this.from = from; } public CodeRequest applicationId(String applicationId) { + this.applicationId = applicationId; return this; } @@ -130,12 +136,14 @@ public String getApplicationId() { return applicationId; } + public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public CodeRequest scope(String scope) { + this.scope = scope; return this; } @@ -149,12 +157,14 @@ public String getScope() { return scope; } + public void setScope(String scope) { this.scope = scope; } public CodeRequest message(String message) { + this.message = message; return this; } @@ -168,12 +178,14 @@ public String getMessage() { return message; } + public void setMessage(String message) { this.message = message; } public CodeRequest digits(Integer digits) { + this.digits = digits; return this; } @@ -189,6 +201,7 @@ public Integer getDigits() { return digits; } + public void setDigits(Integer digits) { this.digits = digits; } @@ -376,12 +389,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/Conference.java b/src/main/java/com/bandwidth/sdk/model/Conference.java index 6fcfc83f..91f59645 100644 --- a/src/main/java/com/bandwidth/sdk/model/Conference.java +++ b/src/main/java/com/bandwidth/sdk/model/Conference.java @@ -49,6 +49,7 @@ 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; @@ -94,6 +95,7 @@ public Conference() { } public Conference id(String id) { + this.id = id; return this; } @@ -107,12 +109,14 @@ public String getId() { return id; } + public void setId(String id) { this.id = id; } public Conference name(String name) { + this.name = name; return this; } @@ -126,12 +130,14 @@ public String getName() { return name; } + public void setName(String name) { this.name = name; } public Conference createdTime(OffsetDateTime createdTime) { + this.createdTime = createdTime; return this; } @@ -145,12 +151,14 @@ public OffsetDateTime getCreatedTime() { return createdTime; } + public void setCreatedTime(OffsetDateTime createdTime) { this.createdTime = createdTime; } public Conference completedTime(OffsetDateTime completedTime) { + this.completedTime = completedTime; return this; } @@ -164,12 +172,14 @@ public OffsetDateTime getCompletedTime() { return completedTime; } + public void setCompletedTime(OffsetDateTime completedTime) { this.completedTime = completedTime; } public Conference conferenceEventUrl(URI conferenceEventUrl) { + this.conferenceEventUrl = conferenceEventUrl; return this; } @@ -183,12 +193,14 @@ public URI getConferenceEventUrl() { return conferenceEventUrl; } + public void setConferenceEventUrl(URI conferenceEventUrl) { this.conferenceEventUrl = conferenceEventUrl; } public Conference conferenceEventMethod(CallbackMethodEnum conferenceEventMethod) { + this.conferenceEventMethod = conferenceEventMethod; return this; } @@ -202,12 +214,14 @@ public CallbackMethodEnum getConferenceEventMethod() { return conferenceEventMethod; } + public void setConferenceEventMethod(CallbackMethodEnum conferenceEventMethod) { this.conferenceEventMethod = conferenceEventMethod; } public Conference tag(String tag) { + this.tag = tag; return this; } @@ -221,12 +235,14 @@ public String getTag() { return tag; } + public void setTag(String tag) { this.tag = tag; } public Conference activeMembers(List activeMembers) { + this.activeMembers = activeMembers; return this; } @@ -248,6 +264,7 @@ public List getActiveMembers() { return activeMembers; } + public void setActiveMembers(List activeMembers) { this.activeMembers = activeMembers; } @@ -404,10 +421,6 @@ 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())); } @@ -455,12 +468,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/ConferenceCompletedCallback.java b/src/main/java/com/bandwidth/sdk/model/ConferenceCompletedCallback.java index d84dcb2a..d0987304 100644 --- a/src/main/java/com/bandwidth/sdk/model/ConferenceCompletedCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/ConferenceCompletedCallback.java @@ -44,6 +44,7 @@ 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; @@ -77,6 +78,7 @@ public ConferenceCompletedCallback() { } public ConferenceCompletedCallback eventType(String eventType) { + this.eventType = eventType; return this; } @@ -90,12 +92,14 @@ public String getEventType() { return eventType; } + public void setEventType(String eventType) { this.eventType = eventType; } public ConferenceCompletedCallback eventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; return this; } @@ -109,12 +113,14 @@ public OffsetDateTime getEventTime() { return eventTime; } + public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public ConferenceCompletedCallback conferenceId(String conferenceId) { + this.conferenceId = conferenceId; return this; } @@ -128,12 +134,14 @@ public String getConferenceId() { return conferenceId; } + public void setConferenceId(String conferenceId) { this.conferenceId = conferenceId; } public ConferenceCompletedCallback name(String name) { + this.name = name; return this; } @@ -147,12 +155,14 @@ public String getName() { return name; } + public void setName(String name) { this.name = name; } public ConferenceCompletedCallback tag(String tag) { + this.tag = tag; return this; } @@ -166,6 +176,7 @@ public String getTag() { return tag; } + public void setTag(String tag) { this.tag = tag; } @@ -346,12 +357,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/ConferenceCreatedCallback.java b/src/main/java/com/bandwidth/sdk/model/ConferenceCreatedCallback.java index 8543c224..705be5c1 100644 --- a/src/main/java/com/bandwidth/sdk/model/ConferenceCreatedCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/ConferenceCreatedCallback.java @@ -44,6 +44,7 @@ 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; @@ -77,6 +78,7 @@ public ConferenceCreatedCallback() { } public ConferenceCreatedCallback eventType(String eventType) { + this.eventType = eventType; return this; } @@ -90,12 +92,14 @@ public String getEventType() { return eventType; } + public void setEventType(String eventType) { this.eventType = eventType; } public ConferenceCreatedCallback eventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; return this; } @@ -109,12 +113,14 @@ public OffsetDateTime getEventTime() { return eventTime; } + public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public ConferenceCreatedCallback conferenceId(String conferenceId) { + this.conferenceId = conferenceId; return this; } @@ -128,12 +134,14 @@ public String getConferenceId() { return conferenceId; } + public void setConferenceId(String conferenceId) { this.conferenceId = conferenceId; } public ConferenceCreatedCallback name(String name) { + this.name = name; return this; } @@ -147,12 +155,14 @@ public String getName() { return name; } + public void setName(String name) { this.name = name; } public ConferenceCreatedCallback tag(String tag) { + this.tag = tag; return this; } @@ -166,6 +176,7 @@ public String getTag() { return tag; } + public void setTag(String tag) { this.tag = tag; } @@ -346,12 +357,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/ConferenceMember.java b/src/main/java/com/bandwidth/sdk/model/ConferenceMember.java index fe364c78..c599189f 100644 --- a/src/main/java/com/bandwidth/sdk/model/ConferenceMember.java +++ b/src/main/java/com/bandwidth/sdk/model/ConferenceMember.java @@ -45,6 +45,7 @@ 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,6 +83,7 @@ public ConferenceMember() { } public ConferenceMember callId(String callId) { + this.callId = callId; return this; } @@ -95,12 +97,14 @@ public String getCallId() { return callId; } + public void setCallId(String callId) { this.callId = callId; } public ConferenceMember conferenceId(String conferenceId) { + this.conferenceId = conferenceId; return this; } @@ -114,12 +118,14 @@ public String getConferenceId() { return conferenceId; } + public void setConferenceId(String conferenceId) { this.conferenceId = conferenceId; } public ConferenceMember memberUrl(String memberUrl) { + this.memberUrl = memberUrl; return this; } @@ -133,12 +139,14 @@ public String getMemberUrl() { return memberUrl; } + public void setMemberUrl(String memberUrl) { this.memberUrl = memberUrl; } public ConferenceMember mute(Boolean mute) { + this.mute = mute; return this; } @@ -152,12 +160,14 @@ public Boolean getMute() { return mute; } + public void setMute(Boolean mute) { this.mute = mute; } public ConferenceMember hold(Boolean hold) { + this.hold = hold; return this; } @@ -171,12 +181,14 @@ public Boolean getHold() { return hold; } + public void setHold(Boolean hold) { this.hold = hold; } public ConferenceMember callIdsToCoach(List callIdsToCoach) { + this.callIdsToCoach = callIdsToCoach; return this; } @@ -198,6 +210,7 @@ public List getCallIdsToCoach() { return callIdsToCoach; } + public void setCallIdsToCoach(List callIdsToCoach) { this.callIdsToCoach = callIdsToCoach; } @@ -382,12 +395,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/ConferenceMemberExitCallback.java b/src/main/java/com/bandwidth/sdk/model/ConferenceMemberExitCallback.java index 950fb522..ac74ee38 100644 --- a/src/main/java/com/bandwidth/sdk/model/ConferenceMemberExitCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/ConferenceMemberExitCallback.java @@ -44,6 +44,7 @@ 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; @@ -89,6 +90,7 @@ public ConferenceMemberExitCallback() { } public ConferenceMemberExitCallback eventType(String eventType) { + this.eventType = eventType; return this; } @@ -102,12 +104,14 @@ public String getEventType() { return eventType; } + public void setEventType(String eventType) { this.eventType = eventType; } public ConferenceMemberExitCallback eventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; return this; } @@ -121,12 +125,14 @@ public OffsetDateTime getEventTime() { return eventTime; } + public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public ConferenceMemberExitCallback conferenceId(String conferenceId) { + this.conferenceId = conferenceId; return this; } @@ -140,12 +146,14 @@ public String getConferenceId() { return conferenceId; } + public void setConferenceId(String conferenceId) { this.conferenceId = conferenceId; } public ConferenceMemberExitCallback name(String name) { + this.name = name; return this; } @@ -159,12 +167,14 @@ public String getName() { return name; } + public void setName(String name) { this.name = name; } public ConferenceMemberExitCallback from(String from) { + this.from = from; return this; } @@ -178,12 +188,14 @@ public String getFrom() { return from; } + public void setFrom(String from) { this.from = from; } public ConferenceMemberExitCallback to(String to) { + this.to = to; return this; } @@ -197,12 +209,14 @@ public String getTo() { return to; } + public void setTo(String to) { this.to = to; } public ConferenceMemberExitCallback callId(String callId) { + this.callId = callId; return this; } @@ -216,12 +230,14 @@ public String getCallId() { return callId; } + public void setCallId(String callId) { this.callId = callId; } public ConferenceMemberExitCallback tag(String tag) { + this.tag = tag; return this; } @@ -235,6 +251,7 @@ public String getTag() { return tag; } + public void setTag(String tag) { this.tag = tag; } @@ -433,12 +450,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/ConferenceMemberJoinCallback.java b/src/main/java/com/bandwidth/sdk/model/ConferenceMemberJoinCallback.java index 6d3b9b06..1524aa62 100644 --- a/src/main/java/com/bandwidth/sdk/model/ConferenceMemberJoinCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/ConferenceMemberJoinCallback.java @@ -44,6 +44,7 @@ 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; @@ -89,6 +90,7 @@ public ConferenceMemberJoinCallback() { } public ConferenceMemberJoinCallback eventType(String eventType) { + this.eventType = eventType; return this; } @@ -102,12 +104,14 @@ public String getEventType() { return eventType; } + public void setEventType(String eventType) { this.eventType = eventType; } public ConferenceMemberJoinCallback eventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; return this; } @@ -121,12 +125,14 @@ public OffsetDateTime getEventTime() { return eventTime; } + public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public ConferenceMemberJoinCallback conferenceId(String conferenceId) { + this.conferenceId = conferenceId; return this; } @@ -140,12 +146,14 @@ public String getConferenceId() { return conferenceId; } + public void setConferenceId(String conferenceId) { this.conferenceId = conferenceId; } public ConferenceMemberJoinCallback name(String name) { + this.name = name; return this; } @@ -159,12 +167,14 @@ public String getName() { return name; } + public void setName(String name) { this.name = name; } public ConferenceMemberJoinCallback from(String from) { + this.from = from; return this; } @@ -178,12 +188,14 @@ public String getFrom() { return from; } + public void setFrom(String from) { this.from = from; } public ConferenceMemberJoinCallback to(String to) { + this.to = to; return this; } @@ -197,12 +209,14 @@ public String getTo() { return to; } + public void setTo(String to) { this.to = to; } public ConferenceMemberJoinCallback callId(String callId) { + this.callId = callId; return this; } @@ -216,12 +230,14 @@ public String getCallId() { return callId; } + public void setCallId(String callId) { this.callId = callId; } public ConferenceMemberJoinCallback tag(String tag) { + this.tag = tag; return this; } @@ -235,6 +251,7 @@ public String getTag() { return tag; } + public void setTag(String tag) { this.tag = tag; } @@ -433,12 +450,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/ConferenceRecordingAvailableCallback.java b/src/main/java/com/bandwidth/sdk/model/ConferenceRecordingAvailableCallback.java index eec5e1e7..c0785daf 100644 --- a/src/main/java/com/bandwidth/sdk/model/ConferenceRecordingAvailableCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/ConferenceRecordingAvailableCallback.java @@ -46,6 +46,7 @@ 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; @@ -115,6 +116,7 @@ public ConferenceRecordingAvailableCallback() { } public ConferenceRecordingAvailableCallback eventType(String eventType) { + this.eventType = eventType; return this; } @@ -128,12 +130,14 @@ public String getEventType() { return eventType; } + public void setEventType(String eventType) { this.eventType = eventType; } public ConferenceRecordingAvailableCallback eventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; return this; } @@ -147,12 +151,14 @@ public OffsetDateTime getEventTime() { return eventTime; } + public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public ConferenceRecordingAvailableCallback conferenceId(String conferenceId) { + this.conferenceId = conferenceId; return this; } @@ -166,12 +172,14 @@ public String getConferenceId() { return conferenceId; } + public void setConferenceId(String conferenceId) { this.conferenceId = conferenceId; } public ConferenceRecordingAvailableCallback name(String name) { + this.name = name; return this; } @@ -185,12 +193,14 @@ public String getName() { return name; } + public void setName(String name) { this.name = name; } public ConferenceRecordingAvailableCallback accountId(String accountId) { + this.accountId = accountId; return this; } @@ -204,12 +214,14 @@ public String getAccountId() { return accountId; } + public void setAccountId(String accountId) { this.accountId = accountId; } public ConferenceRecordingAvailableCallback recordingId(String recordingId) { + this.recordingId = recordingId; return this; } @@ -223,12 +235,14 @@ public String getRecordingId() { return recordingId; } + public void setRecordingId(String recordingId) { this.recordingId = recordingId; } public ConferenceRecordingAvailableCallback channels(Integer channels) { + this.channels = channels; return this; } @@ -242,12 +256,14 @@ public Integer getChannels() { return channels; } + public void setChannels(Integer channels) { this.channels = channels; } public ConferenceRecordingAvailableCallback startTime(OffsetDateTime startTime) { + this.startTime = startTime; return this; } @@ -261,12 +277,14 @@ public OffsetDateTime getStartTime() { return startTime; } + public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public ConferenceRecordingAvailableCallback endTime(OffsetDateTime endTime) { + this.endTime = endTime; return this; } @@ -280,12 +298,14 @@ public OffsetDateTime getEndTime() { return endTime; } + public void setEndTime(OffsetDateTime endTime) { this.endTime = endTime; } public ConferenceRecordingAvailableCallback duration(String duration) { + this.duration = duration; return this; } @@ -299,12 +319,14 @@ public String getDuration() { return duration; } + public void setDuration(String duration) { this.duration = duration; } public ConferenceRecordingAvailableCallback fileFormat(FileFormatEnum fileFormat) { + this.fileFormat = fileFormat; return this; } @@ -318,12 +340,14 @@ public FileFormatEnum getFileFormat() { return fileFormat; } + public void setFileFormat(FileFormatEnum fileFormat) { this.fileFormat = fileFormat; } public ConferenceRecordingAvailableCallback mediaUrl(URI mediaUrl) { + this.mediaUrl = mediaUrl; return this; } @@ -337,12 +361,14 @@ public URI getMediaUrl() { return mediaUrl; } + public void setMediaUrl(URI mediaUrl) { this.mediaUrl = mediaUrl; } public ConferenceRecordingAvailableCallback tag(String tag) { + this.tag = tag; return this; } @@ -356,12 +382,14 @@ public String getTag() { return tag; } + public void setTag(String tag) { this.tag = tag; } public ConferenceRecordingAvailableCallback status(String status) { + this.status = status; return this; } @@ -375,6 +403,7 @@ public String getStatus() { return status; } + public void setStatus(String status) { this.status = status; } @@ -558,10 +587,6 @@ 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())); } @@ -601,12 +626,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/ConferenceRecordingMetadata.java b/src/main/java/com/bandwidth/sdk/model/ConferenceRecordingMetadata.java index 01c5b260..17e88457 100644 --- a/src/main/java/com/bandwidth/sdk/model/ConferenceRecordingMetadata.java +++ b/src/main/java/com/bandwidth/sdk/model/ConferenceRecordingMetadata.java @@ -46,6 +46,7 @@ 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; @@ -103,6 +104,7 @@ public ConferenceRecordingMetadata() { } public ConferenceRecordingMetadata accountId(String accountId) { + this.accountId = accountId; return this; } @@ -116,12 +118,14 @@ public String getAccountId() { return accountId; } + public void setAccountId(String accountId) { this.accountId = accountId; } public ConferenceRecordingMetadata conferenceId(String conferenceId) { + this.conferenceId = conferenceId; return this; } @@ -135,12 +139,14 @@ public String getConferenceId() { return conferenceId; } + public void setConferenceId(String conferenceId) { this.conferenceId = conferenceId; } public ConferenceRecordingMetadata name(String name) { + this.name = name; return this; } @@ -154,12 +160,14 @@ public String getName() { return name; } + public void setName(String name) { this.name = name; } public ConferenceRecordingMetadata recordingId(String recordingId) { + this.recordingId = recordingId; return this; } @@ -173,12 +181,14 @@ public String getRecordingId() { return recordingId; } + public void setRecordingId(String recordingId) { this.recordingId = recordingId; } public ConferenceRecordingMetadata duration(String duration) { + this.duration = duration; return this; } @@ -192,12 +202,14 @@ public String getDuration() { return duration; } + public void setDuration(String duration) { this.duration = duration; } public ConferenceRecordingMetadata channels(Integer channels) { + this.channels = channels; return this; } @@ -211,12 +223,14 @@ public Integer getChannels() { return channels; } + public void setChannels(Integer channels) { this.channels = channels; } public ConferenceRecordingMetadata startTime(OffsetDateTime startTime) { + this.startTime = startTime; return this; } @@ -230,12 +244,14 @@ public OffsetDateTime getStartTime() { return startTime; } + public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public ConferenceRecordingMetadata endTime(OffsetDateTime endTime) { + this.endTime = endTime; return this; } @@ -249,12 +265,14 @@ public OffsetDateTime getEndTime() { return endTime; } + public void setEndTime(OffsetDateTime endTime) { this.endTime = endTime; } public ConferenceRecordingMetadata fileFormat(FileFormatEnum fileFormat) { + this.fileFormat = fileFormat; return this; } @@ -268,12 +286,14 @@ public FileFormatEnum getFileFormat() { return fileFormat; } + public void setFileFormat(FileFormatEnum fileFormat) { this.fileFormat = fileFormat; } public ConferenceRecordingMetadata status(String status) { + this.status = status; return this; } @@ -287,12 +307,14 @@ public String getStatus() { return status; } + public void setStatus(String status) { this.status = status; } public ConferenceRecordingMetadata mediaUrl(URI mediaUrl) { + this.mediaUrl = mediaUrl; return this; } @@ -306,6 +328,7 @@ public URI getMediaUrl() { return mediaUrl; } + public void setMediaUrl(URI mediaUrl) { this.mediaUrl = mediaUrl; } @@ -477,10 +500,6 @@ 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())); } @@ -517,12 +536,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/ConferenceRedirectCallback.java b/src/main/java/com/bandwidth/sdk/model/ConferenceRedirectCallback.java index 71e83f34..6158fcbf 100644 --- a/src/main/java/com/bandwidth/sdk/model/ConferenceRedirectCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/ConferenceRedirectCallback.java @@ -44,6 +44,7 @@ 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; @@ -77,6 +78,7 @@ public ConferenceRedirectCallback() { } public ConferenceRedirectCallback eventType(String eventType) { + this.eventType = eventType; return this; } @@ -90,12 +92,14 @@ public String getEventType() { return eventType; } + public void setEventType(String eventType) { this.eventType = eventType; } public ConferenceRedirectCallback eventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; return this; } @@ -109,12 +113,14 @@ public OffsetDateTime getEventTime() { return eventTime; } + public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public ConferenceRedirectCallback conferenceId(String conferenceId) { + this.conferenceId = conferenceId; return this; } @@ -128,12 +134,14 @@ public String getConferenceId() { return conferenceId; } + public void setConferenceId(String conferenceId) { this.conferenceId = conferenceId; } public ConferenceRedirectCallback name(String name) { + this.name = name; return this; } @@ -147,12 +155,14 @@ public String getName() { return name; } + public void setName(String name) { this.name = name; } public ConferenceRedirectCallback tag(String tag) { + this.tag = tag; return this; } @@ -166,6 +176,7 @@ public String getTag() { return tag; } + public void setTag(String tag) { this.tag = tag; } @@ -346,12 +357,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/ConferenceStateEnum.java b/src/main/java/com/bandwidth/sdk/model/ConferenceStateEnum.java index 8f457611..76446226 100644 --- a/src/main/java/com/bandwidth/sdk/model/ConferenceStateEnum.java +++ b/src/main/java/com/bandwidth/sdk/model/ConferenceStateEnum.java @@ -18,7 +18,6 @@ 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; @@ -69,10 +68,5 @@ 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 10a6d3a1..a965c1d7 100644 --- a/src/main/java/com/bandwidth/sdk/model/CreateCall.java +++ b/src/main/java/com/bandwidth/sdk/model/CreateCall.java @@ -46,6 +46,7 @@ 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,6 +140,7 @@ public CreateCall() { } public CreateCall to(String to) { + this.to = to; return this; } @@ -152,12 +154,14 @@ public String getTo() { return to; } + public void setTo(String to) { this.to = to; } public CreateCall from(String from) { + this.from = from; return this; } @@ -171,12 +175,14 @@ public String getFrom() { return from; } + public void setFrom(String from) { this.from = from; } public CreateCall displayName(String displayName) { + this.displayName = displayName; return this; } @@ -190,12 +196,14 @@ public String getDisplayName() { return displayName; } + public void setDisplayName(String displayName) { this.displayName = displayName; } public CreateCall uui(String uui) { + this.uui = uui; return this; } @@ -209,12 +217,14 @@ public String getUui() { return uui; } + public void setUui(String uui) { this.uui = uui; } public CreateCall applicationId(String applicationId) { + this.applicationId = applicationId; return this; } @@ -228,12 +238,14 @@ public String getApplicationId() { return applicationId; } + public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public CreateCall answerUrl(URI answerUrl) { + this.answerUrl = answerUrl; return this; } @@ -247,12 +259,14 @@ public URI getAnswerUrl() { return answerUrl; } + public void setAnswerUrl(URI answerUrl) { this.answerUrl = answerUrl; } public CreateCall answerMethod(CallbackMethodEnum answerMethod) { + this.answerMethod = answerMethod; return this; } @@ -266,12 +280,14 @@ public CallbackMethodEnum getAnswerMethod() { return answerMethod; } + public void setAnswerMethod(CallbackMethodEnum answerMethod) { this.answerMethod = answerMethod; } public CreateCall username(String username) { + this.username = username; return this; } @@ -285,12 +301,14 @@ public String getUsername() { return username; } + public void setUsername(String username) { this.username = username; } public CreateCall password(String password) { + this.password = password; return this; } @@ -304,12 +322,14 @@ public String getPassword() { return password; } + public void setPassword(String password) { this.password = password; } public CreateCall answerFallbackUrl(URI answerFallbackUrl) { + this.answerFallbackUrl = answerFallbackUrl; return this; } @@ -323,12 +343,14 @@ public URI getAnswerFallbackUrl() { return answerFallbackUrl; } + public void setAnswerFallbackUrl(URI answerFallbackUrl) { this.answerFallbackUrl = answerFallbackUrl; } public CreateCall answerFallbackMethod(CallbackMethodEnum answerFallbackMethod) { + this.answerFallbackMethod = answerFallbackMethod; return this; } @@ -342,12 +364,14 @@ public CallbackMethodEnum getAnswerFallbackMethod() { return answerFallbackMethod; } + public void setAnswerFallbackMethod(CallbackMethodEnum answerFallbackMethod) { this.answerFallbackMethod = answerFallbackMethod; } public CreateCall fallbackUsername(String fallbackUsername) { + this.fallbackUsername = fallbackUsername; return this; } @@ -361,12 +385,14 @@ public String getFallbackUsername() { return fallbackUsername; } + public void setFallbackUsername(String fallbackUsername) { this.fallbackUsername = fallbackUsername; } public CreateCall fallbackPassword(String fallbackPassword) { + this.fallbackPassword = fallbackPassword; return this; } @@ -380,12 +406,14 @@ public String getFallbackPassword() { return fallbackPassword; } + public void setFallbackPassword(String fallbackPassword) { this.fallbackPassword = fallbackPassword; } public CreateCall disconnectUrl(URI disconnectUrl) { + this.disconnectUrl = disconnectUrl; return this; } @@ -399,12 +427,14 @@ public URI getDisconnectUrl() { return disconnectUrl; } + public void setDisconnectUrl(URI disconnectUrl) { this.disconnectUrl = disconnectUrl; } public CreateCall disconnectMethod(CallbackMethodEnum disconnectMethod) { + this.disconnectMethod = disconnectMethod; return this; } @@ -418,12 +448,14 @@ public CallbackMethodEnum getDisconnectMethod() { return disconnectMethod; } + public void setDisconnectMethod(CallbackMethodEnum disconnectMethod) { this.disconnectMethod = disconnectMethod; } public CreateCall callTimeout(Double callTimeout) { + this.callTimeout = callTimeout; return this; } @@ -439,12 +471,14 @@ public Double getCallTimeout() { return callTimeout; } + public void setCallTimeout(Double callTimeout) { this.callTimeout = callTimeout; } public CreateCall callbackTimeout(Double callbackTimeout) { + this.callbackTimeout = callbackTimeout; return this; } @@ -460,12 +494,14 @@ public Double getCallbackTimeout() { return callbackTimeout; } + public void setCallbackTimeout(Double callbackTimeout) { this.callbackTimeout = callbackTimeout; } public CreateCall machineDetection(MachineDetectionConfiguration machineDetection) { + this.machineDetection = machineDetection; return this; } @@ -479,12 +515,14 @@ public MachineDetectionConfiguration getMachineDetection() { return machineDetection; } + public void setMachineDetection(MachineDetectionConfiguration machineDetection) { this.machineDetection = machineDetection; } public CreateCall priority(Integer priority) { + this.priority = priority; return this; } @@ -500,12 +538,14 @@ public Integer getPriority() { return priority; } + public void setPriority(Integer priority) { this.priority = priority; } public CreateCall tag(String tag) { + this.tag = tag; return this; } @@ -519,6 +559,7 @@ public String getTag() { return tag; } + public void setTag(String tag) { this.tag = tag; } @@ -731,10 +772,6 @@ 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())); } @@ -744,10 +781,6 @@ 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())); } @@ -757,10 +790,6 @@ 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")); @@ -798,12 +827,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/CreateCallResponse.java b/src/main/java/com/bandwidth/sdk/model/CreateCallResponse.java index a4d79525..e99359cc 100644 --- a/src/main/java/com/bandwidth/sdk/model/CreateCallResponse.java +++ b/src/main/java/com/bandwidth/sdk/model/CreateCallResponse.java @@ -46,6 +46,7 @@ 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; @@ -143,6 +144,7 @@ public CreateCallResponse() { } public CreateCallResponse applicationId(String applicationId) { + this.applicationId = applicationId; return this; } @@ -156,12 +158,14 @@ public String getApplicationId() { return applicationId; } + public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public CreateCallResponse accountId(String accountId) { + this.accountId = accountId; return this; } @@ -175,12 +179,14 @@ public String getAccountId() { return accountId; } + public void setAccountId(String accountId) { this.accountId = accountId; } public CreateCallResponse callId(String callId) { + this.callId = callId; return this; } @@ -194,12 +200,14 @@ public String getCallId() { return callId; } + public void setCallId(String callId) { this.callId = callId; } public CreateCallResponse to(String to) { + this.to = to; return this; } @@ -213,12 +221,14 @@ public String getTo() { return to; } + public void setTo(String to) { this.to = to; } public CreateCallResponse from(String from) { + this.from = from; return this; } @@ -232,12 +242,14 @@ public String getFrom() { return from; } + public void setFrom(String from) { this.from = from; } public CreateCallResponse enqueuedTime(OffsetDateTime enqueuedTime) { + this.enqueuedTime = enqueuedTime; return this; } @@ -251,12 +263,14 @@ public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } + public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public CreateCallResponse callUrl(URI callUrl) { + this.callUrl = callUrl; return this; } @@ -270,12 +284,14 @@ public URI getCallUrl() { return callUrl; } + public void setCallUrl(URI callUrl) { this.callUrl = callUrl; } public CreateCallResponse callTimeout(Double callTimeout) { + this.callTimeout = callTimeout; return this; } @@ -289,12 +305,14 @@ public Double getCallTimeout() { return callTimeout; } + public void setCallTimeout(Double callTimeout) { this.callTimeout = callTimeout; } public CreateCallResponse callbackTimeout(Double callbackTimeout) { + this.callbackTimeout = callbackTimeout; return this; } @@ -308,12 +326,14 @@ public Double getCallbackTimeout() { return callbackTimeout; } + public void setCallbackTimeout(Double callbackTimeout) { this.callbackTimeout = callbackTimeout; } public CreateCallResponse tag(String tag) { + this.tag = tag; return this; } @@ -327,12 +347,14 @@ public String getTag() { return tag; } + public void setTag(String tag) { this.tag = tag; } public CreateCallResponse answerMethod(CallbackMethodEnum answerMethod) { + this.answerMethod = answerMethod; return this; } @@ -346,12 +368,14 @@ public CallbackMethodEnum getAnswerMethod() { return answerMethod; } + public void setAnswerMethod(CallbackMethodEnum answerMethod) { this.answerMethod = answerMethod; } public CreateCallResponse answerUrl(URI answerUrl) { + this.answerUrl = answerUrl; return this; } @@ -365,12 +389,14 @@ public URI getAnswerUrl() { return answerUrl; } + public void setAnswerUrl(URI answerUrl) { this.answerUrl = answerUrl; } public CreateCallResponse answerFallbackMethod(CallbackMethodEnum answerFallbackMethod) { + this.answerFallbackMethod = answerFallbackMethod; return this; } @@ -384,12 +410,14 @@ public CallbackMethodEnum getAnswerFallbackMethod() { return answerFallbackMethod; } + public void setAnswerFallbackMethod(CallbackMethodEnum answerFallbackMethod) { this.answerFallbackMethod = answerFallbackMethod; } public CreateCallResponse answerFallbackUrl(URI answerFallbackUrl) { + this.answerFallbackUrl = answerFallbackUrl; return this; } @@ -403,12 +431,14 @@ public URI getAnswerFallbackUrl() { return answerFallbackUrl; } + public void setAnswerFallbackUrl(URI answerFallbackUrl) { this.answerFallbackUrl = answerFallbackUrl; } public CreateCallResponse disconnectMethod(CallbackMethodEnum disconnectMethod) { + this.disconnectMethod = disconnectMethod; return this; } @@ -422,12 +452,14 @@ public CallbackMethodEnum getDisconnectMethod() { return disconnectMethod; } + public void setDisconnectMethod(CallbackMethodEnum disconnectMethod) { this.disconnectMethod = disconnectMethod; } public CreateCallResponse disconnectUrl(URI disconnectUrl) { + this.disconnectUrl = disconnectUrl; return this; } @@ -441,12 +473,14 @@ public URI getDisconnectUrl() { return disconnectUrl; } + public void setDisconnectUrl(URI disconnectUrl) { this.disconnectUrl = disconnectUrl; } public CreateCallResponse username(String username) { + this.username = username; return this; } @@ -460,12 +494,14 @@ public String getUsername() { return username; } + public void setUsername(String username) { this.username = username; } public CreateCallResponse password(String password) { + this.password = password; return this; } @@ -479,12 +515,14 @@ public String getPassword() { return password; } + public void setPassword(String password) { this.password = password; } public CreateCallResponse fallbackUsername(String fallbackUsername) { + this.fallbackUsername = fallbackUsername; return this; } @@ -498,12 +536,14 @@ public String getFallbackUsername() { return fallbackUsername; } + public void setFallbackUsername(String fallbackUsername) { this.fallbackUsername = fallbackUsername; } public CreateCallResponse fallbackPassword(String fallbackPassword) { + this.fallbackPassword = fallbackPassword; return this; } @@ -517,12 +557,14 @@ public String getFallbackPassword() { return fallbackPassword; } + public void setFallbackPassword(String fallbackPassword) { this.fallbackPassword = fallbackPassword; } public CreateCallResponse priority(Integer priority) { + this.priority = priority; return this; } @@ -536,6 +578,7 @@ public Integer getPriority() { return priority; } + public void setPriority(Integer priority) { this.priority = priority; } @@ -759,20 +802,12 @@ 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())); } @@ -818,12 +853,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/CreateLookupResponse.java b/src/main/java/com/bandwidth/sdk/model/CreateLookupResponse.java index 72635523..5a9bdcab 100644 --- a/src/main/java/com/bandwidth/sdk/model/CreateLookupResponse.java +++ b/src/main/java/com/bandwidth/sdk/model/CreateLookupResponse.java @@ -43,6 +43,7 @@ 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,6 +65,7 @@ public CreateLookupResponse() { } public CreateLookupResponse requestId(String requestId) { + this.requestId = requestId; return this; } @@ -77,12 +79,14 @@ public String getRequestId() { return requestId; } + public void setRequestId(String requestId) { this.requestId = requestId; } public CreateLookupResponse status(LookupStatusEnum status) { + this.status = status; return this; } @@ -96,6 +100,7 @@ public LookupStatusEnum getStatus() { return status; } + public void setStatus(LookupStatusEnum status) { this.status = status; } @@ -217,10 +222,6 @@ 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 { @@ -251,12 +252,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/CreateMessageRequestError.java b/src/main/java/com/bandwidth/sdk/model/CreateMessageRequestError.java index 7289d0d2..a54042d2 100644 --- a/src/main/java/com/bandwidth/sdk/model/CreateMessageRequestError.java +++ b/src/main/java/com/bandwidth/sdk/model/CreateMessageRequestError.java @@ -45,6 +45,7 @@ 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; @@ -70,6 +71,7 @@ public CreateMessageRequestError() { } public CreateMessageRequestError type(String type) { + this.type = type; return this; } @@ -83,12 +85,14 @@ public String getType() { return type; } + public void setType(String type) { this.type = type; } public CreateMessageRequestError description(String description) { + this.description = description; return this; } @@ -102,12 +106,14 @@ public String getDescription() { return description; } + public void setDescription(String description) { this.description = description; } public CreateMessageRequestError fieldErrors(List fieldErrors) { + this.fieldErrors = fieldErrors; return this; } @@ -129,6 +135,7 @@ public List getFieldErrors() { return fieldErrors; } + public void setFieldErrors(List fieldErrors) { this.fieldErrors = fieldErrors; } @@ -309,12 +316,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/DeferredResult.java b/src/main/java/com/bandwidth/sdk/model/DeferredResult.java index b9f7fc69..2a480d08 100644 --- a/src/main/java/com/bandwidth/sdk/model/DeferredResult.java +++ b/src/main/java/com/bandwidth/sdk/model/DeferredResult.java @@ -42,6 +42,7 @@ 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,6 +64,7 @@ public DeferredResult() { } public DeferredResult result(Object result) { + this.result = result; return this; } @@ -76,12 +78,14 @@ public Object getResult() { return result; } + public void setResult(Object result) { this.result = result; } public DeferredResult setOrExpired(Boolean setOrExpired) { + this.setOrExpired = setOrExpired; return this; } @@ -95,6 +99,7 @@ public Boolean getSetOrExpired() { return setOrExpired; } + public void setSetOrExpired(Boolean setOrExpired) { this.setOrExpired = setOrExpired; } @@ -243,12 +248,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/DisconnectCallback.java b/src/main/java/com/bandwidth/sdk/model/DisconnectCallback.java index a6869eec..f0e11ec8 100644 --- a/src/main/java/com/bandwidth/sdk/model/DisconnectCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/DisconnectCallback.java @@ -45,6 +45,7 @@ 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; @@ -126,6 +127,7 @@ public DisconnectCallback() { } public DisconnectCallback eventType(String eventType) { + this.eventType = eventType; return this; } @@ -139,12 +141,14 @@ public String getEventType() { return eventType; } + public void setEventType(String eventType) { this.eventType = eventType; } public DisconnectCallback eventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; return this; } @@ -158,12 +162,14 @@ public OffsetDateTime getEventTime() { return eventTime; } + public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public DisconnectCallback accountId(String accountId) { + this.accountId = accountId; return this; } @@ -177,12 +183,14 @@ public String getAccountId() { return accountId; } + public void setAccountId(String accountId) { this.accountId = accountId; } public DisconnectCallback applicationId(String applicationId) { + this.applicationId = applicationId; return this; } @@ -196,12 +204,14 @@ public String getApplicationId() { return applicationId; } + public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public DisconnectCallback from(String from) { + this.from = from; return this; } @@ -215,12 +225,14 @@ public String getFrom() { return from; } + public void setFrom(String from) { this.from = from; } public DisconnectCallback to(String to) { + this.to = to; return this; } @@ -234,12 +246,14 @@ public String getTo() { return to; } + public void setTo(String to) { this.to = to; } public DisconnectCallback callId(String callId) { + this.callId = callId; return this; } @@ -253,12 +267,14 @@ public String getCallId() { return callId; } + public void setCallId(String callId) { this.callId = callId; } public DisconnectCallback direction(CallDirectionEnum direction) { + this.direction = direction; return this; } @@ -272,12 +288,14 @@ public CallDirectionEnum getDirection() { return direction; } + public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public DisconnectCallback callUrl(String callUrl) { + this.callUrl = callUrl; return this; } @@ -291,12 +309,14 @@ public String getCallUrl() { return callUrl; } + public void setCallUrl(String callUrl) { this.callUrl = callUrl; } public DisconnectCallback enqueuedTime(OffsetDateTime enqueuedTime) { + this.enqueuedTime = enqueuedTime; return this; } @@ -310,12 +330,14 @@ public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } + public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public DisconnectCallback startTime(OffsetDateTime startTime) { + this.startTime = startTime; return this; } @@ -329,12 +351,14 @@ public OffsetDateTime getStartTime() { return startTime; } + public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public DisconnectCallback answerTime(OffsetDateTime answerTime) { + this.answerTime = answerTime; return this; } @@ -348,12 +372,14 @@ public OffsetDateTime getAnswerTime() { return answerTime; } + public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public DisconnectCallback endTime(OffsetDateTime endTime) { + this.endTime = endTime; return this; } @@ -367,12 +393,14 @@ public OffsetDateTime getEndTime() { return endTime; } + public void setEndTime(OffsetDateTime endTime) { this.endTime = endTime; } public DisconnectCallback cause(String cause) { + this.cause = cause; return this; } @@ -386,12 +414,14 @@ public String getCause() { return cause; } + public void setCause(String cause) { this.cause = cause; } public DisconnectCallback errorMessage(String errorMessage) { + this.errorMessage = errorMessage; return this; } @@ -405,12 +435,14 @@ public String getErrorMessage() { return errorMessage; } + public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; } public DisconnectCallback errorId(String errorId) { + this.errorId = errorId; return this; } @@ -424,12 +456,14 @@ public String getErrorId() { return errorId; } + public void setErrorId(String errorId) { this.errorId = errorId; } public DisconnectCallback tag(String tag) { + this.tag = tag; return this; } @@ -443,6 +477,7 @@ public String getTag() { return tag; } + public void setTag(String tag) { this.tag = tag; } @@ -635,10 +670,6 @@ 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())); } @@ -684,12 +715,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/Diversion.java b/src/main/java/com/bandwidth/sdk/model/Diversion.java index 11ea34b7..78fc646b 100644 --- a/src/main/java/com/bandwidth/sdk/model/Diversion.java +++ b/src/main/java/com/bandwidth/sdk/model/Diversion.java @@ -42,6 +42,7 @@ 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,6 +84,7 @@ public Diversion() { } public Diversion reason(String reason) { + this.reason = reason; return this; } @@ -96,12 +98,14 @@ public String getReason() { return reason; } + public void setReason(String reason) { this.reason = reason; } public Diversion privacy(String privacy) { + this.privacy = privacy; return this; } @@ -115,12 +119,14 @@ public String getPrivacy() { return privacy; } + public void setPrivacy(String privacy) { this.privacy = privacy; } public Diversion screen(String screen) { + this.screen = screen; return this; } @@ -134,12 +140,14 @@ public String getScreen() { return screen; } + public void setScreen(String screen) { this.screen = screen; } public Diversion counter(String counter) { + this.counter = counter; return this; } @@ -153,12 +161,14 @@ public String getCounter() { return counter; } + public void setCounter(String counter) { this.counter = counter; } public Diversion limit(String limit) { + this.limit = limit; return this; } @@ -172,12 +182,14 @@ public String getLimit() { return limit; } + public void setLimit(String limit) { this.limit = limit; } public Diversion unknown(String unknown) { + this.unknown = unknown; return this; } @@ -191,12 +203,14 @@ public String getUnknown() { return unknown; } + public void setUnknown(String unknown) { this.unknown = unknown; } public Diversion origTo(String origTo) { + this.origTo = origTo; return this; } @@ -210,6 +224,7 @@ public String getOrigTo() { return origTo; } + public void setOrigTo(String origTo) { this.origTo = origTo; } @@ -394,12 +409,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/DtmfCallback.java b/src/main/java/com/bandwidth/sdk/model/DtmfCallback.java index 61a3ae3c..73fd1608 100644 --- a/src/main/java/com/bandwidth/sdk/model/DtmfCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/DtmfCallback.java @@ -45,6 +45,7 @@ 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; @@ -126,6 +127,7 @@ public DtmfCallback() { } public DtmfCallback eventType(String eventType) { + this.eventType = eventType; return this; } @@ -139,12 +141,14 @@ public String getEventType() { return eventType; } + public void setEventType(String eventType) { this.eventType = eventType; } public DtmfCallback eventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; return this; } @@ -158,12 +162,14 @@ public OffsetDateTime getEventTime() { return eventTime; } + public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public DtmfCallback accountId(String accountId) { + this.accountId = accountId; return this; } @@ -177,12 +183,14 @@ public String getAccountId() { return accountId; } + public void setAccountId(String accountId) { this.accountId = accountId; } public DtmfCallback applicationId(String applicationId) { + this.applicationId = applicationId; return this; } @@ -196,12 +204,14 @@ public String getApplicationId() { return applicationId; } + public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public DtmfCallback from(String from) { + this.from = from; return this; } @@ -215,12 +225,14 @@ public String getFrom() { return from; } + public void setFrom(String from) { this.from = from; } public DtmfCallback to(String to) { + this.to = to; return this; } @@ -234,12 +246,14 @@ public String getTo() { return to; } + public void setTo(String to) { this.to = to; } public DtmfCallback callId(String callId) { + this.callId = callId; return this; } @@ -253,12 +267,14 @@ public String getCallId() { return callId; } + public void setCallId(String callId) { this.callId = callId; } public DtmfCallback direction(CallDirectionEnum direction) { + this.direction = direction; return this; } @@ -272,12 +288,14 @@ public CallDirectionEnum getDirection() { return direction; } + public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public DtmfCallback digit(String digit) { + this.digit = digit; return this; } @@ -291,12 +309,14 @@ public String getDigit() { return digit; } + public void setDigit(String digit) { this.digit = digit; } public DtmfCallback callUrl(String callUrl) { + this.callUrl = callUrl; return this; } @@ -310,12 +330,14 @@ public String getCallUrl() { return callUrl; } + public void setCallUrl(String callUrl) { this.callUrl = callUrl; } public DtmfCallback enqueuedTime(OffsetDateTime enqueuedTime) { + this.enqueuedTime = enqueuedTime; return this; } @@ -329,12 +351,14 @@ public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } + public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public DtmfCallback startTime(OffsetDateTime startTime) { + this.startTime = startTime; return this; } @@ -348,12 +372,14 @@ public OffsetDateTime getStartTime() { return startTime; } + public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public DtmfCallback answerTime(OffsetDateTime answerTime) { + this.answerTime = answerTime; return this; } @@ -367,12 +393,14 @@ public OffsetDateTime getAnswerTime() { return answerTime; } + public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public DtmfCallback parentCallId(String parentCallId) { + this.parentCallId = parentCallId; return this; } @@ -386,12 +414,14 @@ public String getParentCallId() { return parentCallId; } + public void setParentCallId(String parentCallId) { this.parentCallId = parentCallId; } public DtmfCallback transferCallerId(String transferCallerId) { + this.transferCallerId = transferCallerId; return this; } @@ -405,12 +435,14 @@ public String getTransferCallerId() { return transferCallerId; } + public void setTransferCallerId(String transferCallerId) { this.transferCallerId = transferCallerId; } public DtmfCallback transferTo(String transferTo) { + this.transferTo = transferTo; return this; } @@ -424,12 +456,14 @@ public String getTransferTo() { return transferTo; } + public void setTransferTo(String transferTo) { this.transferTo = transferTo; } public DtmfCallback tag(String tag) { + this.tag = tag; return this; } @@ -443,6 +477,7 @@ public String getTag() { return tag; } + public void setTag(String tag) { this.tag = tag; } @@ -635,10 +670,6 @@ 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())); } @@ -687,12 +718,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/FieldError.java b/src/main/java/com/bandwidth/sdk/model/FieldError.java index 4ebd11a5..46618903 100644 --- a/src/main/java/com/bandwidth/sdk/model/FieldError.java +++ b/src/main/java/com/bandwidth/sdk/model/FieldError.java @@ -42,6 +42,7 @@ 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,6 +64,7 @@ public FieldError() { } public FieldError fieldName(String fieldName) { + this.fieldName = fieldName; return this; } @@ -76,12 +78,14 @@ public String getFieldName() { return fieldName; } + public void setFieldName(String fieldName) { this.fieldName = fieldName; } public FieldError description(String description) { + this.description = description; return this; } @@ -95,6 +99,7 @@ public String getDescription() { return description; } + public void setDescription(String description) { this.description = description; } @@ -249,12 +254,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/FileFormatEnum.java b/src/main/java/com/bandwidth/sdk/model/FileFormatEnum.java index 1f27ba16..69296f70 100644 --- a/src/main/java/com/bandwidth/sdk/model/FileFormatEnum.java +++ b/src/main/java/com/bandwidth/sdk/model/FileFormatEnum.java @@ -18,7 +18,6 @@ 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; @@ -69,10 +68,5 @@ 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 8141bd97..8ac36f91 100644 --- a/src/main/java/com/bandwidth/sdk/model/GatherCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/GatherCallback.java @@ -45,6 +45,7 @@ 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; @@ -130,6 +131,7 @@ public GatherCallback() { } public GatherCallback eventType(String eventType) { + this.eventType = eventType; return this; } @@ -143,12 +145,14 @@ public String getEventType() { return eventType; } + public void setEventType(String eventType) { this.eventType = eventType; } public GatherCallback eventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; return this; } @@ -162,12 +166,14 @@ public OffsetDateTime getEventTime() { return eventTime; } + public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public GatherCallback accountId(String accountId) { + this.accountId = accountId; return this; } @@ -181,12 +187,14 @@ public String getAccountId() { return accountId; } + public void setAccountId(String accountId) { this.accountId = accountId; } public GatherCallback applicationId(String applicationId) { + this.applicationId = applicationId; return this; } @@ -200,12 +208,14 @@ public String getApplicationId() { return applicationId; } + public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public GatherCallback from(String from) { + this.from = from; return this; } @@ -219,12 +229,14 @@ public String getFrom() { return from; } + public void setFrom(String from) { this.from = from; } public GatherCallback to(String to) { + this.to = to; return this; } @@ -238,12 +250,14 @@ public String getTo() { return to; } + public void setTo(String to) { this.to = to; } public GatherCallback direction(CallDirectionEnum direction) { + this.direction = direction; return this; } @@ -257,12 +271,14 @@ public CallDirectionEnum getDirection() { return direction; } + public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public GatherCallback callId(String callId) { + this.callId = callId; return this; } @@ -276,12 +292,14 @@ public String getCallId() { return callId; } + public void setCallId(String callId) { this.callId = callId; } public GatherCallback digits(String digits) { + this.digits = digits; return this; } @@ -295,12 +313,14 @@ public String getDigits() { return digits; } + public void setDigits(String digits) { this.digits = digits; } public GatherCallback callUrl(String callUrl) { + this.callUrl = callUrl; return this; } @@ -314,12 +334,14 @@ public String getCallUrl() { return callUrl; } + public void setCallUrl(String callUrl) { this.callUrl = callUrl; } public GatherCallback enqueuedTime(OffsetDateTime enqueuedTime) { + this.enqueuedTime = enqueuedTime; return this; } @@ -333,12 +355,14 @@ public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } + public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public GatherCallback startTime(OffsetDateTime startTime) { + this.startTime = startTime; return this; } @@ -352,12 +376,14 @@ public OffsetDateTime getStartTime() { return startTime; } + public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public GatherCallback answerTime(OffsetDateTime answerTime) { + this.answerTime = answerTime; return this; } @@ -371,12 +397,14 @@ public OffsetDateTime getAnswerTime() { return answerTime; } + public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public GatherCallback parentCallId(String parentCallId) { + this.parentCallId = parentCallId; return this; } @@ -390,12 +418,14 @@ public String getParentCallId() { return parentCallId; } + public void setParentCallId(String parentCallId) { this.parentCallId = parentCallId; } public GatherCallback terminatingDigit(String terminatingDigit) { + this.terminatingDigit = terminatingDigit; return this; } @@ -409,12 +439,14 @@ public String getTerminatingDigit() { return terminatingDigit; } + public void setTerminatingDigit(String terminatingDigit) { this.terminatingDigit = terminatingDigit; } public GatherCallback transferCallerId(String transferCallerId) { + this.transferCallerId = transferCallerId; return this; } @@ -428,12 +460,14 @@ public String getTransferCallerId() { return transferCallerId; } + public void setTransferCallerId(String transferCallerId) { this.transferCallerId = transferCallerId; } public GatherCallback transferTo(String transferTo) { + this.transferTo = transferTo; return this; } @@ -447,12 +481,14 @@ public String getTransferTo() { return transferTo; } + public void setTransferTo(String transferTo) { this.transferTo = transferTo; } public GatherCallback tag(String tag) { + this.tag = tag; return this; } @@ -466,6 +502,7 @@ public String getTag() { return tag; } + public void setTag(String tag) { this.tag = tag; } @@ -658,10 +695,6 @@ 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())); } @@ -716,12 +749,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/InboundMessageCallback.java b/src/main/java/com/bandwidth/sdk/model/InboundMessageCallback.java index 05c05577..1ba464ec 100644 --- a/src/main/java/com/bandwidth/sdk/model/InboundMessageCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/InboundMessageCallback.java @@ -44,6 +44,7 @@ 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; @@ -77,6 +78,7 @@ public InboundMessageCallback() { } public InboundMessageCallback time(OffsetDateTime time) { + this.time = time; return this; } @@ -90,12 +92,14 @@ public OffsetDateTime getTime() { return time; } + public void setTime(OffsetDateTime time) { this.time = time; } public InboundMessageCallback type(String type) { + this.type = type; return this; } @@ -109,12 +113,14 @@ public String getType() { return type; } + public void setType(String type) { this.type = type; } public InboundMessageCallback to(String to) { + this.to = to; return this; } @@ -128,12 +134,14 @@ public String getTo() { return to; } + public void setTo(String to) { this.to = to; } public InboundMessageCallback description(String description) { + this.description = description; return this; } @@ -147,12 +155,14 @@ public String getDescription() { return description; } + public void setDescription(String description) { this.description = description; } public InboundMessageCallback message(InboundMessageCallbackMessage message) { + this.message = message; return this; } @@ -166,6 +176,7 @@ public InboundMessageCallbackMessage getMessage() { return message; } + public void setMessage(InboundMessageCallbackMessage message) { this.message = message; } @@ -346,12 +357,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/InboundMessageCallbackMessage.java b/src/main/java/com/bandwidth/sdk/model/InboundMessageCallbackMessage.java index d88c356a..9d5d99d9 100644 --- a/src/main/java/com/bandwidth/sdk/model/InboundMessageCallbackMessage.java +++ b/src/main/java/com/bandwidth/sdk/model/InboundMessageCallbackMessage.java @@ -50,6 +50,7 @@ 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,6 +112,7 @@ public InboundMessageCallbackMessage() { } public InboundMessageCallbackMessage id(String id) { + this.id = id; return this; } @@ -124,12 +126,14 @@ public String getId() { return id; } + public void setId(String id) { this.id = id; } public InboundMessageCallbackMessage owner(String owner) { + this.owner = owner; return this; } @@ -143,12 +147,14 @@ public String getOwner() { return owner; } + public void setOwner(String owner) { this.owner = owner; } public InboundMessageCallbackMessage applicationId(String applicationId) { + this.applicationId = applicationId; return this; } @@ -162,12 +168,14 @@ public String getApplicationId() { return applicationId; } + public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public InboundMessageCallbackMessage time(OffsetDateTime time) { + this.time = time; return this; } @@ -181,12 +189,14 @@ public OffsetDateTime getTime() { return time; } + public void setTime(OffsetDateTime time) { this.time = time; } public InboundMessageCallbackMessage segmentCount(Integer segmentCount) { + this.segmentCount = segmentCount; return this; } @@ -200,12 +210,14 @@ public Integer getSegmentCount() { return segmentCount; } + public void setSegmentCount(Integer segmentCount) { this.segmentCount = segmentCount; } public InboundMessageCallbackMessage direction(MessageDirectionEnum direction) { + this.direction = direction; return this; } @@ -219,12 +231,14 @@ public MessageDirectionEnum getDirection() { return direction; } + public void setDirection(MessageDirectionEnum direction) { this.direction = direction; } public InboundMessageCallbackMessage to(Set to) { + this.to = to; return this; } @@ -246,12 +260,14 @@ public Set getTo() { return to; } + public void setTo(Set to) { this.to = to; } public InboundMessageCallbackMessage from(String from) { + this.from = from; return this; } @@ -265,12 +281,14 @@ public String getFrom() { return from; } + public void setFrom(String from) { this.from = from; } public InboundMessageCallbackMessage text(String text) { + this.text = text; return this; } @@ -284,12 +302,14 @@ public String getText() { return text; } + public void setText(String text) { this.text = text; } public InboundMessageCallbackMessage tag(String tag) { + this.tag = tag; return this; } @@ -303,12 +323,14 @@ public String getTag() { return tag; } + public void setTag(String tag) { this.tag = tag; } public InboundMessageCallbackMessage media(List media) { + this.media = media; return this; } @@ -330,12 +352,14 @@ public List getMedia() { return media; } + public void setMedia(List media) { this.media = media; } public InboundMessageCallbackMessage priority(PriorityEnum priority) { + this.priority = priority; return this; } @@ -349,6 +373,7 @@ public PriorityEnum getPriority() { return priority; } + public void setPriority(PriorityEnum priority) { this.priority = priority; } @@ -522,8 +547,6 @@ 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`"); @@ -543,10 +566,6 @@ 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 { @@ -577,12 +596,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/InitiateCallback.java b/src/main/java/com/bandwidth/sdk/model/InitiateCallback.java index cbb5c651..ed3e6394 100644 --- a/src/main/java/com/bandwidth/sdk/model/InitiateCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/InitiateCallback.java @@ -46,6 +46,7 @@ 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; @@ -107,6 +108,7 @@ public InitiateCallback() { } public InitiateCallback eventType(String eventType) { + this.eventType = eventType; return this; } @@ -120,12 +122,14 @@ public String getEventType() { return eventType; } + public void setEventType(String eventType) { this.eventType = eventType; } public InitiateCallback eventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; return this; } @@ -139,12 +143,14 @@ public OffsetDateTime getEventTime() { return eventTime; } + public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public InitiateCallback accountId(String accountId) { + this.accountId = accountId; return this; } @@ -158,12 +164,14 @@ public String getAccountId() { return accountId; } + public void setAccountId(String accountId) { this.accountId = accountId; } public InitiateCallback applicationId(String applicationId) { + this.applicationId = applicationId; return this; } @@ -177,12 +185,14 @@ public String getApplicationId() { return applicationId; } + public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public InitiateCallback from(String from) { + this.from = from; return this; } @@ -196,12 +206,14 @@ public String getFrom() { return from; } + public void setFrom(String from) { this.from = from; } public InitiateCallback to(String to) { + this.to = to; return this; } @@ -215,12 +227,14 @@ public String getTo() { return to; } + public void setTo(String to) { this.to = to; } public InitiateCallback direction(CallDirectionEnum direction) { + this.direction = direction; return this; } @@ -234,12 +248,14 @@ public CallDirectionEnum getDirection() { return direction; } + public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public InitiateCallback callId(String callId) { + this.callId = callId; return this; } @@ -253,12 +269,14 @@ public String getCallId() { return callId; } + public void setCallId(String callId) { this.callId = callId; } public InitiateCallback callUrl(String callUrl) { + this.callUrl = callUrl; return this; } @@ -272,12 +290,14 @@ public String getCallUrl() { return callUrl; } + public void setCallUrl(String callUrl) { this.callUrl = callUrl; } public InitiateCallback startTime(OffsetDateTime startTime) { + this.startTime = startTime; return this; } @@ -291,12 +311,14 @@ public OffsetDateTime getStartTime() { return startTime; } + public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public InitiateCallback diversion(Diversion diversion) { + this.diversion = diversion; return this; } @@ -310,12 +332,14 @@ public Diversion getDiversion() { return diversion; } + public void setDiversion(Diversion diversion) { this.diversion = diversion; } public InitiateCallback stirShaken(StirShaken stirShaken) { + this.stirShaken = stirShaken; return this; } @@ -329,6 +353,7 @@ public StirShaken getStirShaken() { return stirShaken; } + public void setStirShaken(StirShaken stirShaken) { this.stirShaken = stirShaken; } @@ -492,10 +517,6 @@ 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())); } @@ -540,12 +561,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/ListMessageDirectionEnum.java b/src/main/java/com/bandwidth/sdk/model/ListMessageDirectionEnum.java index f175c9cd..5fbe269b 100644 --- a/src/main/java/com/bandwidth/sdk/model/ListMessageDirectionEnum.java +++ b/src/main/java/com/bandwidth/sdk/model/ListMessageDirectionEnum.java @@ -18,7 +18,6 @@ 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; @@ -69,10 +68,5 @@ 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 2ba9635d..465c76f0 100644 --- a/src/main/java/com/bandwidth/sdk/model/ListMessageItem.java +++ b/src/main/java/com/bandwidth/sdk/model/ListMessageItem.java @@ -47,6 +47,7 @@ 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; @@ -128,6 +129,7 @@ public ListMessageItem() { } public ListMessageItem messageId(String messageId) { + this.messageId = messageId; return this; } @@ -141,12 +143,14 @@ public String getMessageId() { return messageId; } + public void setMessageId(String messageId) { this.messageId = messageId; } public ListMessageItem accountId(String accountId) { + this.accountId = accountId; return this; } @@ -160,12 +164,14 @@ public String getAccountId() { return accountId; } + public void setAccountId(String accountId) { this.accountId = accountId; } public ListMessageItem sourceTn(String sourceTn) { + this.sourceTn = sourceTn; return this; } @@ -179,12 +185,14 @@ public String getSourceTn() { return sourceTn; } + public void setSourceTn(String sourceTn) { this.sourceTn = sourceTn; } public ListMessageItem destinationTn(String destinationTn) { + this.destinationTn = destinationTn; return this; } @@ -198,12 +206,14 @@ public String getDestinationTn() { return destinationTn; } + public void setDestinationTn(String destinationTn) { this.destinationTn = destinationTn; } public ListMessageItem messageStatus(MessageStatusEnum messageStatus) { + this.messageStatus = messageStatus; return this; } @@ -217,12 +227,14 @@ public MessageStatusEnum getMessageStatus() { return messageStatus; } + public void setMessageStatus(MessageStatusEnum messageStatus) { this.messageStatus = messageStatus; } public ListMessageItem messageDirection(ListMessageDirectionEnum messageDirection) { + this.messageDirection = messageDirection; return this; } @@ -236,12 +248,14 @@ public ListMessageDirectionEnum getMessageDirection() { return messageDirection; } + public void setMessageDirection(ListMessageDirectionEnum messageDirection) { this.messageDirection = messageDirection; } public ListMessageItem messageType(MessageTypeEnum messageType) { + this.messageType = messageType; return this; } @@ -255,12 +269,14 @@ public MessageTypeEnum getMessageType() { return messageType; } + public void setMessageType(MessageTypeEnum messageType) { this.messageType = messageType; } public ListMessageItem segmentCount(Integer segmentCount) { + this.segmentCount = segmentCount; return this; } @@ -274,12 +290,14 @@ public Integer getSegmentCount() { return segmentCount; } + public void setSegmentCount(Integer segmentCount) { this.segmentCount = segmentCount; } public ListMessageItem errorCode(Integer errorCode) { + this.errorCode = errorCode; return this; } @@ -293,12 +311,14 @@ public Integer getErrorCode() { return errorCode; } + public void setErrorCode(Integer errorCode) { this.errorCode = errorCode; } public ListMessageItem receiveTime(OffsetDateTime receiveTime) { + this.receiveTime = receiveTime; return this; } @@ -312,12 +332,14 @@ public OffsetDateTime getReceiveTime() { return receiveTime; } + public void setReceiveTime(OffsetDateTime receiveTime) { this.receiveTime = receiveTime; } public ListMessageItem carrierName(String carrierName) { + this.carrierName = carrierName; return this; } @@ -331,12 +353,14 @@ public String getCarrierName() { return carrierName; } + public void setCarrierName(String carrierName) { this.carrierName = carrierName; } public ListMessageItem messageSize(Integer messageSize) { + this.messageSize = messageSize; return this; } @@ -350,12 +374,14 @@ public Integer getMessageSize() { return messageSize; } + public void setMessageSize(Integer messageSize) { this.messageSize = messageSize; } public ListMessageItem messageLength(Integer messageLength) { + this.messageLength = messageLength; return this; } @@ -369,12 +395,14 @@ public Integer getMessageLength() { return messageLength; } + public void setMessageLength(Integer messageLength) { this.messageLength = messageLength; } public ListMessageItem attachmentCount(Integer attachmentCount) { + this.attachmentCount = attachmentCount; return this; } @@ -388,12 +416,14 @@ public Integer getAttachmentCount() { return attachmentCount; } + public void setAttachmentCount(Integer attachmentCount) { this.attachmentCount = attachmentCount; } public ListMessageItem recipientCount(Integer recipientCount) { + this.recipientCount = recipientCount; return this; } @@ -407,12 +437,14 @@ public Integer getRecipientCount() { return recipientCount; } + public void setRecipientCount(Integer recipientCount) { this.recipientCount = recipientCount; } public ListMessageItem campaignClass(String campaignClass) { + this.campaignClass = campaignClass; return this; } @@ -426,12 +458,14 @@ public String getCampaignClass() { return campaignClass; } + public void setCampaignClass(String campaignClass) { this.campaignClass = campaignClass; } public ListMessageItem campaignId(String campaignId) { + this.campaignId = campaignId; return this; } @@ -445,6 +479,7 @@ public String getCampaignId() { return campaignId; } + public void setCampaignId(String campaignId) { this.campaignId = campaignId; } @@ -631,18 +666,6 @@ 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())); } @@ -682,12 +705,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/LookupRequest.java b/src/main/java/com/bandwidth/sdk/model/LookupRequest.java index 79ab25b9..f41a7f01 100644 --- a/src/main/java/com/bandwidth/sdk/model/LookupRequest.java +++ b/src/main/java/com/bandwidth/sdk/model/LookupRequest.java @@ -44,6 +44,7 @@ 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,6 +62,7 @@ public LookupRequest() { } public LookupRequest tns(List tns) { + this.tns = tns; return this; } @@ -82,6 +84,7 @@ public List getTns() { return tns; } + public void setTns(List tns) { this.tns = tns; } @@ -241,12 +244,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/LookupResult.java b/src/main/java/com/bandwidth/sdk/model/LookupResult.java index 0d353417..7238b192 100644 --- a/src/main/java/com/bandwidth/sdk/model/LookupResult.java +++ b/src/main/java/com/bandwidth/sdk/model/LookupResult.java @@ -42,6 +42,7 @@ 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; @@ -91,6 +92,7 @@ public LookupResult() { } public LookupResult responseCode(Integer responseCode) { + this.responseCode = responseCode; return this; } @@ -104,12 +106,14 @@ public Integer getResponseCode() { return responseCode; } + public void setResponseCode(Integer responseCode) { this.responseCode = responseCode; } public LookupResult message(String message) { + this.message = message; return this; } @@ -123,12 +127,14 @@ public String getMessage() { return message; } + public void setMessage(String message) { this.message = message; } public LookupResult e164Format(String e164Format) { + this.e164Format = e164Format; return this; } @@ -142,12 +148,14 @@ public String getE164Format() { return e164Format; } + public void setE164Format(String e164Format) { this.e164Format = e164Format; } public LookupResult formatted(String formatted) { + this.formatted = formatted; return this; } @@ -161,12 +169,14 @@ public String getFormatted() { return formatted; } + public void setFormatted(String formatted) { this.formatted = formatted; } public LookupResult country(String country) { + this.country = country; return this; } @@ -180,12 +190,14 @@ public String getCountry() { return country; } + public void setCountry(String country) { this.country = country; } public LookupResult lineType(String lineType) { + this.lineType = lineType; return this; } @@ -199,12 +211,14 @@ public String getLineType() { return lineType; } + public void setLineType(String lineType) { this.lineType = lineType; } public LookupResult lineProvider(String lineProvider) { + this.lineProvider = lineProvider; return this; } @@ -218,12 +232,14 @@ public String getLineProvider() { return lineProvider; } + public void setLineProvider(String lineProvider) { this.lineProvider = lineProvider; } public LookupResult mobileCountryCode(String mobileCountryCode) { + this.mobileCountryCode = mobileCountryCode; return this; } @@ -237,12 +253,14 @@ public String getMobileCountryCode() { return mobileCountryCode; } + public void setMobileCountryCode(String mobileCountryCode) { this.mobileCountryCode = mobileCountryCode; } public LookupResult mobileNetworkCode(String mobileNetworkCode) { + this.mobileNetworkCode = mobileNetworkCode; return this; } @@ -256,6 +274,7 @@ public String getMobileNetworkCode() { return mobileNetworkCode; } + public void setMobileNetworkCode(String mobileNetworkCode) { this.mobileNetworkCode = mobileNetworkCode; } @@ -449,12 +468,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/LookupStatus.java b/src/main/java/com/bandwidth/sdk/model/LookupStatus.java index f438c752..227b1bd3 100644 --- a/src/main/java/com/bandwidth/sdk/model/LookupStatus.java +++ b/src/main/java/com/bandwidth/sdk/model/LookupStatus.java @@ -46,6 +46,7 @@ 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; @@ -75,6 +76,7 @@ public LookupStatus() { } public LookupStatus requestId(String requestId) { + this.requestId = requestId; return this; } @@ -88,12 +90,14 @@ public String getRequestId() { return requestId; } + public void setRequestId(String requestId) { this.requestId = requestId; } public LookupStatus status(LookupStatusEnum status) { + this.status = status; return this; } @@ -107,12 +111,14 @@ public LookupStatusEnum getStatus() { return status; } + public void setStatus(LookupStatusEnum status) { this.status = status; } public LookupStatus result(List result) { + this.result = result; return this; } @@ -134,12 +140,14 @@ public List getResult() { return result; } + public void setResult(List result) { this.result = result; } public LookupStatus failedTelephoneNumbers(List failedTelephoneNumbers) { + this.failedTelephoneNumbers = failedTelephoneNumbers; return this; } @@ -161,6 +169,7 @@ public List getFailedTelephoneNumbers() { return failedTelephoneNumbers; } + public void setFailedTelephoneNumbers(List failedTelephoneNumbers) { this.failedTelephoneNumbers = failedTelephoneNumbers; } @@ -288,10 +297,6 @@ 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) { @@ -340,12 +345,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/LookupStatusEnum.java b/src/main/java/com/bandwidth/sdk/model/LookupStatusEnum.java index 02a72484..59798a1f 100644 --- a/src/main/java/com/bandwidth/sdk/model/LookupStatusEnum.java +++ b/src/main/java/com/bandwidth/sdk/model/LookupStatusEnum.java @@ -18,7 +18,6 @@ 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; @@ -73,10 +72,5 @@ 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 7d380947..1e3e414f 100644 --- a/src/main/java/com/bandwidth/sdk/model/MachineDetectionCompleteCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/MachineDetectionCompleteCallback.java @@ -46,6 +46,7 @@ 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; @@ -115,6 +116,7 @@ public MachineDetectionCompleteCallback() { } public MachineDetectionCompleteCallback eventType(String eventType) { + this.eventType = eventType; return this; } @@ -128,12 +130,14 @@ public String getEventType() { return eventType; } + public void setEventType(String eventType) { this.eventType = eventType; } public MachineDetectionCompleteCallback eventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; return this; } @@ -147,12 +151,14 @@ public OffsetDateTime getEventTime() { return eventTime; } + public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public MachineDetectionCompleteCallback accountId(String accountId) { + this.accountId = accountId; return this; } @@ -166,12 +172,14 @@ public String getAccountId() { return accountId; } + public void setAccountId(String accountId) { this.accountId = accountId; } public MachineDetectionCompleteCallback applicationId(String applicationId) { + this.applicationId = applicationId; return this; } @@ -185,12 +193,14 @@ public String getApplicationId() { return applicationId; } + public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public MachineDetectionCompleteCallback from(String from) { + this.from = from; return this; } @@ -204,12 +214,14 @@ public String getFrom() { return from; } + public void setFrom(String from) { this.from = from; } public MachineDetectionCompleteCallback to(String to) { + this.to = to; return this; } @@ -223,12 +235,14 @@ public String getTo() { return to; } + public void setTo(String to) { this.to = to; } public MachineDetectionCompleteCallback direction(CallDirectionEnum direction) { + this.direction = direction; return this; } @@ -242,12 +256,14 @@ public CallDirectionEnum getDirection() { return direction; } + public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public MachineDetectionCompleteCallback callId(String callId) { + this.callId = callId; return this; } @@ -261,12 +277,14 @@ public String getCallId() { return callId; } + public void setCallId(String callId) { this.callId = callId; } public MachineDetectionCompleteCallback callUrl(String callUrl) { + this.callUrl = callUrl; return this; } @@ -280,12 +298,14 @@ public String getCallUrl() { return callUrl; } + public void setCallUrl(String callUrl) { this.callUrl = callUrl; } public MachineDetectionCompleteCallback enqueuedTime(OffsetDateTime enqueuedTime) { + this.enqueuedTime = enqueuedTime; return this; } @@ -299,12 +319,14 @@ public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } + public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public MachineDetectionCompleteCallback startTime(OffsetDateTime startTime) { + this.startTime = startTime; return this; } @@ -318,12 +340,14 @@ public OffsetDateTime getStartTime() { return startTime; } + public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public MachineDetectionCompleteCallback answerTime(OffsetDateTime answerTime) { + this.answerTime = answerTime; return this; } @@ -337,12 +361,14 @@ public OffsetDateTime getAnswerTime() { return answerTime; } + public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public MachineDetectionCompleteCallback tag(String tag) { + this.tag = tag; return this; } @@ -356,12 +382,14 @@ public String getTag() { return tag; } + public void setTag(String tag) { this.tag = tag; } public MachineDetectionCompleteCallback machineDetectionResult(MachineDetectionResult machineDetectionResult) { + this.machineDetectionResult = machineDetectionResult; return this; } @@ -375,6 +403,7 @@ public MachineDetectionResult getMachineDetectionResult() { return machineDetectionResult; } + public void setMachineDetectionResult(MachineDetectionResult machineDetectionResult) { this.machineDetectionResult = machineDetectionResult; } @@ -555,10 +584,6 @@ 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())); } @@ -602,12 +627,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/MachineDetectionConfiguration.java b/src/main/java/com/bandwidth/sdk/model/MachineDetectionConfiguration.java index 1a08054f..041100f6 100644 --- a/src/main/java/com/bandwidth/sdk/model/MachineDetectionConfiguration.java +++ b/src/main/java/com/bandwidth/sdk/model/MachineDetectionConfiguration.java @@ -46,6 +46,7 @@ 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,6 +120,7 @@ public MachineDetectionConfiguration() { } public MachineDetectionConfiguration mode(MachineDetectionModeEnum mode) { + this.mode = mode; return this; } @@ -132,12 +134,14 @@ public MachineDetectionModeEnum getMode() { return mode; } + public void setMode(MachineDetectionModeEnum mode) { this.mode = mode; } public MachineDetectionConfiguration detectionTimeout(Double detectionTimeout) { + this.detectionTimeout = detectionTimeout; return this; } @@ -151,12 +155,14 @@ public Double getDetectionTimeout() { return detectionTimeout; } + public void setDetectionTimeout(Double detectionTimeout) { this.detectionTimeout = detectionTimeout; } public MachineDetectionConfiguration silenceTimeout(Double silenceTimeout) { + this.silenceTimeout = silenceTimeout; return this; } @@ -170,12 +176,14 @@ public Double getSilenceTimeout() { return silenceTimeout; } + public void setSilenceTimeout(Double silenceTimeout) { this.silenceTimeout = silenceTimeout; } public MachineDetectionConfiguration speechThreshold(Double speechThreshold) { + this.speechThreshold = speechThreshold; return this; } @@ -189,12 +197,14 @@ public Double getSpeechThreshold() { return speechThreshold; } + public void setSpeechThreshold(Double speechThreshold) { this.speechThreshold = speechThreshold; } public MachineDetectionConfiguration speechEndThreshold(Double speechEndThreshold) { + this.speechEndThreshold = speechEndThreshold; return this; } @@ -208,12 +218,14 @@ public Double getSpeechEndThreshold() { return speechEndThreshold; } + public void setSpeechEndThreshold(Double speechEndThreshold) { this.speechEndThreshold = speechEndThreshold; } public MachineDetectionConfiguration machineSpeechEndThreshold(Double machineSpeechEndThreshold) { + this.machineSpeechEndThreshold = machineSpeechEndThreshold; return this; } @@ -227,12 +239,14 @@ public Double getMachineSpeechEndThreshold() { return machineSpeechEndThreshold; } + public void setMachineSpeechEndThreshold(Double machineSpeechEndThreshold) { this.machineSpeechEndThreshold = machineSpeechEndThreshold; } public MachineDetectionConfiguration delayResult(Boolean delayResult) { + this.delayResult = delayResult; return this; } @@ -246,12 +260,14 @@ public Boolean getDelayResult() { return delayResult; } + public void setDelayResult(Boolean delayResult) { this.delayResult = delayResult; } public MachineDetectionConfiguration callbackUrl(URI callbackUrl) { + this.callbackUrl = callbackUrl; return this; } @@ -265,12 +281,14 @@ public URI getCallbackUrl() { return callbackUrl; } + public void setCallbackUrl(URI callbackUrl) { this.callbackUrl = callbackUrl; } public MachineDetectionConfiguration callbackMethod(CallbackMethodEnum callbackMethod) { + this.callbackMethod = callbackMethod; return this; } @@ -284,12 +302,14 @@ public CallbackMethodEnum getCallbackMethod() { return callbackMethod; } + public void setCallbackMethod(CallbackMethodEnum callbackMethod) { this.callbackMethod = callbackMethod; } public MachineDetectionConfiguration username(String username) { + this.username = username; return this; } @@ -303,12 +323,14 @@ public String getUsername() { return username; } + public void setUsername(String username) { this.username = username; } public MachineDetectionConfiguration password(String password) { + this.password = password; return this; } @@ -322,12 +344,14 @@ public String getPassword() { return password; } + public void setPassword(String password) { this.password = password; } public MachineDetectionConfiguration fallbackUrl(URI fallbackUrl) { + this.fallbackUrl = fallbackUrl; return this; } @@ -341,12 +365,14 @@ public URI getFallbackUrl() { return fallbackUrl; } + public void setFallbackUrl(URI fallbackUrl) { this.fallbackUrl = fallbackUrl; } public MachineDetectionConfiguration fallbackMethod(CallbackMethodEnum fallbackMethod) { + this.fallbackMethod = fallbackMethod; return this; } @@ -360,12 +386,14 @@ public CallbackMethodEnum getFallbackMethod() { return fallbackMethod; } + public void setFallbackMethod(CallbackMethodEnum fallbackMethod) { this.fallbackMethod = fallbackMethod; } public MachineDetectionConfiguration fallbackUsername(String fallbackUsername) { + this.fallbackUsername = fallbackUsername; return this; } @@ -379,12 +407,14 @@ public String getFallbackUsername() { return fallbackUsername; } + public void setFallbackUsername(String fallbackUsername) { this.fallbackUsername = fallbackUsername; } public MachineDetectionConfiguration fallbackPassword(String fallbackPassword) { + this.fallbackPassword = fallbackPassword; return this; } @@ -398,6 +428,7 @@ public String getFallbackPassword() { return fallbackPassword; } + public void setFallbackPassword(String fallbackPassword) { this.fallbackPassword = fallbackPassword; } @@ -566,17 +597,9 @@ 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())); } @@ -586,10 +609,6 @@ 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())); } @@ -626,12 +645,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/MachineDetectionModeEnum.java b/src/main/java/com/bandwidth/sdk/model/MachineDetectionModeEnum.java index 633c38e1..07bba122 100644 --- a/src/main/java/com/bandwidth/sdk/model/MachineDetectionModeEnum.java +++ b/src/main/java/com/bandwidth/sdk/model/MachineDetectionModeEnum.java @@ -18,7 +18,6 @@ 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; @@ -69,10 +68,5 @@ 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 49e7b798..135144a7 100644 --- a/src/main/java/com/bandwidth/sdk/model/MachineDetectionResult.java +++ b/src/main/java/com/bandwidth/sdk/model/MachineDetectionResult.java @@ -42,6 +42,7 @@ 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,6 +64,7 @@ public MachineDetectionResult() { } public MachineDetectionResult value(String value) { + this.value = value; return this; } @@ -76,12 +78,14 @@ public String getValue() { return value; } + public void setValue(String value) { this.value = value; } public MachineDetectionResult duration(String duration) { + this.duration = duration; return this; } @@ -95,6 +99,7 @@ public String getDuration() { return duration; } + public void setDuration(String duration) { this.duration = duration; } @@ -249,12 +254,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/Media.java b/src/main/java/com/bandwidth/sdk/model/Media.java index 223d1fc7..5465ff98 100644 --- a/src/main/java/com/bandwidth/sdk/model/Media.java +++ b/src/main/java/com/bandwidth/sdk/model/Media.java @@ -42,6 +42,7 @@ 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; @@ -67,6 +68,7 @@ public Media() { } public Media content(String content) { + this.content = content; return this; } @@ -80,12 +82,14 @@ public String getContent() { return content; } + public void setContent(String content) { this.content = content; } public Media contentLength(Integer contentLength) { + this.contentLength = contentLength; return this; } @@ -99,12 +103,14 @@ public Integer getContentLength() { return contentLength; } + public void setContentLength(Integer contentLength) { this.contentLength = contentLength; } public Media mediaName(String mediaName) { + this.mediaName = mediaName; return this; } @@ -118,6 +124,7 @@ public String getMediaName() { return mediaName; } + public void setMediaName(String mediaName) { this.mediaName = mediaName; } @@ -275,12 +282,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/Message.java b/src/main/java/com/bandwidth/sdk/model/Message.java index 1a6e0e71..a6d830dd 100644 --- a/src/main/java/com/bandwidth/sdk/model/Message.java +++ b/src/main/java/com/bandwidth/sdk/model/Message.java @@ -47,6 +47,7 @@ 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,6 +113,7 @@ public Message() { } public Message id(String id) { + this.id = id; return this; } @@ -125,12 +127,14 @@ public String getId() { return id; } + public void setId(String id) { this.id = id; } public Message owner(String owner) { + this.owner = owner; return this; } @@ -144,12 +148,14 @@ public String getOwner() { return owner; } + public void setOwner(String owner) { this.owner = owner; } public Message applicationId(String applicationId) { + this.applicationId = applicationId; return this; } @@ -163,12 +169,14 @@ public String getApplicationId() { return applicationId; } + public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public Message time(OffsetDateTime time) { + this.time = time; return this; } @@ -182,12 +190,14 @@ public OffsetDateTime getTime() { return time; } + public void setTime(OffsetDateTime time) { this.time = time; } public Message segmentCount(Integer segmentCount) { + this.segmentCount = segmentCount; return this; } @@ -201,12 +211,14 @@ public Integer getSegmentCount() { return segmentCount; } + public void setSegmentCount(Integer segmentCount) { this.segmentCount = segmentCount; } public Message direction(MessageDirectionEnum direction) { + this.direction = direction; return this; } @@ -220,12 +232,14 @@ public MessageDirectionEnum getDirection() { return direction; } + public void setDirection(MessageDirectionEnum direction) { this.direction = direction; } public Message to(Set to) { + this.to = to; return this; } @@ -247,12 +261,14 @@ public Set getTo() { return to; } + public void setTo(Set to) { this.to = to; } public Message from(String from) { + this.from = from; return this; } @@ -266,12 +282,14 @@ public String getFrom() { return from; } + public void setFrom(String from) { this.from = from; } public Message media(Set media) { + this.media = media; return this; } @@ -293,12 +311,14 @@ public Set getMedia() { return media; } + public void setMedia(Set media) { this.media = media; } public Message text(String text) { + this.text = text; return this; } @@ -312,12 +332,14 @@ public String getText() { return text; } + public void setText(String text) { this.text = text; } public Message tag(String tag) { + this.tag = tag; return this; } @@ -331,12 +353,14 @@ public String getTag() { return tag; } + public void setTag(String tag) { this.tag = tag; } public Message priority(PriorityEnum priority) { + this.priority = priority; return this; } @@ -350,12 +374,14 @@ public PriorityEnum getPriority() { return priority; } + public void setPriority(PriorityEnum priority) { this.priority = priority; } public Message expiration(OffsetDateTime expiration) { + this.expiration = expiration; return this; } @@ -369,6 +395,7 @@ public OffsetDateTime getExpiration() { return expiration; } + public void setExpiration(OffsetDateTime expiration) { this.expiration = expiration; } @@ -529,10 +556,6 @@ 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())); @@ -550,10 +573,6 @@ 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 { @@ -584,12 +603,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallback.java b/src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallback.java index 22e3d23e..7a3a30c7 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallback.java @@ -44,6 +44,7 @@ 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; @@ -77,6 +78,7 @@ public MessageDeliveredCallback() { } public MessageDeliveredCallback time(OffsetDateTime time) { + this.time = time; return this; } @@ -90,12 +92,14 @@ public OffsetDateTime getTime() { return time; } + public void setTime(OffsetDateTime time) { this.time = time; } public MessageDeliveredCallback type(String type) { + this.type = type; return this; } @@ -109,12 +113,14 @@ public String getType() { return type; } + public void setType(String type) { this.type = type; } public MessageDeliveredCallback to(String to) { + this.to = to; return this; } @@ -128,12 +134,14 @@ public String getTo() { return to; } + public void setTo(String to) { this.to = to; } public MessageDeliveredCallback description(String description) { + this.description = description; return this; } @@ -147,12 +155,14 @@ public String getDescription() { return description; } + public void setDescription(String description) { this.description = description; } public MessageDeliveredCallback message(MessageDeliveredCallbackMessage message) { + this.message = message; return this; } @@ -166,6 +176,7 @@ public MessageDeliveredCallbackMessage getMessage() { return message; } + public void setMessage(MessageDeliveredCallbackMessage message) { this.message = message; } @@ -346,12 +357,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallbackMessage.java b/src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallbackMessage.java index eda66577..144c4c0e 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallbackMessage.java +++ b/src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallbackMessage.java @@ -50,6 +50,7 @@ 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,6 +112,7 @@ public MessageDeliveredCallbackMessage() { } public MessageDeliveredCallbackMessage id(String id) { + this.id = id; return this; } @@ -124,12 +126,14 @@ public String getId() { return id; } + public void setId(String id) { this.id = id; } public MessageDeliveredCallbackMessage owner(String owner) { + this.owner = owner; return this; } @@ -143,12 +147,14 @@ public String getOwner() { return owner; } + public void setOwner(String owner) { this.owner = owner; } public MessageDeliveredCallbackMessage applicationId(String applicationId) { + this.applicationId = applicationId; return this; } @@ -162,12 +168,14 @@ public String getApplicationId() { return applicationId; } + public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public MessageDeliveredCallbackMessage time(OffsetDateTime time) { + this.time = time; return this; } @@ -181,12 +189,14 @@ public OffsetDateTime getTime() { return time; } + public void setTime(OffsetDateTime time) { this.time = time; } public MessageDeliveredCallbackMessage segmentCount(Integer segmentCount) { + this.segmentCount = segmentCount; return this; } @@ -200,12 +210,14 @@ public Integer getSegmentCount() { return segmentCount; } + public void setSegmentCount(Integer segmentCount) { this.segmentCount = segmentCount; } public MessageDeliveredCallbackMessage direction(MessageDirectionEnum direction) { + this.direction = direction; return this; } @@ -219,12 +231,14 @@ public MessageDirectionEnum getDirection() { return direction; } + public void setDirection(MessageDirectionEnum direction) { this.direction = direction; } public MessageDeliveredCallbackMessage to(Set to) { + this.to = to; return this; } @@ -246,12 +260,14 @@ public Set getTo() { return to; } + public void setTo(Set to) { this.to = to; } public MessageDeliveredCallbackMessage from(String from) { + this.from = from; return this; } @@ -265,12 +281,14 @@ public String getFrom() { return from; } + public void setFrom(String from) { this.from = from; } public MessageDeliveredCallbackMessage text(String text) { + this.text = text; return this; } @@ -284,12 +302,14 @@ public String getText() { return text; } + public void setText(String text) { this.text = text; } public MessageDeliveredCallbackMessage tag(String tag) { + this.tag = tag; return this; } @@ -303,12 +323,14 @@ public String getTag() { return tag; } + public void setTag(String tag) { this.tag = tag; } public MessageDeliveredCallbackMessage media(List media) { + this.media = media; return this; } @@ -330,12 +352,14 @@ public List getMedia() { return media; } + public void setMedia(List media) { this.media = media; } public MessageDeliveredCallbackMessage priority(PriorityEnum priority) { + this.priority = priority; return this; } @@ -349,6 +373,7 @@ public PriorityEnum getPriority() { return priority; } + public void setPriority(PriorityEnum priority) { this.priority = priority; } @@ -523,8 +548,6 @@ 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`"); @@ -544,10 +567,6 @@ 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 { @@ -578,12 +597,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/MessageDirectionEnum.java b/src/main/java/com/bandwidth/sdk/model/MessageDirectionEnum.java index 52886e8a..4713b361 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessageDirectionEnum.java +++ b/src/main/java/com/bandwidth/sdk/model/MessageDirectionEnum.java @@ -18,7 +18,6 @@ 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; @@ -69,10 +68,5 @@ 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 44358a45..7969be97 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessageFailedCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/MessageFailedCallback.java @@ -44,6 +44,7 @@ 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; @@ -81,6 +82,7 @@ public MessageFailedCallback() { } public MessageFailedCallback time(OffsetDateTime time) { + this.time = time; return this; } @@ -94,12 +96,14 @@ public OffsetDateTime getTime() { return time; } + public void setTime(OffsetDateTime time) { this.time = time; } public MessageFailedCallback type(String type) { + this.type = type; return this; } @@ -113,12 +117,14 @@ public String getType() { return type; } + public void setType(String type) { this.type = type; } public MessageFailedCallback to(String to) { + this.to = to; return this; } @@ -132,12 +138,14 @@ public String getTo() { return to; } + public void setTo(String to) { this.to = to; } public MessageFailedCallback description(String description) { + this.description = description; return this; } @@ -151,12 +159,14 @@ public String getDescription() { return description; } + public void setDescription(String description) { this.description = description; } public MessageFailedCallback message(MessageFailedCallbackMessage message) { + this.message = message; return this; } @@ -170,12 +180,14 @@ public MessageFailedCallbackMessage getMessage() { return message; } + public void setMessage(MessageFailedCallbackMessage message) { this.message = message; } public MessageFailedCallback errorCode(Integer errorCode) { + this.errorCode = errorCode; return this; } @@ -189,6 +201,7 @@ public Integer getErrorCode() { return errorCode; } + public void setErrorCode(Integer errorCode) { this.errorCode = errorCode; } @@ -373,12 +386,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/MessageFailedCallbackMessage.java b/src/main/java/com/bandwidth/sdk/model/MessageFailedCallbackMessage.java index a1bf8a14..6d65d19f 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessageFailedCallbackMessage.java +++ b/src/main/java/com/bandwidth/sdk/model/MessageFailedCallbackMessage.java @@ -50,6 +50,7 @@ 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,6 +112,7 @@ public MessageFailedCallbackMessage() { } public MessageFailedCallbackMessage id(String id) { + this.id = id; return this; } @@ -124,12 +126,14 @@ public String getId() { return id; } + public void setId(String id) { this.id = id; } public MessageFailedCallbackMessage owner(String owner) { + this.owner = owner; return this; } @@ -143,12 +147,14 @@ public String getOwner() { return owner; } + public void setOwner(String owner) { this.owner = owner; } public MessageFailedCallbackMessage applicationId(String applicationId) { + this.applicationId = applicationId; return this; } @@ -162,12 +168,14 @@ public String getApplicationId() { return applicationId; } + public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public MessageFailedCallbackMessage time(OffsetDateTime time) { + this.time = time; return this; } @@ -181,12 +189,14 @@ public OffsetDateTime getTime() { return time; } + public void setTime(OffsetDateTime time) { this.time = time; } public MessageFailedCallbackMessage segmentCount(Integer segmentCount) { + this.segmentCount = segmentCount; return this; } @@ -200,12 +210,14 @@ public Integer getSegmentCount() { return segmentCount; } + public void setSegmentCount(Integer segmentCount) { this.segmentCount = segmentCount; } public MessageFailedCallbackMessage direction(MessageDirectionEnum direction) { + this.direction = direction; return this; } @@ -219,12 +231,14 @@ public MessageDirectionEnum getDirection() { return direction; } + public void setDirection(MessageDirectionEnum direction) { this.direction = direction; } public MessageFailedCallbackMessage to(Set to) { + this.to = to; return this; } @@ -246,12 +260,14 @@ public Set getTo() { return to; } + public void setTo(Set to) { this.to = to; } public MessageFailedCallbackMessage from(String from) { + this.from = from; return this; } @@ -265,12 +281,14 @@ public String getFrom() { return from; } + public void setFrom(String from) { this.from = from; } public MessageFailedCallbackMessage text(String text) { + this.text = text; return this; } @@ -284,12 +302,14 @@ public String getText() { return text; } + public void setText(String text) { this.text = text; } public MessageFailedCallbackMessage tag(String tag) { + this.tag = tag; return this; } @@ -303,12 +323,14 @@ public String getTag() { return tag; } + public void setTag(String tag) { this.tag = tag; } public MessageFailedCallbackMessage media(List media) { + this.media = media; return this; } @@ -330,12 +352,14 @@ public List getMedia() { return media; } + public void setMedia(List media) { this.media = media; } public MessageFailedCallbackMessage priority(PriorityEnum priority) { + this.priority = priority; return this; } @@ -349,6 +373,7 @@ public PriorityEnum getPriority() { return priority; } + public void setPriority(PriorityEnum priority) { this.priority = priority; } @@ -524,8 +549,6 @@ 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`"); @@ -545,8 +568,6 @@ 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 { @@ -577,12 +598,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/MessageRequest.java b/src/main/java/com/bandwidth/sdk/model/MessageRequest.java index 4be77b2f..8ae0dad4 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessageRequest.java +++ b/src/main/java/com/bandwidth/sdk/model/MessageRequest.java @@ -49,6 +49,7 @@ 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; @@ -94,6 +95,7 @@ public MessageRequest() { } public MessageRequest applicationId(String applicationId) { + this.applicationId = applicationId; return this; } @@ -107,12 +109,14 @@ public String getApplicationId() { return applicationId; } + public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public MessageRequest to(Set to) { + this.to = to; return this; } @@ -134,12 +138,14 @@ public Set getTo() { return to; } + public void setTo(Set to) { this.to = to; } public MessageRequest from(String from) { + this.from = from; return this; } @@ -153,12 +159,14 @@ public String getFrom() { return from; } + public void setFrom(String from) { this.from = from; } public MessageRequest text(String text) { + this.text = text; return this; } @@ -172,12 +180,14 @@ public String getText() { return text; } + public void setText(String text) { this.text = text; } public MessageRequest media(List media) { + this.media = media; return this; } @@ -199,12 +209,14 @@ public List getMedia() { return media; } + public void setMedia(List media) { this.media = media; } public MessageRequest tag(String tag) { + this.tag = tag; return this; } @@ -218,12 +230,14 @@ public String getTag() { return tag; } + public void setTag(String tag) { this.tag = tag; } public MessageRequest priority(PriorityEnum priority) { + this.priority = priority; return this; } @@ -237,12 +251,14 @@ public PriorityEnum getPriority() { return priority; } + public void setPriority(PriorityEnum priority) { this.priority = priority; } public MessageRequest expiration(OffsetDateTime expiration) { + this.expiration = expiration; return this; } @@ -256,6 +272,7 @@ public OffsetDateTime getExpiration() { return expiration; } + public void setExpiration(OffsetDateTime expiration) { this.expiration = expiration; } @@ -424,10 +441,6 @@ 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 { @@ -458,12 +471,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/MessageSendingCallback.java b/src/main/java/com/bandwidth/sdk/model/MessageSendingCallback.java index 1bc60314..4be4d232 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessageSendingCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/MessageSendingCallback.java @@ -44,6 +44,7 @@ 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; @@ -77,6 +78,7 @@ public MessageSendingCallback() { } public MessageSendingCallback time(OffsetDateTime time) { + this.time = time; return this; } @@ -90,12 +92,14 @@ public OffsetDateTime getTime() { return time; } + public void setTime(OffsetDateTime time) { this.time = time; } public MessageSendingCallback type(String type) { + this.type = type; return this; } @@ -109,12 +113,14 @@ public String getType() { return type; } + public void setType(String type) { this.type = type; } public MessageSendingCallback to(String to) { + this.to = to; return this; } @@ -128,12 +134,14 @@ public String getTo() { return to; } + public void setTo(String to) { this.to = to; } public MessageSendingCallback description(String description) { + this.description = description; return this; } @@ -147,12 +155,14 @@ public String getDescription() { return description; } + public void setDescription(String description) { this.description = description; } public MessageSendingCallback message(MessageSendingCallbackMessage message) { + this.message = message; return this; } @@ -166,6 +176,7 @@ public MessageSendingCallbackMessage getMessage() { return message; } + public void setMessage(MessageSendingCallbackMessage message) { this.message = message; } @@ -346,12 +357,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/MessageSendingCallbackMessage.java b/src/main/java/com/bandwidth/sdk/model/MessageSendingCallbackMessage.java index bc98b2d8..1bced475 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessageSendingCallbackMessage.java +++ b/src/main/java/com/bandwidth/sdk/model/MessageSendingCallbackMessage.java @@ -50,6 +50,7 @@ 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,6 +112,7 @@ public MessageSendingCallbackMessage() { } public MessageSendingCallbackMessage id(String id) { + this.id = id; return this; } @@ -124,12 +126,14 @@ public String getId() { return id; } + public void setId(String id) { this.id = id; } public MessageSendingCallbackMessage owner(String owner) { + this.owner = owner; return this; } @@ -143,12 +147,14 @@ public String getOwner() { return owner; } + public void setOwner(String owner) { this.owner = owner; } public MessageSendingCallbackMessage applicationId(String applicationId) { + this.applicationId = applicationId; return this; } @@ -162,12 +168,14 @@ public String getApplicationId() { return applicationId; } + public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public MessageSendingCallbackMessage time(OffsetDateTime time) { + this.time = time; return this; } @@ -181,12 +189,14 @@ public OffsetDateTime getTime() { return time; } + public void setTime(OffsetDateTime time) { this.time = time; } public MessageSendingCallbackMessage segmentCount(Integer segmentCount) { + this.segmentCount = segmentCount; return this; } @@ -200,12 +210,14 @@ public Integer getSegmentCount() { return segmentCount; } + public void setSegmentCount(Integer segmentCount) { this.segmentCount = segmentCount; } public MessageSendingCallbackMessage direction(MessageDirectionEnum direction) { + this.direction = direction; return this; } @@ -219,12 +231,14 @@ public MessageDirectionEnum getDirection() { return direction; } + public void setDirection(MessageDirectionEnum direction) { this.direction = direction; } public MessageSendingCallbackMessage to(Set to) { + this.to = to; return this; } @@ -246,12 +260,14 @@ public Set getTo() { return to; } + public void setTo(Set to) { this.to = to; } public MessageSendingCallbackMessage from(String from) { + this.from = from; return this; } @@ -265,12 +281,14 @@ public String getFrom() { return from; } + public void setFrom(String from) { this.from = from; } public MessageSendingCallbackMessage text(String text) { + this.text = text; return this; } @@ -284,12 +302,14 @@ public String getText() { return text; } + public void setText(String text) { this.text = text; } public MessageSendingCallbackMessage tag(String tag) { + this.tag = tag; return this; } @@ -303,12 +323,14 @@ public String getTag() { return tag; } + public void setTag(String tag) { this.tag = tag; } public MessageSendingCallbackMessage media(List media) { + this.media = media; return this; } @@ -330,12 +352,14 @@ public List getMedia() { return media; } + public void setMedia(List media) { this.media = media; } public MessageSendingCallbackMessage priority(PriorityEnum priority) { + this.priority = priority; return this; } @@ -349,6 +373,7 @@ public PriorityEnum getPriority() { return priority; } + public void setPriority(PriorityEnum priority) { this.priority = priority; } @@ -524,8 +549,6 @@ 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`"); @@ -547,8 +570,6 @@ 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 { @@ -579,12 +600,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/MessageStatusEnum.java b/src/main/java/com/bandwidth/sdk/model/MessageStatusEnum.java index 80760f09..90a978bf 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessageStatusEnum.java +++ b/src/main/java/com/bandwidth/sdk/model/MessageStatusEnum.java @@ -18,7 +18,6 @@ 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; @@ -81,10 +80,5 @@ 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 e12241ca..8ce1bc4b 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessageTypeEnum.java +++ b/src/main/java/com/bandwidth/sdk/model/MessageTypeEnum.java @@ -18,7 +18,6 @@ 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; @@ -69,10 +68,5 @@ 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 62ce1bae..8c40885c 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessagesList.java +++ b/src/main/java/com/bandwidth/sdk/model/MessagesList.java @@ -46,6 +46,7 @@ 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,6 +72,7 @@ public MessagesList() { } public MessagesList totalCount(Integer totalCount) { + this.totalCount = totalCount; return this; } @@ -84,12 +86,14 @@ public Integer getTotalCount() { return totalCount; } + public void setTotalCount(Integer totalCount) { this.totalCount = totalCount; } public MessagesList pageInfo(PageInfo pageInfo) { + this.pageInfo = pageInfo; return this; } @@ -103,12 +107,14 @@ public PageInfo getPageInfo() { return pageInfo; } + public void setPageInfo(PageInfo pageInfo) { this.pageInfo = pageInfo; } public MessagesList messages(List messages) { + this.messages = messages; return this; } @@ -130,6 +136,7 @@ public List getMessages() { return messages; } + public void setMessages(List messages) { this.messages = messages; } @@ -299,12 +306,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/MessagingCodeResponse.java b/src/main/java/com/bandwidth/sdk/model/MessagingCodeResponse.java index f4964937..fb5f2e3d 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessagingCodeResponse.java +++ b/src/main/java/com/bandwidth/sdk/model/MessagingCodeResponse.java @@ -42,6 +42,7 @@ 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; @@ -59,6 +60,7 @@ public MessagingCodeResponse() { } public MessagingCodeResponse messageId(String messageId) { + this.messageId = messageId; return this; } @@ -72,6 +74,7 @@ public String getMessageId() { return messageId; } + public void setMessageId(String messageId) { this.messageId = messageId; } @@ -220,12 +223,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/MessagingRequestError.java b/src/main/java/com/bandwidth/sdk/model/MessagingRequestError.java index 3a2b4b72..a0f4af11 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessagingRequestError.java +++ b/src/main/java/com/bandwidth/sdk/model/MessagingRequestError.java @@ -42,6 +42,7 @@ 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,6 +64,7 @@ public MessagingRequestError() { } public MessagingRequestError type(String type) { + this.type = type; return this; } @@ -76,12 +78,14 @@ public String getType() { return type; } + public void setType(String type) { this.type = type; } public MessagingRequestError description(String description) { + this.description = description; return this; } @@ -95,6 +99,7 @@ public String getDescription() { return description; } + public void setDescription(String description) { this.description = description; } @@ -258,12 +263,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/MfaForbiddenRequestError.java b/src/main/java/com/bandwidth/sdk/model/MfaForbiddenRequestError.java index 1e106166..9905efdd 100644 --- a/src/main/java/com/bandwidth/sdk/model/MfaForbiddenRequestError.java +++ b/src/main/java/com/bandwidth/sdk/model/MfaForbiddenRequestError.java @@ -42,6 +42,7 @@ 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; @@ -59,6 +60,7 @@ public MfaForbiddenRequestError() { } public MfaForbiddenRequestError message(String message) { + this.message = message; return this; } @@ -72,6 +74,7 @@ public String getMessage() { return message; } + public void setMessage(String message) { this.message = message; } @@ -220,12 +223,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/MfaRequestError.java b/src/main/java/com/bandwidth/sdk/model/MfaRequestError.java index c2d56a44..84b45f8a 100644 --- a/src/main/java/com/bandwidth/sdk/model/MfaRequestError.java +++ b/src/main/java/com/bandwidth/sdk/model/MfaRequestError.java @@ -42,6 +42,7 @@ 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,6 +64,7 @@ public MfaRequestError() { } public MfaRequestError error(String error) { + this.error = error; return this; } @@ -76,12 +78,14 @@ public String getError() { return error; } + public void setError(String error) { this.error = error; } public MfaRequestError requestId(String requestId) { + this.requestId = requestId; return this; } @@ -95,6 +99,7 @@ public String getRequestId() { return requestId; } + public void setRequestId(String requestId) { this.requestId = requestId; } @@ -249,12 +254,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/MfaUnauthorizedRequestError.java b/src/main/java/com/bandwidth/sdk/model/MfaUnauthorizedRequestError.java index 61de33df..67320cae 100644 --- a/src/main/java/com/bandwidth/sdk/model/MfaUnauthorizedRequestError.java +++ b/src/main/java/com/bandwidth/sdk/model/MfaUnauthorizedRequestError.java @@ -42,6 +42,7 @@ 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; @@ -59,6 +60,7 @@ public MfaUnauthorizedRequestError() { } public MfaUnauthorizedRequestError message(String message) { + this.message = message; return this; } @@ -72,6 +74,7 @@ public String getMessage() { return message; } + public void setMessage(String message) { this.message = message; } @@ -220,12 +223,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/PageInfo.java b/src/main/java/com/bandwidth/sdk/model/PageInfo.java index 717c80da..a1c5d8fc 100644 --- a/src/main/java/com/bandwidth/sdk/model/PageInfo.java +++ b/src/main/java/com/bandwidth/sdk/model/PageInfo.java @@ -42,6 +42,7 @@ 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,6 +72,7 @@ public PageInfo() { } public PageInfo prevPage(String prevPage) { + this.prevPage = prevPage; return this; } @@ -84,12 +86,14 @@ public String getPrevPage() { return prevPage; } + public void setPrevPage(String prevPage) { this.prevPage = prevPage; } public PageInfo nextPage(String nextPage) { + this.nextPage = nextPage; return this; } @@ -103,12 +107,14 @@ public String getNextPage() { return nextPage; } + public void setNextPage(String nextPage) { this.nextPage = nextPage; } public PageInfo prevPageToken(String prevPageToken) { + this.prevPageToken = prevPageToken; return this; } @@ -122,12 +128,14 @@ public String getPrevPageToken() { return prevPageToken; } + public void setPrevPageToken(String prevPageToken) { this.prevPageToken = prevPageToken; } public PageInfo nextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; return this; } @@ -141,6 +149,7 @@ public String getNextPageToken() { return nextPageToken; } + public void setNextPageToken(String nextPageToken) { this.nextPageToken = nextPageToken; } @@ -307,12 +316,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/PriorityEnum.java b/src/main/java/com/bandwidth/sdk/model/PriorityEnum.java index 75f872e1..6200bb49 100644 --- a/src/main/java/com/bandwidth/sdk/model/PriorityEnum.java +++ b/src/main/java/com/bandwidth/sdk/model/PriorityEnum.java @@ -18,7 +18,6 @@ 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; @@ -69,10 +68,5 @@ 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 0ac0a4a8..3523315e 100644 --- a/src/main/java/com/bandwidth/sdk/model/RecordingAvailableCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/RecordingAvailableCallback.java @@ -47,6 +47,7 @@ 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; @@ -148,6 +149,7 @@ public RecordingAvailableCallback() { } public RecordingAvailableCallback eventType(String eventType) { + this.eventType = eventType; return this; } @@ -161,12 +163,14 @@ public String getEventType() { return eventType; } + public void setEventType(String eventType) { this.eventType = eventType; } public RecordingAvailableCallback eventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; return this; } @@ -180,12 +184,14 @@ public OffsetDateTime getEventTime() { return eventTime; } + public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public RecordingAvailableCallback accountId(String accountId) { + this.accountId = accountId; return this; } @@ -199,12 +205,14 @@ public String getAccountId() { return accountId; } + public void setAccountId(String accountId) { this.accountId = accountId; } public RecordingAvailableCallback applicationId(String applicationId) { + this.applicationId = applicationId; return this; } @@ -218,12 +226,14 @@ public String getApplicationId() { return applicationId; } + public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public RecordingAvailableCallback from(String from) { + this.from = from; return this; } @@ -237,12 +247,14 @@ public String getFrom() { return from; } + public void setFrom(String from) { this.from = from; } public RecordingAvailableCallback to(String to) { + this.to = to; return this; } @@ -256,12 +268,14 @@ public String getTo() { return to; } + public void setTo(String to) { this.to = to; } public RecordingAvailableCallback direction(CallDirectionEnum direction) { + this.direction = direction; return this; } @@ -275,12 +289,14 @@ public CallDirectionEnum getDirection() { return direction; } + public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public RecordingAvailableCallback callId(String callId) { + this.callId = callId; return this; } @@ -294,12 +310,14 @@ public String getCallId() { return callId; } + public void setCallId(String callId) { this.callId = callId; } public RecordingAvailableCallback callUrl(String callUrl) { + this.callUrl = callUrl; return this; } @@ -313,12 +331,14 @@ public String getCallUrl() { return callUrl; } + public void setCallUrl(String callUrl) { this.callUrl = callUrl; } public RecordingAvailableCallback parentCallId(String parentCallId) { + this.parentCallId = parentCallId; return this; } @@ -332,12 +352,14 @@ public String getParentCallId() { return parentCallId; } + public void setParentCallId(String parentCallId) { this.parentCallId = parentCallId; } public RecordingAvailableCallback recordingId(String recordingId) { + this.recordingId = recordingId; return this; } @@ -351,12 +373,14 @@ public String getRecordingId() { return recordingId; } + public void setRecordingId(String recordingId) { this.recordingId = recordingId; } public RecordingAvailableCallback mediaUrl(URI mediaUrl) { + this.mediaUrl = mediaUrl; return this; } @@ -370,12 +394,14 @@ public URI getMediaUrl() { return mediaUrl; } + public void setMediaUrl(URI mediaUrl) { this.mediaUrl = mediaUrl; } public RecordingAvailableCallback enqueuedTime(OffsetDateTime enqueuedTime) { + this.enqueuedTime = enqueuedTime; return this; } @@ -389,12 +415,14 @@ public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } + public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public RecordingAvailableCallback startTime(OffsetDateTime startTime) { + this.startTime = startTime; return this; } @@ -408,12 +436,14 @@ public OffsetDateTime getStartTime() { return startTime; } + public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public RecordingAvailableCallback endTime(OffsetDateTime endTime) { + this.endTime = endTime; return this; } @@ -427,12 +457,14 @@ public OffsetDateTime getEndTime() { return endTime; } + public void setEndTime(OffsetDateTime endTime) { this.endTime = endTime; } public RecordingAvailableCallback duration(String duration) { + this.duration = duration; return this; } @@ -446,12 +478,14 @@ public String getDuration() { return duration; } + public void setDuration(String duration) { this.duration = duration; } public RecordingAvailableCallback fileFormat(FileFormatEnum fileFormat) { + this.fileFormat = fileFormat; return this; } @@ -465,12 +499,14 @@ public FileFormatEnum getFileFormat() { return fileFormat; } + public void setFileFormat(FileFormatEnum fileFormat) { this.fileFormat = fileFormat; } public RecordingAvailableCallback channels(String channels) { + this.channels = channels; return this; } @@ -484,12 +520,14 @@ public String getChannels() { return channels; } + public void setChannels(String channels) { this.channels = channels; } public RecordingAvailableCallback tag(String tag) { + this.tag = tag; return this; } @@ -503,12 +541,14 @@ public String getTag() { return tag; } + public void setTag(String tag) { this.tag = tag; } public RecordingAvailableCallback status(String status) { + this.status = status; return this; } @@ -522,12 +562,14 @@ public String getStatus() { return status; } + public void setStatus(String status) { this.status = status; } public RecordingAvailableCallback transferCallerId(String transferCallerId) { + this.transferCallerId = transferCallerId; return this; } @@ -541,12 +583,14 @@ public String getTransferCallerId() { return transferCallerId; } + public void setTransferCallerId(String transferCallerId) { this.transferCallerId = transferCallerId; } public RecordingAvailableCallback transferTo(String transferTo) { + this.transferTo = transferTo; return this; } @@ -560,6 +604,7 @@ public String getTransferTo() { return transferTo; } + public void setTransferTo(String transferTo) { this.transferTo = transferTo; } @@ -764,10 +809,6 @@ 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())); } @@ -786,10 +827,6 @@ 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())); } @@ -835,12 +872,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/RecordingCompleteCallback.java b/src/main/java/com/bandwidth/sdk/model/RecordingCompleteCallback.java index 4325aaf1..02e92e37 100644 --- a/src/main/java/com/bandwidth/sdk/model/RecordingCompleteCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/RecordingCompleteCallback.java @@ -47,6 +47,7 @@ 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; @@ -148,6 +149,7 @@ public RecordingCompleteCallback() { } public RecordingCompleteCallback eventType(String eventType) { + this.eventType = eventType; return this; } @@ -161,12 +163,14 @@ public String getEventType() { return eventType; } + public void setEventType(String eventType) { this.eventType = eventType; } public RecordingCompleteCallback eventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; return this; } @@ -180,12 +184,14 @@ public OffsetDateTime getEventTime() { return eventTime; } + public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public RecordingCompleteCallback accountId(String accountId) { + this.accountId = accountId; return this; } @@ -199,12 +205,14 @@ public String getAccountId() { return accountId; } + public void setAccountId(String accountId) { this.accountId = accountId; } public RecordingCompleteCallback applicationId(String applicationId) { + this.applicationId = applicationId; return this; } @@ -218,12 +226,14 @@ public String getApplicationId() { return applicationId; } + public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public RecordingCompleteCallback from(String from) { + this.from = from; return this; } @@ -237,12 +247,14 @@ public String getFrom() { return from; } + public void setFrom(String from) { this.from = from; } public RecordingCompleteCallback to(String to) { + this.to = to; return this; } @@ -256,12 +268,14 @@ public String getTo() { return to; } + public void setTo(String to) { this.to = to; } public RecordingCompleteCallback direction(CallDirectionEnum direction) { + this.direction = direction; return this; } @@ -275,12 +289,14 @@ public CallDirectionEnum getDirection() { return direction; } + public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public RecordingCompleteCallback callId(String callId) { + this.callId = callId; return this; } @@ -294,12 +310,14 @@ public String getCallId() { return callId; } + public void setCallId(String callId) { this.callId = callId; } public RecordingCompleteCallback callUrl(String callUrl) { + this.callUrl = callUrl; return this; } @@ -313,12 +331,14 @@ public String getCallUrl() { return callUrl; } + public void setCallUrl(String callUrl) { this.callUrl = callUrl; } public RecordingCompleteCallback parentCallId(String parentCallId) { + this.parentCallId = parentCallId; return this; } @@ -332,12 +352,14 @@ public String getParentCallId() { return parentCallId; } + public void setParentCallId(String parentCallId) { this.parentCallId = parentCallId; } public RecordingCompleteCallback recordingId(String recordingId) { + this.recordingId = recordingId; return this; } @@ -351,12 +373,14 @@ public String getRecordingId() { return recordingId; } + public void setRecordingId(String recordingId) { this.recordingId = recordingId; } public RecordingCompleteCallback mediaUrl(URI mediaUrl) { + this.mediaUrl = mediaUrl; return this; } @@ -370,12 +394,14 @@ public URI getMediaUrl() { return mediaUrl; } + public void setMediaUrl(URI mediaUrl) { this.mediaUrl = mediaUrl; } public RecordingCompleteCallback enqueuedTime(OffsetDateTime enqueuedTime) { + this.enqueuedTime = enqueuedTime; return this; } @@ -389,12 +415,14 @@ public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } + public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public RecordingCompleteCallback startTime(OffsetDateTime startTime) { + this.startTime = startTime; return this; } @@ -408,12 +436,14 @@ public OffsetDateTime getStartTime() { return startTime; } + public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public RecordingCompleteCallback answerTime(OffsetDateTime answerTime) { + this.answerTime = answerTime; return this; } @@ -427,12 +457,14 @@ public OffsetDateTime getAnswerTime() { return answerTime; } + public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public RecordingCompleteCallback endTime(OffsetDateTime endTime) { + this.endTime = endTime; return this; } @@ -446,12 +478,14 @@ public OffsetDateTime getEndTime() { return endTime; } + public void setEndTime(OffsetDateTime endTime) { this.endTime = endTime; } public RecordingCompleteCallback duration(String duration) { + this.duration = duration; return this; } @@ -465,12 +499,14 @@ public String getDuration() { return duration; } + public void setDuration(String duration) { this.duration = duration; } public RecordingCompleteCallback fileFormat(FileFormatEnum fileFormat) { + this.fileFormat = fileFormat; return this; } @@ -484,12 +520,14 @@ public FileFormatEnum getFileFormat() { return fileFormat; } + public void setFileFormat(FileFormatEnum fileFormat) { this.fileFormat = fileFormat; } public RecordingCompleteCallback channels(Integer channels) { + this.channels = channels; return this; } @@ -503,12 +541,14 @@ public Integer getChannels() { return channels; } + public void setChannels(Integer channels) { this.channels = channels; } public RecordingCompleteCallback tag(String tag) { + this.tag = tag; return this; } @@ -522,12 +562,14 @@ public String getTag() { return tag; } + public void setTag(String tag) { this.tag = tag; } public RecordingCompleteCallback transferCallerId(String transferCallerId) { + this.transferCallerId = transferCallerId; return this; } @@ -541,12 +583,14 @@ public String getTransferCallerId() { return transferCallerId; } + public void setTransferCallerId(String transferCallerId) { this.transferCallerId = transferCallerId; } public RecordingCompleteCallback transferTo(String transferTo) { + this.transferTo = transferTo; return this; } @@ -560,6 +604,7 @@ public String getTransferTo() { return transferTo; } + public void setTransferTo(String transferTo) { this.transferTo = transferTo; } @@ -764,10 +809,6 @@ 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())); } @@ -786,10 +827,6 @@ 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())); } @@ -829,12 +866,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/RecordingStateEnum.java b/src/main/java/com/bandwidth/sdk/model/RecordingStateEnum.java index ff3d9507..9e32ec07 100644 --- a/src/main/java/com/bandwidth/sdk/model/RecordingStateEnum.java +++ b/src/main/java/com/bandwidth/sdk/model/RecordingStateEnum.java @@ -18,7 +18,6 @@ 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; @@ -69,10 +68,5 @@ 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 dab359ac..1cb5b0e2 100644 --- a/src/main/java/com/bandwidth/sdk/model/RedirectCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/RedirectCallback.java @@ -45,6 +45,7 @@ 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; @@ -122,6 +123,7 @@ public RedirectCallback() { } public RedirectCallback eventType(String eventType) { + this.eventType = eventType; return this; } @@ -135,12 +137,14 @@ public String getEventType() { return eventType; } + public void setEventType(String eventType) { this.eventType = eventType; } public RedirectCallback eventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; return this; } @@ -154,12 +158,14 @@ public OffsetDateTime getEventTime() { return eventTime; } + public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public RedirectCallback accountId(String accountId) { + this.accountId = accountId; return this; } @@ -173,12 +179,14 @@ public String getAccountId() { return accountId; } + public void setAccountId(String accountId) { this.accountId = accountId; } public RedirectCallback applicationId(String applicationId) { + this.applicationId = applicationId; return this; } @@ -192,12 +200,14 @@ public String getApplicationId() { return applicationId; } + public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public RedirectCallback from(String from) { + this.from = from; return this; } @@ -211,12 +221,14 @@ public String getFrom() { return from; } + public void setFrom(String from) { this.from = from; } public RedirectCallback to(String to) { + this.to = to; return this; } @@ -230,12 +242,14 @@ public String getTo() { return to; } + public void setTo(String to) { this.to = to; } public RedirectCallback direction(CallDirectionEnum direction) { + this.direction = direction; return this; } @@ -249,12 +263,14 @@ public CallDirectionEnum getDirection() { return direction; } + public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public RedirectCallback callId(String callId) { + this.callId = callId; return this; } @@ -268,12 +284,14 @@ public String getCallId() { return callId; } + public void setCallId(String callId) { this.callId = callId; } public RedirectCallback callUrl(String callUrl) { + this.callUrl = callUrl; return this; } @@ -287,12 +305,14 @@ public String getCallUrl() { return callUrl; } + public void setCallUrl(String callUrl) { this.callUrl = callUrl; } public RedirectCallback parentCallId(String parentCallId) { + this.parentCallId = parentCallId; return this; } @@ -306,12 +326,14 @@ public String getParentCallId() { return parentCallId; } + public void setParentCallId(String parentCallId) { this.parentCallId = parentCallId; } public RedirectCallback enqueuedTime(OffsetDateTime enqueuedTime) { + this.enqueuedTime = enqueuedTime; return this; } @@ -325,12 +347,14 @@ public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } + public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public RedirectCallback startTime(OffsetDateTime startTime) { + this.startTime = startTime; return this; } @@ -344,12 +368,14 @@ public OffsetDateTime getStartTime() { return startTime; } + public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public RedirectCallback answerTime(OffsetDateTime answerTime) { + this.answerTime = answerTime; return this; } @@ -363,12 +389,14 @@ public OffsetDateTime getAnswerTime() { return answerTime; } + public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public RedirectCallback tag(String tag) { + this.tag = tag; return this; } @@ -382,12 +410,14 @@ public String getTag() { return tag; } + public void setTag(String tag) { this.tag = tag; } public RedirectCallback transferCallerId(String transferCallerId) { + this.transferCallerId = transferCallerId; return this; } @@ -401,12 +431,14 @@ public String getTransferCallerId() { return transferCallerId; } + public void setTransferCallerId(String transferCallerId) { this.transferCallerId = transferCallerId; } public RedirectCallback transferTo(String transferTo) { + this.transferTo = transferTo; return this; } @@ -420,6 +452,7 @@ public String getTransferTo() { return transferTo; } + public void setTransferTo(String transferTo) { this.transferTo = transferTo; } @@ -606,10 +639,6 @@ 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())); } @@ -658,12 +687,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/RedirectMethodEnum.java b/src/main/java/com/bandwidth/sdk/model/RedirectMethodEnum.java index ef3d6bfd..18c26b22 100644 --- a/src/main/java/com/bandwidth/sdk/model/RedirectMethodEnum.java +++ b/src/main/java/com/bandwidth/sdk/model/RedirectMethodEnum.java @@ -18,7 +18,6 @@ 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; @@ -69,10 +68,5 @@ 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 1b0e0ecc..37f2ed35 100644 --- a/src/main/java/com/bandwidth/sdk/model/StirShaken.java +++ b/src/main/java/com/bandwidth/sdk/model/StirShaken.java @@ -42,6 +42,7 @@ 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; @@ -67,6 +68,7 @@ public StirShaken() { } public StirShaken verstat(String verstat) { + this.verstat = verstat; return this; } @@ -80,12 +82,14 @@ public String getVerstat() { return verstat; } + public void setVerstat(String verstat) { this.verstat = verstat; } public StirShaken attestationIndicator(String attestationIndicator) { + this.attestationIndicator = attestationIndicator; return this; } @@ -99,12 +103,14 @@ public String getAttestationIndicator() { return attestationIndicator; } + public void setAttestationIndicator(String attestationIndicator) { this.attestationIndicator = attestationIndicator; } public StirShaken originatingId(String originatingId) { + this.originatingId = originatingId; return this; } @@ -118,6 +124,7 @@ public String getOriginatingId() { return originatingId; } + public void setOriginatingId(String originatingId) { this.originatingId = originatingId; } @@ -278,12 +285,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/Tag.java b/src/main/java/com/bandwidth/sdk/model/Tag.java index 6dc61cde..6964e4d8 100644 --- a/src/main/java/com/bandwidth/sdk/model/Tag.java +++ b/src/main/java/com/bandwidth/sdk/model/Tag.java @@ -42,6 +42,7 @@ 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,6 +64,7 @@ public Tag() { } public Tag key(String key) { + this.key = key; return this; } @@ -76,12 +78,14 @@ public String getKey() { return key; } + public void setKey(String key) { this.key = key; } public Tag value(String value) { + this.value = value; return this; } @@ -95,6 +99,7 @@ public String getValue() { return value; } + public void setValue(String value) { this.value = value; } @@ -249,12 +254,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/TnLookupRequestError.java b/src/main/java/com/bandwidth/sdk/model/TnLookupRequestError.java index 948becc4..1cfa0ab4 100644 --- a/src/main/java/com/bandwidth/sdk/model/TnLookupRequestError.java +++ b/src/main/java/com/bandwidth/sdk/model/TnLookupRequestError.java @@ -42,6 +42,7 @@ 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; @@ -59,6 +60,7 @@ public TnLookupRequestError() { } public TnLookupRequestError message(String message) { + this.message = message; return this; } @@ -72,6 +74,7 @@ public String getMessage() { return message; } + public void setMessage(String message) { this.message = message; } @@ -220,12 +223,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/TranscribeRecording.java b/src/main/java/com/bandwidth/sdk/model/TranscribeRecording.java index 7a95598e..f5680890 100644 --- a/src/main/java/com/bandwidth/sdk/model/TranscribeRecording.java +++ b/src/main/java/com/bandwidth/sdk/model/TranscribeRecording.java @@ -45,6 +45,7 @@ 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; @@ -86,6 +87,7 @@ public TranscribeRecording() { } public TranscribeRecording callbackUrl(URI callbackUrl) { + this.callbackUrl = callbackUrl; return this; } @@ -99,12 +101,14 @@ public URI getCallbackUrl() { return callbackUrl; } + public void setCallbackUrl(URI callbackUrl) { this.callbackUrl = callbackUrl; } public TranscribeRecording callbackMethod(CallbackMethodEnum callbackMethod) { + this.callbackMethod = callbackMethod; return this; } @@ -118,12 +122,14 @@ public CallbackMethodEnum getCallbackMethod() { return callbackMethod; } + public void setCallbackMethod(CallbackMethodEnum callbackMethod) { this.callbackMethod = callbackMethod; } public TranscribeRecording username(String username) { + this.username = username; return this; } @@ -137,12 +143,14 @@ public String getUsername() { return username; } + public void setUsername(String username) { this.username = username; } public TranscribeRecording password(String password) { + this.password = password; return this; } @@ -156,12 +164,14 @@ public String getPassword() { return password; } + public void setPassword(String password) { this.password = password; } public TranscribeRecording tag(String tag) { + this.tag = tag; return this; } @@ -175,12 +185,14 @@ public String getTag() { return tag; } + public void setTag(String tag) { this.tag = tag; } public TranscribeRecording callbackTimeout(Double callbackTimeout) { + this.callbackTimeout = callbackTimeout; return this; } @@ -196,12 +208,14 @@ public Double getCallbackTimeout() { return callbackTimeout; } + public void setCallbackTimeout(Double callbackTimeout) { this.callbackTimeout = callbackTimeout; } public TranscribeRecording detectLanguage(Boolean detectLanguage) { + this.detectLanguage = detectLanguage; return this; } @@ -215,6 +229,7 @@ public Boolean getDetectLanguage() { return detectLanguage; } + public void setDetectLanguage(Boolean detectLanguage) { this.detectLanguage = detectLanguage; } @@ -362,10 +377,6 @@ 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())); } @@ -405,12 +416,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/Transcription.java b/src/main/java/com/bandwidth/sdk/model/Transcription.java index 1a8e531e..dc3f1c32 100644 --- a/src/main/java/com/bandwidth/sdk/model/Transcription.java +++ b/src/main/java/com/bandwidth/sdk/model/Transcription.java @@ -42,6 +42,7 @@ 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,6 +64,7 @@ public Transcription() { } public Transcription text(String text) { + this.text = text; return this; } @@ -76,12 +78,14 @@ public String getText() { return text; } + public void setText(String text) { this.text = text; } public Transcription confidence(Double confidence) { + this.confidence = confidence; return this; } @@ -95,6 +99,7 @@ public Double getConfidence() { return confidence; } + public void setConfidence(Double confidence) { this.confidence = confidence; } @@ -246,12 +251,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/TranscriptionAvailableCallback.java b/src/main/java/com/bandwidth/sdk/model/TranscriptionAvailableCallback.java index 446e4ea6..9b40b70f 100644 --- a/src/main/java/com/bandwidth/sdk/model/TranscriptionAvailableCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/TranscriptionAvailableCallback.java @@ -48,6 +48,7 @@ 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; @@ -145,6 +146,7 @@ public TranscriptionAvailableCallback() { } public TranscriptionAvailableCallback eventType(String eventType) { + this.eventType = eventType; return this; } @@ -158,12 +160,14 @@ public String getEventType() { return eventType; } + public void setEventType(String eventType) { this.eventType = eventType; } public TranscriptionAvailableCallback eventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; return this; } @@ -177,12 +181,14 @@ public OffsetDateTime getEventTime() { return eventTime; } + public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public TranscriptionAvailableCallback accountId(String accountId) { + this.accountId = accountId; return this; } @@ -196,12 +202,14 @@ public String getAccountId() { return accountId; } + public void setAccountId(String accountId) { this.accountId = accountId; } public TranscriptionAvailableCallback applicationId(String applicationId) { + this.applicationId = applicationId; return this; } @@ -215,12 +223,14 @@ public String getApplicationId() { return applicationId; } + public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public TranscriptionAvailableCallback from(String from) { + this.from = from; return this; } @@ -234,12 +244,14 @@ public String getFrom() { return from; } + public void setFrom(String from) { this.from = from; } public TranscriptionAvailableCallback to(String to) { + this.to = to; return this; } @@ -253,12 +265,14 @@ public String getTo() { return to; } + public void setTo(String to) { this.to = to; } public TranscriptionAvailableCallback direction(CallDirectionEnum direction) { + this.direction = direction; return this; } @@ -272,12 +286,14 @@ public CallDirectionEnum getDirection() { return direction; } + public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public TranscriptionAvailableCallback callId(String callId) { + this.callId = callId; return this; } @@ -291,12 +307,14 @@ public String getCallId() { return callId; } + public void setCallId(String callId) { this.callId = callId; } public TranscriptionAvailableCallback callUrl(String callUrl) { + this.callUrl = callUrl; return this; } @@ -310,12 +328,14 @@ public String getCallUrl() { return callUrl; } + public void setCallUrl(String callUrl) { this.callUrl = callUrl; } public TranscriptionAvailableCallback mediaUrl(URI mediaUrl) { + this.mediaUrl = mediaUrl; return this; } @@ -329,12 +349,14 @@ public URI getMediaUrl() { return mediaUrl; } + public void setMediaUrl(URI mediaUrl) { this.mediaUrl = mediaUrl; } public TranscriptionAvailableCallback parentCallId(String parentCallId) { + this.parentCallId = parentCallId; return this; } @@ -348,12 +370,14 @@ public String getParentCallId() { return parentCallId; } + public void setParentCallId(String parentCallId) { this.parentCallId = parentCallId; } public TranscriptionAvailableCallback recordingId(String recordingId) { + this.recordingId = recordingId; return this; } @@ -367,12 +391,14 @@ public String getRecordingId() { return recordingId; } + public void setRecordingId(String recordingId) { this.recordingId = recordingId; } public TranscriptionAvailableCallback enqueuedTime(OffsetDateTime enqueuedTime) { + this.enqueuedTime = enqueuedTime; return this; } @@ -386,12 +412,14 @@ public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } + public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public TranscriptionAvailableCallback startTime(OffsetDateTime startTime) { + this.startTime = startTime; return this; } @@ -405,12 +433,14 @@ public OffsetDateTime getStartTime() { return startTime; } + public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public TranscriptionAvailableCallback endTime(OffsetDateTime endTime) { + this.endTime = endTime; return this; } @@ -424,12 +454,14 @@ public OffsetDateTime getEndTime() { return endTime; } + public void setEndTime(OffsetDateTime endTime) { this.endTime = endTime; } public TranscriptionAvailableCallback duration(String duration) { + this.duration = duration; return this; } @@ -443,12 +475,14 @@ public String getDuration() { return duration; } + public void setDuration(String duration) { this.duration = duration; } public TranscriptionAvailableCallback fileFormat(FileFormatEnum fileFormat) { + this.fileFormat = fileFormat; return this; } @@ -462,12 +496,14 @@ public FileFormatEnum getFileFormat() { return fileFormat; } + public void setFileFormat(FileFormatEnum fileFormat) { this.fileFormat = fileFormat; } public TranscriptionAvailableCallback tag(String tag) { + this.tag = tag; return this; } @@ -481,12 +517,14 @@ public String getTag() { return tag; } + public void setTag(String tag) { this.tag = tag; } public TranscriptionAvailableCallback transcription(Transcription transcription) { + this.transcription = transcription; return this; } @@ -500,12 +538,14 @@ public Transcription getTranscription() { return transcription; } + public void setTranscription(Transcription transcription) { this.transcription = transcription; } public TranscriptionAvailableCallback transferCallerId(String transferCallerId) { + this.transferCallerId = transferCallerId; return this; } @@ -519,12 +559,14 @@ public String getTransferCallerId() { return transferCallerId; } + public void setTransferCallerId(String transferCallerId) { this.transferCallerId = transferCallerId; } public TranscriptionAvailableCallback transferTo(String transferTo) { + this.transferTo = transferTo; return this; } @@ -538,6 +580,7 @@ public String getTransferTo() { return transferTo; } + public void setTransferTo(String transferTo) { this.transferTo = transferTo; } @@ -739,10 +782,6 @@ 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())); } @@ -761,10 +800,6 @@ 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())); } @@ -808,12 +843,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/TranscriptionList.java b/src/main/java/com/bandwidth/sdk/model/TranscriptionList.java index fb569dcc..b7fedd5a 100644 --- a/src/main/java/com/bandwidth/sdk/model/TranscriptionList.java +++ b/src/main/java/com/bandwidth/sdk/model/TranscriptionList.java @@ -45,6 +45,7 @@ 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,6 +63,7 @@ public TranscriptionList() { } public TranscriptionList transcripts(List transcripts) { + this.transcripts = transcripts; return this; } @@ -83,6 +85,7 @@ public List getTranscripts() { return transcripts; } + public void setTranscripts(List transcripts) { this.transcripts = transcripts; } @@ -242,12 +245,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/TranscriptionMetadata.java b/src/main/java/com/bandwidth/sdk/model/TranscriptionMetadata.java index 1a3ccdaa..ede152d6 100644 --- a/src/main/java/com/bandwidth/sdk/model/TranscriptionMetadata.java +++ b/src/main/java/com/bandwidth/sdk/model/TranscriptionMetadata.java @@ -43,6 +43,7 @@ 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,6 +73,7 @@ public TranscriptionMetadata() { } public TranscriptionMetadata id(String id) { + this.id = id; return this; } @@ -85,12 +87,14 @@ public String getId() { return id; } + public void setId(String id) { this.id = id; } public TranscriptionMetadata status(String status) { + this.status = status; return this; } @@ -104,12 +108,14 @@ public String getStatus() { return status; } + public void setStatus(String status) { this.status = status; } public TranscriptionMetadata completedTime(String completedTime) { + this.completedTime = completedTime; return this; } @@ -123,12 +129,14 @@ public String getCompletedTime() { return completedTime; } + public void setCompletedTime(String completedTime) { this.completedTime = completedTime; } public TranscriptionMetadata url(URI url) { + this.url = url; return this; } @@ -142,6 +150,7 @@ public URI getUrl() { return url; } + public void setUrl(URI url) { this.url = url; } @@ -308,12 +317,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/TransferAnswerCallback.java b/src/main/java/com/bandwidth/sdk/model/TransferAnswerCallback.java index 32333989..9ea43ba9 100644 --- a/src/main/java/com/bandwidth/sdk/model/TransferAnswerCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/TransferAnswerCallback.java @@ -45,6 +45,7 @@ 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; @@ -118,6 +119,7 @@ public TransferAnswerCallback() { } public TransferAnswerCallback eventType(String eventType) { + this.eventType = eventType; return this; } @@ -131,12 +133,14 @@ public String getEventType() { return eventType; } + public void setEventType(String eventType) { this.eventType = eventType; } public TransferAnswerCallback eventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; return this; } @@ -150,12 +154,14 @@ public OffsetDateTime getEventTime() { return eventTime; } + public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public TransferAnswerCallback accountId(String accountId) { + this.accountId = accountId; return this; } @@ -169,12 +175,14 @@ public String getAccountId() { return accountId; } + public void setAccountId(String accountId) { this.accountId = accountId; } public TransferAnswerCallback applicationId(String applicationId) { + this.applicationId = applicationId; return this; } @@ -188,12 +196,14 @@ public String getApplicationId() { return applicationId; } + public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public TransferAnswerCallback from(String from) { + this.from = from; return this; } @@ -207,12 +217,14 @@ public String getFrom() { return from; } + public void setFrom(String from) { this.from = from; } public TransferAnswerCallback to(String to) { + this.to = to; return this; } @@ -226,12 +238,14 @@ public String getTo() { return to; } + public void setTo(String to) { this.to = to; } public TransferAnswerCallback direction(CallDirectionEnum direction) { + this.direction = direction; return this; } @@ -245,12 +259,14 @@ public CallDirectionEnum getDirection() { return direction; } + public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public TransferAnswerCallback callId(String callId) { + this.callId = callId; return this; } @@ -264,12 +280,14 @@ public String getCallId() { return callId; } + public void setCallId(String callId) { this.callId = callId; } public TransferAnswerCallback callUrl(String callUrl) { + this.callUrl = callUrl; return this; } @@ -283,12 +301,14 @@ public String getCallUrl() { return callUrl; } + public void setCallUrl(String callUrl) { this.callUrl = callUrl; } public TransferAnswerCallback enqueuedTime(OffsetDateTime enqueuedTime) { + this.enqueuedTime = enqueuedTime; return this; } @@ -302,12 +322,14 @@ public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } + public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public TransferAnswerCallback startTime(OffsetDateTime startTime) { + this.startTime = startTime; return this; } @@ -321,12 +343,14 @@ public OffsetDateTime getStartTime() { return startTime; } + public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public TransferAnswerCallback answerTime(OffsetDateTime answerTime) { + this.answerTime = answerTime; return this; } @@ -340,12 +364,14 @@ public OffsetDateTime getAnswerTime() { return answerTime; } + public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public TransferAnswerCallback tag(String tag) { + this.tag = tag; return this; } @@ -359,12 +385,14 @@ public String getTag() { return tag; } + public void setTag(String tag) { this.tag = tag; } public TransferAnswerCallback transferCallerId(String transferCallerId) { + this.transferCallerId = transferCallerId; return this; } @@ -378,12 +406,14 @@ public String getTransferCallerId() { return transferCallerId; } + public void setTransferCallerId(String transferCallerId) { this.transferCallerId = transferCallerId; } public TransferAnswerCallback transferTo(String transferTo) { + this.transferTo = transferTo; return this; } @@ -397,6 +427,7 @@ public String getTransferTo() { return transferTo; } + public void setTransferTo(String transferTo) { this.transferTo = transferTo; } @@ -580,10 +611,6 @@ 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())); } @@ -629,12 +656,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/TransferCompleteCallback.java b/src/main/java/com/bandwidth/sdk/model/TransferCompleteCallback.java index 19d9a4b4..7b8c772b 100644 --- a/src/main/java/com/bandwidth/sdk/model/TransferCompleteCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/TransferCompleteCallback.java @@ -45,6 +45,7 @@ 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; @@ -130,6 +131,7 @@ public TransferCompleteCallback() { } public TransferCompleteCallback eventType(String eventType) { + this.eventType = eventType; return this; } @@ -143,12 +145,14 @@ public String getEventType() { return eventType; } + public void setEventType(String eventType) { this.eventType = eventType; } public TransferCompleteCallback eventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; return this; } @@ -162,12 +166,14 @@ public OffsetDateTime getEventTime() { return eventTime; } + public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public TransferCompleteCallback accountId(String accountId) { + this.accountId = accountId; return this; } @@ -181,12 +187,14 @@ public String getAccountId() { return accountId; } + public void setAccountId(String accountId) { this.accountId = accountId; } public TransferCompleteCallback applicationId(String applicationId) { + this.applicationId = applicationId; return this; } @@ -200,12 +208,14 @@ public String getApplicationId() { return applicationId; } + public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public TransferCompleteCallback from(String from) { + this.from = from; return this; } @@ -219,12 +229,14 @@ public String getFrom() { return from; } + public void setFrom(String from) { this.from = from; } public TransferCompleteCallback to(String to) { + this.to = to; return this; } @@ -238,12 +250,14 @@ public String getTo() { return to; } + public void setTo(String to) { this.to = to; } public TransferCompleteCallback direction(CallDirectionEnum direction) { + this.direction = direction; return this; } @@ -257,12 +271,14 @@ public CallDirectionEnum getDirection() { return direction; } + public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public TransferCompleteCallback callId(String callId) { + this.callId = callId; return this; } @@ -276,12 +292,14 @@ public String getCallId() { return callId; } + public void setCallId(String callId) { this.callId = callId; } public TransferCompleteCallback callUrl(String callUrl) { + this.callUrl = callUrl; return this; } @@ -295,12 +313,14 @@ public String getCallUrl() { return callUrl; } + public void setCallUrl(String callUrl) { this.callUrl = callUrl; } public TransferCompleteCallback enqueuedTime(OffsetDateTime enqueuedTime) { + this.enqueuedTime = enqueuedTime; return this; } @@ -314,12 +334,14 @@ public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } + public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public TransferCompleteCallback startTime(OffsetDateTime startTime) { + this.startTime = startTime; return this; } @@ -333,12 +355,14 @@ public OffsetDateTime getStartTime() { return startTime; } + public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public TransferCompleteCallback answerTime(OffsetDateTime answerTime) { + this.answerTime = answerTime; return this; } @@ -352,12 +376,14 @@ public OffsetDateTime getAnswerTime() { return answerTime; } + public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public TransferCompleteCallback tag(String tag) { + this.tag = tag; return this; } @@ -371,12 +397,14 @@ public String getTag() { return tag; } + public void setTag(String tag) { this.tag = tag; } public TransferCompleteCallback transferCallerId(String transferCallerId) { + this.transferCallerId = transferCallerId; return this; } @@ -390,12 +418,14 @@ public String getTransferCallerId() { return transferCallerId; } + public void setTransferCallerId(String transferCallerId) { this.transferCallerId = transferCallerId; } public TransferCompleteCallback transferTo(String transferTo) { + this.transferTo = transferTo; return this; } @@ -409,12 +439,14 @@ public String getTransferTo() { return transferTo; } + public void setTransferTo(String transferTo) { this.transferTo = transferTo; } public TransferCompleteCallback cause(String cause) { + this.cause = cause; return this; } @@ -428,12 +460,14 @@ public String getCause() { return cause; } + public void setCause(String cause) { this.cause = cause; } public TransferCompleteCallback errorMessage(String errorMessage) { + this.errorMessage = errorMessage; return this; } @@ -447,12 +481,14 @@ public String getErrorMessage() { return errorMessage; } + public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; } public TransferCompleteCallback errorId(String errorId) { + this.errorId = errorId; return this; } @@ -466,6 +502,7 @@ public String getErrorId() { return errorId; } + public void setErrorId(String errorId) { this.errorId = errorId; } @@ -658,10 +695,6 @@ 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())); } @@ -716,12 +749,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/TransferDisconnectCallback.java b/src/main/java/com/bandwidth/sdk/model/TransferDisconnectCallback.java index c9e438ae..05ccefd5 100644 --- a/src/main/java/com/bandwidth/sdk/model/TransferDisconnectCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/TransferDisconnectCallback.java @@ -45,6 +45,7 @@ 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; @@ -138,6 +139,7 @@ public TransferDisconnectCallback() { } public TransferDisconnectCallback eventType(String eventType) { + this.eventType = eventType; return this; } @@ -151,12 +153,14 @@ public String getEventType() { return eventType; } + public void setEventType(String eventType) { this.eventType = eventType; } public TransferDisconnectCallback eventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; return this; } @@ -170,12 +174,14 @@ public OffsetDateTime getEventTime() { return eventTime; } + public void setEventTime(OffsetDateTime eventTime) { this.eventTime = eventTime; } public TransferDisconnectCallback accountId(String accountId) { + this.accountId = accountId; return this; } @@ -189,12 +195,14 @@ public String getAccountId() { return accountId; } + public void setAccountId(String accountId) { this.accountId = accountId; } public TransferDisconnectCallback applicationId(String applicationId) { + this.applicationId = applicationId; return this; } @@ -208,12 +216,14 @@ public String getApplicationId() { return applicationId; } + public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public TransferDisconnectCallback from(String from) { + this.from = from; return this; } @@ -227,12 +237,14 @@ public String getFrom() { return from; } + public void setFrom(String from) { this.from = from; } public TransferDisconnectCallback to(String to) { + this.to = to; return this; } @@ -246,12 +258,14 @@ public String getTo() { return to; } + public void setTo(String to) { this.to = to; } public TransferDisconnectCallback direction(CallDirectionEnum direction) { + this.direction = direction; return this; } @@ -265,12 +279,14 @@ public CallDirectionEnum getDirection() { return direction; } + public void setDirection(CallDirectionEnum direction) { this.direction = direction; } public TransferDisconnectCallback callId(String callId) { + this.callId = callId; return this; } @@ -284,12 +300,14 @@ public String getCallId() { return callId; } + public void setCallId(String callId) { this.callId = callId; } public TransferDisconnectCallback callUrl(String callUrl) { + this.callUrl = callUrl; return this; } @@ -303,12 +321,14 @@ public String getCallUrl() { return callUrl; } + public void setCallUrl(String callUrl) { this.callUrl = callUrl; } public TransferDisconnectCallback parentCallId(String parentCallId) { + this.parentCallId = parentCallId; return this; } @@ -322,12 +342,14 @@ public String getParentCallId() { return parentCallId; } + public void setParentCallId(String parentCallId) { this.parentCallId = parentCallId; } public TransferDisconnectCallback enqueuedTime(OffsetDateTime enqueuedTime) { + this.enqueuedTime = enqueuedTime; return this; } @@ -341,12 +363,14 @@ public OffsetDateTime getEnqueuedTime() { return enqueuedTime; } + public void setEnqueuedTime(OffsetDateTime enqueuedTime) { this.enqueuedTime = enqueuedTime; } public TransferDisconnectCallback startTime(OffsetDateTime startTime) { + this.startTime = startTime; return this; } @@ -360,12 +384,14 @@ public OffsetDateTime getStartTime() { return startTime; } + public void setStartTime(OffsetDateTime startTime) { this.startTime = startTime; } public TransferDisconnectCallback answerTime(OffsetDateTime answerTime) { + this.answerTime = answerTime; return this; } @@ -379,12 +405,14 @@ public OffsetDateTime getAnswerTime() { return answerTime; } + public void setAnswerTime(OffsetDateTime answerTime) { this.answerTime = answerTime; } public TransferDisconnectCallback endTime(OffsetDateTime endTime) { + this.endTime = endTime; return this; } @@ -398,12 +426,14 @@ public OffsetDateTime getEndTime() { return endTime; } + public void setEndTime(OffsetDateTime endTime) { this.endTime = endTime; } public TransferDisconnectCallback tag(String tag) { + this.tag = tag; return this; } @@ -417,12 +447,14 @@ public String getTag() { return tag; } + public void setTag(String tag) { this.tag = tag; } public TransferDisconnectCallback transferCallerId(String transferCallerId) { + this.transferCallerId = transferCallerId; return this; } @@ -436,12 +468,14 @@ public String getTransferCallerId() { return transferCallerId; } + public void setTransferCallerId(String transferCallerId) { this.transferCallerId = transferCallerId; } public TransferDisconnectCallback transferTo(String transferTo) { + this.transferTo = transferTo; return this; } @@ -455,12 +489,14 @@ public String getTransferTo() { return transferTo; } + public void setTransferTo(String transferTo) { this.transferTo = transferTo; } public TransferDisconnectCallback cause(String cause) { + this.cause = cause; return this; } @@ -474,12 +510,14 @@ public String getCause() { return cause; } + public void setCause(String cause) { this.cause = cause; } public TransferDisconnectCallback errorMessage(String errorMessage) { + this.errorMessage = errorMessage; return this; } @@ -493,12 +531,14 @@ public String getErrorMessage() { return errorMessage; } + public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; } public TransferDisconnectCallback errorId(String errorId) { + this.errorId = errorId; return this; } @@ -512,6 +552,7 @@ public String getErrorId() { return errorId; } + public void setErrorId(String errorId) { this.errorId = errorId; } @@ -710,10 +751,6 @@ 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())); } @@ -771,12 +808,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/UpdateCall.java b/src/main/java/com/bandwidth/sdk/model/UpdateCall.java index afa0dfc7..c367471e 100644 --- a/src/main/java/com/bandwidth/sdk/model/UpdateCall.java +++ b/src/main/java/com/bandwidth/sdk/model/UpdateCall.java @@ -46,6 +46,7 @@ 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; @@ -99,6 +100,7 @@ public UpdateCall() { } public UpdateCall state(CallStateEnum state) { + this.state = state; return this; } @@ -112,12 +114,14 @@ public CallStateEnum getState() { return state; } + public void setState(CallStateEnum state) { this.state = state; } public UpdateCall redirectUrl(URI redirectUrl) { + this.redirectUrl = redirectUrl; return this; } @@ -131,12 +135,14 @@ public URI getRedirectUrl() { return redirectUrl; } + public void setRedirectUrl(URI redirectUrl) { this.redirectUrl = redirectUrl; } public UpdateCall redirectMethod(RedirectMethodEnum redirectMethod) { + this.redirectMethod = redirectMethod; return this; } @@ -150,12 +156,14 @@ public RedirectMethodEnum getRedirectMethod() { return redirectMethod; } + public void setRedirectMethod(RedirectMethodEnum redirectMethod) { this.redirectMethod = redirectMethod; } public UpdateCall username(String username) { + this.username = username; return this; } @@ -169,12 +177,14 @@ public String getUsername() { return username; } + public void setUsername(String username) { this.username = username; } public UpdateCall password(String password) { + this.password = password; return this; } @@ -188,12 +198,14 @@ public String getPassword() { return password; } + public void setPassword(String password) { this.password = password; } public UpdateCall redirectFallbackUrl(URI redirectFallbackUrl) { + this.redirectFallbackUrl = redirectFallbackUrl; return this; } @@ -207,12 +219,14 @@ public URI getRedirectFallbackUrl() { return redirectFallbackUrl; } + public void setRedirectFallbackUrl(URI redirectFallbackUrl) { this.redirectFallbackUrl = redirectFallbackUrl; } public UpdateCall redirectFallbackMethod(RedirectMethodEnum redirectFallbackMethod) { + this.redirectFallbackMethod = redirectFallbackMethod; return this; } @@ -226,12 +240,14 @@ public RedirectMethodEnum getRedirectFallbackMethod() { return redirectFallbackMethod; } + public void setRedirectFallbackMethod(RedirectMethodEnum redirectFallbackMethod) { this.redirectFallbackMethod = redirectFallbackMethod; } public UpdateCall fallbackUsername(String fallbackUsername) { + this.fallbackUsername = fallbackUsername; return this; } @@ -245,12 +261,14 @@ public String getFallbackUsername() { return fallbackUsername; } + public void setFallbackUsername(String fallbackUsername) { this.fallbackUsername = fallbackUsername; } public UpdateCall fallbackPassword(String fallbackPassword) { + this.fallbackPassword = fallbackPassword; return this; } @@ -264,12 +282,14 @@ public String getFallbackPassword() { return fallbackPassword; } + public void setFallbackPassword(String fallbackPassword) { this.fallbackPassword = fallbackPassword; } public UpdateCall tag(String tag) { + this.tag = tag; return this; } @@ -283,6 +303,7 @@ public String getTag() { return tag; } + public void setTag(String tag) { this.tag = tag; } @@ -436,17 +457,9 @@ 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())); } @@ -456,10 +469,6 @@ 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())); } @@ -499,12 +508,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/UpdateCallRecording.java b/src/main/java/com/bandwidth/sdk/model/UpdateCallRecording.java index 58f982c4..90e9148f 100644 --- a/src/main/java/com/bandwidth/sdk/model/UpdateCallRecording.java +++ b/src/main/java/com/bandwidth/sdk/model/UpdateCallRecording.java @@ -43,6 +43,7 @@ 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,6 +61,7 @@ public UpdateCallRecording() { } public UpdateCallRecording state(RecordingStateEnum state) { + this.state = state; return this; } @@ -73,6 +75,7 @@ public RecordingStateEnum getState() { return state; } + public void setState(RecordingStateEnum state) { this.state = state; } @@ -196,8 +199,6 @@ 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 { @@ -228,12 +229,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/UpdateConference.java b/src/main/java/com/bandwidth/sdk/model/UpdateConference.java index 7aa26838..afa2ae1c 100644 --- a/src/main/java/com/bandwidth/sdk/model/UpdateConference.java +++ b/src/main/java/com/bandwidth/sdk/model/UpdateConference.java @@ -46,6 +46,7 @@ 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,6 +96,7 @@ public UpdateConference() { } public UpdateConference status(ConferenceStateEnum status) { + this.status = status; return this; } @@ -108,12 +110,14 @@ public ConferenceStateEnum getStatus() { return status; } + public void setStatus(ConferenceStateEnum status) { this.status = status; } public UpdateConference redirectUrl(URI redirectUrl) { + this.redirectUrl = redirectUrl; return this; } @@ -127,12 +131,14 @@ public URI getRedirectUrl() { return redirectUrl; } + public void setRedirectUrl(URI redirectUrl) { this.redirectUrl = redirectUrl; } public UpdateConference redirectMethod(RedirectMethodEnum redirectMethod) { + this.redirectMethod = redirectMethod; return this; } @@ -146,12 +152,14 @@ public RedirectMethodEnum getRedirectMethod() { return redirectMethod; } + public void setRedirectMethod(RedirectMethodEnum redirectMethod) { this.redirectMethod = redirectMethod; } public UpdateConference username(String username) { + this.username = username; return this; } @@ -165,12 +173,14 @@ public String getUsername() { return username; } + public void setUsername(String username) { this.username = username; } public UpdateConference password(String password) { + this.password = password; return this; } @@ -184,12 +194,14 @@ public String getPassword() { return password; } + public void setPassword(String password) { this.password = password; } public UpdateConference redirectFallbackUrl(URI redirectFallbackUrl) { + this.redirectFallbackUrl = redirectFallbackUrl; return this; } @@ -203,12 +215,14 @@ public URI getRedirectFallbackUrl() { return redirectFallbackUrl; } + public void setRedirectFallbackUrl(URI redirectFallbackUrl) { this.redirectFallbackUrl = redirectFallbackUrl; } public UpdateConference redirectFallbackMethod(RedirectMethodEnum redirectFallbackMethod) { + this.redirectFallbackMethod = redirectFallbackMethod; return this; } @@ -222,12 +236,14 @@ public RedirectMethodEnum getRedirectFallbackMethod() { return redirectFallbackMethod; } + public void setRedirectFallbackMethod(RedirectMethodEnum redirectFallbackMethod) { this.redirectFallbackMethod = redirectFallbackMethod; } public UpdateConference fallbackUsername(String fallbackUsername) { + this.fallbackUsername = fallbackUsername; return this; } @@ -241,12 +257,14 @@ public String getFallbackUsername() { return fallbackUsername; } + public void setFallbackUsername(String fallbackUsername) { this.fallbackUsername = fallbackUsername; } public UpdateConference fallbackPassword(String fallbackPassword) { + this.fallbackPassword = fallbackPassword; return this; } @@ -260,6 +278,7 @@ public String getFallbackPassword() { return fallbackPassword; } + public void setFallbackPassword(String fallbackPassword) { this.fallbackPassword = fallbackPassword; } @@ -410,17 +429,9 @@ 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())); } @@ -430,10 +441,6 @@ 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())); } @@ -470,12 +477,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/UpdateConferenceMember.java b/src/main/java/com/bandwidth/sdk/model/UpdateConferenceMember.java index deeae0bf..00cffd4f 100644 --- a/src/main/java/com/bandwidth/sdk/model/UpdateConferenceMember.java +++ b/src/main/java/com/bandwidth/sdk/model/UpdateConferenceMember.java @@ -45,6 +45,7 @@ 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; @@ -70,6 +71,7 @@ public UpdateConferenceMember() { } public UpdateConferenceMember mute(Boolean mute) { + this.mute = mute; return this; } @@ -83,12 +85,14 @@ public Boolean getMute() { return mute; } + public void setMute(Boolean mute) { this.mute = mute; } public UpdateConferenceMember hold(Boolean hold) { + this.hold = hold; return this; } @@ -102,12 +106,14 @@ public Boolean getHold() { return hold; } + public void setHold(Boolean hold) { this.hold = hold; } public UpdateConferenceMember callIdsToCoach(List callIdsToCoach) { + this.callIdsToCoach = callIdsToCoach; return this; } @@ -129,6 +135,7 @@ public List getCallIdsToCoach() { return callIdsToCoach; } + public void setCallIdsToCoach(List callIdsToCoach) { this.callIdsToCoach = callIdsToCoach; } @@ -295,12 +302,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/VerifyCodeRequest.java b/src/main/java/com/bandwidth/sdk/model/VerifyCodeRequest.java index 4a7eee10..87c6d224 100644 --- a/src/main/java/com/bandwidth/sdk/model/VerifyCodeRequest.java +++ b/src/main/java/com/bandwidth/sdk/model/VerifyCodeRequest.java @@ -43,6 +43,7 @@ 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,6 +73,7 @@ public VerifyCodeRequest() { } public VerifyCodeRequest to(String to) { + this.to = to; return this; } @@ -85,12 +87,14 @@ public String getTo() { return to; } + public void setTo(String to) { this.to = to; } public VerifyCodeRequest scope(String scope) { + this.scope = scope; return this; } @@ -104,12 +108,14 @@ public String getScope() { return scope; } + public void setScope(String scope) { this.scope = scope; } public VerifyCodeRequest expirationTimeInMinutes(BigDecimal expirationTimeInMinutes) { + this.expirationTimeInMinutes = expirationTimeInMinutes; return this; } @@ -125,12 +131,14 @@ public BigDecimal getExpirationTimeInMinutes() { return expirationTimeInMinutes; } + public void setExpirationTimeInMinutes(BigDecimal expirationTimeInMinutes) { this.expirationTimeInMinutes = expirationTimeInMinutes; } public VerifyCodeRequest code(String code) { + this.code = code; return this; } @@ -144,6 +152,7 @@ public String getCode() { return code; } + public void setCode(String code) { this.code = code; } @@ -317,12 +326,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/VerifyCodeResponse.java b/src/main/java/com/bandwidth/sdk/model/VerifyCodeResponse.java index b6f2707c..595c8057 100644 --- a/src/main/java/com/bandwidth/sdk/model/VerifyCodeResponse.java +++ b/src/main/java/com/bandwidth/sdk/model/VerifyCodeResponse.java @@ -42,6 +42,7 @@ 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; @@ -59,6 +60,7 @@ public VerifyCodeResponse() { } public VerifyCodeResponse valid(Boolean valid) { + this.valid = valid; return this; } @@ -72,6 +74,7 @@ public Boolean getValid() { return valid; } + public void setValid(Boolean valid) { this.valid = valid; } @@ -217,12 +220,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/VoiceApiError.java b/src/main/java/com/bandwidth/sdk/model/VoiceApiError.java index a6ece3fc..905ebfcd 100644 --- a/src/main/java/com/bandwidth/sdk/model/VoiceApiError.java +++ b/src/main/java/com/bandwidth/sdk/model/VoiceApiError.java @@ -43,6 +43,7 @@ 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,6 +69,7 @@ public VoiceApiError() { } public VoiceApiError type(String type) { + this.type = type; return this; } @@ -81,12 +83,14 @@ public String getType() { return type; } + public void setType(String type) { this.type = type; } public VoiceApiError description(String description) { + this.description = description; return this; } @@ -100,12 +104,14 @@ public String getDescription() { return description; } + public void setDescription(String description) { this.description = description; } public VoiceApiError id(String id) { + this.id = id; return this; } @@ -119,6 +125,7 @@ public String getId() { return id; } + public void setId(String id) { this.id = id; } @@ -290,12 +297,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } } diff --git a/src/main/java/com/bandwidth/sdk/model/VoiceCodeResponse.java b/src/main/java/com/bandwidth/sdk/model/VoiceCodeResponse.java index 636618b3..e63e8932 100644 --- a/src/main/java/com/bandwidth/sdk/model/VoiceCodeResponse.java +++ b/src/main/java/com/bandwidth/sdk/model/VoiceCodeResponse.java @@ -42,6 +42,7 @@ 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; @@ -59,6 +60,7 @@ public VoiceCodeResponse() { } public VoiceCodeResponse callId(String callId) { + this.callId = callId; return this; } @@ -72,6 +74,7 @@ public String getCallId() { return callId; } + public void setCallId(String callId) { this.callId = callId; } @@ -220,12 +223,7 @@ else if (entry.getValue() instanceof Boolean) else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } }