From f486c8be91a2801b19254ebf7335ea1a1770389a Mon Sep 17 00:00:00 2001 From: DX-Bandwidth Date: Tue, 14 Jan 2025 14:06:20 +0000 Subject: [PATCH 1/4] Generate SDK with OpenAPI Generator Version --- .openapi-generator/FILES | 22 +- README.md | 11 +- api/openapi.yaml | 589 +++++------- bandwidth.yml | 893 ++++++++---------- docs/CallbackTypeEnum.md | 17 + docs/MediaApi.md | 6 +- docs/Message.md | 4 +- docs/MessageCallback.md | 19 + docs/MessageCallbackMessage.md | 25 + docs/MessageRequest.md | 6 +- docs/MessagesApi.md | 32 +- src/main/java/com/bandwidth/sdk/JSON.java | 10 +- .../java/com/bandwidth/sdk/api/MediaApi.java | 14 +- .../com/bandwidth/sdk/api/MessagesApi.java | 64 +- .../bandwidth/sdk/model/CallbackTypeEnum.java | 82 ++ .../java/com/bandwidth/sdk/model/Message.java | 4 +- .../bandwidth/sdk/model/MessageCallback.java | 456 +++++++++ .../sdk/model/MessageCallbackMessage.java | 667 +++++++++++++ .../bandwidth/sdk/model/MessageRequest.java | 6 +- .../sdk/model/MessageStatusEnum.java | 2 +- 20 files changed, 2020 insertions(+), 909 deletions(-) create mode 100644 docs/CallbackTypeEnum.md create mode 100644 docs/MessageCallback.md create mode 100644 docs/MessageCallbackMessage.md create mode 100644 src/main/java/com/bandwidth/sdk/model/CallbackTypeEnum.java create mode 100644 src/main/java/com/bandwidth/sdk/model/MessageCallback.java create mode 100644 src/main/java/com/bandwidth/sdk/model/MessageCallbackMessage.java 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..be588690 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -322,8 +322,8 @@ paths: schema: type: string style: simple - - description: General-header field is used to specify directives that MUST - be obeyed by all caching mechanisms along the request/response chain. + - description: | + General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. example: no-cache explode: false in: header @@ -408,11 +408,8 @@ paths: schema: type: string style: simple - - description: "The ID of the message to search for. Special characters need\ - \ to be encoded using URL encoding. Message IDs could come in different\ - \ formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2\ - \ are valid message ID formats. Note that you must include at least one\ - \ query parameter." + - description: | + The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. example: 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 explode: true in: query @@ -421,10 +418,8 @@ paths: schema: type: string style: form - - description: "The phone number that sent the message. Accepted values are:\ - \ a single full phone number a comma separated list of full phone numbers\ - \ (maximum of 10) or a single partial phone number (minimum of 5 characters\ - \ e.g. '%2B1919')." + - description: | + The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). example: '%2B15554443333' explode: true in: query @@ -433,10 +428,8 @@ paths: schema: type: string style: form - - description: "The phone number that received the message. Accepted values\ - \ are: a single full phone number a comma separated list of full phone numbers\ - \ (maximum of 10) or a single partial phone number (minimum of 5 characters\ - \ e.g. '%2B1919')." + - description: | + The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). example: '%2B15554443333' explode: true in: query @@ -445,8 +438,8 @@ paths: schema: type: string style: form - - description: The status of the message. One of RECEIVED QUEUED SENDING SENT - FAILED DELIVERED ACCEPTED UNDELIVERED. + - description: | + The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. explode: true in: query name: messageStatus @@ -462,9 +455,8 @@ paths: schema: $ref: '#/components/schemas/listMessageDirectionEnum' style: form - - description: The name of the carrier used for this message. Possible values - include but are not limited to Verizon and TMobile. Special characters need - to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). + - description: | + The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). example: Verizon explode: true in: query @@ -490,8 +482,8 @@ paths: schema: type: integer style: form - - description: The start of the date range to search in ISO 8601 format. Uses - the message receive time. The date range to search in is currently 14 days. + - description: | + The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. example: 2022-09-14T18:20:16.000Z explode: true in: query @@ -500,8 +492,8 @@ paths: schema: type: string style: form - - description: The end of the date range to search in ISO 8601 format. Uses - the message receive time. The date range to search in is currently 14 days. + - description: | + The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. example: 2022-09-14T18:20:16.000Z explode: true in: query @@ -538,8 +530,8 @@ paths: schema: type: string style: form - - description: The maximum records requested in search result. Default 100. - The sum of limit and after cannot be more than 10000. + - description: | + The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. example: 50 explode: true in: query @@ -617,8 +609,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 +4636,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 +4656,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: @@ -4872,8 +5017,8 @@ components: type: string style: simple cacheControl: - description: General-header field is used to specify directives that MUST be - obeyed by all caching mechanisms along the request/response chain. + description: | + General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. example: no-cache explode: false in: header @@ -4893,11 +5038,8 @@ components: type: string style: simple messageId: - description: "The ID of the message to search for. Special characters need to\ - \ be encoded using URL encoding. Message IDs could come in different formats,\ - \ e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2\ - \ are valid message ID formats. Note that you must include at least one query\ - \ parameter." + description: | + The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. example: 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 explode: true in: query @@ -4907,9 +5049,8 @@ components: type: string style: form sourceTn: - description: "The phone number that sent the message. Accepted values are: a\ - \ single full phone number a comma separated list of full phone numbers (maximum\ - \ of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919')." + description: | + The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). example: '%2B15554443333' explode: true in: query @@ -4919,10 +5060,8 @@ components: type: string style: form destinationTn: - description: "The phone number that received the message. Accepted values are:\ - \ a single full phone number a comma separated list of full phone numbers\ - \ (maximum of 10) or a single partial phone number (minimum of 5 characters\ - \ e.g. '%2B1919')." + description: | + The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). example: '%2B15554443333' explode: true in: query @@ -4932,8 +5071,8 @@ components: type: string style: form messageStatus: - description: The status of the message. One of RECEIVED QUEUED SENDING SENT - FAILED DELIVERED ACCEPTED UNDELIVERED. + description: | + The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. explode: true in: query name: messageStatus @@ -4951,9 +5090,8 @@ components: $ref: '#/components/schemas/listMessageDirectionEnum' style: form carrierName: - description: The name of the carrier used for this message. Possible values - include but are not limited to Verizon and TMobile. Special characters need - to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). + description: | + The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). example: Verizon explode: true in: query @@ -4982,8 +5120,8 @@ components: type: integer style: form fromDateTime: - description: The start of the date range to search in ISO 8601 format. Uses - the message receive time. The date range to search in is currently 14 days. + description: | + The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. example: 2022-09-14T18:20:16.000Z explode: true in: query @@ -4993,8 +5131,8 @@ components: type: string style: form toDateTime: - description: The end of the date range to search in ISO 8601 format. Uses the - message receive time. The date range to search in is currently 14 days. + description: | + The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. example: 2022-09-14T18:20:16.000Z explode: true in: query @@ -5035,8 +5173,8 @@ components: type: string style: form limit: - description: The maximum records requested in search result. Default 100. The - sum of limit and after cannot be more than 10000. + description: | + The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. example: 50 explode: true in: query @@ -5360,6 +5498,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 +5546,10 @@ components: schema: format: binary type: string + text/html: + schema: + format: binary + type: string text/plain: schema: format: binary @@ -5448,6 +5598,10 @@ components: schema: format: binary type: string + video/x-flv: + schema: + format: binary + type: string required: true createCallRequest: content: @@ -6000,6 +6154,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. @@ -6011,8 +6177,8 @@ components: example: default type: string messageStatusEnum: - description: The status of the message. One of RECEIVED QUEUED SENDING SENT - FAILED DELIVERED ACCEPTED UNDELIVERED. + description: | + The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. enum: - RECEIVED - QUEUED @@ -6312,7 +6478,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,12 +6500,12 @@ 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: - description: The number of segments the original message from the user is - broken into before sending over to carrier networks. + description: | + The number of segments the original message from the user is broken into before sending over to carrier networks. example: 2 type: integer direction: @@ -6357,10 +6523,8 @@ components: example: "+15553332222" type: string media: - description: The list of media URLs sent in the message. Including a `filename` - field in the `Content-Disposition` header of the media linked with a URL - will set the displayed file name. This is a best practice to ensure that - your media has a readable file name. + description: | + The list of media URLs sent in the message. Including a `filename` field in the `Content-Disposition` header of the media linked with a URL will set the displayed file name. This is a best practice to ensure that your media has a readable file name. example: - https://dev.bandwidth.com/images/bandwidth-logo.png items: @@ -6407,7 +6571,7 @@ components: \ Sender IDs can contain up to 11 characters, upper-case letters A-Z,\ \ lower-case letters a-z, numbers 0-9, space, hyphen -, plus +, underscore\ \ _ and ampersand &. Alphanumeric Sender IDs must contain at least one\ - \ letter." + \ letter.\n" example: "+15551113333" type: string text: @@ -6417,7 +6581,7 @@ components: maxLength: 2048 type: string media: - description: |- + description: | A list of URLs to include as media attachments as part of the message. Each URL can be at most 4096 characters. example: @@ -6436,7 +6600,7 @@ components: priority: $ref: '#/components/schemas/priorityEnum' expiration: - description: |- + description: | A string with the date/time value that the message will automatically expire by. This must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. Must be a date-time in the future. Not supported on MMS. example: 2021-02-01T11:29:18-05:00 @@ -6448,288 +6612,38 @@ components: - to title: MessageRequest type: object - inboundMessageCallback: - description: Inbound Message Callback - properties: - time: - example: 2016-09-14T18:20:16Z - 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 + 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-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 +6655,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 +6680,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 +6698,6 @@ components: - id - owner - segmentCount - - tag - text - time - to diff --git a/bandwidth.yml b/bandwidth.yml index 11c79d23..8725d1d6 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: |- @@ -1344,7 +1357,7 @@ components: example: default messageStatusEnum: type: string - description: >- + description: > The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. enum: @@ -1574,10 +1587,10 @@ 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: >- + description: > The number of segments the original message from the user is broken into before sending over to carrier networks. example: 2 @@ -1600,7 +1613,7 @@ components: type: array items: type: string - description: >- + description: > The list of media URLs sent in the message. Including a `filename` field in the `Content-Disposition` header of the media linked with a URL will set the displayed file name. This is a best practice to @@ -1647,7 +1660,7 @@ components: type: string from: type: string - description: >- + description: > Either an alphanumeric sender ID or the sender's Bandwidth phone number in E.164 format, which must be hosted within Bandwidth and linked to the account that is generating the message. @@ -1668,7 +1681,7 @@ components: type: string format: uri maxLength: 4096 - description: >- + description: > A list of URLs to include as media attachments as part of the message. @@ -1687,7 +1700,7 @@ components: expiration: type: string format: date-time - description: >- + description: > A string with the date/time value that the message will automatically expire by. This must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. Must be a @@ -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 @@ -5127,7 +4891,7 @@ components: name: Cache-Control style: simple explode: false - description: >- + description: > General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. example: no-cache @@ -5145,7 +4909,7 @@ components: in: query name: messageId required: false - description: >- + description: > The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and @@ -5158,7 +4922,7 @@ components: in: query name: sourceTn required: false - description: >- + description: > The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. @@ -5170,7 +4934,7 @@ components: in: query name: destinationTn required: false - description: >- + description: > The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 @@ -5182,7 +4946,7 @@ components: in: query name: messageStatus required: false - description: >- + description: > The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. schema: @@ -5198,7 +4962,7 @@ components: in: query name: carrierName required: false - description: >- + description: > The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). @@ -5224,7 +4988,7 @@ components: in: query name: fromDateTime required: false - description: >- + description: > The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. example: 2022-09-14T18:20:16.000Z @@ -5234,7 +4998,7 @@ components: in: query name: toDateTime required: false - description: >- + description: > The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. example: 2022-09-14T18:20:16.000Z @@ -5270,7 +5034,7 @@ components: in: query name: limit required: false - description: >- + description: > The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. schema: @@ -5463,19 +5227,330 @@ 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 + 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 @@ -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..0595c076 100644 --- a/docs/MediaApi.md +++ b/docs/MediaApi.md @@ -276,7 +276,7 @@ public class Example { String mediaId = "14762070468292kw2fuqty55yp2b2/0/bw.png"; // String | Media ID to retrieve. File body = new File("/path/to/file"); // File | String contentType = "audio/wav"; // String | The media type of the entity-body. - String cacheControl = "no-cache"; // String | General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. + String cacheControl = "no-cache"; // String | General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. try { apiInstance.uploadMedia(accountId, mediaId, body, contentType, cacheControl); } catch (ApiException e) { @@ -298,7 +298,7 @@ public class Example { | **mediaId** | **String**| Media ID to retrieve. | | | **body** | **File**| | | | **contentType** | **String**| The media type of the entity-body. | [optional] | -| **cacheControl** | **String**| General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. | [optional] | +| **cacheControl** | **String**| General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. | [optional] | ### Return type @@ -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/Message.md b/docs/Message.md index ef12c3ba..b204fcce 100644 --- a/docs/Message.md +++ b/docs/Message.md @@ -11,11 +11,11 @@ |**owner** | **String** | The Bandwidth phone number associated with the message. | [optional] | |**applicationId** | **String** | The application ID associated with the message. | [optional] | |**time** | **OffsetDateTime** | The datetime stamp of the message in ISO 8601 | [optional] | -|**segmentCount** | **Integer** | The number of segments the original message from the user is broken into before sending over to carrier networks. | [optional] | +|**segmentCount** | **Integer** | The number of segments the original message from the user is broken into before sending over to carrier networks. | [optional] | |**direction** | **MessageDirectionEnum** | | [optional] | |**to** | **Set<String>** | The phone number recipients of the message. | [optional] | |**from** | **String** | The phone number the message was sent from. | [optional] | -|**media** | **Set<String>** | The list of media URLs sent in the message. Including a `filename` field in the `Content-Disposition` header of the media linked with a URL will set the displayed file name. This is a best practice to ensure that your media has a readable file name. | [optional] | +|**media** | **Set<String>** | The list of media URLs sent in the message. Including a `filename` field in the `Content-Disposition` header of the media linked with a URL will set the displayed file name. This is a best practice to ensure that your media has a readable file name. | [optional] | |**text** | **String** | The contents of the message. | [optional] | |**tag** | **String** | The custom string set by the user. | [optional] | |**priority** | **PriorityEnum** | | [optional] | 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/docs/MessageRequest.md b/docs/MessageRequest.md index bc3ee310..bd6bb8f7 100644 --- a/docs/MessageRequest.md +++ b/docs/MessageRequest.md @@ -9,12 +9,12 @@ |------------ | ------------- | ------------- | -------------| |**applicationId** | **String** | The ID of the Application your from number is associated with in the Bandwidth Phone Number Dashboard. | | |**to** | **Set<String>** | The phone number(s) the message should be sent to in E164 format. | | -|**from** | **String** | Either an alphanumeric sender ID or the sender's Bandwidth phone number in E.164 format, which must be hosted within Bandwidth and linked to the account that is generating the message. Alphanumeric Sender IDs can contain up to 11 characters, upper-case letters A-Z, lower-case letters a-z, numbers 0-9, space, hyphen -, plus +, underscore _ and ampersand &. Alphanumeric Sender IDs must contain at least one letter. | | +|**from** | **String** | Either an alphanumeric sender ID or the sender's Bandwidth phone number in E.164 format, which must be hosted within Bandwidth and linked to the account that is generating the message. Alphanumeric Sender IDs can contain up to 11 characters, upper-case letters A-Z, lower-case letters a-z, numbers 0-9, space, hyphen -, plus +, underscore _ and ampersand &. Alphanumeric Sender IDs must contain at least one letter. | | |**text** | **String** | The contents of the text message. Must be 2048 characters or less. | [optional] | -|**media** | **List<URI>** | A list of URLs to include as media attachments as part of the message. Each URL can be at most 4096 characters. | [optional] | +|**media** | **List<URI>** | A list of URLs to include as media attachments as part of the message. Each URL can be at most 4096 characters. | [optional] | |**tag** | **String** | A custom string that will be included in callback events of the message. Max 1024 characters. | [optional] | |**priority** | **PriorityEnum** | | [optional] | -|**expiration** | **OffsetDateTime** | A string with the date/time value that the message will automatically expire by. This must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. Must be a date-time in the future. Not supported on MMS. | [optional] | +|**expiration** | **OffsetDateTime** | A string with the date/time value that the message will automatically expire by. This must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. Must be a date-time in the future. Not supported on MMS. | [optional] | diff --git a/docs/MessagesApi.md b/docs/MessagesApi.md index 641562b7..473eed8a 100644 --- a/docs/MessagesApi.md +++ b/docs/MessagesApi.md @@ -116,20 +116,20 @@ public class Example { MessagesApi apiInstance = new MessagesApi(defaultClient); String accountId = "9900000"; // String | Your Bandwidth Account ID. - String messageId = "9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6"; // String | The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. - String sourceTn = "%2B15554443333"; // String | The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). - String destinationTn = "%2B15554443333"; // String | The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). - MessageStatusEnum messageStatus = MessageStatusEnum.fromValue("RECEIVED"); // MessageStatusEnum | The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. + String messageId = "9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6"; // String | The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. + String sourceTn = "%2B15554443333"; // String | The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). + String destinationTn = "%2B15554443333"; // String | The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). + MessageStatusEnum messageStatus = MessageStatusEnum.fromValue("RECEIVED"); // MessageStatusEnum | The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. ListMessageDirectionEnum messageDirection = ListMessageDirectionEnum.fromValue("INBOUND"); // ListMessageDirectionEnum | The direction of the message. One of INBOUND OUTBOUND. - String carrierName = "Verizon"; // String | The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). + String carrierName = "Verizon"; // String | The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). MessageTypeEnum messageType = MessageTypeEnum.fromValue("sms"); // MessageTypeEnum | The type of message. Either sms or mms. Integer errorCode = 9902; // Integer | The error code of the message. - String fromDateTime = "2022-09-14T18:20:16.000Z"; // String | The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. - String toDateTime = "2022-09-14T18:20:16.000Z"; // String | The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. + String fromDateTime = "2022-09-14T18:20:16.000Z"; // String | The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. + String toDateTime = "2022-09-14T18:20:16.000Z"; // String | The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. String campaignId = "CJEUMDK"; // String | The campaign ID of the message. String sort = "sourceTn:desc"; // String | The field and direction to sort by combined with a colon. Direction is either asc or desc. String pageToken = "gdEewhcJLQRB5"; // String | A base64 encoded value used for pagination of results. - Integer limit = 50; // Integer | The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. + Integer limit = 50; // Integer | The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. Boolean limitTotalCount = true; // Boolean | When set to true, the response's totalCount field will have a maximum value of 10,000. When set to false, or excluded, this will give an accurate totalCount of all messages that match the provided filters. If you are experiencing latency, try using this parameter to limit your results. try { MessagesList result = apiInstance.listMessages(accountId, messageId, sourceTn, destinationTn, messageStatus, messageDirection, carrierName, messageType, errorCode, fromDateTime, toDateTime, campaignId, sort, pageToken, limit, limitTotalCount); @@ -150,20 +150,20 @@ public class Example { | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| | **accountId** | **String**| Your Bandwidth Account ID. | | -| **messageId** | **String**| The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. | [optional] | -| **sourceTn** | **String**| The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). | [optional] | -| **destinationTn** | **String**| The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). | [optional] | -| **messageStatus** | [**MessageStatusEnum**](.md)| The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. | [optional] [enum: RECEIVED, QUEUED, SENDING, SENT, FAILED, DELIVERED, ACCEPTED, UNDELIVERED] | +| **messageId** | **String**| The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. | [optional] | +| **sourceTn** | **String**| The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). | [optional] | +| **destinationTn** | **String**| The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). | [optional] | +| **messageStatus** | [**MessageStatusEnum**](.md)| The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. | [optional] [enum: RECEIVED, QUEUED, SENDING, SENT, FAILED, DELIVERED, ACCEPTED, UNDELIVERED] | | **messageDirection** | [**ListMessageDirectionEnum**](.md)| The direction of the message. One of INBOUND OUTBOUND. | [optional] [enum: INBOUND, OUTBOUND] | -| **carrierName** | **String**| The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). | [optional] | +| **carrierName** | **String**| The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). | [optional] | | **messageType** | [**MessageTypeEnum**](.md)| The type of message. Either sms or mms. | [optional] [enum: sms, mms] | | **errorCode** | **Integer**| The error code of the message. | [optional] | -| **fromDateTime** | **String**| The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. | [optional] | -| **toDateTime** | **String**| The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. | [optional] | +| **fromDateTime** | **String**| The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. | [optional] | +| **toDateTime** | **String**| The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. | [optional] | | **campaignId** | **String**| The campaign ID of the message. | [optional] | | **sort** | **String**| The field and direction to sort by combined with a colon. Direction is either asc or desc. | [optional] | | **pageToken** | **String**| A base64 encoded value used for pagination of results. | [optional] | -| **limit** | **Integer**| The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. | [optional] | +| **limit** | **Integer**| The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. | [optional] | | **limitTotalCount** | **Boolean**| When set to true, the response's totalCount field will have a maximum value of 10,000. When set to false, or excluded, this will give an accurate totalCount of all messages that match the provided filters. If you are experiencing latency, try using this parameter to limit your results. | [optional] | ### Return type 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..35993115 100644 --- a/src/main/java/com/bandwidth/sdk/api/MediaApi.java +++ b/src/main/java/com/bandwidth/sdk/api/MediaApi.java @@ -583,7 +583,7 @@ public okhttp3.Call listMediaAsync(String accountId, String continuationToken, f * @param mediaId Media ID to retrieve. (required) * @param body (required) * @param contentType The media type of the entity-body. (optional) - * @param cacheControl General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. (optional) + * @param cacheControl General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -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) { @@ -730,7 +734,7 @@ private okhttp3.Call uploadMediaValidateBeforeCall(String accountId, String medi * @param mediaId Media ID to retrieve. (required) * @param body (required) * @param contentType The media type of the entity-body. (optional) - * @param cacheControl General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. (optional) + * @param cacheControl General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. (optional) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -758,7 +762,7 @@ public void uploadMedia(String accountId, String mediaId, File body, String cont * @param mediaId Media ID to retrieve. (required) * @param body (required) * @param contentType The media type of the entity-body. (optional) - * @param cacheControl General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. (optional) + * @param cacheControl General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. (optional) * @return ApiResponse<Void> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -788,7 +792,7 @@ public ApiResponse uploadMediaWithHttpInfo(String accountId, String mediaI * @param mediaId Media ID to retrieve. (required) * @param body (required) * @param contentType The media type of the entity-body. (optional) - * @param cacheControl General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. (optional) + * @param cacheControl General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object diff --git a/src/main/java/com/bandwidth/sdk/api/MessagesApi.java b/src/main/java/com/bandwidth/sdk/api/MessagesApi.java index bd4db0c3..de0038b5 100644 --- a/src/main/java/com/bandwidth/sdk/api/MessagesApi.java +++ b/src/main/java/com/bandwidth/sdk/api/MessagesApi.java @@ -251,20 +251,20 @@ public okhttp3.Call createMessageAsync(String accountId, MessageRequest messageR /** * Build call for listMessages * @param accountId Your Bandwidth Account ID. (required) - * @param messageId The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. (optional) - * @param sourceTn The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) - * @param destinationTn The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) - * @param messageStatus The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. (optional) + * @param messageId The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. (optional) + * @param sourceTn The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) + * @param destinationTn The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) + * @param messageStatus The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. (optional) * @param messageDirection The direction of the message. One of INBOUND OUTBOUND. (optional) - * @param carrierName The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). (optional) + * @param carrierName The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). (optional) * @param messageType The type of message. Either sms or mms. (optional) * @param errorCode The error code of the message. (optional) - * @param fromDateTime The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) - * @param toDateTime The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) + * @param fromDateTime The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) + * @param toDateTime The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) * @param campaignId The campaign ID of the message. (optional) * @param sort The field and direction to sort by combined with a colon. Direction is either asc or desc. (optional) * @param pageToken A base64 encoded value used for pagination of results. (optional) - * @param limit The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. (optional) + * @param limit The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. (optional) * @param limitTotalCount When set to true, the response's totalCount field will have a maximum value of 10,000. When set to false, or excluded, this will give an accurate totalCount of all messages that match the provided filters. If you are experiencing latency, try using this parameter to limit your results. (optional) * @param _callback Callback for upload/download progress * @return Call to execute @@ -403,20 +403,20 @@ private okhttp3.Call listMessagesValidateBeforeCall(String accountId, String mes * List Messages * Returns a list of messages based on query parameters. * @param accountId Your Bandwidth Account ID. (required) - * @param messageId The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. (optional) - * @param sourceTn The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) - * @param destinationTn The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) - * @param messageStatus The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. (optional) + * @param messageId The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. (optional) + * @param sourceTn The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) + * @param destinationTn The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) + * @param messageStatus The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. (optional) * @param messageDirection The direction of the message. One of INBOUND OUTBOUND. (optional) - * @param carrierName The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). (optional) + * @param carrierName The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). (optional) * @param messageType The type of message. Either sms or mms. (optional) * @param errorCode The error code of the message. (optional) - * @param fromDateTime The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) - * @param toDateTime The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) + * @param fromDateTime The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) + * @param toDateTime The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) * @param campaignId The campaign ID of the message. (optional) * @param sort The field and direction to sort by combined with a colon. Direction is either asc or desc. (optional) * @param pageToken A base64 encoded value used for pagination of results. (optional) - * @param limit The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. (optional) + * @param limit The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. (optional) * @param limitTotalCount When set to true, the response's totalCount field will have a maximum value of 10,000. When set to false, or excluded, this will give an accurate totalCount of all messages that match the provided filters. If you are experiencing latency, try using this parameter to limit your results. (optional) * @return MessagesList * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body @@ -443,20 +443,20 @@ public MessagesList listMessages(String accountId, String messageId, String sour * List Messages * Returns a list of messages based on query parameters. * @param accountId Your Bandwidth Account ID. (required) - * @param messageId The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. (optional) - * @param sourceTn The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) - * @param destinationTn The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) - * @param messageStatus The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. (optional) + * @param messageId The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. (optional) + * @param sourceTn The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) + * @param destinationTn The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) + * @param messageStatus The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. (optional) * @param messageDirection The direction of the message. One of INBOUND OUTBOUND. (optional) - * @param carrierName The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). (optional) + * @param carrierName The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). (optional) * @param messageType The type of message. Either sms or mms. (optional) * @param errorCode The error code of the message. (optional) - * @param fromDateTime The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) - * @param toDateTime The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) + * @param fromDateTime The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) + * @param toDateTime The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) * @param campaignId The campaign ID of the message. (optional) * @param sort The field and direction to sort by combined with a colon. Direction is either asc or desc. (optional) * @param pageToken A base64 encoded value used for pagination of results. (optional) - * @param limit The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. (optional) + * @param limit The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. (optional) * @param limitTotalCount When set to true, the response's totalCount field will have a maximum value of 10,000. When set to false, or excluded, this will give an accurate totalCount of all messages that match the provided filters. If you are experiencing latency, try using this parameter to limit your results. (optional) * @return ApiResponse<MessagesList> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body @@ -484,20 +484,20 @@ public ApiResponse listMessagesWithHttpInfo(String accountId, Stri * List Messages (asynchronously) * Returns a list of messages based on query parameters. * @param accountId Your Bandwidth Account ID. (required) - * @param messageId The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. (optional) - * @param sourceTn The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) - * @param destinationTn The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) - * @param messageStatus The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. (optional) + * @param messageId The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. (optional) + * @param sourceTn The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) + * @param destinationTn The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) + * @param messageStatus The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. (optional) * @param messageDirection The direction of the message. One of INBOUND OUTBOUND. (optional) - * @param carrierName The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). (optional) + * @param carrierName The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). (optional) * @param messageType The type of message. Either sms or mms. (optional) * @param errorCode The error code of the message. (optional) - * @param fromDateTime The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) - * @param toDateTime The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) + * @param fromDateTime The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) + * @param toDateTime The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) * @param campaignId The campaign ID of the message. (optional) * @param sort The field and direction to sort by combined with a colon. Direction is either asc or desc. (optional) * @param pageToken A base64 encoded value used for pagination of results. (optional) - * @param limit The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. (optional) + * @param limit The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. (optional) * @param limitTotalCount When set to true, the response's totalCount field will have a maximum value of 10,000. When set to false, or excluded, this will give an accurate totalCount of all messages that match the provided filters. If you are experiencing latency, try using this parameter to limit your results. (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call 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/Message.java b/src/main/java/com/bandwidth/sdk/model/Message.java index 4e2bde24..9356197b 100644 --- a/src/main/java/com/bandwidth/sdk/model/Message.java +++ b/src/main/java/com/bandwidth/sdk/model/Message.java @@ -205,7 +205,7 @@ public Message segmentCount(@javax.annotation.Nullable Integer segmentCount) { } /** - * The number of segments the original message from the user is broken into before sending over to carrier networks. + * The number of segments the original message from the user is broken into before sending over to carrier networks. * @return segmentCount */ @javax.annotation.Nullable @@ -297,7 +297,7 @@ public Message addMediaItem(String mediaItem) { } /** - * The list of media URLs sent in the message. Including a `filename` field in the `Content-Disposition` header of the media linked with a URL will set the displayed file name. This is a best practice to ensure that your media has a readable file name. + * The list of media URLs sent in the message. Including a `filename` field in the `Content-Disposition` header of the media linked with a URL will set the displayed file name. This is a best practice to ensure that your media has a readable file name. * @return media */ @javax.annotation.Nullable diff --git a/src/main/java/com/bandwidth/sdk/model/MessageCallback.java b/src/main/java/com/bandwidth/sdk/model/MessageCallback.java new file mode 100644 index 00000000..59430ef5 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/MessageCallback.java @@ -0,0 +1,456 @@ +/* + * 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.CallbackTypeEnum; +import com.bandwidth.sdk.model.MessageCallbackMessage; +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 org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * Message Callback Schema + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") +public class MessageCallback { + 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 CallbackTypeEnum 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 MessageCallbackMessage message; + + public static final String SERIALIZED_NAME_ERROR_CODE = "errorCode"; + @SerializedName(SERIALIZED_NAME_ERROR_CODE) + @javax.annotation.Nullable + private Integer errorCode; + + public MessageCallback() { + } + + public MessageCallback 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 MessageCallback type(@javax.annotation.Nonnull CallbackTypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + public CallbackTypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull CallbackTypeEnum type) { + this.type = type; + } + + + public MessageCallback 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 MessageCallback description(@javax.annotation.Nonnull String description) { + this.description = description; + return this; + } + + /** + * A detailed description of the event described by the callback. + * @return description + */ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nonnull String description) { + this.description = description; + } + + + public MessageCallback message(@javax.annotation.Nonnull MessageCallbackMessage message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + */ + @javax.annotation.Nonnull + public MessageCallbackMessage getMessage() { + return message; + } + + public void setMessage(@javax.annotation.Nonnull MessageCallbackMessage message) { + this.message = message; + } + + + public MessageCallback errorCode(@javax.annotation.Nullable Integer errorCode) { + this.errorCode = errorCode; + return this; + } + + /** + * Optional error code, applicable only when type is `message-failed`. + * @return errorCode + */ + @javax.annotation.Nullable + public Integer getErrorCode() { + return errorCode; + } + + public void setErrorCode(@javax.annotation.Nullable Integer errorCode) { + this.errorCode = errorCode; + } + + /** + * 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 MessageCallback instance itself + */ + public MessageCallback 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; + } + 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 + 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 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"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" errorCode: ").append(toIndentedString(errorCode)).append("\n"); + sb.append(" 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"); + openapiFields.add("errorCode"); + + // 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 MessageCallback + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MessageCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MessageCallback is not found in the empty JSON string", MessageCallback.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + 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(); + // 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())); + } + 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` + MessageCallbackMessage.validateJsonElement(jsonObj.get("message")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MessageCallback.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MessageCallback' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MessageCallback.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MessageCallback 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 MessageCallback read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MessageCallback instance = thisAdapter.fromJsonTree(jsonObj); + 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 MessageCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of MessageCallback + * @throws IOException if the JSON string is invalid with respect to MessageCallback + */ + public static MessageCallback fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MessageCallback.class); + } + + /** + * Convert an instance of MessageCallback 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/MessageCallbackMessage.java b/src/main/java/com/bandwidth/sdk/model/MessageCallbackMessage.java new file mode 100644 index 00000000..0ea1c1e3 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/MessageCallbackMessage.java @@ -0,0 +1,667 @@ +/* + * 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 org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * Message payload schema within a MessageCallback + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") +public class MessageCallbackMessage { + 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.Nullable + private List media; + + public static final String SERIALIZED_NAME_PRIORITY = "priority"; + @SerializedName(SERIALIZED_NAME_PRIORITY) + @javax.annotation.Nullable + private PriorityEnum priority; + + public MessageCallbackMessage() { + } + + public MessageCallbackMessage 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 MessageCallbackMessage 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 MessageCallbackMessage 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 MessageCallbackMessage 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 MessageCallbackMessage 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 MessageCallbackMessage 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 MessageCallbackMessage to(@javax.annotation.Nonnull Set to) { + this.to = to; + return this; + } + + public MessageCallbackMessage 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 MessageCallbackMessage 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 MessageCallbackMessage 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 MessageCallbackMessage 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 MessageCallbackMessage media(@javax.annotation.Nullable List media) { + this.media = media; + return this; + } + + public MessageCallbackMessage addMediaItem(URI mediaItem) { + if (this.media == null) { + this.media = new ArrayList<>(); + } + this.media.add(mediaItem); + return this; + } + + /** + * Optional media, applicable only for mms + * @return media + */ + @javax.annotation.Nullable + public List getMedia() { + return media; + } + + public void setMedia(@javax.annotation.Nullable List media) { + this.media = media; + } + + + public MessageCallbackMessage 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 MessageCallbackMessage instance itself + */ + public MessageCallbackMessage 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; + } + 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 + 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 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"); + 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"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MessageCallbackMessage + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MessageCallbackMessage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MessageCallbackMessage is not found in the empty JSON string", MessageCallbackMessage.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + 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())); + } + } + 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 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 (!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(MessageCallbackMessage.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MessageCallbackMessage 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 MessageCallbackMessage read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MessageCallbackMessage instance = thisAdapter.fromJsonTree(jsonObj); + 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 MessageCallbackMessage given an JSON string + * + * @param jsonString JSON string + * @return An instance of MessageCallbackMessage + * @throws IOException if the JSON string is invalid with respect to MessageCallbackMessage + */ + public static MessageCallbackMessage fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MessageCallbackMessage.class); + } + + /** + * Convert an instance of MessageCallbackMessage to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/MessageRequest.java b/src/main/java/com/bandwidth/sdk/model/MessageRequest.java index 3859eed6..6927a7f1 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessageRequest.java +++ b/src/main/java/com/bandwidth/sdk/model/MessageRequest.java @@ -152,7 +152,7 @@ public MessageRequest from(@javax.annotation.Nonnull String from) { } /** - * Either an alphanumeric sender ID or the sender's Bandwidth phone number in E.164 format, which must be hosted within Bandwidth and linked to the account that is generating the message. Alphanumeric Sender IDs can contain up to 11 characters, upper-case letters A-Z, lower-case letters a-z, numbers 0-9, space, hyphen -, plus +, underscore _ and ampersand &. Alphanumeric Sender IDs must contain at least one letter. + * Either an alphanumeric sender ID or the sender's Bandwidth phone number in E.164 format, which must be hosted within Bandwidth and linked to the account that is generating the message. Alphanumeric Sender IDs can contain up to 11 characters, upper-case letters A-Z, lower-case letters a-z, numbers 0-9, space, hyphen -, plus +, underscore _ and ampersand &. Alphanumeric Sender IDs must contain at least one letter. * @return from */ @javax.annotation.Nonnull @@ -198,7 +198,7 @@ public MessageRequest addMediaItem(URI mediaItem) { } /** - * A list of URLs to include as media attachments as part of the message. Each URL can be at most 4096 characters. + * A list of URLs to include as media attachments as part of the message. Each URL can be at most 4096 characters. * @return media */ @javax.annotation.Nullable @@ -255,7 +255,7 @@ public MessageRequest expiration(@javax.annotation.Nullable OffsetDateTime expir } /** - * A string with the date/time value that the message will automatically expire by. This must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. Must be a date-time in the future. Not supported on MMS. + * A string with the date/time value that the message will automatically expire by. This must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. Must be a date-time in the future. Not supported on MMS. * @return expiration */ @javax.annotation.Nullable diff --git a/src/main/java/com/bandwidth/sdk/model/MessageStatusEnum.java b/src/main/java/com/bandwidth/sdk/model/MessageStatusEnum.java index 80760f09..781eb479 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessageStatusEnum.java +++ b/src/main/java/com/bandwidth/sdk/model/MessageStatusEnum.java @@ -24,7 +24,7 @@ import com.google.gson.stream.JsonWriter; /** - * The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. + * The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. */ @JsonAdapter(MessageStatusEnum.Adapter.class) public enum MessageStatusEnum { From 9184fababac99cd029948e3b3ff97093b3be50b3 Mon Sep 17 00:00:00 2001 From: ckoegel Date: Tue, 14 Jan 2025 12:11:07 -0500 Subject: [PATCH 2/4] fix spaces --- api/openapi.yaml | 107 ++++++++++-------- bandwidth.yml | 30 ++--- docs/MediaApi.md | 4 +- docs/Message.md | 4 +- docs/MessageRequest.md | 6 +- docs/MessagesApi.md | 32 +++--- .../java/com/bandwidth/sdk/api/MediaApi.java | 8 +- .../com/bandwidth/sdk/api/MessagesApi.java | 64 +++++------ .../java/com/bandwidth/sdk/model/Message.java | 4 +- .../bandwidth/sdk/model/MessageRequest.java | 6 +- .../sdk/model/MessageStatusEnum.java | 2 +- 11 files changed, 142 insertions(+), 125 deletions(-) diff --git a/api/openapi.yaml b/api/openapi.yaml index be588690..17670371 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -322,8 +322,8 @@ paths: schema: type: string style: simple - - description: | - General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. + - description: General-header field is used to specify directives that MUST + be obeyed by all caching mechanisms along the request/response chain. example: no-cache explode: false in: header @@ -408,8 +408,11 @@ paths: schema: type: string style: simple - - description: | - The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. + - description: "The ID of the message to search for. Special characters need\ + \ to be encoded using URL encoding. Message IDs could come in different\ + \ formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2\ + \ are valid message ID formats. Note that you must include at least one\ + \ query parameter." example: 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 explode: true in: query @@ -418,8 +421,10 @@ paths: schema: type: string style: form - - description: | - The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). + - description: "The phone number that sent the message. Accepted values are:\ + \ a single full phone number a comma separated list of full phone numbers\ + \ (maximum of 10) or a single partial phone number (minimum of 5 characters\ + \ e.g. '%2B1919')." example: '%2B15554443333' explode: true in: query @@ -428,8 +433,10 @@ paths: schema: type: string style: form - - description: | - The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). + - description: "The phone number that received the message. Accepted values\ + \ are: a single full phone number a comma separated list of full phone numbers\ + \ (maximum of 10) or a single partial phone number (minimum of 5 characters\ + \ e.g. '%2B1919')." example: '%2B15554443333' explode: true in: query @@ -438,8 +445,8 @@ paths: schema: type: string style: form - - description: | - The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. + - description: The status of the message. One of RECEIVED QUEUED SENDING SENT + FAILED DELIVERED ACCEPTED UNDELIVERED. explode: true in: query name: messageStatus @@ -455,8 +462,9 @@ paths: schema: $ref: '#/components/schemas/listMessageDirectionEnum' style: form - - description: | - The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). + - description: The name of the carrier used for this message. Possible values + include but are not limited to Verizon and TMobile. Special characters need + to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). example: Verizon explode: true in: query @@ -482,8 +490,8 @@ paths: schema: type: integer style: form - - description: | - The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. + - description: The start of the date range to search in ISO 8601 format. Uses + the message receive time. The date range to search in is currently 14 days. example: 2022-09-14T18:20:16.000Z explode: true in: query @@ -492,8 +500,8 @@ paths: schema: type: string style: form - - description: | - The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. + - description: The end of the date range to search in ISO 8601 format. Uses + the message receive time. The date range to search in is currently 14 days. example: 2022-09-14T18:20:16.000Z explode: true in: query @@ -530,8 +538,8 @@ paths: schema: type: string style: form - - description: | - The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. + - description: The maximum records requested in search result. Default 100. + The sum of limit and after cannot be more than 10000. example: 50 explode: true in: query @@ -5017,8 +5025,8 @@ components: type: string style: simple cacheControl: - description: | - General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. + description: General-header field is used to specify directives that MUST be + obeyed by all caching mechanisms along the request/response chain. example: no-cache explode: false in: header @@ -5038,8 +5046,11 @@ components: type: string style: simple messageId: - description: | - The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. + description: "The ID of the message to search for. Special characters need to\ + \ be encoded using URL encoding. Message IDs could come in different formats,\ + \ e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2\ + \ are valid message ID formats. Note that you must include at least one query\ + \ parameter." example: 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 explode: true in: query @@ -5049,8 +5060,9 @@ components: type: string style: form sourceTn: - description: | - The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). + description: "The phone number that sent the message. Accepted values are: a\ + \ single full phone number a comma separated list of full phone numbers (maximum\ + \ of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919')." example: '%2B15554443333' explode: true in: query @@ -5060,8 +5072,10 @@ components: type: string style: form destinationTn: - description: | - The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). + description: "The phone number that received the message. Accepted values are:\ + \ a single full phone number a comma separated list of full phone numbers\ + \ (maximum of 10) or a single partial phone number (minimum of 5 characters\ + \ e.g. '%2B1919')." example: '%2B15554443333' explode: true in: query @@ -5071,8 +5085,8 @@ components: type: string style: form messageStatus: - description: | - The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. + description: The status of the message. One of RECEIVED QUEUED SENDING SENT + FAILED DELIVERED ACCEPTED UNDELIVERED. explode: true in: query name: messageStatus @@ -5090,8 +5104,9 @@ components: $ref: '#/components/schemas/listMessageDirectionEnum' style: form carrierName: - description: | - The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). + description: The name of the carrier used for this message. Possible values + include but are not limited to Verizon and TMobile. Special characters need + to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). example: Verizon explode: true in: query @@ -5120,8 +5135,8 @@ components: type: integer style: form fromDateTime: - description: | - The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. + description: The start of the date range to search in ISO 8601 format. Uses + the message receive time. The date range to search in is currently 14 days. example: 2022-09-14T18:20:16.000Z explode: true in: query @@ -5131,8 +5146,8 @@ components: type: string style: form toDateTime: - description: | - The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. + description: The end of the date range to search in ISO 8601 format. Uses the + message receive time. The date range to search in is currently 14 days. example: 2022-09-14T18:20:16.000Z explode: true in: query @@ -5173,8 +5188,8 @@ components: type: string style: form limit: - description: | - The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. + description: The maximum records requested in search result. Default 100. The + sum of limit and after cannot be more than 10000. example: 50 explode: true in: query @@ -6177,8 +6192,8 @@ components: example: default type: string messageStatusEnum: - description: | - The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. + description: The status of the message. One of RECEIVED QUEUED SENDING SENT + FAILED DELIVERED ACCEPTED UNDELIVERED. enum: - RECEIVED - QUEUED @@ -6504,8 +6519,8 @@ components: format: date-time type: string segmentCount: - description: | - The number of segments the original message from the user is broken into before sending over to carrier networks. + description: The number of segments the original message from the user is + broken into before sending over to carrier networks. example: 2 type: integer direction: @@ -6523,8 +6538,10 @@ components: example: "+15553332222" type: string media: - description: | - The list of media URLs sent in the message. Including a `filename` field in the `Content-Disposition` header of the media linked with a URL will set the displayed file name. This is a best practice to ensure that your media has a readable file name. + description: The list of media URLs sent in the message. Including a `filename` + field in the `Content-Disposition` header of the media linked with a URL + will set the displayed file name. This is a best practice to ensure that + your media has a readable file name. example: - https://dev.bandwidth.com/images/bandwidth-logo.png items: @@ -6571,7 +6588,7 @@ components: \ Sender IDs can contain up to 11 characters, upper-case letters A-Z,\ \ lower-case letters a-z, numbers 0-9, space, hyphen -, plus +, underscore\ \ _ and ampersand &. Alphanumeric Sender IDs must contain at least one\ - \ letter.\n" + \ letter." example: "+15551113333" type: string text: @@ -6581,7 +6598,7 @@ components: maxLength: 2048 type: string media: - description: | + description: |- A list of URLs to include as media attachments as part of the message. Each URL can be at most 4096 characters. example: @@ -6600,7 +6617,7 @@ components: priority: $ref: '#/components/schemas/priorityEnum' expiration: - description: | + description: |- A string with the date/time value that the message will automatically expire by. This must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. Must be a date-time in the future. Not supported on MMS. example: 2021-02-01T11:29:18-05:00 diff --git a/bandwidth.yml b/bandwidth.yml index 8725d1d6..87921dfa 100644 --- a/bandwidth.yml +++ b/bandwidth.yml @@ -1357,7 +1357,7 @@ components: example: default messageStatusEnum: type: string - description: > + description: >- The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. enum: @@ -1590,7 +1590,7 @@ components: example: 2024-12-02T20:15:57.278Z segmentCount: type: integer - description: > + description: >- The number of segments the original message from the user is broken into before sending over to carrier networks. example: 2 @@ -1613,7 +1613,7 @@ components: type: array items: type: string - description: > + description: >- The list of media URLs sent in the message. Including a `filename` field in the `Content-Disposition` header of the media linked with a URL will set the displayed file name. This is a best practice to @@ -1660,7 +1660,7 @@ components: type: string from: type: string - description: > + description: >- Either an alphanumeric sender ID or the sender's Bandwidth phone number in E.164 format, which must be hosted within Bandwidth and linked to the account that is generating the message. @@ -1681,7 +1681,7 @@ components: type: string format: uri maxLength: 4096 - description: > + description: >- A list of URLs to include as media attachments as part of the message. @@ -1700,7 +1700,7 @@ components: expiration: type: string format: date-time - description: > + description: >- A string with the date/time value that the message will automatically expire by. This must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. Must be a @@ -4891,7 +4891,7 @@ components: name: Cache-Control style: simple explode: false - description: > + description: >- General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. example: no-cache @@ -4909,7 +4909,7 @@ components: in: query name: messageId required: false - description: > + description: >- The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and @@ -4922,7 +4922,7 @@ components: in: query name: sourceTn required: false - description: > + description: >- The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. @@ -4934,7 +4934,7 @@ components: in: query name: destinationTn required: false - description: > + description: >- The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 @@ -4946,7 +4946,7 @@ components: in: query name: messageStatus required: false - description: > + description: >- The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. schema: @@ -4962,7 +4962,7 @@ components: in: query name: carrierName required: false - description: > + description: >- The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). @@ -4988,7 +4988,7 @@ components: in: query name: fromDateTime required: false - description: > + description: >- The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. example: 2022-09-14T18:20:16.000Z @@ -4998,7 +4998,7 @@ components: in: query name: toDateTime required: false - description: > + description: >- The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. example: 2022-09-14T18:20:16.000Z @@ -5034,7 +5034,7 @@ components: in: query name: limit required: false - description: > + description: >- The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. schema: diff --git a/docs/MediaApi.md b/docs/MediaApi.md index 0595c076..427119ae 100644 --- a/docs/MediaApi.md +++ b/docs/MediaApi.md @@ -276,7 +276,7 @@ public class Example { String mediaId = "14762070468292kw2fuqty55yp2b2/0/bw.png"; // String | Media ID to retrieve. File body = new File("/path/to/file"); // File | String contentType = "audio/wav"; // String | The media type of the entity-body. - String cacheControl = "no-cache"; // String | General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. + String cacheControl = "no-cache"; // String | General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. try { apiInstance.uploadMedia(accountId, mediaId, body, contentType, cacheControl); } catch (ApiException e) { @@ -298,7 +298,7 @@ public class Example { | **mediaId** | **String**| Media ID to retrieve. | | | **body** | **File**| | | | **contentType** | **String**| The media type of the entity-body. | [optional] | -| **cacheControl** | **String**| General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. | [optional] | +| **cacheControl** | **String**| General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. | [optional] | ### Return type diff --git a/docs/Message.md b/docs/Message.md index b204fcce..ef12c3ba 100644 --- a/docs/Message.md +++ b/docs/Message.md @@ -11,11 +11,11 @@ |**owner** | **String** | The Bandwidth phone number associated with the message. | [optional] | |**applicationId** | **String** | The application ID associated with the message. | [optional] | |**time** | **OffsetDateTime** | The datetime stamp of the message in ISO 8601 | [optional] | -|**segmentCount** | **Integer** | The number of segments the original message from the user is broken into before sending over to carrier networks. | [optional] | +|**segmentCount** | **Integer** | The number of segments the original message from the user is broken into before sending over to carrier networks. | [optional] | |**direction** | **MessageDirectionEnum** | | [optional] | |**to** | **Set<String>** | The phone number recipients of the message. | [optional] | |**from** | **String** | The phone number the message was sent from. | [optional] | -|**media** | **Set<String>** | The list of media URLs sent in the message. Including a `filename` field in the `Content-Disposition` header of the media linked with a URL will set the displayed file name. This is a best practice to ensure that your media has a readable file name. | [optional] | +|**media** | **Set<String>** | The list of media URLs sent in the message. Including a `filename` field in the `Content-Disposition` header of the media linked with a URL will set the displayed file name. This is a best practice to ensure that your media has a readable file name. | [optional] | |**text** | **String** | The contents of the message. | [optional] | |**tag** | **String** | The custom string set by the user. | [optional] | |**priority** | **PriorityEnum** | | [optional] | diff --git a/docs/MessageRequest.md b/docs/MessageRequest.md index bd6bb8f7..bc3ee310 100644 --- a/docs/MessageRequest.md +++ b/docs/MessageRequest.md @@ -9,12 +9,12 @@ |------------ | ------------- | ------------- | -------------| |**applicationId** | **String** | The ID of the Application your from number is associated with in the Bandwidth Phone Number Dashboard. | | |**to** | **Set<String>** | The phone number(s) the message should be sent to in E164 format. | | -|**from** | **String** | Either an alphanumeric sender ID or the sender's Bandwidth phone number in E.164 format, which must be hosted within Bandwidth and linked to the account that is generating the message. Alphanumeric Sender IDs can contain up to 11 characters, upper-case letters A-Z, lower-case letters a-z, numbers 0-9, space, hyphen -, plus +, underscore _ and ampersand &. Alphanumeric Sender IDs must contain at least one letter. | | +|**from** | **String** | Either an alphanumeric sender ID or the sender's Bandwidth phone number in E.164 format, which must be hosted within Bandwidth and linked to the account that is generating the message. Alphanumeric Sender IDs can contain up to 11 characters, upper-case letters A-Z, lower-case letters a-z, numbers 0-9, space, hyphen -, plus +, underscore _ and ampersand &. Alphanumeric Sender IDs must contain at least one letter. | | |**text** | **String** | The contents of the text message. Must be 2048 characters or less. | [optional] | -|**media** | **List<URI>** | A list of URLs to include as media attachments as part of the message. Each URL can be at most 4096 characters. | [optional] | +|**media** | **List<URI>** | A list of URLs to include as media attachments as part of the message. Each URL can be at most 4096 characters. | [optional] | |**tag** | **String** | A custom string that will be included in callback events of the message. Max 1024 characters. | [optional] | |**priority** | **PriorityEnum** | | [optional] | -|**expiration** | **OffsetDateTime** | A string with the date/time value that the message will automatically expire by. This must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. Must be a date-time in the future. Not supported on MMS. | [optional] | +|**expiration** | **OffsetDateTime** | A string with the date/time value that the message will automatically expire by. This must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. Must be a date-time in the future. Not supported on MMS. | [optional] | diff --git a/docs/MessagesApi.md b/docs/MessagesApi.md index 473eed8a..641562b7 100644 --- a/docs/MessagesApi.md +++ b/docs/MessagesApi.md @@ -116,20 +116,20 @@ public class Example { MessagesApi apiInstance = new MessagesApi(defaultClient); String accountId = "9900000"; // String | Your Bandwidth Account ID. - String messageId = "9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6"; // String | The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. - String sourceTn = "%2B15554443333"; // String | The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). - String destinationTn = "%2B15554443333"; // String | The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). - MessageStatusEnum messageStatus = MessageStatusEnum.fromValue("RECEIVED"); // MessageStatusEnum | The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. + String messageId = "9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6"; // String | The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. + String sourceTn = "%2B15554443333"; // String | The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). + String destinationTn = "%2B15554443333"; // String | The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). + MessageStatusEnum messageStatus = MessageStatusEnum.fromValue("RECEIVED"); // MessageStatusEnum | The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. ListMessageDirectionEnum messageDirection = ListMessageDirectionEnum.fromValue("INBOUND"); // ListMessageDirectionEnum | The direction of the message. One of INBOUND OUTBOUND. - String carrierName = "Verizon"; // String | The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). + String carrierName = "Verizon"; // String | The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). MessageTypeEnum messageType = MessageTypeEnum.fromValue("sms"); // MessageTypeEnum | The type of message. Either sms or mms. Integer errorCode = 9902; // Integer | The error code of the message. - String fromDateTime = "2022-09-14T18:20:16.000Z"; // String | The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. - String toDateTime = "2022-09-14T18:20:16.000Z"; // String | The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. + String fromDateTime = "2022-09-14T18:20:16.000Z"; // String | The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. + String toDateTime = "2022-09-14T18:20:16.000Z"; // String | The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. String campaignId = "CJEUMDK"; // String | The campaign ID of the message. String sort = "sourceTn:desc"; // String | The field and direction to sort by combined with a colon. Direction is either asc or desc. String pageToken = "gdEewhcJLQRB5"; // String | A base64 encoded value used for pagination of results. - Integer limit = 50; // Integer | The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. + Integer limit = 50; // Integer | The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. Boolean limitTotalCount = true; // Boolean | When set to true, the response's totalCount field will have a maximum value of 10,000. When set to false, or excluded, this will give an accurate totalCount of all messages that match the provided filters. If you are experiencing latency, try using this parameter to limit your results. try { MessagesList result = apiInstance.listMessages(accountId, messageId, sourceTn, destinationTn, messageStatus, messageDirection, carrierName, messageType, errorCode, fromDateTime, toDateTime, campaignId, sort, pageToken, limit, limitTotalCount); @@ -150,20 +150,20 @@ public class Example { | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| | **accountId** | **String**| Your Bandwidth Account ID. | | -| **messageId** | **String**| The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. | [optional] | -| **sourceTn** | **String**| The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). | [optional] | -| **destinationTn** | **String**| The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). | [optional] | -| **messageStatus** | [**MessageStatusEnum**](.md)| The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. | [optional] [enum: RECEIVED, QUEUED, SENDING, SENT, FAILED, DELIVERED, ACCEPTED, UNDELIVERED] | +| **messageId** | **String**| The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. | [optional] | +| **sourceTn** | **String**| The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). | [optional] | +| **destinationTn** | **String**| The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). | [optional] | +| **messageStatus** | [**MessageStatusEnum**](.md)| The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. | [optional] [enum: RECEIVED, QUEUED, SENDING, SENT, FAILED, DELIVERED, ACCEPTED, UNDELIVERED] | | **messageDirection** | [**ListMessageDirectionEnum**](.md)| The direction of the message. One of INBOUND OUTBOUND. | [optional] [enum: INBOUND, OUTBOUND] | -| **carrierName** | **String**| The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). | [optional] | +| **carrierName** | **String**| The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). | [optional] | | **messageType** | [**MessageTypeEnum**](.md)| The type of message. Either sms or mms. | [optional] [enum: sms, mms] | | **errorCode** | **Integer**| The error code of the message. | [optional] | -| **fromDateTime** | **String**| The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. | [optional] | -| **toDateTime** | **String**| The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. | [optional] | +| **fromDateTime** | **String**| The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. | [optional] | +| **toDateTime** | **String**| The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. | [optional] | | **campaignId** | **String**| The campaign ID of the message. | [optional] | | **sort** | **String**| The field and direction to sort by combined with a colon. Direction is either asc or desc. | [optional] | | **pageToken** | **String**| A base64 encoded value used for pagination of results. | [optional] | -| **limit** | **Integer**| The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. | [optional] | +| **limit** | **Integer**| The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. | [optional] | | **limitTotalCount** | **Boolean**| When set to true, the response's totalCount field will have a maximum value of 10,000. When set to false, or excluded, this will give an accurate totalCount of all messages that match the provided filters. If you are experiencing latency, try using this parameter to limit your results. | [optional] | ### Return type diff --git a/src/main/java/com/bandwidth/sdk/api/MediaApi.java b/src/main/java/com/bandwidth/sdk/api/MediaApi.java index 35993115..e98cfb3b 100644 --- a/src/main/java/com/bandwidth/sdk/api/MediaApi.java +++ b/src/main/java/com/bandwidth/sdk/api/MediaApi.java @@ -583,7 +583,7 @@ public okhttp3.Call listMediaAsync(String accountId, String continuationToken, f * @param mediaId Media ID to retrieve. (required) * @param body (required) * @param contentType The media type of the entity-body. (optional) - * @param cacheControl General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. (optional) + * @param cacheControl General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -734,7 +734,7 @@ private okhttp3.Call uploadMediaValidateBeforeCall(String accountId, String medi * @param mediaId Media ID to retrieve. (required) * @param body (required) * @param contentType The media type of the entity-body. (optional) - * @param cacheControl General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. (optional) + * @param cacheControl General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. (optional) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
@@ -762,7 +762,7 @@ public void uploadMedia(String accountId, String mediaId, File body, String cont * @param mediaId Media ID to retrieve. (required) * @param body (required) * @param contentType The media type of the entity-body. (optional) - * @param cacheControl General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. (optional) + * @param cacheControl General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. (optional) * @return ApiResponse<Void> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -792,7 +792,7 @@ public ApiResponse uploadMediaWithHttpInfo(String accountId, String mediaI * @param mediaId Media ID to retrieve. (required) * @param body (required) * @param contentType The media type of the entity-body. (optional) - * @param cacheControl General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. (optional) + * @param cacheControl General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object diff --git a/src/main/java/com/bandwidth/sdk/api/MessagesApi.java b/src/main/java/com/bandwidth/sdk/api/MessagesApi.java index de0038b5..bd4db0c3 100644 --- a/src/main/java/com/bandwidth/sdk/api/MessagesApi.java +++ b/src/main/java/com/bandwidth/sdk/api/MessagesApi.java @@ -251,20 +251,20 @@ public okhttp3.Call createMessageAsync(String accountId, MessageRequest messageR /** * Build call for listMessages * @param accountId Your Bandwidth Account ID. (required) - * @param messageId The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. (optional) - * @param sourceTn The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) - * @param destinationTn The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) - * @param messageStatus The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. (optional) + * @param messageId The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. (optional) + * @param sourceTn The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) + * @param destinationTn The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) + * @param messageStatus The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. (optional) * @param messageDirection The direction of the message. One of INBOUND OUTBOUND. (optional) - * @param carrierName The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). (optional) + * @param carrierName The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). (optional) * @param messageType The type of message. Either sms or mms. (optional) * @param errorCode The error code of the message. (optional) - * @param fromDateTime The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) - * @param toDateTime The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) + * @param fromDateTime The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) + * @param toDateTime The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) * @param campaignId The campaign ID of the message. (optional) * @param sort The field and direction to sort by combined with a colon. Direction is either asc or desc. (optional) * @param pageToken A base64 encoded value used for pagination of results. (optional) - * @param limit The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. (optional) + * @param limit The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. (optional) * @param limitTotalCount When set to true, the response's totalCount field will have a maximum value of 10,000. When set to false, or excluded, this will give an accurate totalCount of all messages that match the provided filters. If you are experiencing latency, try using this parameter to limit your results. (optional) * @param _callback Callback for upload/download progress * @return Call to execute @@ -403,20 +403,20 @@ private okhttp3.Call listMessagesValidateBeforeCall(String accountId, String mes * List Messages * Returns a list of messages based on query parameters. * @param accountId Your Bandwidth Account ID. (required) - * @param messageId The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. (optional) - * @param sourceTn The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) - * @param destinationTn The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) - * @param messageStatus The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. (optional) + * @param messageId The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. (optional) + * @param sourceTn The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) + * @param destinationTn The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) + * @param messageStatus The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. (optional) * @param messageDirection The direction of the message. One of INBOUND OUTBOUND. (optional) - * @param carrierName The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). (optional) + * @param carrierName The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). (optional) * @param messageType The type of message. Either sms or mms. (optional) * @param errorCode The error code of the message. (optional) - * @param fromDateTime The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) - * @param toDateTime The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) + * @param fromDateTime The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) + * @param toDateTime The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) * @param campaignId The campaign ID of the message. (optional) * @param sort The field and direction to sort by combined with a colon. Direction is either asc or desc. (optional) * @param pageToken A base64 encoded value used for pagination of results. (optional) - * @param limit The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. (optional) + * @param limit The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. (optional) * @param limitTotalCount When set to true, the response's totalCount field will have a maximum value of 10,000. When set to false, or excluded, this will give an accurate totalCount of all messages that match the provided filters. If you are experiencing latency, try using this parameter to limit your results. (optional) * @return MessagesList * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body @@ -443,20 +443,20 @@ public MessagesList listMessages(String accountId, String messageId, String sour * List Messages * Returns a list of messages based on query parameters. * @param accountId Your Bandwidth Account ID. (required) - * @param messageId The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. (optional) - * @param sourceTn The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) - * @param destinationTn The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) - * @param messageStatus The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. (optional) + * @param messageId The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. (optional) + * @param sourceTn The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) + * @param destinationTn The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) + * @param messageStatus The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. (optional) * @param messageDirection The direction of the message. One of INBOUND OUTBOUND. (optional) - * @param carrierName The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). (optional) + * @param carrierName The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). (optional) * @param messageType The type of message. Either sms or mms. (optional) * @param errorCode The error code of the message. (optional) - * @param fromDateTime The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) - * @param toDateTime The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) + * @param fromDateTime The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) + * @param toDateTime The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) * @param campaignId The campaign ID of the message. (optional) * @param sort The field and direction to sort by combined with a colon. Direction is either asc or desc. (optional) * @param pageToken A base64 encoded value used for pagination of results. (optional) - * @param limit The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. (optional) + * @param limit The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. (optional) * @param limitTotalCount When set to true, the response's totalCount field will have a maximum value of 10,000. When set to false, or excluded, this will give an accurate totalCount of all messages that match the provided filters. If you are experiencing latency, try using this parameter to limit your results. (optional) * @return ApiResponse<MessagesList> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body @@ -484,20 +484,20 @@ public ApiResponse listMessagesWithHttpInfo(String accountId, Stri * List Messages (asynchronously) * Returns a list of messages based on query parameters. * @param accountId Your Bandwidth Account ID. (required) - * @param messageId The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. (optional) - * @param sourceTn The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) - * @param destinationTn The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) - * @param messageStatus The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. (optional) + * @param messageId The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. (optional) + * @param sourceTn The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) + * @param destinationTn The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) + * @param messageStatus The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. (optional) * @param messageDirection The direction of the message. One of INBOUND OUTBOUND. (optional) - * @param carrierName The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). (optional) + * @param carrierName The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). (optional) * @param messageType The type of message. Either sms or mms. (optional) * @param errorCode The error code of the message. (optional) - * @param fromDateTime The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) - * @param toDateTime The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) + * @param fromDateTime The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) + * @param toDateTime The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) * @param campaignId The campaign ID of the message. (optional) * @param sort The field and direction to sort by combined with a colon. Direction is either asc or desc. (optional) * @param pageToken A base64 encoded value used for pagination of results. (optional) - * @param limit The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. (optional) + * @param limit The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. (optional) * @param limitTotalCount When set to true, the response's totalCount field will have a maximum value of 10,000. When set to false, or excluded, this will give an accurate totalCount of all messages that match the provided filters. If you are experiencing latency, try using this parameter to limit your results. (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call diff --git a/src/main/java/com/bandwidth/sdk/model/Message.java b/src/main/java/com/bandwidth/sdk/model/Message.java index 9356197b..4e2bde24 100644 --- a/src/main/java/com/bandwidth/sdk/model/Message.java +++ b/src/main/java/com/bandwidth/sdk/model/Message.java @@ -205,7 +205,7 @@ public Message segmentCount(@javax.annotation.Nullable Integer segmentCount) { } /** - * The number of segments the original message from the user is broken into before sending over to carrier networks. + * The number of segments the original message from the user is broken into before sending over to carrier networks. * @return segmentCount */ @javax.annotation.Nullable @@ -297,7 +297,7 @@ public Message addMediaItem(String mediaItem) { } /** - * The list of media URLs sent in the message. Including a `filename` field in the `Content-Disposition` header of the media linked with a URL will set the displayed file name. This is a best practice to ensure that your media has a readable file name. + * The list of media URLs sent in the message. Including a `filename` field in the `Content-Disposition` header of the media linked with a URL will set the displayed file name. This is a best practice to ensure that your media has a readable file name. * @return media */ @javax.annotation.Nullable diff --git a/src/main/java/com/bandwidth/sdk/model/MessageRequest.java b/src/main/java/com/bandwidth/sdk/model/MessageRequest.java index 6927a7f1..3859eed6 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessageRequest.java +++ b/src/main/java/com/bandwidth/sdk/model/MessageRequest.java @@ -152,7 +152,7 @@ public MessageRequest from(@javax.annotation.Nonnull String from) { } /** - * Either an alphanumeric sender ID or the sender's Bandwidth phone number in E.164 format, which must be hosted within Bandwidth and linked to the account that is generating the message. Alphanumeric Sender IDs can contain up to 11 characters, upper-case letters A-Z, lower-case letters a-z, numbers 0-9, space, hyphen -, plus +, underscore _ and ampersand &. Alphanumeric Sender IDs must contain at least one letter. + * Either an alphanumeric sender ID or the sender's Bandwidth phone number in E.164 format, which must be hosted within Bandwidth and linked to the account that is generating the message. Alphanumeric Sender IDs can contain up to 11 characters, upper-case letters A-Z, lower-case letters a-z, numbers 0-9, space, hyphen -, plus +, underscore _ and ampersand &. Alphanumeric Sender IDs must contain at least one letter. * @return from */ @javax.annotation.Nonnull @@ -198,7 +198,7 @@ public MessageRequest addMediaItem(URI mediaItem) { } /** - * A list of URLs to include as media attachments as part of the message. Each URL can be at most 4096 characters. + * A list of URLs to include as media attachments as part of the message. Each URL can be at most 4096 characters. * @return media */ @javax.annotation.Nullable @@ -255,7 +255,7 @@ public MessageRequest expiration(@javax.annotation.Nullable OffsetDateTime expir } /** - * A string with the date/time value that the message will automatically expire by. This must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. Must be a date-time in the future. Not supported on MMS. + * A string with the date/time value that the message will automatically expire by. This must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. Must be a date-time in the future. Not supported on MMS. * @return expiration */ @javax.annotation.Nullable diff --git a/src/main/java/com/bandwidth/sdk/model/MessageStatusEnum.java b/src/main/java/com/bandwidth/sdk/model/MessageStatusEnum.java index 781eb479..80760f09 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessageStatusEnum.java +++ b/src/main/java/com/bandwidth/sdk/model/MessageStatusEnum.java @@ -24,7 +24,7 @@ import com.google.gson.stream.JsonWriter; /** - * The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. + * The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. */ @JsonAdapter(MessageStatusEnum.Adapter.class) public enum MessageStatusEnum { From 004c69c22bfbf2e13fb1192975f0b5e43af6ca86 Mon Sep 17 00:00:00 2001 From: ckoegel Date: Tue, 14 Jan 2025 15:25:09 -0500 Subject: [PATCH 3/4] remove unused models --- .../sdk/model/InboundMessageCallback.java | 417 ----------- .../model/InboundMessageCallbackMessage.java | 655 ----------------- .../sdk/model/MessageDeliveredCallback.java | 417 ----------- .../MessageDeliveredCallbackMessage.java | 656 ----------------- .../sdk/model/MessageFailedCallback.java | 445 ------------ .../model/MessageFailedCallbackMessage.java | 656 ----------------- .../sdk/model/MessageSendingCallback.java | 417 ----------- .../model/MessageSendingCallbackMessage.java | 658 ------------------ .../sdk/model/TranscriptionList.java | 309 -------- .../sdk/model/TranscriptionMetadata.java | 375 ---------- .../InboundMessageCallbackMessageTest.java | 153 ---- .../models/InboundMessageCallbackTest.java | 83 --- .../MessageDeliveredCallbackMessageTest.java | 153 ---- .../models/MessageDeliveredCallbackTest.java | 83 --- .../MessageFailedCallbackMessageTest.java | 153 ---- .../models/MessageFailedCallbackTest.java | 92 --- .../MessageSendingCallbackMessageTest.java | 153 ---- .../models/MessageSendingCallbackTest.java | 83 --- 18 files changed, 5958 deletions(-) delete mode 100644 src/main/java/com/bandwidth/sdk/model/InboundMessageCallback.java delete mode 100644 src/main/java/com/bandwidth/sdk/model/InboundMessageCallbackMessage.java delete mode 100644 src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallback.java delete mode 100644 src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallbackMessage.java delete mode 100644 src/main/java/com/bandwidth/sdk/model/MessageFailedCallback.java delete mode 100644 src/main/java/com/bandwidth/sdk/model/MessageFailedCallbackMessage.java delete mode 100644 src/main/java/com/bandwidth/sdk/model/MessageSendingCallback.java delete mode 100644 src/main/java/com/bandwidth/sdk/model/MessageSendingCallbackMessage.java delete mode 100644 src/main/java/com/bandwidth/sdk/model/TranscriptionList.java delete mode 100644 src/main/java/com/bandwidth/sdk/model/TranscriptionMetadata.java delete mode 100644 src/test/java/com/bandwidth/sdk/unit/models/InboundMessageCallbackMessageTest.java delete mode 100644 src/test/java/com/bandwidth/sdk/unit/models/InboundMessageCallbackTest.java delete mode 100644 src/test/java/com/bandwidth/sdk/unit/models/MessageDeliveredCallbackMessageTest.java delete mode 100644 src/test/java/com/bandwidth/sdk/unit/models/MessageDeliveredCallbackTest.java delete mode 100644 src/test/java/com/bandwidth/sdk/unit/models/MessageFailedCallbackMessageTest.java delete mode 100644 src/test/java/com/bandwidth/sdk/unit/models/MessageFailedCallbackTest.java delete mode 100644 src/test/java/com/bandwidth/sdk/unit/models/MessageSendingCallbackMessageTest.java delete mode 100644 src/test/java/com/bandwidth/sdk/unit/models/MessageSendingCallbackTest.java 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/InboundMessageCallbackMessage.java b/src/main/java/com/bandwidth/sdk/model/InboundMessageCallbackMessage.java deleted file mode 100644 index faab65bf..00000000 --- a/src/main/java/com/bandwidth/sdk/model/InboundMessageCallbackMessage.java +++ /dev/null @@ -1,655 +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; - -/** - * Inbound Message Callback Message Schema - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") -public class InboundMessageCallbackMessage { - 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.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 InboundMessageCallbackMessage() { - } - - public InboundMessageCallbackMessage 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 InboundMessageCallbackMessage 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 InboundMessageCallbackMessage 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 InboundMessageCallbackMessage 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 InboundMessageCallbackMessage 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 InboundMessageCallbackMessage 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 InboundMessageCallbackMessage to(@javax.annotation.Nonnull Set to) { - this.to = to; - return this; - } - - public InboundMessageCallbackMessage 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 InboundMessageCallbackMessage 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 InboundMessageCallbackMessage 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 InboundMessageCallbackMessage 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 InboundMessageCallbackMessage media(@javax.annotation.Nullable List media) { - this.media = media; - return this; - } - - public InboundMessageCallbackMessage 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 InboundMessageCallbackMessage 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 InboundMessageCallbackMessage instance itself - */ - public InboundMessageCallbackMessage 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; - } - 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); - } - - @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 InboundMessageCallbackMessage {\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"); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to InboundMessageCallbackMessage - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!InboundMessageCallbackMessage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in InboundMessageCallbackMessage is not found in the empty JSON string", InboundMessageCallbackMessage.openapiRequiredFields.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : InboundMessageCallbackMessage.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 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 (!InboundMessageCallbackMessage.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'InboundMessageCallbackMessage' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(InboundMessageCallbackMessage.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, InboundMessageCallbackMessage 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 InboundMessageCallbackMessage 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); - 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 InboundMessageCallbackMessage given an JSON string - * - * @param jsonString JSON string - * @return An instance of InboundMessageCallbackMessage - * @throws IOException if the JSON string is invalid with respect to InboundMessageCallbackMessage - */ - public static InboundMessageCallbackMessage fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, InboundMessageCallbackMessage.class); - } - - /** - * Convert an instance of InboundMessageCallbackMessage to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallback.java b/src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallback.java 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/MessageFailedCallback.java b/src/main/java/com/bandwidth/sdk/model/MessageFailedCallback.java deleted file mode 100644 index 076afbef..00000000 --- a/src/main/java/com/bandwidth/sdk/model/MessageFailedCallback.java +++ /dev/null @@ -1,445 +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.MessageFailedCallbackMessage; -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 Failed Callback - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.10.0") -public class MessageFailedCallback { - 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 MessageFailedCallbackMessage message; - - public static final String SERIALIZED_NAME_ERROR_CODE = "errorCode"; - @SerializedName(SERIALIZED_NAME_ERROR_CODE) - @javax.annotation.Nonnull - private Integer errorCode; - - public MessageFailedCallback() { - } - - public MessageFailedCallback 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 MessageFailedCallback 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 MessageFailedCallback 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 MessageFailedCallback 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 MessageFailedCallback message(@javax.annotation.Nonnull MessageFailedCallbackMessage message) { - this.message = message; - return this; - } - - /** - * Get message - * @return message - */ - @javax.annotation.Nonnull - public MessageFailedCallbackMessage getMessage() { - return message; - } - - public void setMessage(@javax.annotation.Nonnull MessageFailedCallbackMessage message) { - this.message = message; - } - - - public MessageFailedCallback errorCode(@javax.annotation.Nonnull Integer errorCode) { - this.errorCode = errorCode; - return this; - } - - /** - * Get errorCode - * @return errorCode - */ - @javax.annotation.Nonnull - public Integer getErrorCode() { - return errorCode; - } - - public void setErrorCode(@javax.annotation.Nonnull Integer errorCode) { - this.errorCode = errorCode; - } - - /** - * 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 MessageFailedCallback instance itself - */ - public MessageFailedCallback 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; - } - 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); - } - - @Override - public int hashCode() { - return Objects.hash(time, type, to, description, message, errorCode, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class MessageFailedCallback {\n"); - sb.append(" time: ").append(toIndentedString(time)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" to: ").append(toIndentedString(to)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append(" errorCode: ").append(toIndentedString(errorCode)).append("\n"); - sb.append(" 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"); - openapiFields.add("errorCode"); - - // 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"); - 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 - */ - 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())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : MessageFailedCallback.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` - MessageFailedCallbackMessage.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 - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(MessageFailedCallback.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, MessageFailedCallback 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 MessageFailedCallback 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); - 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 MessageFailedCallback given an JSON string - * - * @param jsonString JSON string - * @return An instance of MessageFailedCallback - * @throws IOException if the JSON string is invalid with respect to MessageFailedCallback - */ - public static MessageFailedCallback fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, MessageFailedCallback.class); - } - - /** - * Convert an instance of MessageFailedCallback to an JSON string - * - * @return JSON string - */ - 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/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/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/MessageFailedCallbackMessageTest.java b/src/test/java/com/bandwidth/sdk/unit/models/MessageFailedCallbackMessageTest.java deleted file mode 100644 index 01a761b1..00000000 --- a/src/test/java/com/bandwidth/sdk/unit/models/MessageFailedCallbackMessageTest.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.MessageFailedCallbackMessage; -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 MessageFailedCallbackMessage - */ -public class MessageFailedCallbackMessageTest { - private final MessageFailedCallbackMessage model = new MessageFailedCallbackMessage() - .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 MessageFailedCallbackMessage - */ - @Test - public void testMessageFailedCallbackMessage() { - assertThat(model, instanceOf(MessageFailedCallbackMessage.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/MessageFailedCallbackTest.java b/src/test/java/com/bandwidth/sdk/unit/models/MessageFailedCallbackTest.java deleted file mode 100644 index a08f6e59..00000000 --- a/src/test/java/com/bandwidth/sdk/unit/models/MessageFailedCallbackTest.java +++ /dev/null @@ -1,92 +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.MessageFailedCallback; -import com.bandwidth.sdk.model.MessageFailedCallbackMessage; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.CoreMatchers.instanceOf; - -/** - * Model tests for MessageFailedCallback - */ -public class MessageFailedCallbackTest { - private final MessageFailedCallback model = new MessageFailedCallback() - .time(OffsetDateTime.now()) - .type("type") - .to("to") - .description("description") - .message(new MessageFailedCallbackMessage()) - .errorCode(123); - - /** - * Model tests for MessageFailedCallback - */ - @Test - public void testMessageFailedCallback() { - assertThat(model, instanceOf(MessageFailedCallback.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(MessageFailedCallbackMessage.class)); - } - - /** - * Test the property 'errorCode' - */ - @Test - public void errorCodeTest() { - assertThat(model.getErrorCode(), instanceOf(Integer.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)); - } - -} From 1282c4361b3094bd4eeca351a9433161f1c76f6f Mon Sep 17 00:00:00 2001 From: ckoegel Date: Tue, 14 Jan 2025 15:25:16 -0500 Subject: [PATCH 4/4] update tests --- .../sdk/unit/models/CallbackTypeEnumTest.java | 37 +++++ .../models/MessageCallbackMessageTest.java | 152 ++++++++++++++++++ .../sdk/unit/models/MessageCallbackTest.java | 93 +++++++++++ 3 files changed, 282 insertions(+) create mode 100644 src/test/java/com/bandwidth/sdk/unit/models/CallbackTypeEnumTest.java create mode 100644 src/test/java/com/bandwidth/sdk/unit/models/MessageCallbackMessageTest.java create mode 100644 src/test/java/com/bandwidth/sdk/unit/models/MessageCallbackTest.java 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/MessageCallbackMessageTest.java b/src/test/java/com/bandwidth/sdk/unit/models/MessageCallbackMessageTest.java new file mode 100644 index 00000000..6f05a9d2 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/MessageCallbackMessageTest.java @@ -0,0 +1,152 @@ +/* + * 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.time.OffsetDateTime; +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 MessageCallbackMessage + */ +public class MessageCallbackMessageTest { + private final MessageCallbackMessage model = new MessageCallbackMessage() + .id("id") + .owner("owner") + .applicationId("applicationId") + .time(OffsetDateTime.now()) + .segmentCount(1) + .direction(MessageDirectionEnum.IN) + .to(Sets.newSet("+1234567890")) + .from("from") + .text("text") + .tag("tag") + .media(new ArrayList()) + .priority(PriorityEnum.HIGH); + + /** + * Model tests for MessageCallbackMessage + */ + @Test + public void testMessageCallbackMessage() { + assertThat(model, instanceOf(MessageCallbackMessage.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(Set.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/MessageCallbackTest.java b/src/test/java/com/bandwidth/sdk/unit/models/MessageCallbackTest.java new file mode 100644 index 00000000..6caffe24 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/MessageCallbackTest.java @@ -0,0 +1,93 @@ +/* + * 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.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 MessageCallback + */ +public class MessageCallbackTest { + private final MessageCallback model = new MessageCallback() + .time(OffsetDateTime.now()) + .type(CallbackTypeEnum.DELIVERED) + .to("+1234567890") + .description("description") + .message(new MessageCallbackMessage()) + .errorCode(123); + + /** + * Model tests for MessageCallback + */ + @Test + public void testMessageCallback() { + assertThat(model, instanceOf(MessageCallback.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(CallbackTypeEnum.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(MessageCallbackMessage.class)); + } + + /** + * Test the property 'errorCode' + */ + @Test + public void errorCodeTest() { + assertThat(model.getErrorCode(), instanceOf(Integer.class)); + } + +}