diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index a00bd3ea..0a5ed83d 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -17,6 +17,7 @@ docs/CallTranscriptionMetadata.md docs/CallTranscriptionResponse.md docs/CallTranscriptionTrackEnum.md docs/CallbackMethodEnum.md +docs/CallbackTypeEnum.md docs/CallsApi.md docs/CodeRequest.md docs/Conference.md @@ -41,8 +42,6 @@ docs/DtmfCallback.md docs/FieldError.md docs/FileFormatEnum.md docs/GatherCallback.md -docs/InboundMessageCallback.md -docs/InboundMessageCallbackMessage.md docs/InitiateCallback.md docs/ListMessageDirectionEnum.md docs/ListMessageItem.md @@ -57,14 +56,10 @@ docs/MachineDetectionResult.md docs/Media.md docs/MediaApi.md docs/Message.md -docs/MessageDeliveredCallback.md -docs/MessageDeliveredCallbackMessage.md +docs/MessageCallback.md +docs/MessageCallbackMessage.md docs/MessageDirectionEnum.md -docs/MessageFailedCallback.md -docs/MessageFailedCallbackMessage.md docs/MessageRequest.md -docs/MessageSendingCallback.md -docs/MessageSendingCallbackMessage.md docs/MessageStatusEnum.md docs/MessageTypeEnum.md docs/MessagesApi.md @@ -155,6 +150,7 @@ src/main/java/com/bandwidth/sdk/model/CallTranscriptionMetadata.java src/main/java/com/bandwidth/sdk/model/CallTranscriptionResponse.java src/main/java/com/bandwidth/sdk/model/CallTranscriptionTrackEnum.java src/main/java/com/bandwidth/sdk/model/CallbackMethodEnum.java +src/main/java/com/bandwidth/sdk/model/CallbackTypeEnum.java src/main/java/com/bandwidth/sdk/model/CodeRequest.java src/main/java/com/bandwidth/sdk/model/Conference.java src/main/java/com/bandwidth/sdk/model/ConferenceCompletedCallback.java @@ -177,8 +173,6 @@ src/main/java/com/bandwidth/sdk/model/DtmfCallback.java src/main/java/com/bandwidth/sdk/model/FieldError.java src/main/java/com/bandwidth/sdk/model/FileFormatEnum.java src/main/java/com/bandwidth/sdk/model/GatherCallback.java -src/main/java/com/bandwidth/sdk/model/InboundMessageCallback.java -src/main/java/com/bandwidth/sdk/model/InboundMessageCallbackMessage.java src/main/java/com/bandwidth/sdk/model/InitiateCallback.java src/main/java/com/bandwidth/sdk/model/ListMessageDirectionEnum.java src/main/java/com/bandwidth/sdk/model/ListMessageItem.java @@ -192,14 +186,10 @@ src/main/java/com/bandwidth/sdk/model/MachineDetectionModeEnum.java src/main/java/com/bandwidth/sdk/model/MachineDetectionResult.java src/main/java/com/bandwidth/sdk/model/Media.java src/main/java/com/bandwidth/sdk/model/Message.java -src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallback.java -src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallbackMessage.java +src/main/java/com/bandwidth/sdk/model/MessageCallback.java +src/main/java/com/bandwidth/sdk/model/MessageCallbackMessage.java src/main/java/com/bandwidth/sdk/model/MessageDirectionEnum.java -src/main/java/com/bandwidth/sdk/model/MessageFailedCallback.java -src/main/java/com/bandwidth/sdk/model/MessageFailedCallbackMessage.java src/main/java/com/bandwidth/sdk/model/MessageRequest.java -src/main/java/com/bandwidth/sdk/model/MessageSendingCallback.java -src/main/java/com/bandwidth/sdk/model/MessageSendingCallbackMessage.java src/main/java/com/bandwidth/sdk/model/MessageStatusEnum.java src/main/java/com/bandwidth/sdk/model/MessageTypeEnum.java src/main/java/com/bandwidth/sdk/model/MessagesList.java diff --git a/README.md b/README.md index 7f29d440..4af7c59a 100644 --- a/README.md +++ b/README.md @@ -179,6 +179,7 @@ Class | Method | HTTP request | Description - [CallTranscriptionResponse](docs/CallTranscriptionResponse.md) - [CallTranscriptionTrackEnum](docs/CallTranscriptionTrackEnum.md) - [CallbackMethodEnum](docs/CallbackMethodEnum.md) + - [CallbackTypeEnum](docs/CallbackTypeEnum.md) - [CodeRequest](docs/CodeRequest.md) - [Conference](docs/Conference.md) - [ConferenceCompletedCallback](docs/ConferenceCompletedCallback.md) @@ -201,8 +202,6 @@ Class | Method | HTTP request | Description - [FieldError](docs/FieldError.md) - [FileFormatEnum](docs/FileFormatEnum.md) - [GatherCallback](docs/GatherCallback.md) - - [InboundMessageCallback](docs/InboundMessageCallback.md) - - [InboundMessageCallbackMessage](docs/InboundMessageCallbackMessage.md) - [InitiateCallback](docs/InitiateCallback.md) - [ListMessageDirectionEnum](docs/ListMessageDirectionEnum.md) - [ListMessageItem](docs/ListMessageItem.md) @@ -216,14 +215,10 @@ Class | Method | HTTP request | Description - [MachineDetectionResult](docs/MachineDetectionResult.md) - [Media](docs/Media.md) - [Message](docs/Message.md) - - [MessageDeliveredCallback](docs/MessageDeliveredCallback.md) - - [MessageDeliveredCallbackMessage](docs/MessageDeliveredCallbackMessage.md) + - [MessageCallback](docs/MessageCallback.md) + - [MessageCallbackMessage](docs/MessageCallbackMessage.md) - [MessageDirectionEnum](docs/MessageDirectionEnum.md) - - [MessageFailedCallback](docs/MessageFailedCallback.md) - - [MessageFailedCallbackMessage](docs/MessageFailedCallbackMessage.md) - [MessageRequest](docs/MessageRequest.md) - - [MessageSendingCallback](docs/MessageSendingCallback.md) - - [MessageSendingCallbackMessage](docs/MessageSendingCallbackMessage.md) - [MessageStatusEnum](docs/MessageStatusEnum.md) - [MessageTypeEnum](docs/MessageTypeEnum.md) - [MessagesList](docs/MessagesList.md) diff --git a/api/openapi.yaml b/api/openapi.yaml index 789c3efa..17670371 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -617,8 +617,6 @@ paths: - application/json post: callbacks: - inboundCallback: - $ref: '#/components/callbacks/inboundCallback' statusCallback: $ref: '#/components/callbacks/statusCallback' description: Endpoint for sending text messages and picture messages using V2 @@ -4646,9 +4644,16 @@ components: requestBody: content: application/json: + examples: + smsMessageReceivedCallback: + $ref: '#/components/examples/smsMessageReceivedCallbackExample' + mmsMessageReceivedCallback: + $ref: '#/components/examples/mmsMessageReceivedCallbackExample' schema: - $ref: '#/components/schemas/inboundMessageCallback' - description: Inbound Message Callback Payload + $ref: '#/components/schemas/messageCallback' + description: | +

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

Please visit Webhooks

required: true responses: "200": @@ -4659,18 +4664,166 @@ components: requestBody: content: application/json: + examples: + messageSendingCallback: + $ref: '#/components/examples/messageSendingCallbackExample' + smsMessageDeliveredCallback: + $ref: '#/components/examples/smsMessageDeliveredCallbackExample' + mmsMessageDeliveredCallback: + $ref: '#/components/examples/mmsMessageDeliveredCallbackExample' + groupMmsMessageDeliveredCallback: + $ref: '#/components/examples/groupMmsMessageDeliveredCallbackExample' + messageFailedCallback: + $ref: '#/components/examples/messageFailedCallbackExample' schema: - oneOf: - - $ref: '#/components/schemas/messageSendingCallback' - - $ref: '#/components/schemas/messageDeliveredCallback' - - $ref: '#/components/schemas/messageFailedCallback' - type: object - description: Status Callback Payload + $ref: '#/components/schemas/messageCallback' + description: | +

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

Please visit Webhooks

required: true responses: "200": description: OK examples: + smsMessageReceivedCallbackExample: + summary: An example of a sms message-received callback body. + value: + time: 2025-01-06T15:43:35.502180Z + type: message-received + to: "+12345678902" + description: Incoming message received + message: + id: 14762070468292kw2fuqty55yp2b2 + owner: "+12345678902" + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + time: 2025-01-06T15:43:34.000000Z + segmentCount: 1 + direction: in + to: + - "+12345678902" + from: "+12345678901" + text: "Hey, check out this SMS!" + mmsMessageReceivedCallbackExample: + summary: An example of a mms message-received callback body. + value: + time: 2024-09-14T18:20:45.160744Z + type: message-received + to: "+12345678902" + description: Incoming message received + message: + id: 14762070468292kw2fuqty55yp2b2 + owner: "+12345678902" + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + time: 2024-09-14T18:20:45.160744Z + segmentCount: 1 + direction: in + to: + - "+12345678902" + - "+12345678903" + from: "+12345678901" + text: "Hey, check out the MMS!" + media: + - https://messaging.bandwidth.com/api/v2/users/9900902/media/14762070468292kw2fuqty55yp2b2/0/bw.png + messageSendingCallbackExample: + summary: An example of a message-sending callback body. + value: + time: 2024-06-25T18:42:36.979456Z + type: message-sending + to: "+15554443333" + description: Message is sending to carrier. + message: + id: 1593110555875xo7watq5px6rbe5d + owner: "+15552221111" + applicationId: cfd4fb83-7531-4acc-b471-42d0bb76a65c + time: 2024-06-25T18:42:35.876906Z + segmentCount: 1 + direction: out + to: + - "+15554443333" + from: "+15552221111" + text: "" + media: + - https://dev.bandwidth.com/images/bandwidth-logo.png + tag: your tag here + smsMessageDeliveredCallbackExample: + summary: An example of a sms message-delivered callback body. + value: + type: message-delivered + time: 2024-09-14T18:20:11.160744Z + description: Message delivered to carrier. + to: "+12345678902" + message: + id: 14762070468292kw2fuqty55yp2b2 + time: 2024-09-14T18:20:11.160744Z + to: + - "+12345678902" + from: "+12345678901" + text: "" + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + owner: "+12345678902" + direction: out + segmentCount: 1 + mmsMessageDeliveredCallbackExample: + summary: An example of a mms message-delivered callback body. + value: + type: message-delivered + time: 2024-09-14T18:20:24.160544Z + description: Message delivered to carrier. + to: "+12345678902" + message: + id: 14762070468292kw2fuqty55yp2b2 + time: 2024-09-14T18:20:24.160544Z + to: + - "+12345678902" + from: "+12345678901" + text: "" + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + owner: "+12345678902" + direction: out + segmentCount: 1 + media: + - https://dev.bandwidth.com/images/bandwidth-logo.png + groupMmsMessageDeliveredCallbackExample: + summary: An example of a group mms message-delivered callback body. + value: + type: message-delivered + time: 2024-09-14T18:20:17.160544Z + description: Message delivered to carrier. + to: "+12345678902" + message: + id: 14762070468292kw2fuqty55yp2b2 + time: 2024-09-14T18:20:17.160544Z + to: + - "+12345678902" + - "+12345678903" + from: "+12345678901" + text: "" + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + owner: "+12345678902" + direction: out + segmentCount: 1 + messageFailedCallbackExample: + summary: An example of a message-failed callback body. + value: + type: message-failed + time: 2024-12-18T16:51:27.704450Z + description: forbidden to country + to: "+52345678903" + errorCode: 4432 + message: + id: 14762070468292kw2fuqty55yp2b2 + time: 2024-12-18T16:51:27.704450Z + to: + - "+12345678902" + - "+52345678903" + from: "+12345678901" + text: "" + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + media: + - https://dev.bandwidth.com/images/bandwidth-logo.png + owner: "+12345678901" + direction: out + segmentCount: 1 createCallResponseExample: summary: Example of a createCall Response value: @@ -5360,6 +5513,14 @@ components: schema: format: binary type: string + image/heic: + schema: + format: binary + type: string + image/heif: + schema: + format: binary + type: string image/jpeg: schema: format: binary @@ -5400,6 +5561,10 @@ components: schema: format: binary type: string + text/html: + schema: + format: binary + type: string text/plain: schema: format: binary @@ -5448,6 +5613,10 @@ components: schema: format: binary type: string + video/x-flv: + schema: + format: binary + type: string required: true createCallRequest: content: @@ -6000,6 +6169,18 @@ components: $ref: '#/components/schemas/tnLookupRequestError' description: Internal Server Error schemas: + callbackTypeEnum: + description: | + Indicates the type of the callback: + - `message-received` for inbound callbacks. + - One of `message-sending`, `message-delivered`, `message-failed` for status callbacks. + enum: + - message-received + - message-sending + - message-delivered + - message-failed + example: message-delivered + type: string priorityEnum: description: |- The priority specified by the user. @@ -6312,7 +6493,7 @@ components: from: "+15553332222" expiration: 2021-02-01T11:29:18-05:00 id: 1589228074636lm4k2je7j7jklbn2 - time: 2022-09-14T18:20:16Z + time: 2024-12-02T20:15:57.278Z to: - "+15552223333" text: Hello world @@ -6334,7 +6515,7 @@ components: type: string time: description: The datetime stamp of the message in ISO 8601 - example: 2022-09-14T18:20:16Z + example: 2024-12-02T20:15:57.278Z format: date-time type: string segmentCount: @@ -6448,288 +6629,38 @@ components: - to title: MessageRequest type: object - inboundMessageCallback: - description: Inbound Message Callback + messageCallback: + description: Message Callback Schema properties: time: - example: 2016-09-14T18:20:16Z + example: 2024-12-02T20:15:57.278Z format: date-time type: string type: - example: message-received - type: string - to: - example: "+15552223333" - type: string - description: - example: Incoming message received - type: string - message: - $ref: '#/components/schemas/inboundMessageCallbackMessage' - required: - - description - - message - - time - - to - - type - type: object - inboundMessageCallbackMessage: - description: Inbound Message Callback Message Schema - properties: - id: - example: 1661365814859loidf7mcwd4qacn7 - type: string - owner: - example: "+15553332222" - type: string - applicationId: - example: 93de2206-9669-4e07-948d-329f4b722ee2 - type: string - time: - example: 2016-09-14T18:20:16Z - format: date-time - type: string - segmentCount: - example: 1 - type: integer - direction: - $ref: '#/components/schemas/messageDirectionEnum' - to: - example: - - "+15552223333" - items: - type: string - type: array - uniqueItems: true - from: - example: "+15553332222" - type: string - text: - example: Hello world - type: string - tag: - example: custom string - type: string - media: - example: - - https://dev.bandwidth.com/images/bandwidth-logo.png - - https://dev.bandwidth.com/images/github_logo.png - items: - format: uri - type: string - type: array - priority: - $ref: '#/components/schemas/priorityEnum' - required: - - applicationId - - direction - - from - - id - - owner - - segmentCount - - text - - time - - to - type: object - messageSendingCallback: - description: Message Sending Callback - properties: - time: - example: 2016-09-14T18:20:16Z - format: date-time - type: string - type: - example: message-sending - type: string - to: - example: "+15552223333" - type: string - description: - example: Message is sending to carrier - type: string - message: - $ref: '#/components/schemas/messageSendingCallbackMessage' - required: - - description - - message - - time - - to - - type - type: object - messageSendingCallbackMessage: - description: Message Sending Callback Message Schema - properties: - id: - example: 1661365814859loidf7mcwd4qacn7 - type: string - owner: - example: "+15553332222" - type: string - applicationId: - example: 93de2206-9669-4e07-948d-329f4b722ee2 - type: string - time: - example: 2016-09-14T18:20:16Z - format: date-time - type: string - segmentCount: - example: 1 - type: integer - direction: - $ref: '#/components/schemas/messageDirectionEnum' - to: - example: - - "+15552223333" - items: - type: string - type: array - uniqueItems: true - from: - example: "+15553332222" - type: string - text: - example: Hello world - type: string - tag: - example: custom string - type: string - media: - example: - - https://dev.bandwidth.com/images/bandwidth-logo.png - - https://dev.bandwidth.com/images/github_logo.png - items: - format: uri - type: string - type: array - priority: - $ref: '#/components/schemas/priorityEnum' - required: - - applicationId - - direction - - from - - id - - media - - owner - - segmentCount - - text - - time - - to - type: object - messageDeliveredCallback: - description: Message Delivered Callback - properties: - time: - example: 2016-09-14T18:20:16Z - format: date-time - type: string - type: - example: message-delivered - type: string - to: - example: "+15552223333" - type: string - description: - example: Message delivered to carrier. - type: string - message: - $ref: '#/components/schemas/messageDeliveredCallbackMessage' - required: - - description - - message - - time - - to - - type - type: object - messageDeliveredCallbackMessage: - description: Message Delivered Callback Message Schema - properties: - id: - example: 1661365814859loidf7mcwd4qacn7 - type: string - owner: - example: "+15553332222" - type: string - applicationId: - example: 93de2206-9669-4e07-948d-329f4b722ee2 - type: string - time: - example: 2016-09-14T18:20:16Z - format: date-time - type: string - segmentCount: - example: 1 - type: integer - direction: - $ref: '#/components/schemas/messageDirectionEnum' - to: - example: - - "+15552223333" - items: - type: string - type: array - uniqueItems: true - from: - example: "+15553332222" - type: string - text: - example: Hello world - type: string - tag: - example: custom string - type: string - media: - example: - - https://dev.bandwidth.com/images/bandwidth-logo.png - - https://dev.bandwidth.com/images/github_logo.png - items: - format: uri - type: string - type: array - priority: - $ref: '#/components/schemas/priorityEnum' - required: - - applicationId - - direction - - from - - id - - owner - - segmentCount - - tag - - text - - time - - to - type: object - messageFailedCallback: - description: Message Failed Callback - properties: - time: - example: 2016-09-14T18:20:16Z - format: date-time - type: string - type: - example: message-failed - type: string + $ref: '#/components/schemas/callbackTypeEnum' to: example: "+15552223333" type: string description: + description: A detailed description of the event described by the callback. example: rejected-unallocated-from-number type: string message: - $ref: '#/components/schemas/messageFailedCallbackMessage' + $ref: '#/components/schemas/messageCallbackMessage' errorCode: - example: 9902 + description: "Optional error code, applicable only when type is `message-failed`." + example: 4405 + nullable: true type: integer required: - description - - errorCode - message - time - to - type type: object - messageFailedCallbackMessage: - description: Message Failed Callback Message Schema + messageCallbackMessage: + description: Message payload schema within a MessageCallback properties: id: example: 1661365814859loidf7mcwd4qacn7 @@ -6741,7 +6672,7 @@ components: example: 93de2206-9669-4e07-948d-329f4b722ee2 type: string time: - example: 2016-09-14T18:20:16Z + example: 2024-12-02T20:15:57.666Z format: date-time type: string segmentCount: @@ -6766,12 +6697,14 @@ components: example: custom string type: string media: + description: "Optional media, applicable only for mms" example: - https://dev.bandwidth.com/images/bandwidth-logo.png - https://dev.bandwidth.com/images/github_logo.png items: format: uri type: string + nullable: true type: array priority: $ref: '#/components/schemas/priorityEnum' @@ -6782,7 +6715,6 @@ components: - id - owner - segmentCount - - tag - text - time - to diff --git a/bandwidth.yml b/bandwidth.yml index 11c79d23..87921dfa 100644 --- a/bandwidth.yml +++ b/bandwidth.yml @@ -230,8 +230,6 @@ paths: '500': $ref: '#/components/responses/messagingInternalServerError' callbacks: - inboundCallback: - $ref: '#/components/callbacks/inboundCallback' statusCallback: $ref: '#/components/callbacks/statusCallback' servers: *ref_0 @@ -1332,6 +1330,21 @@ paths: servers: *ref_3 components: schemas: + callbackTypeEnum: + type: string + enum: + - message-received + - message-sending + - message-delivered + - message-failed + description: > + Indicates the type of the callback: + + - `message-received` for inbound callbacks. + + - One of `message-sending`, `message-delivered`, `message-failed` for + status callbacks. + example: message-delivered priorityEnum: type: string description: |- @@ -1574,7 +1587,7 @@ components: type: string format: date-time description: The datetime stamp of the message in ISO 8601 - example: 2022-09-14T18:20:16.000Z + example: 2024-12-02T20:15:57.278Z segmentCount: type: integer description: >- @@ -1695,288 +1708,38 @@ components: Not supported on MMS. example: '2021-02-01T11:29:18-05:00' - inboundMessageCallback: - description: Inbound Message Callback - type: object - properties: - time: - type: string - format: date-time - example: 2016-09-14T18:20:16.000Z - type: - type: string - example: message-received - to: - type: string - example: '+15552223333' - description: - type: string - example: Incoming message received - message: - $ref: '#/components/schemas/inboundMessageCallbackMessage' - required: - - time - - type - - to - - description - - message - inboundMessageCallbackMessage: - description: Inbound Message Callback Message Schema - type: object - properties: - id: - type: string - example: 1661365814859loidf7mcwd4qacn7 - owner: - type: string - example: '+15553332222' - applicationId: - type: string - example: 93de2206-9669-4e07-948d-329f4b722ee2 - time: - type: string - format: date-time - example: 2016-09-14T18:20:16.000Z - segmentCount: - type: integer - example: 1 - direction: - $ref: '#/components/schemas/messageDirectionEnum' - to: - uniqueItems: true - type: array - items: - type: string - example: - - '+15552223333' - from: - type: string - example: '+15553332222' - text: - type: string - example: Hello world - tag: - type: string - example: custom string - media: - type: array - items: - type: string - format: uri - example: - - https://dev.bandwidth.com/images/bandwidth-logo.png - - https://dev.bandwidth.com/images/github_logo.png - priority: - $ref: '#/components/schemas/priorityEnum' - required: - - id - - owner - - applicationId - - time - - segmentCount - - direction - - to - - from - - text - messageSendingCallback: - type: object - description: Message Sending Callback - properties: - time: - type: string - format: date-time - example: 2016-09-14T18:20:16.000Z - type: - type: string - example: message-sending - to: - type: string - example: '+15552223333' - description: - type: string - example: Message is sending to carrier - message: - $ref: '#/components/schemas/messageSendingCallbackMessage' - required: - - time - - type - - to - - description - - message - messageSendingCallbackMessage: - description: Message Sending Callback Message Schema - type: object - properties: - id: - type: string - example: 1661365814859loidf7mcwd4qacn7 - owner: - type: string - example: '+15553332222' - applicationId: - type: string - example: 93de2206-9669-4e07-948d-329f4b722ee2 - time: - type: string - format: date-time - example: 2016-09-14T18:20:16.000Z - segmentCount: - type: integer - example: 1 - direction: - $ref: '#/components/schemas/messageDirectionEnum' - to: - uniqueItems: true - type: array - items: - type: string - example: - - '+15552223333' - from: - type: string - example: '+15553332222' - text: - type: string - example: Hello world - tag: - type: string - example: custom string - media: - type: array - items: - type: string - format: uri - example: - - https://dev.bandwidth.com/images/bandwidth-logo.png - - https://dev.bandwidth.com/images/github_logo.png - priority: - $ref: '#/components/schemas/priorityEnum' - required: - - id - - owner - - applicationId - - time - - segmentCount - - direction - - to - - from - - text - - media - messageDeliveredCallback: - description: Message Delivered Callback - type: object - properties: - time: - type: string - format: date-time - example: 2016-09-14T18:20:16.000Z - type: - type: string - example: message-delivered - to: - type: string - example: '+15552223333' - description: - type: string - example: Message delivered to carrier. - message: - $ref: '#/components/schemas/messageDeliveredCallbackMessage' - required: - - time - - type - - to - - description - - message - messageDeliveredCallbackMessage: - description: Message Delivered Callback Message Schema - type: object - properties: - id: - type: string - example: 1661365814859loidf7mcwd4qacn7 - owner: - type: string - example: '+15553332222' - applicationId: - type: string - example: 93de2206-9669-4e07-948d-329f4b722ee2 - time: - type: string - format: date-time - example: 2016-09-14T18:20:16.000Z - segmentCount: - type: integer - example: 1 - direction: - $ref: '#/components/schemas/messageDirectionEnum' - to: - uniqueItems: true - type: array - items: - type: string - example: - - '+15552223333' - from: - type: string - example: '+15553332222' - text: - type: string - example: Hello world - tag: - type: string - example: custom string - media: - type: array - items: - type: string - format: uri - example: - - https://dev.bandwidth.com/images/bandwidth-logo.png - - https://dev.bandwidth.com/images/github_logo.png - priority: - $ref: '#/components/schemas/priorityEnum' - required: - - id - - owner - - applicationId - - time - - segmentCount - - direction - - to - - from - - text - - tag - messageFailedCallback: - description: Message Failed Callback + messageCallback: + description: Message Callback Schema type: object properties: time: type: string format: date-time - example: 2016-09-14T18:20:16.000Z + example: 2024-12-02T20:15:57.278Z type: - type: string - example: message-failed + $ref: '#/components/schemas/callbackTypeEnum' to: type: string example: '+15552223333' description: type: string + description: A detailed description of the event described by the callback. example: rejected-unallocated-from-number message: - $ref: '#/components/schemas/messageFailedCallbackMessage' + $ref: '#/components/schemas/messageCallbackMessage' errorCode: type: integer - example: 9902 + description: Optional error code, applicable only when type is `message-failed`. + nullable: true + example: 4405 required: - time - type - to - description - message - - errorCode - messageFailedCallbackMessage: - description: Message Failed Callback Message Schema + messageCallbackMessage: + description: Message payload schema within a MessageCallback type: object properties: id: @@ -1991,7 +1754,7 @@ components: time: type: string format: date-time - example: 2016-09-14T18:20:16.000Z + example: 2024-12-02T20:15:57.666Z segmentCount: type: integer example: 1 @@ -2015,6 +1778,8 @@ components: example: custom string media: type: array + description: Optional media, applicable only for mms + nullable: true items: type: string format: uri @@ -2033,7 +1798,6 @@ components: - to - from - text - - tag callbackMethodEnum: type: string nullable: true @@ -5463,34 +5227,345 @@ components: type: string description: The phone number lookup request ID from Bandwidth. example: 004223a0-8b17-41b1-bf81-20732adf5590 - requestBodies: - createMessageRequest: - content: - application/json: - schema: - $ref: '#/components/schemas/messageRequest' - required: true - uploadMediaRequest: - content: - application/json: - schema: - type: string - format: binary - application/ogg: - schema: - type: string - format: binary - application/pdf: - schema: - type: string - format: binary - application/rtf: - schema: - type: string - format: binary - application/zip: - schema: - type: string + examples: + smsMessageReceivedCallbackExample: + summary: An example of a sms message-received callback body. + value: + time: '2025-01-06T15:43:35.502180Z' + type: message-received + to: '+12345678902' + description: Incoming message received + message: + id: 14762070468292kw2fuqty55yp2b2 + owner: '+12345678902' + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + time: '2025-01-06T15:43:34.000000Z' + segmentCount: 1 + direction: in + to: + - '+12345678902' + from: '+12345678901' + text: Hey, check out this SMS! + mmsMessageReceivedCallbackExample: + summary: An example of a mms message-received callback body. + value: + time: '2024-09-14T18:20:45.160744Z' + type: message-received + to: '+12345678902' + description: Incoming message received + message: + id: 14762070468292kw2fuqty55yp2b2 + owner: '+12345678902' + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + time: '2024-09-14T18:20:45.160744Z' + segmentCount: 1 + direction: in + to: + - '+12345678902' + - '+12345678903' + from: '+12345678901' + text: Hey, check out the MMS! + media: + - >- + https://messaging.bandwidth.com/api/v2/users/9900902/media/14762070468292kw2fuqty55yp2b2/0/bw.png + messageSendingCallbackExample: + summary: An example of a message-sending callback body. + value: + time: '2024-06-25T18:42:36.979456Z' + type: message-sending + to: '+15554443333' + description: Message is sending to carrier. + message: + id: 1593110555875xo7watq5px6rbe5d + owner: '+15552221111' + applicationId: cfd4fb83-7531-4acc-b471-42d0bb76a65c + time: '2024-06-25T18:42:35.876906Z' + segmentCount: 1 + direction: out + to: + - '+15554443333' + from: '+15552221111' + text: '' + media: + - https://dev.bandwidth.com/images/bandwidth-logo.png + tag: your tag here + smsMessageDeliveredCallbackExample: + summary: An example of a sms message-delivered callback body. + value: + type: message-delivered + time: '2024-09-14T18:20:11.160744Z' + description: Message delivered to carrier. + to: '+12345678902' + message: + id: 14762070468292kw2fuqty55yp2b2 + time: '2024-09-14T18:20:11.160744Z' + to: + - '+12345678902' + from: '+12345678901' + text: '' + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + owner: '+12345678902' + direction: out + segmentCount: 1 + mmsMessageDeliveredCallbackExample: + summary: An example of a mms message-delivered callback body. + value: + type: message-delivered + time: '2024-09-14T18:20:24.160544Z' + description: Message delivered to carrier. + to: '+12345678902' + message: + id: 14762070468292kw2fuqty55yp2b2 + time: '2024-09-14T18:20:24.160544Z' + to: + - '+12345678902' + from: '+12345678901' + text: '' + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + owner: '+12345678902' + direction: out + segmentCount: 1 + media: + - https://dev.bandwidth.com/images/bandwidth-logo.png + groupMmsMessageDeliveredCallbackExample: + summary: An example of a group mms message-delivered callback body. + value: + type: message-delivered + time: '2024-09-14T18:20:17.160544Z' + description: Message delivered to carrier. + to: '+12345678902' + message: + id: 14762070468292kw2fuqty55yp2b2 + time: '2024-09-14T18:20:17.160544Z' + to: + - '+12345678902' + - '+12345678903' + from: '+12345678901' + text: '' + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + owner: '+12345678902' + direction: out + segmentCount: 1 + messageFailedCallbackExample: + summary: An example of a message-failed callback body. + value: + type: message-failed + time: '2024-12-18T16:51:27.704450Z' + description: forbidden to country + to: '+52345678903' + errorCode: 4432 + message: + id: 14762070468292kw2fuqty55yp2b2 + time: '2024-12-18T16:51:27.704450Z' + to: + - '+12345678902' + - '+52345678903' + from: '+12345678901' + text: '' + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + media: + - https://dev.bandwidth.com/images/bandwidth-logo.png + owner: '+12345678901' + direction: out + segmentCount: 1 + createCallResponseExample: + summary: Example of a createCall Response + value: + applicationId: 04e88489-df02-4e34-a0ee-27a91849555f + accountId: '9900000' + callId: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + 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 + callbackTimeout: 15 + tag: My custom tag value + answerMethod: POST + answerUrl: https://myServer.example/bandwidth/webhooks/answer + answerFallbackMethod: POST + answerFallbackUrl: https://myServer.example/bandwidth/webhooks/answerFallback + disconnectMethod: POST + disconnectUrl: https://myServer.example/bandwidth/webhooks/disconnect + username: mySecretUsername + password: '*****' + fallbackUsername: mySecretUsername + fallbackPassword: '*****' + priority: 5 + listConferencesResponseExample: + summary: Example of a listConferences Response + value: + - id: conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 + name: my-conference-name + createdTime: '2022-06-17T22:19:40.375Z' + completedTime: '2022-06-17T22:20:00.000Z' + conferenceEventUrl: https://myServer.example/bandwidth/webhooks/conferenceEvent + conferenceEventMethod: POST + tag: my custom tag + voiceBadRequestErrorExample: + summary: Example of a Bad Request (400) Error + value: + type: validation + description: 'Invalid answerUrl: only http and https are allowed.' + voiceUnauthorizedErrorExample: + summary: Example of an Unauthorized (401) Error + value: + type: validation + description: 'Invalid answerUrl: only http and https are allowed.' + voiceForbiddenErrorExample: + summary: Example of a Forbidden (403) Error + value: + type: validation + description: 'Invalid answerUrl: only http and https are allowed.' + voiceNotFoundErrorExample: + summary: Example of a Not Found (404) Error + value: + type: validation + description: 'Invalid answerUrl: only http and https are allowed.' + voiceNotAllowedErrorExample: + summary: Example of a Not Allowed (405) Error + value: + type: validation + description: 'Invalid answerUrl: only http and https are allowed.' + voiceConflictErrorExample: + summary: Example of a Conflict (409) Error + value: + type: validation + description: 'Invalid answerUrl: only http and https are allowed.' + voiceUnsupportedMediaTypeErrorExample: + summary: Example of an Unsupported Media Type (415) Error + value: + type: validation + description: 'Invalid answerUrl: only http and https are allowed.' + voiceTooManyRequestsErrorExample: + summary: Example of a Too Many Requests (429) Error + value: + type: validation + description: 'Invalid answerUrl: only http and https are allowed.' + voiceInternalServerErrorExample: + summary: Example of an Internal Server (500) Error + value: + type: validation + description: 'Invalid answerUrl: only http and https are allowed.' + singleNumberRequestExample: + summary: Example Number Lookup Request for One Number + value: + tns: + - '+19195551234' + multipleNumberRequestExample: + summary: Example Number Lookup Request for Multiple Numbers + value: + tns: + - '+19195551234' + - '+19195554321' + lookupInProgressExample: + summary: Example Lookup In Progress Response + value: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: IN_PROGRESS + lookupFailedExample: + summary: Example Lookup Failed Response + value: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: FAILED + failedTelephoneNumbers: + - '+191955512345' + lookupSingleNumberCompleteExample: + summary: Example Single Number Lookup Complete Response + value: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: COMPLETE + result: + - Response Code: 0 + Message: NOERROR + E.164 Format: '+19195551234' + Formatted: (919) 555-1234 + Country: US + Line Type: Mobile + Line Provider: Verizon Wireless + Mobile Country Code: '310' + Mobile Network Code: '010' + lookupMultipleNumbersCompleteExample: + summary: Example Multiple Numbers Lookup Complete Response + value: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: COMPLETE + result: + - Response Code: 0 + Message: NOERROR + E.164 Format: '+19195551234' + Formatted: (919) 555-1234 + Country: US + Line Type: Mobile + Line Provider: Verizon Wireless + Mobile Country Code: '310' + Mobile Network Code: '010' + - Response Code: 0 + Message: NOERROR + E.164 Format: '+19195554321' + Formatted: (919) 555-4321 + Country: US + Line Type: Mobile + Line Provider: T-Mobile USA + Mobile Country Code: '310' + Mobile Network Code: '160' + lookupMultipleNumbersPartialCompleteExample: + summary: Example Multiple Numbers Lookup Partial Complete Response + value: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: PARTIAL_COMPLETE + result: + - Response Code: 0 + Message: NOERROR + E.164 Format: '+19195551234' + Formatted: (919) 555-1234 + Country: US + Line Type: Mobile + Line Provider: Verizon Wireless + Mobile Country Code: '310' + Mobile Network Code: '010' + failedTelephoneNumbers: + - '+191955512345' + lookupSingleNumberCompleteNoInfoExample: + summary: Example Single Number Lookup Complete with No Information Response + value: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: COMPLETE + result: + - Response Code: 3 + Message: NXDOMAIN + E.164 Format: '+19195550000' + Formatted: (919) 555-0000 + Country: US + requestBodies: + createMessageRequest: + content: + application/json: + schema: + $ref: '#/components/schemas/messageRequest' + required: true + uploadMediaRequest: + content: + application/json: + schema: + type: string + format: binary + application/ogg: + schema: + type: string + format: binary + application/pdf: + schema: + type: string + format: binary + application/rtf: + schema: + type: string + format: binary + application/zip: + schema: + type: string format: binary application/x-tar: schema: @@ -5560,6 +5635,14 @@ components: schema: type: string format: binary + image/heic: + schema: + type: string + format: binary + image/heif: + schema: + type: string + format: binary image/jpeg: schema: type: string @@ -5600,6 +5683,10 @@ components: schema: type: string format: binary + text/html: + schema: + type: string + format: binary text/plain: schema: type: string @@ -5648,6 +5735,10 @@ components: schema: type: string format: binary + video/x-flv: + schema: + type: string + format: binary required: true createCallRequest: description: JSON object containing information to create an outbound call @@ -5770,11 +5861,22 @@ components: post: requestBody: required: true - description: Inbound Message Callback Payload + description: > +

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

Please visit Webhooks

content: application/json: schema: - $ref: '#/components/schemas/inboundMessageCallback' + $ref: '#/components/schemas/messageCallback' + examples: + smsMessageReceivedCallback: + $ref: '#/components/examples/smsMessageReceivedCallbackExample' + mmsMessageReceivedCallback: + $ref: '#/components/examples/mmsMessageReceivedCallbackExample' responses: '200': description: OK @@ -5783,186 +5885,31 @@ components: post: requestBody: required: true - description: Status Callback Payload + description: > +

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

Please visit Webhooks

content: application/json: schema: - type: object - oneOf: - - $ref: '#/components/schemas/messageSendingCallback' - - $ref: '#/components/schemas/messageDeliveredCallback' - - $ref: '#/components/schemas/messageFailedCallback' + $ref: '#/components/schemas/messageCallback' + examples: + messageSendingCallback: + $ref: '#/components/examples/messageSendingCallbackExample' + smsMessageDeliveredCallback: + $ref: '#/components/examples/smsMessageDeliveredCallbackExample' + mmsMessageDeliveredCallback: + $ref: '#/components/examples/mmsMessageDeliveredCallbackExample' + groupMmsMessageDeliveredCallback: + $ref: >- + #/components/examples/groupMmsMessageDeliveredCallbackExample + messageFailedCallback: + $ref: '#/components/examples/messageFailedCallbackExample' responses: '200': description: OK - examples: - createCallResponseExample: - summary: Example of a createCall Response - value: - applicationId: 04e88489-df02-4e34-a0ee-27a91849555f - accountId: '9900000' - callId: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 - 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 - callbackTimeout: 15 - tag: My custom tag value - answerMethod: POST - answerUrl: https://myServer.example/bandwidth/webhooks/answer - answerFallbackMethod: POST - answerFallbackUrl: https://myServer.example/bandwidth/webhooks/answerFallback - disconnectMethod: POST - disconnectUrl: https://myServer.example/bandwidth/webhooks/disconnect - username: mySecretUsername - password: '*****' - fallbackUsername: mySecretUsername - fallbackPassword: '*****' - priority: 5 - listConferencesResponseExample: - summary: Example of a listConferences Response - value: - - id: conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 - name: my-conference-name - createdTime: '2022-06-17T22:19:40.375Z' - completedTime: '2022-06-17T22:20:00.000Z' - conferenceEventUrl: https://myServer.example/bandwidth/webhooks/conferenceEvent - conferenceEventMethod: POST - tag: my custom tag - voiceBadRequestErrorExample: - summary: Example of a Bad Request (400) Error - value: - type: validation - description: 'Invalid answerUrl: only http and https are allowed.' - voiceUnauthorizedErrorExample: - summary: Example of an Unauthorized (401) Error - value: - type: validation - description: 'Invalid answerUrl: only http and https are allowed.' - voiceForbiddenErrorExample: - summary: Example of a Forbidden (403) Error - value: - type: validation - description: 'Invalid answerUrl: only http and https are allowed.' - voiceNotFoundErrorExample: - summary: Example of a Not Found (404) Error - value: - type: validation - description: 'Invalid answerUrl: only http and https are allowed.' - voiceNotAllowedErrorExample: - summary: Example of a Not Allowed (405) Error - value: - type: validation - description: 'Invalid answerUrl: only http and https are allowed.' - voiceConflictErrorExample: - summary: Example of a Conflict (409) Error - value: - type: validation - description: 'Invalid answerUrl: only http and https are allowed.' - voiceUnsupportedMediaTypeErrorExample: - summary: Example of an Unsupported Media Type (415) Error - value: - type: validation - description: 'Invalid answerUrl: only http and https are allowed.' - voiceTooManyRequestsErrorExample: - summary: Example of a Too Many Requests (429) Error - value: - type: validation - description: 'Invalid answerUrl: only http and https are allowed.' - voiceInternalServerErrorExample: - summary: Example of an Internal Server (500) Error - value: - type: validation - description: 'Invalid answerUrl: only http and https are allowed.' - singleNumberRequestExample: - summary: Example Number Lookup Request for One Number - value: - tns: - - '+19195551234' - multipleNumberRequestExample: - summary: Example Number Lookup Request for Multiple Numbers - value: - tns: - - '+19195551234' - - '+19195554321' - lookupInProgressExample: - summary: Example Lookup In Progress Response - value: - requestId: 004223a0-8b17-41b1-bf81-20732adf5590 - status: IN_PROGRESS - lookupFailedExample: - summary: Example Lookup Failed Response - value: - requestId: 004223a0-8b17-41b1-bf81-20732adf5590 - status: FAILED - failedTelephoneNumbers: - - '+191955512345' - lookupSingleNumberCompleteExample: - summary: Example Single Number Lookup Complete Response - value: - requestId: 004223a0-8b17-41b1-bf81-20732adf5590 - status: COMPLETE - result: - - Response Code: 0 - Message: NOERROR - E.164 Format: '+19195551234' - Formatted: (919) 555-1234 - Country: US - Line Type: Mobile - Line Provider: Verizon Wireless - Mobile Country Code: '310' - Mobile Network Code: '010' - lookupMultipleNumbersCompleteExample: - summary: Example Multiple Numbers Lookup Complete Response - value: - requestId: 004223a0-8b17-41b1-bf81-20732adf5590 - status: COMPLETE - result: - - Response Code: 0 - Message: NOERROR - E.164 Format: '+19195551234' - Formatted: (919) 555-1234 - Country: US - Line Type: Mobile - Line Provider: Verizon Wireless - Mobile Country Code: '310' - Mobile Network Code: '010' - - Response Code: 0 - Message: NOERROR - E.164 Format: '+19195554321' - Formatted: (919) 555-4321 - Country: US - Line Type: Mobile - Line Provider: T-Mobile USA - Mobile Country Code: '310' - Mobile Network Code: '160' - lookupMultipleNumbersPartialCompleteExample: - summary: Example Multiple Numbers Lookup Partial Complete Response - value: - requestId: 004223a0-8b17-41b1-bf81-20732adf5590 - status: PARTIAL_COMPLETE - result: - - Response Code: 0 - Message: NOERROR - E.164 Format: '+19195551234' - Formatted: (919) 555-1234 - Country: US - Line Type: Mobile - Line Provider: Verizon Wireless - Mobile Country Code: '310' - Mobile Network Code: '010' - failedTelephoneNumbers: - - '+191955512345' - lookupSingleNumberCompleteNoInfoExample: - summary: Example Single Number Lookup Complete with No Information Response - value: - requestId: 004223a0-8b17-41b1-bf81-20732adf5590 - status: COMPLETE - result: - - Response Code: 3 - Message: NXDOMAIN - E.164 Format: '+19195550000' - Formatted: (919) 555-0000 - Country: US diff --git a/docs/CallbackTypeEnum.md b/docs/CallbackTypeEnum.md new file mode 100644 index 00000000..e9e2b4f2 --- /dev/null +++ b/docs/CallbackTypeEnum.md @@ -0,0 +1,17 @@ + + +# CallbackTypeEnum + +## Enum + + +* `RECEIVED` (value: `"message-received"`) + +* `SENDING` (value: `"message-sending"`) + +* `DELIVERED` (value: `"message-delivered"`) + +* `FAILED` (value: `"message-failed"`) + + + diff --git a/docs/MediaApi.md b/docs/MediaApi.md index b24e28b0..427119ae 100644 --- a/docs/MediaApi.md +++ b/docs/MediaApi.md @@ -310,7 +310,7 @@ null (empty response body) ### HTTP request headers - - **Content-Type**: application/json, application/ogg, application/pdf, application/rtf, application/zip, application/x-tar, application/xml, application/gzip, application/x-bzip2, application/x-gzip, application/smil, application/javascript, audio/mp4, audio/mpeg, audio/ogg, audio/flac, audio/webm, audio/wav, audio/amr, audio/3gpp, image/bmp, image/gif, image/jpeg, image/pjpeg, image/png, image/svg+xml, image/tiff, image/webp, image/x-icon, text/css, text/csv, text/calendar, text/plain, text/javascript, text/vcard, text/vnd.wap.wml, text/xml, video/avi, video/mp4, video/mpeg, video/ogg, video/quicktime, video/webm, video/x-ms-wmv + - **Content-Type**: application/json, application/ogg, application/pdf, application/rtf, application/zip, application/x-tar, application/xml, application/gzip, application/x-bzip2, application/x-gzip, application/smil, application/javascript, audio/mp4, audio/mpeg, audio/ogg, audio/flac, audio/webm, audio/wav, audio/amr, audio/3gpp, image/bmp, image/gif, image/heic, image/heif, image/jpeg, image/pjpeg, image/png, image/svg+xml, image/tiff, image/webp, image/x-icon, text/css, text/csv, text/calendar, text/html, text/plain, text/javascript, text/vcard, text/vnd.wap.wml, text/xml, video/avi, video/mp4, video/mpeg, video/ogg, video/quicktime, video/webm, video/x-ms-wmv, video/x-flv - **Accept**: application/json ### HTTP response details diff --git a/docs/MessageCallback.md b/docs/MessageCallback.md new file mode 100644 index 00000000..e9af0c2b --- /dev/null +++ b/docs/MessageCallback.md @@ -0,0 +1,19 @@ + + +# MessageCallback + +Message Callback Schema + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**time** | **OffsetDateTime** | | | +|**type** | **CallbackTypeEnum** | | | +|**to** | **String** | | | +|**description** | **String** | A detailed description of the event described by the callback. | | +|**message** | [**MessageCallbackMessage**](MessageCallbackMessage.md) | | | +|**errorCode** | **Integer** | Optional error code, applicable only when type is `message-failed`. | [optional] | + + + diff --git a/docs/MessageCallbackMessage.md b/docs/MessageCallbackMessage.md new file mode 100644 index 00000000..fee749f4 --- /dev/null +++ b/docs/MessageCallbackMessage.md @@ -0,0 +1,25 @@ + + +# MessageCallbackMessage + +Message payload schema within a MessageCallback + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **String** | | | +|**owner** | **String** | | | +|**applicationId** | **String** | | | +|**time** | **OffsetDateTime** | | | +|**segmentCount** | **Integer** | | | +|**direction** | **MessageDirectionEnum** | | | +|**to** | **Set<String>** | | | +|**from** | **String** | | | +|**text** | **String** | | | +|**tag** | **String** | | [optional] | +|**media** | **List<URI>** | Optional media, applicable only for mms | [optional] | +|**priority** | **PriorityEnum** | | [optional] | + + + diff --git a/src/main/java/com/bandwidth/sdk/JSON.java b/src/main/java/com/bandwidth/sdk/JSON.java index fce101a7..b5958659 100644 --- a/src/main/java/com/bandwidth/sdk/JSON.java +++ b/src/main/java/com/bandwidth/sdk/JSON.java @@ -122,8 +122,6 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.DtmfCallback.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.FieldError.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.GatherCallback.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.InboundMessageCallback.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.InboundMessageCallbackMessage.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.InitiateCallback.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.ListMessageItem.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.LookupRequest.CustomTypeAdapterFactory()); @@ -134,13 +132,9 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MachineDetectionResult.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.Media.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.Message.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MessageDeliveredCallback.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MessageDeliveredCallbackMessage.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MessageFailedCallback.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MessageFailedCallbackMessage.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MessageCallback.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MessageCallbackMessage.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MessageRequest.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MessageSendingCallback.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MessageSendingCallbackMessage.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MessagesList.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MessagingCodeResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MessagingRequestError.CustomTypeAdapterFactory()); diff --git a/src/main/java/com/bandwidth/sdk/api/MediaApi.java b/src/main/java/com/bandwidth/sdk/api/MediaApi.java index 82f67b12..e98cfb3b 100644 --- a/src/main/java/com/bandwidth/sdk/api/MediaApi.java +++ b/src/main/java/com/bandwidth/sdk/api/MediaApi.java @@ -660,6 +660,8 @@ public okhttp3.Call uploadMediaCall(String accountId, String mediaId, File body, "audio/3gpp", "image/bmp", "image/gif", + "image/heic", + "image/heif", "image/jpeg", "image/pjpeg", "image/png", @@ -670,6 +672,7 @@ public okhttp3.Call uploadMediaCall(String accountId, String mediaId, File body, "text/css", "text/csv", "text/calendar", + "text/html", "text/plain", "text/javascript", "text/vcard", @@ -681,7 +684,8 @@ public okhttp3.Call uploadMediaCall(String accountId, String mediaId, File body, "video/ogg", "video/quicktime", "video/webm", - "video/x-ms-wmv" + "video/x-ms-wmv", + "video/x-flv" }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { diff --git a/src/main/java/com/bandwidth/sdk/model/CallbackTypeEnum.java b/src/main/java/com/bandwidth/sdk/model/CallbackTypeEnum.java new file mode 100644 index 00000000..b0ddc5ce --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/CallbackTypeEnum.java @@ -0,0 +1,82 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Indicates the type of the callback: - `message-received` for inbound callbacks. - One of `message-sending`, `message-delivered`, `message-failed` for status callbacks. + */ +@JsonAdapter(CallbackTypeEnum.Adapter.class) +public enum CallbackTypeEnum { + + RECEIVED("message-received"), + + SENDING("message-sending"), + + DELIVERED("message-delivered"), + + FAILED("message-failed"); + + private String value; + + CallbackTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static CallbackTypeEnum fromValue(String value) { + for (CallbackTypeEnum b : CallbackTypeEnum.values()) { + if (b.value.equalsIgnoreCase(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final CallbackTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public CallbackTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return CallbackTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + CallbackTypeEnum.fromValue(value); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/InboundMessageCallback.java b/src/main/java/com/bandwidth/sdk/model/InboundMessageCallback.java deleted file mode 100644 index eca692b9..00000000 --- a/src/main/java/com/bandwidth/sdk/model/InboundMessageCallback.java +++ /dev/null @@ -1,417 +0,0 @@ -/* - * Bandwidth - * Bandwidth's Communication APIs - * - * The version of the OpenAPI document: 1.0.0 - * Contact: letstalk@bandwidth.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.bandwidth.sdk.model; - -import java.util.Objects; -import com.bandwidth.sdk.model.InboundMessageCallbackMessage; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.time.OffsetDateTime; -import java.util.Arrays; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.bandwidth.sdk.JSON; - -/** - * Inbound Message Callback - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") -public class InboundMessageCallback { - public static final String SERIALIZED_NAME_TIME = "time"; - @SerializedName(SERIALIZED_NAME_TIME) - @javax.annotation.Nonnull - private OffsetDateTime time; - - public static final String SERIALIZED_NAME_TYPE = "type"; - @SerializedName(SERIALIZED_NAME_TYPE) - @javax.annotation.Nonnull - private String type; - - public static final String SERIALIZED_NAME_TO = "to"; - @SerializedName(SERIALIZED_NAME_TO) - @javax.annotation.Nonnull - private String to; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - @javax.annotation.Nonnull - private String description; - - public static final String SERIALIZED_NAME_MESSAGE = "message"; - @SerializedName(SERIALIZED_NAME_MESSAGE) - @javax.annotation.Nonnull - private InboundMessageCallbackMessage message; - - public InboundMessageCallback() { - } - - public InboundMessageCallback time(@javax.annotation.Nonnull OffsetDateTime time) { - this.time = time; - return this; - } - - /** - * Get time - * @return time - */ - @javax.annotation.Nonnull - public OffsetDateTime getTime() { - return time; - } - - public void setTime(@javax.annotation.Nonnull OffsetDateTime time) { - this.time = time; - } - - - public InboundMessageCallback type(@javax.annotation.Nonnull String type) { - this.type = type; - return this; - } - - /** - * Get type - * @return type - */ - @javax.annotation.Nonnull - public String getType() { - return type; - } - - public void setType(@javax.annotation.Nonnull String type) { - this.type = type; - } - - - public InboundMessageCallback to(@javax.annotation.Nonnull String to) { - this.to = to; - return this; - } - - /** - * Get to - * @return to - */ - @javax.annotation.Nonnull - public String getTo() { - return to; - } - - public void setTo(@javax.annotation.Nonnull String to) { - this.to = to; - } - - - public InboundMessageCallback description(@javax.annotation.Nonnull String description) { - this.description = description; - return this; - } - - /** - * Get description - * @return description - */ - @javax.annotation.Nonnull - public String getDescription() { - return description; - } - - public void setDescription(@javax.annotation.Nonnull String description) { - this.description = description; - } - - - public InboundMessageCallback message(@javax.annotation.Nonnull InboundMessageCallbackMessage message) { - this.message = message; - return this; - } - - /** - * Get message - * @return message - */ - @javax.annotation.Nonnull - public InboundMessageCallbackMessage getMessage() { - return message; - } - - public void setMessage(@javax.annotation.Nonnull InboundMessageCallbackMessage message) { - this.message = message; - } - - /** - * A container for additional, undeclared properties. - * This is a holder for any undeclared properties as specified with - * the 'additionalProperties' keyword in the OAS document. - */ - private Map additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. - * If the property does not already exist, create it otherwise replace it. - * - * @param key name of the property - * @param value value of the property - * @return the InboundMessageCallback instance itself - */ - public InboundMessageCallback putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - * - * @return a map of objects - */ - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * Return the additional (undeclared) property with the specified name. - * - * @param key name of the property - * @return an object - */ - public Object getAdditionalProperty(String key) { - if (this.additionalProperties == null) { - return null; - } - return this.additionalProperties.get(key); - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - InboundMessageCallback inboundMessageCallback = (InboundMessageCallback) o; - return Objects.equals(this.time, inboundMessageCallback.time) && - Objects.equals(this.type, inboundMessageCallback.type) && - Objects.equals(this.to, inboundMessageCallback.to) && - Objects.equals(this.description, inboundMessageCallback.description) && - Objects.equals(this.message, inboundMessageCallback.message)&& - Objects.equals(this.additionalProperties, inboundMessageCallback.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(time, type, to, description, message, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class InboundMessageCallback {\n"); - sb.append(" time: ").append(toIndentedString(time)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" to: ").append(toIndentedString(to)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("time"); - openapiFields.add("type"); - openapiFields.add("to"); - openapiFields.add("description"); - openapiFields.add("message"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("time"); - openapiRequiredFields.add("type"); - openapiRequiredFields.add("to"); - openapiRequiredFields.add("description"); - openapiRequiredFields.add("message"); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to InboundMessageCallback - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!InboundMessageCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in InboundMessageCallback is not found in the empty JSON string", InboundMessageCallback.openapiRequiredFields.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : InboundMessageCallback.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (!jsonObj.get("type").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); - } - if (!jsonObj.get("to").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); - } - if (!jsonObj.get("description").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); - } - // validate the required field `message` - InboundMessageCallbackMessage.validateJsonElement(jsonObj.get("message")); - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!InboundMessageCallback.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'InboundMessageCallback' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(InboundMessageCallback.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, InboundMessageCallback value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - obj.remove("additionalProperties"); - // serialize additional properties - if (value.getAdditionalProperties() != null) { - for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { - if (entry.getValue() instanceof String) - obj.addProperty(entry.getKey(), (String) entry.getValue()); - else if (entry.getValue() instanceof Number) - obj.addProperty(entry.getKey(), (Number) entry.getValue()); - else if (entry.getValue() instanceof Boolean) - obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); - else if (entry.getValue() instanceof Character) - obj.addProperty(entry.getKey(), (Character) entry.getValue()); - else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } - } - } - } - elementAdapter.write(out, obj); - } - - @Override - public InboundMessageCallback read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - InboundMessageCallback instance = thisAdapter.fromJsonTree(jsonObj); - for (Map.Entry entry : jsonObj.entrySet()) { - if (!openapiFields.contains(entry.getKey())) { - if (entry.getValue().isJsonPrimitive()) { // primitive type - if (entry.getValue().getAsJsonPrimitive().isString()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); - else if (entry.getValue().getAsJsonPrimitive().isNumber()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); - else if (entry.getValue().getAsJsonPrimitive().isBoolean()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); - else - throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); - } else if (entry.getValue().isJsonArray()) { - instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); - } else { // JSON object - instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); - } - } - } - return instance; - } - - }.nullSafe(); - } - } - - /** - * Create an instance of InboundMessageCallback given an JSON string - * - * @param jsonString JSON string - * @return An instance of InboundMessageCallback - * @throws IOException if the JSON string is invalid with respect to InboundMessageCallback - */ - public static InboundMessageCallback fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, InboundMessageCallback.class); - } - - /** - * Convert an instance of InboundMessageCallback to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/bandwidth/sdk/model/MessageFailedCallback.java b/src/main/java/com/bandwidth/sdk/model/MessageCallback.java similarity index 75% rename from src/main/java/com/bandwidth/sdk/model/MessageFailedCallback.java rename to src/main/java/com/bandwidth/sdk/model/MessageCallback.java index 076afbef..59430ef5 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessageFailedCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/MessageCallback.java @@ -14,7 +14,8 @@ package com.bandwidth.sdk.model; import java.util.Objects; -import com.bandwidth.sdk.model.MessageFailedCallbackMessage; +import com.bandwidth.sdk.model.CallbackTypeEnum; +import com.bandwidth.sdk.model.MessageCallbackMessage; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -23,6 +24,7 @@ import java.io.IOException; import java.time.OffsetDateTime; import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -48,10 +50,10 @@ import com.bandwidth.sdk.JSON; /** - * Message Failed Callback + * Message Callback Schema */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") -public class MessageFailedCallback { +public class MessageCallback { public static final String SERIALIZED_NAME_TIME = "time"; @SerializedName(SERIALIZED_NAME_TIME) @javax.annotation.Nonnull @@ -60,7 +62,7 @@ public class MessageFailedCallback { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nonnull - private String type; + private CallbackTypeEnum type; public static final String SERIALIZED_NAME_TO = "to"; @SerializedName(SERIALIZED_NAME_TO) @@ -75,17 +77,17 @@ public class MessageFailedCallback { public static final String SERIALIZED_NAME_MESSAGE = "message"; @SerializedName(SERIALIZED_NAME_MESSAGE) @javax.annotation.Nonnull - private MessageFailedCallbackMessage message; + private MessageCallbackMessage message; public static final String SERIALIZED_NAME_ERROR_CODE = "errorCode"; @SerializedName(SERIALIZED_NAME_ERROR_CODE) - @javax.annotation.Nonnull + @javax.annotation.Nullable private Integer errorCode; - public MessageFailedCallback() { + public MessageCallback() { } - public MessageFailedCallback time(@javax.annotation.Nonnull OffsetDateTime time) { + public MessageCallback time(@javax.annotation.Nonnull OffsetDateTime time) { this.time = time; return this; } @@ -104,7 +106,7 @@ public void setTime(@javax.annotation.Nonnull OffsetDateTime time) { } - public MessageFailedCallback type(@javax.annotation.Nonnull String type) { + public MessageCallback type(@javax.annotation.Nonnull CallbackTypeEnum type) { this.type = type; return this; } @@ -114,16 +116,16 @@ public MessageFailedCallback type(@javax.annotation.Nonnull String type) { * @return type */ @javax.annotation.Nonnull - public String getType() { + public CallbackTypeEnum getType() { return type; } - public void setType(@javax.annotation.Nonnull String type) { + public void setType(@javax.annotation.Nonnull CallbackTypeEnum type) { this.type = type; } - public MessageFailedCallback to(@javax.annotation.Nonnull String to) { + public MessageCallback to(@javax.annotation.Nonnull String to) { this.to = to; return this; } @@ -142,13 +144,13 @@ public void setTo(@javax.annotation.Nonnull String to) { } - public MessageFailedCallback description(@javax.annotation.Nonnull String description) { + public MessageCallback description(@javax.annotation.Nonnull String description) { this.description = description; return this; } /** - * Get description + * A detailed description of the event described by the callback. * @return description */ @javax.annotation.Nonnull @@ -161,7 +163,7 @@ public void setDescription(@javax.annotation.Nonnull String description) { } - public MessageFailedCallback message(@javax.annotation.Nonnull MessageFailedCallbackMessage message) { + public MessageCallback message(@javax.annotation.Nonnull MessageCallbackMessage message) { this.message = message; return this; } @@ -171,30 +173,30 @@ public MessageFailedCallback message(@javax.annotation.Nonnull MessageFailedCall * @return message */ @javax.annotation.Nonnull - public MessageFailedCallbackMessage getMessage() { + public MessageCallbackMessage getMessage() { return message; } - public void setMessage(@javax.annotation.Nonnull MessageFailedCallbackMessage message) { + public void setMessage(@javax.annotation.Nonnull MessageCallbackMessage message) { this.message = message; } - public MessageFailedCallback errorCode(@javax.annotation.Nonnull Integer errorCode) { + public MessageCallback errorCode(@javax.annotation.Nullable Integer errorCode) { this.errorCode = errorCode; return this; } /** - * Get errorCode + * Optional error code, applicable only when type is `message-failed`. * @return errorCode */ - @javax.annotation.Nonnull + @javax.annotation.Nullable public Integer getErrorCode() { return errorCode; } - public void setErrorCode(@javax.annotation.Nonnull Integer errorCode) { + public void setErrorCode(@javax.annotation.Nullable Integer errorCode) { this.errorCode = errorCode; } @@ -211,9 +213,9 @@ public void setErrorCode(@javax.annotation.Nonnull Integer errorCode) { * * @param key name of the property * @param value value of the property - * @return the MessageFailedCallback instance itself + * @return the MessageCallback instance itself */ - public MessageFailedCallback putAdditionalProperty(String key, Object value) { + public MessageCallback putAdditionalProperty(String key, Object value) { if (this.additionalProperties == null) { this.additionalProperties = new HashMap(); } @@ -252,14 +254,18 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - MessageFailedCallback messageFailedCallback = (MessageFailedCallback) o; - return Objects.equals(this.time, messageFailedCallback.time) && - Objects.equals(this.type, messageFailedCallback.type) && - Objects.equals(this.to, messageFailedCallback.to) && - Objects.equals(this.description, messageFailedCallback.description) && - Objects.equals(this.message, messageFailedCallback.message) && - Objects.equals(this.errorCode, messageFailedCallback.errorCode)&& - Objects.equals(this.additionalProperties, messageFailedCallback.additionalProperties); + MessageCallback messageCallback = (MessageCallback) o; + return Objects.equals(this.time, messageCallback.time) && + Objects.equals(this.type, messageCallback.type) && + Objects.equals(this.to, messageCallback.to) && + Objects.equals(this.description, messageCallback.description) && + Objects.equals(this.message, messageCallback.message) && + Objects.equals(this.errorCode, messageCallback.errorCode)&& + Objects.equals(this.additionalProperties, messageCallback.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); } @Override @@ -267,10 +273,17 @@ public int hashCode() { return Objects.hash(time, type, to, description, message, errorCode, additionalProperties); } + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class MessageFailedCallback {\n"); + sb.append("class MessageCallback {\n"); sb.append(" time: ").append(toIndentedString(time)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" to: ").append(toIndentedString(to)).append("\n"); @@ -314,32 +327,30 @@ private String toIndentedString(Object o) { openapiRequiredFields.add("to"); openapiRequiredFields.add("description"); openapiRequiredFields.add("message"); - openapiRequiredFields.add("errorCode"); } /** * Validates the JSON Element and throws an exception if issues found * * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to MessageFailedCallback + * @throws IOException if the JSON Element is invalid with respect to MessageCallback */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { - if (!MessageFailedCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in MessageFailedCallback is not found in the empty JSON string", MessageFailedCallback.openapiRequiredFields.toString())); + if (!MessageCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MessageCallback is not found in the empty JSON string", MessageCallback.openapiRequiredFields.toString())); } } // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : MessageFailedCallback.openapiRequiredFields) { + for (String requiredField : MessageCallback.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (!jsonObj.get("type").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); - } + // validate the required field `type` + CallbackTypeEnum.validateJsonElement(jsonObj.get("type")); if (!jsonObj.get("to").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); } @@ -347,23 +358,23 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); } // validate the required field `message` - MessageFailedCallbackMessage.validateJsonElement(jsonObj.get("message")); + MessageCallbackMessage.validateJsonElement(jsonObj.get("message")); } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!MessageFailedCallback.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'MessageFailedCallback' and its subtypes + if (!MessageCallback.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MessageCallback' and its subtypes } final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(MessageFailedCallback.class)); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MessageCallback.class)); - return (TypeAdapter) new TypeAdapter() { + return (TypeAdapter) new TypeAdapter() { @Override - public void write(JsonWriter out, MessageFailedCallback value) throws IOException { + public void write(JsonWriter out, MessageCallback value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); obj.remove("additionalProperties"); // serialize additional properties @@ -391,12 +402,12 @@ else if (entry.getValue() instanceof Character) } @Override - public MessageFailedCallback read(JsonReader in) throws IOException { + public MessageCallback read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); JsonObject jsonObj = jsonElement.getAsJsonObject(); // store additional fields in the deserialized instance - MessageFailedCallback instance = thisAdapter.fromJsonTree(jsonObj); + MessageCallback instance = thisAdapter.fromJsonTree(jsonObj); for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type @@ -423,18 +434,18 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } /** - * Create an instance of MessageFailedCallback given an JSON string + * Create an instance of MessageCallback given an JSON string * * @param jsonString JSON string - * @return An instance of MessageFailedCallback - * @throws IOException if the JSON string is invalid with respect to MessageFailedCallback + * @return An instance of MessageCallback + * @throws IOException if the JSON string is invalid with respect to MessageCallback */ - public static MessageFailedCallback fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, MessageFailedCallback.class); + public static MessageCallback fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MessageCallback.class); } /** - * Convert an instance of MessageFailedCallback to an JSON string + * Convert an instance of MessageCallback to an JSON string * * @return JSON string */ diff --git a/src/main/java/com/bandwidth/sdk/model/InboundMessageCallbackMessage.java b/src/main/java/com/bandwidth/sdk/model/MessageCallbackMessage.java similarity index 80% rename from src/main/java/com/bandwidth/sdk/model/InboundMessageCallbackMessage.java rename to src/main/java/com/bandwidth/sdk/model/MessageCallbackMessage.java index faab65bf..0ea1c1e3 100644 --- a/src/main/java/com/bandwidth/sdk/model/InboundMessageCallbackMessage.java +++ b/src/main/java/com/bandwidth/sdk/model/MessageCallbackMessage.java @@ -29,6 +29,7 @@ import java.util.LinkedHashSet; import java.util.List; import java.util.Set; +import org.openapitools.jackson.nullable.JsonNullable; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -54,10 +55,10 @@ import com.bandwidth.sdk.JSON; /** - * Inbound Message Callback Message Schema + * Message payload schema within a MessageCallback */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") -public class InboundMessageCallbackMessage { +public class MessageCallbackMessage { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nonnull @@ -111,17 +112,17 @@ public class InboundMessageCallbackMessage { public static final String SERIALIZED_NAME_MEDIA = "media"; @SerializedName(SERIALIZED_NAME_MEDIA) @javax.annotation.Nullable - private List media = new ArrayList<>(); + private List media; public static final String SERIALIZED_NAME_PRIORITY = "priority"; @SerializedName(SERIALIZED_NAME_PRIORITY) @javax.annotation.Nullable private PriorityEnum priority; - public InboundMessageCallbackMessage() { + public MessageCallbackMessage() { } - public InboundMessageCallbackMessage id(@javax.annotation.Nonnull String id) { + public MessageCallbackMessage id(@javax.annotation.Nonnull String id) { this.id = id; return this; } @@ -140,7 +141,7 @@ public void setId(@javax.annotation.Nonnull String id) { } - public InboundMessageCallbackMessage owner(@javax.annotation.Nonnull String owner) { + public MessageCallbackMessage owner(@javax.annotation.Nonnull String owner) { this.owner = owner; return this; } @@ -159,7 +160,7 @@ public void setOwner(@javax.annotation.Nonnull String owner) { } - public InboundMessageCallbackMessage applicationId(@javax.annotation.Nonnull String applicationId) { + public MessageCallbackMessage applicationId(@javax.annotation.Nonnull String applicationId) { this.applicationId = applicationId; return this; } @@ -178,7 +179,7 @@ public void setApplicationId(@javax.annotation.Nonnull String applicationId) { } - public InboundMessageCallbackMessage time(@javax.annotation.Nonnull OffsetDateTime time) { + public MessageCallbackMessage time(@javax.annotation.Nonnull OffsetDateTime time) { this.time = time; return this; } @@ -197,7 +198,7 @@ public void setTime(@javax.annotation.Nonnull OffsetDateTime time) { } - public InboundMessageCallbackMessage segmentCount(@javax.annotation.Nonnull Integer segmentCount) { + public MessageCallbackMessage segmentCount(@javax.annotation.Nonnull Integer segmentCount) { this.segmentCount = segmentCount; return this; } @@ -216,7 +217,7 @@ public void setSegmentCount(@javax.annotation.Nonnull Integer segmentCount) { } - public InboundMessageCallbackMessage direction(@javax.annotation.Nonnull MessageDirectionEnum direction) { + public MessageCallbackMessage direction(@javax.annotation.Nonnull MessageDirectionEnum direction) { this.direction = direction; return this; } @@ -235,12 +236,12 @@ public void setDirection(@javax.annotation.Nonnull MessageDirectionEnum directio } - public InboundMessageCallbackMessage to(@javax.annotation.Nonnull Set to) { + public MessageCallbackMessage to(@javax.annotation.Nonnull Set to) { this.to = to; return this; } - public InboundMessageCallbackMessage addToItem(String toItem) { + public MessageCallbackMessage addToItem(String toItem) { if (this.to == null) { this.to = new LinkedHashSet<>(); } @@ -262,7 +263,7 @@ public void setTo(@javax.annotation.Nonnull Set to) { } - public InboundMessageCallbackMessage from(@javax.annotation.Nonnull String from) { + public MessageCallbackMessage from(@javax.annotation.Nonnull String from) { this.from = from; return this; } @@ -281,7 +282,7 @@ public void setFrom(@javax.annotation.Nonnull String from) { } - public InboundMessageCallbackMessage text(@javax.annotation.Nonnull String text) { + public MessageCallbackMessage text(@javax.annotation.Nonnull String text) { this.text = text; return this; } @@ -300,7 +301,7 @@ public void setText(@javax.annotation.Nonnull String text) { } - public InboundMessageCallbackMessage tag(@javax.annotation.Nullable String tag) { + public MessageCallbackMessage tag(@javax.annotation.Nullable String tag) { this.tag = tag; return this; } @@ -319,12 +320,12 @@ public void setTag(@javax.annotation.Nullable String tag) { } - public InboundMessageCallbackMessage media(@javax.annotation.Nullable List media) { + public MessageCallbackMessage media(@javax.annotation.Nullable List media) { this.media = media; return this; } - public InboundMessageCallbackMessage addMediaItem(URI mediaItem) { + public MessageCallbackMessage addMediaItem(URI mediaItem) { if (this.media == null) { this.media = new ArrayList<>(); } @@ -333,7 +334,7 @@ public InboundMessageCallbackMessage addMediaItem(URI mediaItem) { } /** - * Get media + * Optional media, applicable only for mms * @return media */ @javax.annotation.Nullable @@ -346,7 +347,7 @@ public void setMedia(@javax.annotation.Nullable List media) { } - public InboundMessageCallbackMessage priority(@javax.annotation.Nullable PriorityEnum priority) { + public MessageCallbackMessage priority(@javax.annotation.Nullable PriorityEnum priority) { this.priority = priority; return this; } @@ -377,9 +378,9 @@ public void setPriority(@javax.annotation.Nullable PriorityEnum priority) { * * @param key name of the property * @param value value of the property - * @return the InboundMessageCallbackMessage instance itself + * @return the MessageCallbackMessage instance itself */ - public InboundMessageCallbackMessage putAdditionalProperty(String key, Object value) { + public MessageCallbackMessage putAdditionalProperty(String key, Object value) { if (this.additionalProperties == null) { this.additionalProperties = new HashMap(); } @@ -418,20 +419,24 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - InboundMessageCallbackMessage inboundMessageCallbackMessage = (InboundMessageCallbackMessage) o; - return Objects.equals(this.id, inboundMessageCallbackMessage.id) && - Objects.equals(this.owner, inboundMessageCallbackMessage.owner) && - Objects.equals(this.applicationId, inboundMessageCallbackMessage.applicationId) && - Objects.equals(this.time, inboundMessageCallbackMessage.time) && - Objects.equals(this.segmentCount, inboundMessageCallbackMessage.segmentCount) && - Objects.equals(this.direction, inboundMessageCallbackMessage.direction) && - Objects.equals(this.to, inboundMessageCallbackMessage.to) && - Objects.equals(this.from, inboundMessageCallbackMessage.from) && - Objects.equals(this.text, inboundMessageCallbackMessage.text) && - Objects.equals(this.tag, inboundMessageCallbackMessage.tag) && - Objects.equals(this.media, inboundMessageCallbackMessage.media) && - Objects.equals(this.priority, inboundMessageCallbackMessage.priority)&& - Objects.equals(this.additionalProperties, inboundMessageCallbackMessage.additionalProperties); + MessageCallbackMessage messageCallbackMessage = (MessageCallbackMessage) o; + return Objects.equals(this.id, messageCallbackMessage.id) && + Objects.equals(this.owner, messageCallbackMessage.owner) && + Objects.equals(this.applicationId, messageCallbackMessage.applicationId) && + Objects.equals(this.time, messageCallbackMessage.time) && + Objects.equals(this.segmentCount, messageCallbackMessage.segmentCount) && + Objects.equals(this.direction, messageCallbackMessage.direction) && + Objects.equals(this.to, messageCallbackMessage.to) && + Objects.equals(this.from, messageCallbackMessage.from) && + Objects.equals(this.text, messageCallbackMessage.text) && + Objects.equals(this.tag, messageCallbackMessage.tag) && + Objects.equals(this.media, messageCallbackMessage.media) && + Objects.equals(this.priority, messageCallbackMessage.priority)&& + Objects.equals(this.additionalProperties, messageCallbackMessage.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); } @Override @@ -439,10 +444,17 @@ public int hashCode() { return Objects.hash(id, owner, applicationId, time, segmentCount, direction, to, from, text, tag, media, priority, additionalProperties); } + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class InboundMessageCallbackMessage {\n"); + sb.append("class MessageCallbackMessage {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" owner: ").append(toIndentedString(owner)).append("\n"); sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); @@ -508,17 +520,17 @@ private String toIndentedString(Object o) { * Validates the JSON Element and throws an exception if issues found * * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to InboundMessageCallbackMessage + * @throws IOException if the JSON Element is invalid with respect to MessageCallbackMessage */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { - if (!InboundMessageCallbackMessage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in InboundMessageCallbackMessage is not found in the empty JSON string", InboundMessageCallbackMessage.openapiRequiredFields.toString())); + if (!MessageCallbackMessage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MessageCallbackMessage is not found in the empty JSON string", MessageCallbackMessage.openapiRequiredFields.toString())); } } // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : InboundMessageCallbackMessage.openapiRequiredFields) { + for (String requiredField : MessageCallbackMessage.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } @@ -564,16 +576,16 @@ public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!InboundMessageCallbackMessage.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'InboundMessageCallbackMessage' and its subtypes + if (!MessageCallbackMessage.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MessageCallbackMessage' and its subtypes } final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(InboundMessageCallbackMessage.class)); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MessageCallbackMessage.class)); - return (TypeAdapter) new TypeAdapter() { + return (TypeAdapter) new TypeAdapter() { @Override - public void write(JsonWriter out, InboundMessageCallbackMessage value) throws IOException { + public void write(JsonWriter out, MessageCallbackMessage value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); obj.remove("additionalProperties"); // serialize additional properties @@ -601,12 +613,12 @@ else if (entry.getValue() instanceof Character) } @Override - public InboundMessageCallbackMessage read(JsonReader in) throws IOException { + public MessageCallbackMessage read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); JsonObject jsonObj = jsonElement.getAsJsonObject(); // store additional fields in the deserialized instance - InboundMessageCallbackMessage instance = thisAdapter.fromJsonTree(jsonObj); + MessageCallbackMessage instance = thisAdapter.fromJsonTree(jsonObj); for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type @@ -633,18 +645,18 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } /** - * Create an instance of InboundMessageCallbackMessage given an JSON string + * Create an instance of MessageCallbackMessage given an JSON string * * @param jsonString JSON string - * @return An instance of InboundMessageCallbackMessage - * @throws IOException if the JSON string is invalid with respect to InboundMessageCallbackMessage + * @return An instance of MessageCallbackMessage + * @throws IOException if the JSON string is invalid with respect to MessageCallbackMessage */ - public static InboundMessageCallbackMessage fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, InboundMessageCallbackMessage.class); + public static MessageCallbackMessage fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MessageCallbackMessage.class); } /** - * Convert an instance of InboundMessageCallbackMessage to an JSON string + * Convert an instance of MessageCallbackMessage to an JSON string * * @return JSON string */ diff --git a/src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallback.java b/src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallback.java deleted file mode 100644 index 2a9b1c7e..00000000 --- a/src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallback.java +++ /dev/null @@ -1,417 +0,0 @@ -/* - * Bandwidth - * Bandwidth's Communication APIs - * - * The version of the OpenAPI document: 1.0.0 - * Contact: letstalk@bandwidth.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.bandwidth.sdk.model; - -import java.util.Objects; -import com.bandwidth.sdk.model.MessageDeliveredCallbackMessage; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.time.OffsetDateTime; -import java.util.Arrays; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.bandwidth.sdk.JSON; - -/** - * Message Delivered Callback - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") -public class MessageDeliveredCallback { - public static final String SERIALIZED_NAME_TIME = "time"; - @SerializedName(SERIALIZED_NAME_TIME) - @javax.annotation.Nonnull - private OffsetDateTime time; - - public static final String SERIALIZED_NAME_TYPE = "type"; - @SerializedName(SERIALIZED_NAME_TYPE) - @javax.annotation.Nonnull - private String type; - - public static final String SERIALIZED_NAME_TO = "to"; - @SerializedName(SERIALIZED_NAME_TO) - @javax.annotation.Nonnull - private String to; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - @javax.annotation.Nonnull - private String description; - - public static final String SERIALIZED_NAME_MESSAGE = "message"; - @SerializedName(SERIALIZED_NAME_MESSAGE) - @javax.annotation.Nonnull - private MessageDeliveredCallbackMessage message; - - public MessageDeliveredCallback() { - } - - public MessageDeliveredCallback time(@javax.annotation.Nonnull OffsetDateTime time) { - this.time = time; - return this; - } - - /** - * Get time - * @return time - */ - @javax.annotation.Nonnull - public OffsetDateTime getTime() { - return time; - } - - public void setTime(@javax.annotation.Nonnull OffsetDateTime time) { - this.time = time; - } - - - public MessageDeliveredCallback type(@javax.annotation.Nonnull String type) { - this.type = type; - return this; - } - - /** - * Get type - * @return type - */ - @javax.annotation.Nonnull - public String getType() { - return type; - } - - public void setType(@javax.annotation.Nonnull String type) { - this.type = type; - } - - - public MessageDeliveredCallback to(@javax.annotation.Nonnull String to) { - this.to = to; - return this; - } - - /** - * Get to - * @return to - */ - @javax.annotation.Nonnull - public String getTo() { - return to; - } - - public void setTo(@javax.annotation.Nonnull String to) { - this.to = to; - } - - - public MessageDeliveredCallback description(@javax.annotation.Nonnull String description) { - this.description = description; - return this; - } - - /** - * Get description - * @return description - */ - @javax.annotation.Nonnull - public String getDescription() { - return description; - } - - public void setDescription(@javax.annotation.Nonnull String description) { - this.description = description; - } - - - public MessageDeliveredCallback message(@javax.annotation.Nonnull MessageDeliveredCallbackMessage message) { - this.message = message; - return this; - } - - /** - * Get message - * @return message - */ - @javax.annotation.Nonnull - public MessageDeliveredCallbackMessage getMessage() { - return message; - } - - public void setMessage(@javax.annotation.Nonnull MessageDeliveredCallbackMessage message) { - this.message = message; - } - - /** - * A container for additional, undeclared properties. - * This is a holder for any undeclared properties as specified with - * the 'additionalProperties' keyword in the OAS document. - */ - private Map additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. - * If the property does not already exist, create it otherwise replace it. - * - * @param key name of the property - * @param value value of the property - * @return the MessageDeliveredCallback instance itself - */ - public MessageDeliveredCallback putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - * - * @return a map of objects - */ - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * Return the additional (undeclared) property with the specified name. - * - * @param key name of the property - * @return an object - */ - public Object getAdditionalProperty(String key) { - if (this.additionalProperties == null) { - return null; - } - return this.additionalProperties.get(key); - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - MessageDeliveredCallback messageDeliveredCallback = (MessageDeliveredCallback) o; - return Objects.equals(this.time, messageDeliveredCallback.time) && - Objects.equals(this.type, messageDeliveredCallback.type) && - Objects.equals(this.to, messageDeliveredCallback.to) && - Objects.equals(this.description, messageDeliveredCallback.description) && - Objects.equals(this.message, messageDeliveredCallback.message)&& - Objects.equals(this.additionalProperties, messageDeliveredCallback.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(time, type, to, description, message, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class MessageDeliveredCallback {\n"); - sb.append(" time: ").append(toIndentedString(time)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" to: ").append(toIndentedString(to)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("time"); - openapiFields.add("type"); - openapiFields.add("to"); - openapiFields.add("description"); - openapiFields.add("message"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("time"); - openapiRequiredFields.add("type"); - openapiRequiredFields.add("to"); - openapiRequiredFields.add("description"); - openapiRequiredFields.add("message"); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to MessageDeliveredCallback - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!MessageDeliveredCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in MessageDeliveredCallback is not found in the empty JSON string", MessageDeliveredCallback.openapiRequiredFields.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : MessageDeliveredCallback.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (!jsonObj.get("type").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); - } - if (!jsonObj.get("to").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); - } - if (!jsonObj.get("description").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); - } - // validate the required field `message` - MessageDeliveredCallbackMessage.validateJsonElement(jsonObj.get("message")); - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!MessageDeliveredCallback.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'MessageDeliveredCallback' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(MessageDeliveredCallback.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, MessageDeliveredCallback value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - obj.remove("additionalProperties"); - // serialize additional properties - if (value.getAdditionalProperties() != null) { - for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { - if (entry.getValue() instanceof String) - obj.addProperty(entry.getKey(), (String) entry.getValue()); - else if (entry.getValue() instanceof Number) - obj.addProperty(entry.getKey(), (Number) entry.getValue()); - else if (entry.getValue() instanceof Boolean) - obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); - else if (entry.getValue() instanceof Character) - obj.addProperty(entry.getKey(), (Character) entry.getValue()); - else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } - } - } - } - elementAdapter.write(out, obj); - } - - @Override - public MessageDeliveredCallback read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - MessageDeliveredCallback instance = thisAdapter.fromJsonTree(jsonObj); - for (Map.Entry entry : jsonObj.entrySet()) { - if (!openapiFields.contains(entry.getKey())) { - if (entry.getValue().isJsonPrimitive()) { // primitive type - if (entry.getValue().getAsJsonPrimitive().isString()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); - else if (entry.getValue().getAsJsonPrimitive().isNumber()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); - else if (entry.getValue().getAsJsonPrimitive().isBoolean()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); - else - throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); - } else if (entry.getValue().isJsonArray()) { - instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); - } else { // JSON object - instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); - } - } - } - return instance; - } - - }.nullSafe(); - } - } - - /** - * Create an instance of MessageDeliveredCallback given an JSON string - * - * @param jsonString JSON string - * @return An instance of MessageDeliveredCallback - * @throws IOException if the JSON string is invalid with respect to MessageDeliveredCallback - */ - public static MessageDeliveredCallback fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, MessageDeliveredCallback.class); - } - - /** - * Convert an instance of MessageDeliveredCallback to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallbackMessage.java b/src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallbackMessage.java deleted file mode 100644 index c4c644bc..00000000 --- a/src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallbackMessage.java +++ /dev/null @@ -1,656 +0,0 @@ -/* - * Bandwidth - * Bandwidth's Communication APIs - * - * The version of the OpenAPI document: 1.0.0 - * Contact: letstalk@bandwidth.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.bandwidth.sdk.model; - -import java.util.Objects; -import com.bandwidth.sdk.model.MessageDirectionEnum; -import com.bandwidth.sdk.model.PriorityEnum; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.net.URI; -import java.time.OffsetDateTime; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.bandwidth.sdk.JSON; - -/** - * Message Delivered Callback Message Schema - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") -public class MessageDeliveredCallbackMessage { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - @javax.annotation.Nonnull - private String id; - - public static final String SERIALIZED_NAME_OWNER = "owner"; - @SerializedName(SERIALIZED_NAME_OWNER) - @javax.annotation.Nonnull - private String owner; - - public static final String SERIALIZED_NAME_APPLICATION_ID = "applicationId"; - @SerializedName(SERIALIZED_NAME_APPLICATION_ID) - @javax.annotation.Nonnull - private String applicationId; - - public static final String SERIALIZED_NAME_TIME = "time"; - @SerializedName(SERIALIZED_NAME_TIME) - @javax.annotation.Nonnull - private OffsetDateTime time; - - public static final String SERIALIZED_NAME_SEGMENT_COUNT = "segmentCount"; - @SerializedName(SERIALIZED_NAME_SEGMENT_COUNT) - @javax.annotation.Nonnull - private Integer segmentCount; - - public static final String SERIALIZED_NAME_DIRECTION = "direction"; - @SerializedName(SERIALIZED_NAME_DIRECTION) - @javax.annotation.Nonnull - private MessageDirectionEnum direction; - - public static final String SERIALIZED_NAME_TO = "to"; - @SerializedName(SERIALIZED_NAME_TO) - @javax.annotation.Nonnull - private Set to = new LinkedHashSet<>(); - - public static final String SERIALIZED_NAME_FROM = "from"; - @SerializedName(SERIALIZED_NAME_FROM) - @javax.annotation.Nonnull - private String from; - - public static final String SERIALIZED_NAME_TEXT = "text"; - @SerializedName(SERIALIZED_NAME_TEXT) - @javax.annotation.Nonnull - private String text; - - public static final String SERIALIZED_NAME_TAG = "tag"; - @SerializedName(SERIALIZED_NAME_TAG) - @javax.annotation.Nonnull - private String tag; - - public static final String SERIALIZED_NAME_MEDIA = "media"; - @SerializedName(SERIALIZED_NAME_MEDIA) - @javax.annotation.Nullable - private List media = new ArrayList<>(); - - public static final String SERIALIZED_NAME_PRIORITY = "priority"; - @SerializedName(SERIALIZED_NAME_PRIORITY) - @javax.annotation.Nullable - private PriorityEnum priority; - - public MessageDeliveredCallbackMessage() { - } - - public MessageDeliveredCallbackMessage id(@javax.annotation.Nonnull String id) { - this.id = id; - return this; - } - - /** - * Get id - * @return id - */ - @javax.annotation.Nonnull - public String getId() { - return id; - } - - public void setId(@javax.annotation.Nonnull String id) { - this.id = id; - } - - - public MessageDeliveredCallbackMessage owner(@javax.annotation.Nonnull String owner) { - this.owner = owner; - return this; - } - - /** - * Get owner - * @return owner - */ - @javax.annotation.Nonnull - public String getOwner() { - return owner; - } - - public void setOwner(@javax.annotation.Nonnull String owner) { - this.owner = owner; - } - - - public MessageDeliveredCallbackMessage applicationId(@javax.annotation.Nonnull String applicationId) { - this.applicationId = applicationId; - return this; - } - - /** - * Get applicationId - * @return applicationId - */ - @javax.annotation.Nonnull - public String getApplicationId() { - return applicationId; - } - - public void setApplicationId(@javax.annotation.Nonnull String applicationId) { - this.applicationId = applicationId; - } - - - public MessageDeliveredCallbackMessage time(@javax.annotation.Nonnull OffsetDateTime time) { - this.time = time; - return this; - } - - /** - * Get time - * @return time - */ - @javax.annotation.Nonnull - public OffsetDateTime getTime() { - return time; - } - - public void setTime(@javax.annotation.Nonnull OffsetDateTime time) { - this.time = time; - } - - - public MessageDeliveredCallbackMessage segmentCount(@javax.annotation.Nonnull Integer segmentCount) { - this.segmentCount = segmentCount; - return this; - } - - /** - * Get segmentCount - * @return segmentCount - */ - @javax.annotation.Nonnull - public Integer getSegmentCount() { - return segmentCount; - } - - public void setSegmentCount(@javax.annotation.Nonnull Integer segmentCount) { - this.segmentCount = segmentCount; - } - - - public MessageDeliveredCallbackMessage direction(@javax.annotation.Nonnull MessageDirectionEnum direction) { - this.direction = direction; - return this; - } - - /** - * Get direction - * @return direction - */ - @javax.annotation.Nonnull - public MessageDirectionEnum getDirection() { - return direction; - } - - public void setDirection(@javax.annotation.Nonnull MessageDirectionEnum direction) { - this.direction = direction; - } - - - public MessageDeliveredCallbackMessage to(@javax.annotation.Nonnull Set to) { - this.to = to; - return this; - } - - public MessageDeliveredCallbackMessage addToItem(String toItem) { - if (this.to == null) { - this.to = new LinkedHashSet<>(); - } - this.to.add(toItem); - return this; - } - - /** - * Get to - * @return to - */ - @javax.annotation.Nonnull - public Set getTo() { - return to; - } - - public void setTo(@javax.annotation.Nonnull Set to) { - this.to = to; - } - - - public MessageDeliveredCallbackMessage from(@javax.annotation.Nonnull String from) { - this.from = from; - return this; - } - - /** - * Get from - * @return from - */ - @javax.annotation.Nonnull - public String getFrom() { - return from; - } - - public void setFrom(@javax.annotation.Nonnull String from) { - this.from = from; - } - - - public MessageDeliveredCallbackMessage text(@javax.annotation.Nonnull String text) { - this.text = text; - return this; - } - - /** - * Get text - * @return text - */ - @javax.annotation.Nonnull - public String getText() { - return text; - } - - public void setText(@javax.annotation.Nonnull String text) { - this.text = text; - } - - - public MessageDeliveredCallbackMessage tag(@javax.annotation.Nonnull String tag) { - this.tag = tag; - return this; - } - - /** - * Get tag - * @return tag - */ - @javax.annotation.Nonnull - public String getTag() { - return tag; - } - - public void setTag(@javax.annotation.Nonnull String tag) { - this.tag = tag; - } - - - public MessageDeliveredCallbackMessage media(@javax.annotation.Nullable List media) { - this.media = media; - return this; - } - - public MessageDeliveredCallbackMessage addMediaItem(URI mediaItem) { - if (this.media == null) { - this.media = new ArrayList<>(); - } - this.media.add(mediaItem); - return this; - } - - /** - * Get media - * @return media - */ - @javax.annotation.Nullable - public List getMedia() { - return media; - } - - public void setMedia(@javax.annotation.Nullable List media) { - this.media = media; - } - - - public MessageDeliveredCallbackMessage priority(@javax.annotation.Nullable PriorityEnum priority) { - this.priority = priority; - return this; - } - - /** - * Get priority - * @return priority - */ - @javax.annotation.Nullable - public PriorityEnum getPriority() { - return priority; - } - - public void setPriority(@javax.annotation.Nullable PriorityEnum priority) { - this.priority = priority; - } - - /** - * A container for additional, undeclared properties. - * This is a holder for any undeclared properties as specified with - * the 'additionalProperties' keyword in the OAS document. - */ - private Map additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. - * If the property does not already exist, create it otherwise replace it. - * - * @param key name of the property - * @param value value of the property - * @return the MessageDeliveredCallbackMessage instance itself - */ - public MessageDeliveredCallbackMessage putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - * - * @return a map of objects - */ - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * Return the additional (undeclared) property with the specified name. - * - * @param key name of the property - * @return an object - */ - public Object getAdditionalProperty(String key) { - if (this.additionalProperties == null) { - return null; - } - return this.additionalProperties.get(key); - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - MessageDeliveredCallbackMessage messageDeliveredCallbackMessage = (MessageDeliveredCallbackMessage) o; - return Objects.equals(this.id, messageDeliveredCallbackMessage.id) && - Objects.equals(this.owner, messageDeliveredCallbackMessage.owner) && - Objects.equals(this.applicationId, messageDeliveredCallbackMessage.applicationId) && - Objects.equals(this.time, messageDeliveredCallbackMessage.time) && - Objects.equals(this.segmentCount, messageDeliveredCallbackMessage.segmentCount) && - Objects.equals(this.direction, messageDeliveredCallbackMessage.direction) && - Objects.equals(this.to, messageDeliveredCallbackMessage.to) && - Objects.equals(this.from, messageDeliveredCallbackMessage.from) && - Objects.equals(this.text, messageDeliveredCallbackMessage.text) && - Objects.equals(this.tag, messageDeliveredCallbackMessage.tag) && - Objects.equals(this.media, messageDeliveredCallbackMessage.media) && - Objects.equals(this.priority, messageDeliveredCallbackMessage.priority)&& - Objects.equals(this.additionalProperties, messageDeliveredCallbackMessage.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(id, owner, applicationId, time, segmentCount, direction, to, from, text, tag, media, priority, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class MessageDeliveredCallbackMessage {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" owner: ").append(toIndentedString(owner)).append("\n"); - sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); - sb.append(" time: ").append(toIndentedString(time)).append("\n"); - sb.append(" segmentCount: ").append(toIndentedString(segmentCount)).append("\n"); - sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); - sb.append(" to: ").append(toIndentedString(to)).append("\n"); - sb.append(" from: ").append(toIndentedString(from)).append("\n"); - sb.append(" text: ").append(toIndentedString(text)).append("\n"); - sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); - sb.append(" media: ").append(toIndentedString(media)).append("\n"); - sb.append(" priority: ").append(toIndentedString(priority)).append("\n"); - sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("id"); - openapiFields.add("owner"); - openapiFields.add("applicationId"); - openapiFields.add("time"); - openapiFields.add("segmentCount"); - openapiFields.add("direction"); - openapiFields.add("to"); - openapiFields.add("from"); - openapiFields.add("text"); - openapiFields.add("tag"); - openapiFields.add("media"); - openapiFields.add("priority"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("owner"); - openapiRequiredFields.add("applicationId"); - openapiRequiredFields.add("time"); - openapiRequiredFields.add("segmentCount"); - openapiRequiredFields.add("direction"); - openapiRequiredFields.add("to"); - openapiRequiredFields.add("from"); - openapiRequiredFields.add("text"); - openapiRequiredFields.add("tag"); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to MessageDeliveredCallbackMessage - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!MessageDeliveredCallbackMessage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in MessageDeliveredCallbackMessage is not found in the empty JSON string", MessageDeliveredCallbackMessage.openapiRequiredFields.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : MessageDeliveredCallbackMessage.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (!jsonObj.get("id").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); - } - if (!jsonObj.get("owner").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `owner` to be a primitive type in the JSON string but got `%s`", jsonObj.get("owner").toString())); - } - if (!jsonObj.get("applicationId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `applicationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("applicationId").toString())); - } - // validate the required field `direction` - MessageDirectionEnum.validateJsonElement(jsonObj.get("direction")); - // ensure the required json array is present - if (jsonObj.get("to") == null) { - throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); - } else if (!jsonObj.get("to").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `to` to be an array in the JSON string but got `%s`", jsonObj.get("to").toString())); - } - if (!jsonObj.get("from").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); - } - if (!jsonObj.get("text").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); - } - if (!jsonObj.get("tag").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); - } - // ensure the optional json data is an array if present - if (jsonObj.get("media") != null && !jsonObj.get("media").isJsonNull() && !jsonObj.get("media").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `media` to be an array in the JSON string but got `%s`", jsonObj.get("media").toString())); - } - // validate the optional field `priority` - if (jsonObj.get("priority") != null && !jsonObj.get("priority").isJsonNull()) { - PriorityEnum.validateJsonElement(jsonObj.get("priority")); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!MessageDeliveredCallbackMessage.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'MessageDeliveredCallbackMessage' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(MessageDeliveredCallbackMessage.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, MessageDeliveredCallbackMessage value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - obj.remove("additionalProperties"); - // serialize additional properties - if (value.getAdditionalProperties() != null) { - for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { - if (entry.getValue() instanceof String) - obj.addProperty(entry.getKey(), (String) entry.getValue()); - else if (entry.getValue() instanceof Number) - obj.addProperty(entry.getKey(), (Number) entry.getValue()); - else if (entry.getValue() instanceof Boolean) - obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); - else if (entry.getValue() instanceof Character) - obj.addProperty(entry.getKey(), (Character) entry.getValue()); - else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } - } - } - } - elementAdapter.write(out, obj); - } - - @Override - public MessageDeliveredCallbackMessage read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - MessageDeliveredCallbackMessage instance = thisAdapter.fromJsonTree(jsonObj); - for (Map.Entry entry : jsonObj.entrySet()) { - if (!openapiFields.contains(entry.getKey())) { - if (entry.getValue().isJsonPrimitive()) { // primitive type - if (entry.getValue().getAsJsonPrimitive().isString()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); - else if (entry.getValue().getAsJsonPrimitive().isNumber()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); - else if (entry.getValue().getAsJsonPrimitive().isBoolean()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); - else - throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); - } else if (entry.getValue().isJsonArray()) { - instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); - } else { // JSON object - instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); - } - } - } - return instance; - } - - }.nullSafe(); - } - } - - /** - * Create an instance of MessageDeliveredCallbackMessage given an JSON string - * - * @param jsonString JSON string - * @return An instance of MessageDeliveredCallbackMessage - * @throws IOException if the JSON string is invalid with respect to MessageDeliveredCallbackMessage - */ - public static MessageDeliveredCallbackMessage fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, MessageDeliveredCallbackMessage.class); - } - - /** - * Convert an instance of MessageDeliveredCallbackMessage to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/bandwidth/sdk/model/MessageFailedCallbackMessage.java b/src/main/java/com/bandwidth/sdk/model/MessageFailedCallbackMessage.java deleted file mode 100644 index 37dadda7..00000000 --- a/src/main/java/com/bandwidth/sdk/model/MessageFailedCallbackMessage.java +++ /dev/null @@ -1,656 +0,0 @@ -/* - * Bandwidth - * Bandwidth's Communication APIs - * - * The version of the OpenAPI document: 1.0.0 - * Contact: letstalk@bandwidth.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.bandwidth.sdk.model; - -import java.util.Objects; -import com.bandwidth.sdk.model.MessageDirectionEnum; -import com.bandwidth.sdk.model.PriorityEnum; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.net.URI; -import java.time.OffsetDateTime; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.bandwidth.sdk.JSON; - -/** - * Message Failed Callback Message Schema - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") -public class MessageFailedCallbackMessage { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - @javax.annotation.Nonnull - private String id; - - public static final String SERIALIZED_NAME_OWNER = "owner"; - @SerializedName(SERIALIZED_NAME_OWNER) - @javax.annotation.Nonnull - private String owner; - - public static final String SERIALIZED_NAME_APPLICATION_ID = "applicationId"; - @SerializedName(SERIALIZED_NAME_APPLICATION_ID) - @javax.annotation.Nonnull - private String applicationId; - - public static final String SERIALIZED_NAME_TIME = "time"; - @SerializedName(SERIALIZED_NAME_TIME) - @javax.annotation.Nonnull - private OffsetDateTime time; - - public static final String SERIALIZED_NAME_SEGMENT_COUNT = "segmentCount"; - @SerializedName(SERIALIZED_NAME_SEGMENT_COUNT) - @javax.annotation.Nonnull - private Integer segmentCount; - - public static final String SERIALIZED_NAME_DIRECTION = "direction"; - @SerializedName(SERIALIZED_NAME_DIRECTION) - @javax.annotation.Nonnull - private MessageDirectionEnum direction; - - public static final String SERIALIZED_NAME_TO = "to"; - @SerializedName(SERIALIZED_NAME_TO) - @javax.annotation.Nonnull - private Set to = new LinkedHashSet<>(); - - public static final String SERIALIZED_NAME_FROM = "from"; - @SerializedName(SERIALIZED_NAME_FROM) - @javax.annotation.Nonnull - private String from; - - public static final String SERIALIZED_NAME_TEXT = "text"; - @SerializedName(SERIALIZED_NAME_TEXT) - @javax.annotation.Nonnull - private String text; - - public static final String SERIALIZED_NAME_TAG = "tag"; - @SerializedName(SERIALIZED_NAME_TAG) - @javax.annotation.Nonnull - private String tag; - - public static final String SERIALIZED_NAME_MEDIA = "media"; - @SerializedName(SERIALIZED_NAME_MEDIA) - @javax.annotation.Nullable - private List media = new ArrayList<>(); - - public static final String SERIALIZED_NAME_PRIORITY = "priority"; - @SerializedName(SERIALIZED_NAME_PRIORITY) - @javax.annotation.Nullable - private PriorityEnum priority; - - public MessageFailedCallbackMessage() { - } - - public MessageFailedCallbackMessage id(@javax.annotation.Nonnull String id) { - this.id = id; - return this; - } - - /** - * Get id - * @return id - */ - @javax.annotation.Nonnull - public String getId() { - return id; - } - - public void setId(@javax.annotation.Nonnull String id) { - this.id = id; - } - - - public MessageFailedCallbackMessage owner(@javax.annotation.Nonnull String owner) { - this.owner = owner; - return this; - } - - /** - * Get owner - * @return owner - */ - @javax.annotation.Nonnull - public String getOwner() { - return owner; - } - - public void setOwner(@javax.annotation.Nonnull String owner) { - this.owner = owner; - } - - - public MessageFailedCallbackMessage applicationId(@javax.annotation.Nonnull String applicationId) { - this.applicationId = applicationId; - return this; - } - - /** - * Get applicationId - * @return applicationId - */ - @javax.annotation.Nonnull - public String getApplicationId() { - return applicationId; - } - - public void setApplicationId(@javax.annotation.Nonnull String applicationId) { - this.applicationId = applicationId; - } - - - public MessageFailedCallbackMessage time(@javax.annotation.Nonnull OffsetDateTime time) { - this.time = time; - return this; - } - - /** - * Get time - * @return time - */ - @javax.annotation.Nonnull - public OffsetDateTime getTime() { - return time; - } - - public void setTime(@javax.annotation.Nonnull OffsetDateTime time) { - this.time = time; - } - - - public MessageFailedCallbackMessage segmentCount(@javax.annotation.Nonnull Integer segmentCount) { - this.segmentCount = segmentCount; - return this; - } - - /** - * Get segmentCount - * @return segmentCount - */ - @javax.annotation.Nonnull - public Integer getSegmentCount() { - return segmentCount; - } - - public void setSegmentCount(@javax.annotation.Nonnull Integer segmentCount) { - this.segmentCount = segmentCount; - } - - - public MessageFailedCallbackMessage direction(@javax.annotation.Nonnull MessageDirectionEnum direction) { - this.direction = direction; - return this; - } - - /** - * Get direction - * @return direction - */ - @javax.annotation.Nonnull - public MessageDirectionEnum getDirection() { - return direction; - } - - public void setDirection(@javax.annotation.Nonnull MessageDirectionEnum direction) { - this.direction = direction; - } - - - public MessageFailedCallbackMessage to(@javax.annotation.Nonnull Set to) { - this.to = to; - return this; - } - - public MessageFailedCallbackMessage addToItem(String toItem) { - if (this.to == null) { - this.to = new LinkedHashSet<>(); - } - this.to.add(toItem); - return this; - } - - /** - * Get to - * @return to - */ - @javax.annotation.Nonnull - public Set getTo() { - return to; - } - - public void setTo(@javax.annotation.Nonnull Set to) { - this.to = to; - } - - - public MessageFailedCallbackMessage from(@javax.annotation.Nonnull String from) { - this.from = from; - return this; - } - - /** - * Get from - * @return from - */ - @javax.annotation.Nonnull - public String getFrom() { - return from; - } - - public void setFrom(@javax.annotation.Nonnull String from) { - this.from = from; - } - - - public MessageFailedCallbackMessage text(@javax.annotation.Nonnull String text) { - this.text = text; - return this; - } - - /** - * Get text - * @return text - */ - @javax.annotation.Nonnull - public String getText() { - return text; - } - - public void setText(@javax.annotation.Nonnull String text) { - this.text = text; - } - - - public MessageFailedCallbackMessage tag(@javax.annotation.Nonnull String tag) { - this.tag = tag; - return this; - } - - /** - * Get tag - * @return tag - */ - @javax.annotation.Nonnull - public String getTag() { - return tag; - } - - public void setTag(@javax.annotation.Nonnull String tag) { - this.tag = tag; - } - - - public MessageFailedCallbackMessage media(@javax.annotation.Nullable List media) { - this.media = media; - return this; - } - - public MessageFailedCallbackMessage addMediaItem(URI mediaItem) { - if (this.media == null) { - this.media = new ArrayList<>(); - } - this.media.add(mediaItem); - return this; - } - - /** - * Get media - * @return media - */ - @javax.annotation.Nullable - public List getMedia() { - return media; - } - - public void setMedia(@javax.annotation.Nullable List media) { - this.media = media; - } - - - public MessageFailedCallbackMessage priority(@javax.annotation.Nullable PriorityEnum priority) { - this.priority = priority; - return this; - } - - /** - * Get priority - * @return priority - */ - @javax.annotation.Nullable - public PriorityEnum getPriority() { - return priority; - } - - public void setPriority(@javax.annotation.Nullable PriorityEnum priority) { - this.priority = priority; - } - - /** - * A container for additional, undeclared properties. - * This is a holder for any undeclared properties as specified with - * the 'additionalProperties' keyword in the OAS document. - */ - private Map additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. - * If the property does not already exist, create it otherwise replace it. - * - * @param key name of the property - * @param value value of the property - * @return the MessageFailedCallbackMessage instance itself - */ - public MessageFailedCallbackMessage putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - * - * @return a map of objects - */ - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * Return the additional (undeclared) property with the specified name. - * - * @param key name of the property - * @return an object - */ - public Object getAdditionalProperty(String key) { - if (this.additionalProperties == null) { - return null; - } - return this.additionalProperties.get(key); - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - MessageFailedCallbackMessage messageFailedCallbackMessage = (MessageFailedCallbackMessage) o; - return Objects.equals(this.id, messageFailedCallbackMessage.id) && - Objects.equals(this.owner, messageFailedCallbackMessage.owner) && - Objects.equals(this.applicationId, messageFailedCallbackMessage.applicationId) && - Objects.equals(this.time, messageFailedCallbackMessage.time) && - Objects.equals(this.segmentCount, messageFailedCallbackMessage.segmentCount) && - Objects.equals(this.direction, messageFailedCallbackMessage.direction) && - Objects.equals(this.to, messageFailedCallbackMessage.to) && - Objects.equals(this.from, messageFailedCallbackMessage.from) && - Objects.equals(this.text, messageFailedCallbackMessage.text) && - Objects.equals(this.tag, messageFailedCallbackMessage.tag) && - Objects.equals(this.media, messageFailedCallbackMessage.media) && - Objects.equals(this.priority, messageFailedCallbackMessage.priority)&& - Objects.equals(this.additionalProperties, messageFailedCallbackMessage.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(id, owner, applicationId, time, segmentCount, direction, to, from, text, tag, media, priority, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class MessageFailedCallbackMessage {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" owner: ").append(toIndentedString(owner)).append("\n"); - sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); - sb.append(" time: ").append(toIndentedString(time)).append("\n"); - sb.append(" segmentCount: ").append(toIndentedString(segmentCount)).append("\n"); - sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); - sb.append(" to: ").append(toIndentedString(to)).append("\n"); - sb.append(" from: ").append(toIndentedString(from)).append("\n"); - sb.append(" text: ").append(toIndentedString(text)).append("\n"); - sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); - sb.append(" media: ").append(toIndentedString(media)).append("\n"); - sb.append(" priority: ").append(toIndentedString(priority)).append("\n"); - sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("id"); - openapiFields.add("owner"); - openapiFields.add("applicationId"); - openapiFields.add("time"); - openapiFields.add("segmentCount"); - openapiFields.add("direction"); - openapiFields.add("to"); - openapiFields.add("from"); - openapiFields.add("text"); - openapiFields.add("tag"); - openapiFields.add("media"); - openapiFields.add("priority"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("owner"); - openapiRequiredFields.add("applicationId"); - openapiRequiredFields.add("time"); - openapiRequiredFields.add("segmentCount"); - openapiRequiredFields.add("direction"); - openapiRequiredFields.add("to"); - openapiRequiredFields.add("from"); - openapiRequiredFields.add("text"); - openapiRequiredFields.add("tag"); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to MessageFailedCallbackMessage - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!MessageFailedCallbackMessage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in MessageFailedCallbackMessage is not found in the empty JSON string", MessageFailedCallbackMessage.openapiRequiredFields.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : MessageFailedCallbackMessage.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (!jsonObj.get("id").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); - } - if (!jsonObj.get("owner").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `owner` to be a primitive type in the JSON string but got `%s`", jsonObj.get("owner").toString())); - } - if (!jsonObj.get("applicationId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `applicationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("applicationId").toString())); - } - // validate the required field `direction` - MessageDirectionEnum.validateJsonElement(jsonObj.get("direction")); - // ensure the required json array is present - if (jsonObj.get("to") == null) { - throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); - } else if (!jsonObj.get("to").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `to` to be an array in the JSON string but got `%s`", jsonObj.get("to").toString())); - } - if (!jsonObj.get("from").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); - } - if (!jsonObj.get("text").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); - } - if (!jsonObj.get("tag").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); - } - // ensure the optional json data is an array if present - if (jsonObj.get("media") != null && !jsonObj.get("media").isJsonNull() && !jsonObj.get("media").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `media` to be an array in the JSON string but got `%s`", jsonObj.get("media").toString())); - } - // validate the optional field `priority` - if (jsonObj.get("priority") != null && !jsonObj.get("priority").isJsonNull()) { - PriorityEnum.validateJsonElement(jsonObj.get("priority")); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!MessageFailedCallbackMessage.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'MessageFailedCallbackMessage' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(MessageFailedCallbackMessage.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, MessageFailedCallbackMessage value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - obj.remove("additionalProperties"); - // serialize additional properties - if (value.getAdditionalProperties() != null) { - for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { - if (entry.getValue() instanceof String) - obj.addProperty(entry.getKey(), (String) entry.getValue()); - else if (entry.getValue() instanceof Number) - obj.addProperty(entry.getKey(), (Number) entry.getValue()); - else if (entry.getValue() instanceof Boolean) - obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); - else if (entry.getValue() instanceof Character) - obj.addProperty(entry.getKey(), (Character) entry.getValue()); - else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } - } - } - } - elementAdapter.write(out, obj); - } - - @Override - public MessageFailedCallbackMessage read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - MessageFailedCallbackMessage instance = thisAdapter.fromJsonTree(jsonObj); - for (Map.Entry entry : jsonObj.entrySet()) { - if (!openapiFields.contains(entry.getKey())) { - if (entry.getValue().isJsonPrimitive()) { // primitive type - if (entry.getValue().getAsJsonPrimitive().isString()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); - else if (entry.getValue().getAsJsonPrimitive().isNumber()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); - else if (entry.getValue().getAsJsonPrimitive().isBoolean()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); - else - throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); - } else if (entry.getValue().isJsonArray()) { - instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); - } else { // JSON object - instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); - } - } - } - return instance; - } - - }.nullSafe(); - } - } - - /** - * Create an instance of MessageFailedCallbackMessage given an JSON string - * - * @param jsonString JSON string - * @return An instance of MessageFailedCallbackMessage - * @throws IOException if the JSON string is invalid with respect to MessageFailedCallbackMessage - */ - public static MessageFailedCallbackMessage fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, MessageFailedCallbackMessage.class); - } - - /** - * Convert an instance of MessageFailedCallbackMessage to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/bandwidth/sdk/model/MessageSendingCallback.java b/src/main/java/com/bandwidth/sdk/model/MessageSendingCallback.java deleted file mode 100644 index 14d81e84..00000000 --- a/src/main/java/com/bandwidth/sdk/model/MessageSendingCallback.java +++ /dev/null @@ -1,417 +0,0 @@ -/* - * Bandwidth - * Bandwidth's Communication APIs - * - * The version of the OpenAPI document: 1.0.0 - * Contact: letstalk@bandwidth.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.bandwidth.sdk.model; - -import java.util.Objects; -import com.bandwidth.sdk.model.MessageSendingCallbackMessage; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.time.OffsetDateTime; -import java.util.Arrays; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.bandwidth.sdk.JSON; - -/** - * Message Sending Callback - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") -public class MessageSendingCallback { - public static final String SERIALIZED_NAME_TIME = "time"; - @SerializedName(SERIALIZED_NAME_TIME) - @javax.annotation.Nonnull - private OffsetDateTime time; - - public static final String SERIALIZED_NAME_TYPE = "type"; - @SerializedName(SERIALIZED_NAME_TYPE) - @javax.annotation.Nonnull - private String type; - - public static final String SERIALIZED_NAME_TO = "to"; - @SerializedName(SERIALIZED_NAME_TO) - @javax.annotation.Nonnull - private String to; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - @javax.annotation.Nonnull - private String description; - - public static final String SERIALIZED_NAME_MESSAGE = "message"; - @SerializedName(SERIALIZED_NAME_MESSAGE) - @javax.annotation.Nonnull - private MessageSendingCallbackMessage message; - - public MessageSendingCallback() { - } - - public MessageSendingCallback time(@javax.annotation.Nonnull OffsetDateTime time) { - this.time = time; - return this; - } - - /** - * Get time - * @return time - */ - @javax.annotation.Nonnull - public OffsetDateTime getTime() { - return time; - } - - public void setTime(@javax.annotation.Nonnull OffsetDateTime time) { - this.time = time; - } - - - public MessageSendingCallback type(@javax.annotation.Nonnull String type) { - this.type = type; - return this; - } - - /** - * Get type - * @return type - */ - @javax.annotation.Nonnull - public String getType() { - return type; - } - - public void setType(@javax.annotation.Nonnull String type) { - this.type = type; - } - - - public MessageSendingCallback to(@javax.annotation.Nonnull String to) { - this.to = to; - return this; - } - - /** - * Get to - * @return to - */ - @javax.annotation.Nonnull - public String getTo() { - return to; - } - - public void setTo(@javax.annotation.Nonnull String to) { - this.to = to; - } - - - public MessageSendingCallback description(@javax.annotation.Nonnull String description) { - this.description = description; - return this; - } - - /** - * Get description - * @return description - */ - @javax.annotation.Nonnull - public String getDescription() { - return description; - } - - public void setDescription(@javax.annotation.Nonnull String description) { - this.description = description; - } - - - public MessageSendingCallback message(@javax.annotation.Nonnull MessageSendingCallbackMessage message) { - this.message = message; - return this; - } - - /** - * Get message - * @return message - */ - @javax.annotation.Nonnull - public MessageSendingCallbackMessage getMessage() { - return message; - } - - public void setMessage(@javax.annotation.Nonnull MessageSendingCallbackMessage message) { - this.message = message; - } - - /** - * A container for additional, undeclared properties. - * This is a holder for any undeclared properties as specified with - * the 'additionalProperties' keyword in the OAS document. - */ - private Map additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. - * If the property does not already exist, create it otherwise replace it. - * - * @param key name of the property - * @param value value of the property - * @return the MessageSendingCallback instance itself - */ - public MessageSendingCallback putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - * - * @return a map of objects - */ - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * Return the additional (undeclared) property with the specified name. - * - * @param key name of the property - * @return an object - */ - public Object getAdditionalProperty(String key) { - if (this.additionalProperties == null) { - return null; - } - return this.additionalProperties.get(key); - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - MessageSendingCallback messageSendingCallback = (MessageSendingCallback) o; - return Objects.equals(this.time, messageSendingCallback.time) && - Objects.equals(this.type, messageSendingCallback.type) && - Objects.equals(this.to, messageSendingCallback.to) && - Objects.equals(this.description, messageSendingCallback.description) && - Objects.equals(this.message, messageSendingCallback.message)&& - Objects.equals(this.additionalProperties, messageSendingCallback.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(time, type, to, description, message, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class MessageSendingCallback {\n"); - sb.append(" time: ").append(toIndentedString(time)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" to: ").append(toIndentedString(to)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("time"); - openapiFields.add("type"); - openapiFields.add("to"); - openapiFields.add("description"); - openapiFields.add("message"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("time"); - openapiRequiredFields.add("type"); - openapiRequiredFields.add("to"); - openapiRequiredFields.add("description"); - openapiRequiredFields.add("message"); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to MessageSendingCallback - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!MessageSendingCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in MessageSendingCallback is not found in the empty JSON string", MessageSendingCallback.openapiRequiredFields.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : MessageSendingCallback.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (!jsonObj.get("type").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); - } - if (!jsonObj.get("to").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); - } - if (!jsonObj.get("description").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); - } - // validate the required field `message` - MessageSendingCallbackMessage.validateJsonElement(jsonObj.get("message")); - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!MessageSendingCallback.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'MessageSendingCallback' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(MessageSendingCallback.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, MessageSendingCallback value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - obj.remove("additionalProperties"); - // serialize additional properties - if (value.getAdditionalProperties() != null) { - for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { - if (entry.getValue() instanceof String) - obj.addProperty(entry.getKey(), (String) entry.getValue()); - else if (entry.getValue() instanceof Number) - obj.addProperty(entry.getKey(), (Number) entry.getValue()); - else if (entry.getValue() instanceof Boolean) - obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); - else if (entry.getValue() instanceof Character) - obj.addProperty(entry.getKey(), (Character) entry.getValue()); - else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } - } - } - } - elementAdapter.write(out, obj); - } - - @Override - public MessageSendingCallback read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - MessageSendingCallback instance = thisAdapter.fromJsonTree(jsonObj); - for (Map.Entry entry : jsonObj.entrySet()) { - if (!openapiFields.contains(entry.getKey())) { - if (entry.getValue().isJsonPrimitive()) { // primitive type - if (entry.getValue().getAsJsonPrimitive().isString()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); - else if (entry.getValue().getAsJsonPrimitive().isNumber()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); - else if (entry.getValue().getAsJsonPrimitive().isBoolean()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); - else - throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); - } else if (entry.getValue().isJsonArray()) { - instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); - } else { // JSON object - instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); - } - } - } - return instance; - } - - }.nullSafe(); - } - } - - /** - * Create an instance of MessageSendingCallback given an JSON string - * - * @param jsonString JSON string - * @return An instance of MessageSendingCallback - * @throws IOException if the JSON string is invalid with respect to MessageSendingCallback - */ - public static MessageSendingCallback fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, MessageSendingCallback.class); - } - - /** - * Convert an instance of MessageSendingCallback to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/bandwidth/sdk/model/MessageSendingCallbackMessage.java b/src/main/java/com/bandwidth/sdk/model/MessageSendingCallbackMessage.java deleted file mode 100644 index 1db3d24a..00000000 --- a/src/main/java/com/bandwidth/sdk/model/MessageSendingCallbackMessage.java +++ /dev/null @@ -1,658 +0,0 @@ -/* - * Bandwidth - * Bandwidth's Communication APIs - * - * The version of the OpenAPI document: 1.0.0 - * Contact: letstalk@bandwidth.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.bandwidth.sdk.model; - -import java.util.Objects; -import com.bandwidth.sdk.model.MessageDirectionEnum; -import com.bandwidth.sdk.model.PriorityEnum; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.net.URI; -import java.time.OffsetDateTime; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.bandwidth.sdk.JSON; - -/** - * Message Sending Callback Message Schema - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") -public class MessageSendingCallbackMessage { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - @javax.annotation.Nonnull - private String id; - - public static final String SERIALIZED_NAME_OWNER = "owner"; - @SerializedName(SERIALIZED_NAME_OWNER) - @javax.annotation.Nonnull - private String owner; - - public static final String SERIALIZED_NAME_APPLICATION_ID = "applicationId"; - @SerializedName(SERIALIZED_NAME_APPLICATION_ID) - @javax.annotation.Nonnull - private String applicationId; - - public static final String SERIALIZED_NAME_TIME = "time"; - @SerializedName(SERIALIZED_NAME_TIME) - @javax.annotation.Nonnull - private OffsetDateTime time; - - public static final String SERIALIZED_NAME_SEGMENT_COUNT = "segmentCount"; - @SerializedName(SERIALIZED_NAME_SEGMENT_COUNT) - @javax.annotation.Nonnull - private Integer segmentCount; - - public static final String SERIALIZED_NAME_DIRECTION = "direction"; - @SerializedName(SERIALIZED_NAME_DIRECTION) - @javax.annotation.Nonnull - private MessageDirectionEnum direction; - - public static final String SERIALIZED_NAME_TO = "to"; - @SerializedName(SERIALIZED_NAME_TO) - @javax.annotation.Nonnull - private Set to = new LinkedHashSet<>(); - - public static final String SERIALIZED_NAME_FROM = "from"; - @SerializedName(SERIALIZED_NAME_FROM) - @javax.annotation.Nonnull - private String from; - - public static final String SERIALIZED_NAME_TEXT = "text"; - @SerializedName(SERIALIZED_NAME_TEXT) - @javax.annotation.Nonnull - private String text; - - public static final String SERIALIZED_NAME_TAG = "tag"; - @SerializedName(SERIALIZED_NAME_TAG) - @javax.annotation.Nullable - private String tag; - - public static final String SERIALIZED_NAME_MEDIA = "media"; - @SerializedName(SERIALIZED_NAME_MEDIA) - @javax.annotation.Nonnull - private List media = new ArrayList<>(); - - public static final String SERIALIZED_NAME_PRIORITY = "priority"; - @SerializedName(SERIALIZED_NAME_PRIORITY) - @javax.annotation.Nullable - private PriorityEnum priority; - - public MessageSendingCallbackMessage() { - } - - public MessageSendingCallbackMessage id(@javax.annotation.Nonnull String id) { - this.id = id; - return this; - } - - /** - * Get id - * @return id - */ - @javax.annotation.Nonnull - public String getId() { - return id; - } - - public void setId(@javax.annotation.Nonnull String id) { - this.id = id; - } - - - public MessageSendingCallbackMessage owner(@javax.annotation.Nonnull String owner) { - this.owner = owner; - return this; - } - - /** - * Get owner - * @return owner - */ - @javax.annotation.Nonnull - public String getOwner() { - return owner; - } - - public void setOwner(@javax.annotation.Nonnull String owner) { - this.owner = owner; - } - - - public MessageSendingCallbackMessage applicationId(@javax.annotation.Nonnull String applicationId) { - this.applicationId = applicationId; - return this; - } - - /** - * Get applicationId - * @return applicationId - */ - @javax.annotation.Nonnull - public String getApplicationId() { - return applicationId; - } - - public void setApplicationId(@javax.annotation.Nonnull String applicationId) { - this.applicationId = applicationId; - } - - - public MessageSendingCallbackMessage time(@javax.annotation.Nonnull OffsetDateTime time) { - this.time = time; - return this; - } - - /** - * Get time - * @return time - */ - @javax.annotation.Nonnull - public OffsetDateTime getTime() { - return time; - } - - public void setTime(@javax.annotation.Nonnull OffsetDateTime time) { - this.time = time; - } - - - public MessageSendingCallbackMessage segmentCount(@javax.annotation.Nonnull Integer segmentCount) { - this.segmentCount = segmentCount; - return this; - } - - /** - * Get segmentCount - * @return segmentCount - */ - @javax.annotation.Nonnull - public Integer getSegmentCount() { - return segmentCount; - } - - public void setSegmentCount(@javax.annotation.Nonnull Integer segmentCount) { - this.segmentCount = segmentCount; - } - - - public MessageSendingCallbackMessage direction(@javax.annotation.Nonnull MessageDirectionEnum direction) { - this.direction = direction; - return this; - } - - /** - * Get direction - * @return direction - */ - @javax.annotation.Nonnull - public MessageDirectionEnum getDirection() { - return direction; - } - - public void setDirection(@javax.annotation.Nonnull MessageDirectionEnum direction) { - this.direction = direction; - } - - - public MessageSendingCallbackMessage to(@javax.annotation.Nonnull Set to) { - this.to = to; - return this; - } - - public MessageSendingCallbackMessage addToItem(String toItem) { - if (this.to == null) { - this.to = new LinkedHashSet<>(); - } - this.to.add(toItem); - return this; - } - - /** - * Get to - * @return to - */ - @javax.annotation.Nonnull - public Set getTo() { - return to; - } - - public void setTo(@javax.annotation.Nonnull Set to) { - this.to = to; - } - - - public MessageSendingCallbackMessage from(@javax.annotation.Nonnull String from) { - this.from = from; - return this; - } - - /** - * Get from - * @return from - */ - @javax.annotation.Nonnull - public String getFrom() { - return from; - } - - public void setFrom(@javax.annotation.Nonnull String from) { - this.from = from; - } - - - public MessageSendingCallbackMessage text(@javax.annotation.Nonnull String text) { - this.text = text; - return this; - } - - /** - * Get text - * @return text - */ - @javax.annotation.Nonnull - public String getText() { - return text; - } - - public void setText(@javax.annotation.Nonnull String text) { - this.text = text; - } - - - public MessageSendingCallbackMessage tag(@javax.annotation.Nullable String tag) { - this.tag = tag; - return this; - } - - /** - * Get tag - * @return tag - */ - @javax.annotation.Nullable - public String getTag() { - return tag; - } - - public void setTag(@javax.annotation.Nullable String tag) { - this.tag = tag; - } - - - public MessageSendingCallbackMessage media(@javax.annotation.Nonnull List media) { - this.media = media; - return this; - } - - public MessageSendingCallbackMessage addMediaItem(URI mediaItem) { - if (this.media == null) { - this.media = new ArrayList<>(); - } - this.media.add(mediaItem); - return this; - } - - /** - * Get media - * @return media - */ - @javax.annotation.Nonnull - public List getMedia() { - return media; - } - - public void setMedia(@javax.annotation.Nonnull List media) { - this.media = media; - } - - - public MessageSendingCallbackMessage priority(@javax.annotation.Nullable PriorityEnum priority) { - this.priority = priority; - return this; - } - - /** - * Get priority - * @return priority - */ - @javax.annotation.Nullable - public PriorityEnum getPriority() { - return priority; - } - - public void setPriority(@javax.annotation.Nullable PriorityEnum priority) { - this.priority = priority; - } - - /** - * A container for additional, undeclared properties. - * This is a holder for any undeclared properties as specified with - * the 'additionalProperties' keyword in the OAS document. - */ - private Map additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. - * If the property does not already exist, create it otherwise replace it. - * - * @param key name of the property - * @param value value of the property - * @return the MessageSendingCallbackMessage instance itself - */ - public MessageSendingCallbackMessage putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - * - * @return a map of objects - */ - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * Return the additional (undeclared) property with the specified name. - * - * @param key name of the property - * @return an object - */ - public Object getAdditionalProperty(String key) { - if (this.additionalProperties == null) { - return null; - } - return this.additionalProperties.get(key); - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - MessageSendingCallbackMessage messageSendingCallbackMessage = (MessageSendingCallbackMessage) o; - return Objects.equals(this.id, messageSendingCallbackMessage.id) && - Objects.equals(this.owner, messageSendingCallbackMessage.owner) && - Objects.equals(this.applicationId, messageSendingCallbackMessage.applicationId) && - Objects.equals(this.time, messageSendingCallbackMessage.time) && - Objects.equals(this.segmentCount, messageSendingCallbackMessage.segmentCount) && - Objects.equals(this.direction, messageSendingCallbackMessage.direction) && - Objects.equals(this.to, messageSendingCallbackMessage.to) && - Objects.equals(this.from, messageSendingCallbackMessage.from) && - Objects.equals(this.text, messageSendingCallbackMessage.text) && - Objects.equals(this.tag, messageSendingCallbackMessage.tag) && - Objects.equals(this.media, messageSendingCallbackMessage.media) && - Objects.equals(this.priority, messageSendingCallbackMessage.priority)&& - Objects.equals(this.additionalProperties, messageSendingCallbackMessage.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(id, owner, applicationId, time, segmentCount, direction, to, from, text, tag, media, priority, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class MessageSendingCallbackMessage {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" owner: ").append(toIndentedString(owner)).append("\n"); - sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); - sb.append(" time: ").append(toIndentedString(time)).append("\n"); - sb.append(" segmentCount: ").append(toIndentedString(segmentCount)).append("\n"); - sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); - sb.append(" to: ").append(toIndentedString(to)).append("\n"); - sb.append(" from: ").append(toIndentedString(from)).append("\n"); - sb.append(" text: ").append(toIndentedString(text)).append("\n"); - sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); - sb.append(" media: ").append(toIndentedString(media)).append("\n"); - sb.append(" priority: ").append(toIndentedString(priority)).append("\n"); - sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("id"); - openapiFields.add("owner"); - openapiFields.add("applicationId"); - openapiFields.add("time"); - openapiFields.add("segmentCount"); - openapiFields.add("direction"); - openapiFields.add("to"); - openapiFields.add("from"); - openapiFields.add("text"); - openapiFields.add("tag"); - openapiFields.add("media"); - openapiFields.add("priority"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("owner"); - openapiRequiredFields.add("applicationId"); - openapiRequiredFields.add("time"); - openapiRequiredFields.add("segmentCount"); - openapiRequiredFields.add("direction"); - openapiRequiredFields.add("to"); - openapiRequiredFields.add("from"); - openapiRequiredFields.add("text"); - openapiRequiredFields.add("media"); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to MessageSendingCallbackMessage - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!MessageSendingCallbackMessage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in MessageSendingCallbackMessage is not found in the empty JSON string", MessageSendingCallbackMessage.openapiRequiredFields.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : MessageSendingCallbackMessage.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (!jsonObj.get("id").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); - } - if (!jsonObj.get("owner").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `owner` to be a primitive type in the JSON string but got `%s`", jsonObj.get("owner").toString())); - } - if (!jsonObj.get("applicationId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `applicationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("applicationId").toString())); - } - // validate the required field `direction` - MessageDirectionEnum.validateJsonElement(jsonObj.get("direction")); - // ensure the required json array is present - if (jsonObj.get("to") == null) { - throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); - } else if (!jsonObj.get("to").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `to` to be an array in the JSON string but got `%s`", jsonObj.get("to").toString())); - } - if (!jsonObj.get("from").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); - } - if (!jsonObj.get("text").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); - } - if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); - } - // ensure the required json array is present - if (jsonObj.get("media") == null) { - throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); - } 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 optional field `priority` - if (jsonObj.get("priority") != null && !jsonObj.get("priority").isJsonNull()) { - PriorityEnum.validateJsonElement(jsonObj.get("priority")); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!MessageSendingCallbackMessage.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'MessageSendingCallbackMessage' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(MessageSendingCallbackMessage.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, MessageSendingCallbackMessage value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - obj.remove("additionalProperties"); - // serialize additional properties - if (value.getAdditionalProperties() != null) { - for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { - if (entry.getValue() instanceof String) - obj.addProperty(entry.getKey(), (String) entry.getValue()); - else if (entry.getValue() instanceof Number) - obj.addProperty(entry.getKey(), (Number) entry.getValue()); - else if (entry.getValue() instanceof Boolean) - obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); - else if (entry.getValue() instanceof Character) - obj.addProperty(entry.getKey(), (Character) entry.getValue()); - else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } - } - } - } - elementAdapter.write(out, obj); - } - - @Override - public MessageSendingCallbackMessage read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - MessageSendingCallbackMessage instance = thisAdapter.fromJsonTree(jsonObj); - for (Map.Entry entry : jsonObj.entrySet()) { - if (!openapiFields.contains(entry.getKey())) { - if (entry.getValue().isJsonPrimitive()) { // primitive type - if (entry.getValue().getAsJsonPrimitive().isString()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); - else if (entry.getValue().getAsJsonPrimitive().isNumber()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); - else if (entry.getValue().getAsJsonPrimitive().isBoolean()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); - else - throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); - } else if (entry.getValue().isJsonArray()) { - instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); - } else { // JSON object - instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); - } - } - } - return instance; - } - - }.nullSafe(); - } - } - - /** - * Create an instance of MessageSendingCallbackMessage given an JSON string - * - * @param jsonString JSON string - * @return An instance of MessageSendingCallbackMessage - * @throws IOException if the JSON string is invalid with respect to MessageSendingCallbackMessage - */ - public static MessageSendingCallbackMessage fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, MessageSendingCallbackMessage.class); - } - - /** - * Convert an instance of MessageSendingCallbackMessage to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/bandwidth/sdk/model/TranscriptionList.java b/src/main/java/com/bandwidth/sdk/model/TranscriptionList.java deleted file mode 100644 index fb569dcc..00000000 --- a/src/main/java/com/bandwidth/sdk/model/TranscriptionList.java +++ /dev/null @@ -1,309 +0,0 @@ -/* - * Bandwidth - * Bandwidth's Communication APIs - * - * The version of the OpenAPI document: 1.0.0 - * Contact: letstalk@bandwidth.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.bandwidth.sdk.model; - -import java.util.Objects; -import com.bandwidth.sdk.model.Transcription; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.bandwidth.sdk.JSON; - -/** - * TranscriptionList - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class TranscriptionList { - public static final String SERIALIZED_NAME_TRANSCRIPTS = "transcripts"; - @SerializedName(SERIALIZED_NAME_TRANSCRIPTS) - private List transcripts; - - public TranscriptionList() { - } - - public TranscriptionList transcripts(List transcripts) { - this.transcripts = transcripts; - return this; - } - - public TranscriptionList addTranscriptsItem(Transcription transcriptsItem) { - if (this.transcripts == null) { - this.transcripts = new ArrayList<>(); - } - this.transcripts.add(transcriptsItem); - return this; - } - - /** - * Get transcripts - * @return transcripts - **/ - @javax.annotation.Nullable - public List getTranscripts() { - return transcripts; - } - - public void setTranscripts(List transcripts) { - this.transcripts = transcripts; - } - - /** - * A container for additional, undeclared properties. - * This is a holder for any undeclared properties as specified with - * the 'additionalProperties' keyword in the OAS document. - */ - private Map additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. - * If the property does not already exist, create it otherwise replace it. - * - * @param key name of the property - * @param value value of the property - * @return the TranscriptionList instance itself - */ - public TranscriptionList putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - * - * @return a map of objects - */ - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * Return the additional (undeclared) property with the specified name. - * - * @param key name of the property - * @return an object - */ - public Object getAdditionalProperty(String key) { - if (this.additionalProperties == null) { - return null; - } - return this.additionalProperties.get(key); - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - TranscriptionList transcriptionList = (TranscriptionList) o; - return Objects.equals(this.transcripts, transcriptionList.transcripts)&& - Objects.equals(this.additionalProperties, transcriptionList.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(transcripts, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class TranscriptionList {\n"); - sb.append(" transcripts: ").append(toIndentedString(transcripts)).append("\n"); - sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("transcripts"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to TranscriptionList - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!TranscriptionList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in TranscriptionList is not found in the empty JSON string", TranscriptionList.openapiRequiredFields.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (jsonObj.get("transcripts") != null && !jsonObj.get("transcripts").isJsonNull()) { - JsonArray jsonArraytranscripts = jsonObj.getAsJsonArray("transcripts"); - if (jsonArraytranscripts != null) { - // ensure the json data is an array - if (!jsonObj.get("transcripts").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `transcripts` to be an array in the JSON string but got `%s`", jsonObj.get("transcripts").toString())); - } - - // validate the optional field `transcripts` (array) - for (int i = 0; i < jsonArraytranscripts.size(); i++) { - Transcription.validateJsonElement(jsonArraytranscripts.get(i)); - }; - } - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!TranscriptionList.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'TranscriptionList' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(TranscriptionList.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, TranscriptionList value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - obj.remove("additionalProperties"); - // serialize additional properties - if (value.getAdditionalProperties() != null) { - for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { - if (entry.getValue() instanceof String) - obj.addProperty(entry.getKey(), (String) entry.getValue()); - else if (entry.getValue() instanceof Number) - obj.addProperty(entry.getKey(), (Number) entry.getValue()); - else if (entry.getValue() instanceof Boolean) - obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); - else if (entry.getValue() instanceof Character) - obj.addProperty(entry.getKey(), (Character) entry.getValue()); - else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } - } - } - } - elementAdapter.write(out, obj); - } - - @Override - public TranscriptionList read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - TranscriptionList instance = thisAdapter.fromJsonTree(jsonObj); - for (Map.Entry entry : jsonObj.entrySet()) { - if (!openapiFields.contains(entry.getKey())) { - if (entry.getValue().isJsonPrimitive()) { // primitive type - if (entry.getValue().getAsJsonPrimitive().isString()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); - else if (entry.getValue().getAsJsonPrimitive().isNumber()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); - else if (entry.getValue().getAsJsonPrimitive().isBoolean()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); - else - throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); - } else if (entry.getValue().isJsonArray()) { - instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); - } else { // JSON object - instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); - } - } - } - return instance; - } - - }.nullSafe(); - } - } - - /** - * Create an instance of TranscriptionList given an JSON string - * - * @param jsonString JSON string - * @return An instance of TranscriptionList - * @throws IOException if the JSON string is invalid with respect to TranscriptionList - */ - public static TranscriptionList fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, TranscriptionList.class); - } - - /** - * Convert an instance of TranscriptionList to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/bandwidth/sdk/model/TranscriptionMetadata.java b/src/main/java/com/bandwidth/sdk/model/TranscriptionMetadata.java deleted file mode 100644 index 1a3ccdaa..00000000 --- a/src/main/java/com/bandwidth/sdk/model/TranscriptionMetadata.java +++ /dev/null @@ -1,375 +0,0 @@ -/* - * Bandwidth - * Bandwidth's Communication APIs - * - * The version of the OpenAPI document: 1.0.0 - * Contact: letstalk@bandwidth.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.bandwidth.sdk.model; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.net.URI; -import java.util.Arrays; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.bandwidth.sdk.JSON; - -/** - * If the recording was transcribed, metadata about the transcription - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class TranscriptionMetadata { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_STATUS = "status"; - @SerializedName(SERIALIZED_NAME_STATUS) - private String status; - - public static final String SERIALIZED_NAME_COMPLETED_TIME = "completedTime"; - @SerializedName(SERIALIZED_NAME_COMPLETED_TIME) - private String completedTime; - - public static final String SERIALIZED_NAME_URL = "url"; - @SerializedName(SERIALIZED_NAME_URL) - private URI url; - - public TranscriptionMetadata() { - } - - public TranscriptionMetadata id(String id) { - this.id = id; - return this; - } - - /** - * The unique transcription ID - * @return id - **/ - @javax.annotation.Nullable - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - - public TranscriptionMetadata status(String status) { - this.status = status; - return this; - } - - /** - * The current status of the process. For recording, current possible values are 'processing', 'partial', 'complete', 'deleted', and 'error'. For transcriptions, current possible values are 'none', 'processing', 'available', 'error', 'timeout', 'file-size-too-big', and 'file-size-too-small'. Additional states may be added in the future, so your application must be tolerant of unknown values. - * @return status - **/ - @javax.annotation.Nullable - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - - public TranscriptionMetadata completedTime(String completedTime) { - this.completedTime = completedTime; - return this; - } - - /** - * The time that the transcription was completed - * @return completedTime - **/ - @javax.annotation.Nullable - public String getCompletedTime() { - return completedTime; - } - - public void setCompletedTime(String completedTime) { - this.completedTime = completedTime; - } - - - public TranscriptionMetadata url(URI url) { - this.url = url; - return this; - } - - /** - * The URL of the [transcription](#operation/getCallTranscription) - * @return url - **/ - @javax.annotation.Nullable - public URI getUrl() { - return url; - } - - public void setUrl(URI url) { - this.url = url; - } - - /** - * A container for additional, undeclared properties. - * This is a holder for any undeclared properties as specified with - * the 'additionalProperties' keyword in the OAS document. - */ - private Map additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. - * If the property does not already exist, create it otherwise replace it. - * - * @param key name of the property - * @param value value of the property - * @return the TranscriptionMetadata instance itself - */ - public TranscriptionMetadata putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - * - * @return a map of objects - */ - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * Return the additional (undeclared) property with the specified name. - * - * @param key name of the property - * @return an object - */ - public Object getAdditionalProperty(String key) { - if (this.additionalProperties == null) { - return null; - } - return this.additionalProperties.get(key); - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - TranscriptionMetadata transcriptionMetadata = (TranscriptionMetadata) o; - return Objects.equals(this.id, transcriptionMetadata.id) && - Objects.equals(this.status, transcriptionMetadata.status) && - Objects.equals(this.completedTime, transcriptionMetadata.completedTime) && - Objects.equals(this.url, transcriptionMetadata.url)&& - Objects.equals(this.additionalProperties, transcriptionMetadata.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(id, status, completedTime, url, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class TranscriptionMetadata {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" completedTime: ").append(toIndentedString(completedTime)).append("\n"); - sb.append(" url: ").append(toIndentedString(url)).append("\n"); - sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("id"); - openapiFields.add("status"); - openapiFields.add("completedTime"); - openapiFields.add("url"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to TranscriptionMetadata - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!TranscriptionMetadata.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in TranscriptionMetadata is not found in the empty JSON string", TranscriptionMetadata.openapiRequiredFields.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); - } - if ((jsonObj.get("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())); - } - if ((jsonObj.get("completedTime") != null && !jsonObj.get("completedTime").isJsonNull()) && !jsonObj.get("completedTime").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `completedTime` to be a primitive type in the JSON string but got `%s`", jsonObj.get("completedTime").toString())); - } - if ((jsonObj.get("url") != null && !jsonObj.get("url").isJsonNull()) && !jsonObj.get("url").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("url").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!TranscriptionMetadata.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'TranscriptionMetadata' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(TranscriptionMetadata.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, TranscriptionMetadata value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - obj.remove("additionalProperties"); - // serialize additional properties - if (value.getAdditionalProperties() != null) { - for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { - if (entry.getValue() instanceof String) - obj.addProperty(entry.getKey(), (String) entry.getValue()); - else if (entry.getValue() instanceof Number) - obj.addProperty(entry.getKey(), (Number) entry.getValue()); - else if (entry.getValue() instanceof Boolean) - obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); - else if (entry.getValue() instanceof Character) - obj.addProperty(entry.getKey(), (Character) entry.getValue()); - else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } - } - } - } - elementAdapter.write(out, obj); - } - - @Override - public TranscriptionMetadata read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - TranscriptionMetadata instance = thisAdapter.fromJsonTree(jsonObj); - for (Map.Entry entry : jsonObj.entrySet()) { - if (!openapiFields.contains(entry.getKey())) { - if (entry.getValue().isJsonPrimitive()) { // primitive type - if (entry.getValue().getAsJsonPrimitive().isString()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); - else if (entry.getValue().getAsJsonPrimitive().isNumber()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); - else if (entry.getValue().getAsJsonPrimitive().isBoolean()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); - else - throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); - } else if (entry.getValue().isJsonArray()) { - instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); - } else { // JSON object - instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); - } - } - } - return instance; - } - - }.nullSafe(); - } - } - - /** - * Create an instance of TranscriptionMetadata given an JSON string - * - * @param jsonString JSON string - * @return An instance of TranscriptionMetadata - * @throws IOException if the JSON string is invalid with respect to TranscriptionMetadata - */ - public static TranscriptionMetadata fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, TranscriptionMetadata.class); - } - - /** - * Convert an instance of TranscriptionMetadata to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/test/java/com/bandwidth/sdk/unit/models/CallbackTypeEnumTest.java b/src/test/java/com/bandwidth/sdk/unit/models/CallbackTypeEnumTest.java new file mode 100644 index 00000000..52b986c5 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/CallbackTypeEnumTest.java @@ -0,0 +1,37 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import com.bandwidth.sdk.model.CallbackTypeEnum; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.MatcherAssert.assertThat; + +/** + * Model tests for CallbackTypeEnum + */ +public class CallbackTypeEnumTest { + /** + * Model tests for CallbackTypeEnum + */ + @Test + public void testCallbackTypeEnum() { + assertThat(CallbackTypeEnum.DELIVERED.toString(), equalTo("message-delivered")); + assertThat(CallbackTypeEnum.FAILED.toString(), equalTo("message-failed")); + assertThat(CallbackTypeEnum.RECEIVED.toString(), equalTo("message-received")); + assertThat(CallbackTypeEnum.SENDING.toString(), equalTo("message-sending")); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/InboundMessageCallbackMessageTest.java b/src/test/java/com/bandwidth/sdk/unit/models/InboundMessageCallbackMessageTest.java deleted file mode 100644 index 29cc62e4..00000000 --- a/src/test/java/com/bandwidth/sdk/unit/models/InboundMessageCallbackMessageTest.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Bandwidth - * Bandwidth's Communication APIs - * - * The version of the OpenAPI document: 1.0.0 - * Contact: letstalk@bandwidth.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.bandwidth.sdk.unit.models; - -import org.junit.jupiter.api.Test; - -import java.net.URI; -import java.util.List; -import java.util.Arrays; -import java.util.LinkedHashSet; -import java.util.ArrayList; -import java.time.OffsetDateTime; -import org.mockito.internal.util.collections.Sets; -import com.bandwidth.sdk.model.InboundMessageCallbackMessage; -import com.bandwidth.sdk.model.MessageDirectionEnum; -import com.bandwidth.sdk.model.PriorityEnum; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.CoreMatchers.instanceOf; - -/** - * Model tests for InboundMessageCallbackMessage - */ -public class InboundMessageCallbackMessageTest { - private final InboundMessageCallbackMessage model = new InboundMessageCallbackMessage() - .id("id") - .owner("owner") - .applicationId("applicationId") - .time(OffsetDateTime.now()) - .segmentCount(0) - .direction(MessageDirectionEnum.IN) - .to(Sets.newSet("to")) - .from("from") - .text("text") - .tag("tag") - .media(new ArrayList(Arrays.asList(URI.create("http://example.com")))) - .priority(PriorityEnum.HIGH); - - /** - * Model tests for InboundMessageCallbackMessage - */ - @Test - public void testInboundMessageCallbackMessage() { - assertThat(model, instanceOf(InboundMessageCallbackMessage.class)); - } - - /** - * Test the property 'id' - */ - @Test - public void idTest() { - assertThat(model.getId(), instanceOf(String.class)); - } - - /** - * Test the property 'owner' - */ - @Test - public void ownerTest() { - assertThat(model.getOwner(), instanceOf(String.class)); - } - - /** - * Test the property 'applicationId' - */ - @Test - public void applicationIdTest() { - assertThat(model.getApplicationId(), instanceOf(String.class)); - } - - /** - * Test the property 'time' - */ - @Test - public void timeTest() { - assertThat(model.getTime(), instanceOf(OffsetDateTime.class)); - } - - /** - * Test the property 'segmentCount' - */ - @Test - public void segmentCountTest() { - assertThat(model.getSegmentCount(), instanceOf(Integer.class)); - } - - /** - * Test the property 'direction' - */ - @Test - public void directionTest() { - assertThat(model.getDirection(), instanceOf(MessageDirectionEnum.class)); - } - - /** - * Test the property 'to' - */ - @Test - public void toTest() { - assertThat(model.getTo(), instanceOf(LinkedHashSet.class)); - } - - /** - * Test the property 'from' - */ - @Test - public void fromTest() { - assertThat(model.getFrom(), instanceOf(String.class)); - } - - /** - * Test the property 'text' - */ - @Test - public void textTest() { - assertThat(model.getText(), instanceOf(String.class)); - } - - /** - * Test the property 'tag' - */ - @Test - public void tagTest() { - assertThat(model.getTag(), instanceOf(String.class)); - } - - /** - * Test the property 'media' - */ - @Test - public void mediaTest() { - assertThat(model.getMedia(), instanceOf(List.class)); - } - - /** - * Test the property 'priority' - */ - @Test - public void priorityTest() { - assertThat(model.getPriority(), instanceOf(PriorityEnum.class)); - } - -} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/InboundMessageCallbackTest.java b/src/test/java/com/bandwidth/sdk/unit/models/InboundMessageCallbackTest.java deleted file mode 100644 index e6e591d6..00000000 --- a/src/test/java/com/bandwidth/sdk/unit/models/InboundMessageCallbackTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Bandwidth - * Bandwidth's Communication APIs - * - * The version of the OpenAPI document: 1.0.0 - * Contact: letstalk@bandwidth.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.bandwidth.sdk.unit.models; - -import org.junit.jupiter.api.Test; - -import java.time.OffsetDateTime; -import com.bandwidth.sdk.model.InboundMessageCallback; -import com.bandwidth.sdk.model.InboundMessageCallbackMessage; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.CoreMatchers.instanceOf; - -/** - * Model tests for InboundMessageCallback - */ -public class InboundMessageCallbackTest { - private final InboundMessageCallback model = new InboundMessageCallback() - .time(OffsetDateTime.now()) - .type("type") - .to("to") - .description("description") - .message(new InboundMessageCallbackMessage()); - - /** - * Model tests for InboundMessageCallback - */ - @Test - public void testInboundMessageCallback() { - assertThat(model, instanceOf(InboundMessageCallback.class)); - } - - /** - * Test the property 'time' - */ - @Test - public void timeTest() { - assertThat(model.getTime(), instanceOf(OffsetDateTime.class)); - } - - /** - * Test the property 'type' - */ - @Test - public void typeTest() { - assertThat(model.getType(), instanceOf(String.class)); - } - - /** - * Test the property 'to' - */ - @Test - public void toTest() { - assertThat(model.getTo(), instanceOf(String.class)); - } - - /** - * Test the property 'description' - */ - @Test - public void descriptionTest() { - assertThat(model.getDescription(), instanceOf(String.class)); - } - - /** - * Test the property 'message' - */ - @Test - public void messageTest() { - assertThat(model.getMessage(), instanceOf(InboundMessageCallbackMessage.class)); - } - -} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/MessageFailedCallbackMessageTest.java b/src/test/java/com/bandwidth/sdk/unit/models/MessageCallbackMessageTest.java similarity index 80% rename from src/test/java/com/bandwidth/sdk/unit/models/MessageFailedCallbackMessageTest.java rename to src/test/java/com/bandwidth/sdk/unit/models/MessageCallbackMessageTest.java index 01a761b1..6f05a9d2 100644 --- a/src/test/java/com/bandwidth/sdk/unit/models/MessageFailedCallbackMessageTest.java +++ b/src/test/java/com/bandwidth/sdk/unit/models/MessageCallbackMessageTest.java @@ -13,45 +13,44 @@ package com.bandwidth.sdk.unit.models; import org.junit.jupiter.api.Test; -import org.mockito.internal.util.collections.Sets; import java.net.URI; -import java.util.List; -import java.util.Arrays; -import java.util.ArrayList; -import java.util.LinkedHashSet; import java.time.OffsetDateTime; -import com.bandwidth.sdk.model.MessageFailedCallbackMessage; -import com.bandwidth.sdk.model.PriorityEnum; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; +import org.mockito.internal.util.collections.Sets; +import com.bandwidth.sdk.model.MessageCallbackMessage; import com.bandwidth.sdk.model.MessageDirectionEnum; +import com.bandwidth.sdk.model.PriorityEnum; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.CoreMatchers.instanceOf; /** - * Model tests for MessageFailedCallbackMessage + * Model tests for MessageCallbackMessage */ -public class MessageFailedCallbackMessageTest { - private final MessageFailedCallbackMessage model = new MessageFailedCallbackMessage() +public class MessageCallbackMessageTest { + private final MessageCallbackMessage model = new MessageCallbackMessage() .id("id") .owner("owner") .applicationId("applicationId") .time(OffsetDateTime.now()) - .segmentCount(56) + .segmentCount(1) .direction(MessageDirectionEnum.IN) - .to(Sets.newSet("to")) + .to(Sets.newSet("+1234567890")) .from("from") .text("text") .tag("tag") - .media(new ArrayList(Arrays.asList(URI.create("http://example.com")))) + .media(new ArrayList()) .priority(PriorityEnum.HIGH); /** - * Model tests for MessageFailedCallbackMessage + * Model tests for MessageCallbackMessage */ @Test - public void testMessageFailedCallbackMessage() { - assertThat(model, instanceOf(MessageFailedCallbackMessage.class)); + public void testMessageCallbackMessage() { + assertThat(model, instanceOf(MessageCallbackMessage.class)); } /** @@ -107,7 +106,7 @@ public void directionTest() { */ @Test public void toTest() { - assertThat(model.getTo(), instanceOf(LinkedHashSet.class)); + assertThat(model.getTo(), instanceOf(Set.class)); } /** diff --git a/src/test/java/com/bandwidth/sdk/unit/models/MessageFailedCallbackTest.java b/src/test/java/com/bandwidth/sdk/unit/models/MessageCallbackTest.java similarity index 68% rename from src/test/java/com/bandwidth/sdk/unit/models/MessageFailedCallbackTest.java rename to src/test/java/com/bandwidth/sdk/unit/models/MessageCallbackTest.java index a08f6e59..6caffe24 100644 --- a/src/test/java/com/bandwidth/sdk/unit/models/MessageFailedCallbackTest.java +++ b/src/test/java/com/bandwidth/sdk/unit/models/MessageCallbackTest.java @@ -15,30 +15,31 @@ import org.junit.jupiter.api.Test; import java.time.OffsetDateTime; -import com.bandwidth.sdk.model.MessageFailedCallback; -import com.bandwidth.sdk.model.MessageFailedCallbackMessage; +import com.bandwidth.sdk.model.MessageCallback; +import com.bandwidth.sdk.model.CallbackTypeEnum; +import com.bandwidth.sdk.model.MessageCallbackMessage; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.CoreMatchers.instanceOf; /** - * Model tests for MessageFailedCallback + * Model tests for MessageCallback */ -public class MessageFailedCallbackTest { - private final MessageFailedCallback model = new MessageFailedCallback() +public class MessageCallbackTest { + private final MessageCallback model = new MessageCallback() .time(OffsetDateTime.now()) - .type("type") - .to("to") + .type(CallbackTypeEnum.DELIVERED) + .to("+1234567890") .description("description") - .message(new MessageFailedCallbackMessage()) + .message(new MessageCallbackMessage()) .errorCode(123); /** - * Model tests for MessageFailedCallback + * Model tests for MessageCallback */ @Test - public void testMessageFailedCallback() { - assertThat(model, instanceOf(MessageFailedCallback.class)); + public void testMessageCallback() { + assertThat(model, instanceOf(MessageCallback.class)); } /** @@ -54,7 +55,7 @@ public void timeTest() { */ @Test public void typeTest() { - assertThat(model.getType(), instanceOf(String.class)); + assertThat(model.getType(), instanceOf(CallbackTypeEnum.class)); } /** @@ -78,7 +79,7 @@ public void descriptionTest() { */ @Test public void messageTest() { - assertThat(model.getMessage(), instanceOf(MessageFailedCallbackMessage.class)); + assertThat(model.getMessage(), instanceOf(MessageCallbackMessage.class)); } /** diff --git a/src/test/java/com/bandwidth/sdk/unit/models/MessageDeliveredCallbackMessageTest.java b/src/test/java/com/bandwidth/sdk/unit/models/MessageDeliveredCallbackMessageTest.java deleted file mode 100644 index 93f3bde5..00000000 --- a/src/test/java/com/bandwidth/sdk/unit/models/MessageDeliveredCallbackMessageTest.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Bandwidth - * Bandwidth's Communication APIs - * - * The version of the OpenAPI document: 1.0.0 - * Contact: letstalk@bandwidth.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.bandwidth.sdk.unit.models; - -import org.junit.jupiter.api.Test; -import org.mockito.internal.util.collections.Sets; - -import java.net.URI; -import java.util.List; -import java.util.Arrays; -import java.util.ArrayList; -import java.util.LinkedHashSet; -import java.time.OffsetDateTime; -import com.bandwidth.sdk.model.MessageDeliveredCallbackMessage; -import com.bandwidth.sdk.model.PriorityEnum; -import com.bandwidth.sdk.model.MessageDirectionEnum; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.CoreMatchers.instanceOf; - -/** - * Model tests for MessageDeliveredCallbackMessage - */ -public class MessageDeliveredCallbackMessageTest { - private final MessageDeliveredCallbackMessage model = new MessageDeliveredCallbackMessage() - .id("id") - .owner("owner") - .applicationId("applicationId") - .time(OffsetDateTime.now()) - .segmentCount(0) - .direction(MessageDirectionEnum.IN) - .to(Sets.newSet("to")) - .from("from") - .text("text") - .tag("tag") - .media(new ArrayList(Arrays.asList(URI.create("http://example.com")))) - .priority(PriorityEnum.HIGH); - - /** - * Model tests for MessageDeliveredCallbackMessage - */ - @Test - public void testMessageDeliveredCallbackMessage() { - assertThat(model, instanceOf(MessageDeliveredCallbackMessage.class)); - } - - /** - * Test the property 'id' - */ - @Test - public void idTest() { - assertThat(model.getId(), instanceOf(String.class)); - } - - /** - * Test the property 'owner' - */ - @Test - public void ownerTest() { - assertThat(model.getOwner(), instanceOf(String.class)); - } - - /** - * Test the property 'applicationId' - */ - @Test - public void applicationIdTest() { - assertThat(model.getApplicationId(), instanceOf(String.class)); - } - - /** - * Test the property 'time' - */ - @Test - public void timeTest() { - assertThat(model.getTime(), instanceOf(OffsetDateTime.class)); - } - - /** - * Test the property 'segmentCount' - */ - @Test - public void segmentCountTest() { - assertThat(model.getSegmentCount(), instanceOf(Integer.class)); - } - - /** - * Test the property 'direction' - */ - @Test - public void directionTest() { - assertThat(model.getDirection(), instanceOf(MessageDirectionEnum.class)); - } - - /** - * Test the property 'to' - */ - @Test - public void toTest() { - assertThat(model.getTo(), instanceOf(LinkedHashSet.class)); - } - - /** - * Test the property 'from' - */ - @Test - public void fromTest() { - assertThat(model.getFrom(), instanceOf(String.class)); - } - - /** - * Test the property 'text' - */ - @Test - public void textTest() { - assertThat(model.getText(), instanceOf(String.class)); - } - - /** - * Test the property 'tag' - */ - @Test - public void tagTest() { - assertThat(model.getTag(), instanceOf(String.class)); - } - - /** - * Test the property 'media' - */ - @Test - public void mediaTest() { - assertThat(model.getMedia(), instanceOf(List.class)); - } - - /** - * Test the property 'priority' - */ - @Test - public void priorityTest() { - assertThat(model.getPriority(), instanceOf(PriorityEnum.class)); - } - -} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/MessageDeliveredCallbackTest.java b/src/test/java/com/bandwidth/sdk/unit/models/MessageDeliveredCallbackTest.java deleted file mode 100644 index 686e3254..00000000 --- a/src/test/java/com/bandwidth/sdk/unit/models/MessageDeliveredCallbackTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Bandwidth - * Bandwidth's Communication APIs - * - * The version of the OpenAPI document: 1.0.0 - * Contact: letstalk@bandwidth.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.bandwidth.sdk.unit.models; - -import org.junit.jupiter.api.Test; - -import java.time.OffsetDateTime; -import com.bandwidth.sdk.model.MessageDeliveredCallback; -import com.bandwidth.sdk.model.MessageDeliveredCallbackMessage; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.CoreMatchers.instanceOf; - -/** - * Model tests for MessageDeliveredCallback - */ -public class MessageDeliveredCallbackTest { - private final MessageDeliveredCallback model = new MessageDeliveredCallback() - .time(OffsetDateTime.now()) - .type("type") - .to("to") - .description("description") - .message(new MessageDeliveredCallbackMessage()); - - /** - * Model tests for MessageDeliveredCallback - */ - @Test - public void testMessageDeliveredCallback() { - assertThat(model, instanceOf(MessageDeliveredCallback.class)); - } - - /** - * Test the property 'time' - */ - @Test - public void timeTest() { - assertThat(model.getTime(), instanceOf(OffsetDateTime.class)); - } - - /** - * Test the property 'type' - */ - @Test - public void typeTest() { - assertThat(model.getType(), instanceOf(String.class)); - } - - /** - * Test the property 'to' - */ - @Test - public void toTest() { - assertThat(model.getTo(), instanceOf(String.class)); - } - - /** - * Test the property 'description' - */ - @Test - public void descriptionTest() { - assertThat(model.getDescription(), instanceOf(String.class)); - } - - /** - * Test the property 'message' - */ - @Test - public void messageTest() { - assertThat(model.getMessage(), instanceOf(MessageDeliveredCallbackMessage.class)); - } - -} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/MessageSendingCallbackMessageTest.java b/src/test/java/com/bandwidth/sdk/unit/models/MessageSendingCallbackMessageTest.java deleted file mode 100644 index b7c9421f..00000000 --- a/src/test/java/com/bandwidth/sdk/unit/models/MessageSendingCallbackMessageTest.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Bandwidth - * Bandwidth's Communication APIs - * - * The version of the OpenAPI document: 1.0.0 - * Contact: letstalk@bandwidth.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.bandwidth.sdk.unit.models; - -import org.junit.jupiter.api.Test; -import org.mockito.internal.util.collections.Sets; - -import java.net.URI; -import java.util.List; -import java.util.Arrays; -import java.util.ArrayList; -import java.util.LinkedHashSet; -import java.time.OffsetDateTime; -import com.bandwidth.sdk.model.MessageDirectionEnum; -import com.bandwidth.sdk.model.MessageSendingCallbackMessage; -import com.bandwidth.sdk.model.PriorityEnum; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.CoreMatchers.instanceOf; - -/** - * Model tests for MessageSendingCallbackMessage - */ -public class MessageSendingCallbackMessageTest { - private final MessageSendingCallbackMessage model = new MessageSendingCallbackMessage() - .id("id") - .owner("owner") - .applicationId("applicationId") - .time(OffsetDateTime.now()) - .segmentCount(56) - .direction(MessageDirectionEnum.IN) - .to(Sets.newSet("to")) - .from("from") - .text("text") - .tag("tag") - .media(new ArrayList(Arrays.asList(URI.create("http://example.com")))) - .priority(PriorityEnum.HIGH); - - /** - * Model tests for MessageSendingCallbackMessage - */ - @Test - public void testMessageSendingCallbackMessage() { - assertThat(model, instanceOf(MessageSendingCallbackMessage.class)); - } - - /** - * Test the property 'id' - */ - @Test - public void idTest() { - assertThat(model.getId(), instanceOf(String.class)); - } - - /** - * Test the property 'owner' - */ - @Test - public void ownerTest() { - assertThat(model.getOwner(), instanceOf(String.class)); - } - - /** - * Test the property 'applicationId' - */ - @Test - public void applicationIdTest() { - assertThat(model.getApplicationId(), instanceOf(String.class)); - } - - /** - * Test the property 'time' - */ - @Test - public void timeTest() { - assertThat(model.getTime(), instanceOf(OffsetDateTime.class)); - } - - /** - * Test the property 'segmentCount' - */ - @Test - public void segmentCountTest() { - assertThat(model.getSegmentCount(), instanceOf(Integer.class)); - } - - /** - * Test the property 'direction' - */ - @Test - public void directionTest() { - assertThat(model.getDirection(), instanceOf(MessageDirectionEnum.class)); - } - - /** - * Test the property 'to' - */ - @Test - public void toTest() { - assertThat(model.getTo(), instanceOf(LinkedHashSet.class)); - } - - /** - * Test the property 'from' - */ - @Test - public void fromTest() { - assertThat(model.getFrom(), instanceOf(String.class)); - } - - /** - * Test the property 'text' - */ - @Test - public void textTest() { - assertThat(model.getText(), instanceOf(String.class)); - } - - /** - * Test the property 'tag' - */ - @Test - public void tagTest() { - assertThat(model.getTag(), instanceOf(String.class)); - } - - /** - * Test the property 'media' - */ - @Test - public void mediaTest() { - assertThat(model.getMedia(), instanceOf(List.class)); - } - - /** - * Test the property 'priority' - */ - @Test - public void priorityTest() { - assertThat(model.getPriority(), instanceOf(PriorityEnum.class)); - } - -} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/MessageSendingCallbackTest.java b/src/test/java/com/bandwidth/sdk/unit/models/MessageSendingCallbackTest.java deleted file mode 100644 index c069a720..00000000 --- a/src/test/java/com/bandwidth/sdk/unit/models/MessageSendingCallbackTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Bandwidth - * Bandwidth's Communication APIs - * - * The version of the OpenAPI document: 1.0.0 - * Contact: letstalk@bandwidth.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.bandwidth.sdk.unit.models; - -import org.junit.jupiter.api.Test; - -import java.time.OffsetDateTime; -import com.bandwidth.sdk.model.MessageSendingCallback; -import com.bandwidth.sdk.model.MessageSendingCallbackMessage; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.CoreMatchers.instanceOf; - -/** - * Model tests for MessageSendingCallback - */ -public class MessageSendingCallbackTest { - private final MessageSendingCallback model = new MessageSendingCallback() - .time(OffsetDateTime.now()) - .type("type") - .to("to") - .description("description") - .message(new MessageSendingCallbackMessage()); - - /** - * Model tests for MessageSendingCallback - */ - @Test - public void testMessageSendingCallback() { - assertThat(model, instanceOf(MessageSendingCallback.class)); - } - - /** - * Test the property 'time' - */ - @Test - public void timeTest() { - assertThat(model.getTime(), instanceOf(OffsetDateTime.class)); - } - - /** - * Test the property 'type' - */ - @Test - public void typeTest() { - assertThat(model.getType(), instanceOf(String.class)); - } - - /** - * Test the property 'to' - */ - @Test - public void toTest() { - assertThat(model.getTo(), instanceOf(String.class)); - } - - /** - * Test the property 'description' - */ - @Test - public void descriptionTest() { - assertThat(model.getDescription(), instanceOf(String.class)); - } - - /** - * Test the property 'message' - */ - @Test - public void messageTest() { - assertThat(model.getMessage(), instanceOf(MessageSendingCallbackMessage.class)); - } - -}