From c93630982f29e7c2397e81365f4f621d7e6231cf Mon Sep 17 00:00:00 2001 From: DX-Bandwidth Date: Tue, 20 Jan 2026 14:13:10 +0000 Subject: [PATCH 1/5] Generate SDK with OpenAPI Generator Version --- .openapi-generator/FILES | 2 + README.md | 1 + api/openapi.yaml | 98 +++++- bandwidth.yml | 61 +++- docs/CustomTooManyRequestsError.md | 14 + docs/MessagesApi.md | 5 +- ...ChannelChannelListRBMObjectAllOfContent.md | 2 +- docs/RbmMessageMedia.md | 2 +- docs/TfvStatus.md | 1 + docs/VerificationRequest.md | 1 + docs/VerificationUpdateRequest.md | 1 + src/main/java/com/bandwidth/sdk/JSON.java | 1 + .../com/bandwidth/sdk/api/MessagesApi.java | 19 +- .../sdk/model/CustomTooManyRequestsError.java | 324 ++++++++++++++++++ .../bandwidth/sdk/model/RbmMessageMedia.java | 28 +- .../com/bandwidth/sdk/model/TfvStatus.java | 47 ++- .../sdk/model/VerificationRequest.java | 35 +- .../sdk/model/VerificationUpdateRequest.java | 35 +- 18 files changed, 645 insertions(+), 32 deletions(-) create mode 100644 docs/CustomTooManyRequestsError.md create mode 100644 src/main/java/com/bandwidth/sdk/model/CustomTooManyRequestsError.java diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 15c18499..1dcce599 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -48,6 +48,7 @@ docs/CreateMessageRequestError.md docs/CreateMultiChannelMessageResponse.md docs/CreateSyncLookupResponse.md docs/CreateSyncLookupResponseData.md +docs/CustomTooManyRequestsError.md docs/DeactivationEventEnum.md docs/DisconnectCallback.md docs/Diversion.md @@ -275,6 +276,7 @@ src/main/java/com/bandwidth/sdk/model/CreateMessageRequestError.java src/main/java/com/bandwidth/sdk/model/CreateMultiChannelMessageResponse.java src/main/java/com/bandwidth/sdk/model/CreateSyncLookupResponse.java src/main/java/com/bandwidth/sdk/model/CreateSyncLookupResponseData.java +src/main/java/com/bandwidth/sdk/model/CustomTooManyRequestsError.java src/main/java/com/bandwidth/sdk/model/DeactivationEventEnum.java src/main/java/com/bandwidth/sdk/model/DisconnectCallback.java src/main/java/com/bandwidth/sdk/model/Diversion.java diff --git a/README.md b/README.md index 11380861..b05ebb4f 100644 --- a/README.md +++ b/README.md @@ -226,6 +226,7 @@ Class | Method | HTTP request | Description - [CreateMultiChannelMessageResponse](docs/CreateMultiChannelMessageResponse.md) - [CreateSyncLookupResponse](docs/CreateSyncLookupResponse.md) - [CreateSyncLookupResponseData](docs/CreateSyncLookupResponseData.md) + - [CustomTooManyRequestsError](docs/CustomTooManyRequestsError.md) - [DeactivationEventEnum](docs/DeactivationEventEnum.md) - [DisconnectCallback](docs/DisconnectCallback.md) - [Diversion](docs/Diversion.md) diff --git a/api/openapi.yaml b/api/openapi.yaml index 2515f2fc..debf5003 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -399,7 +399,10 @@ paths: url: https://messaging.bandwidth.com/api/v2 /users/{accountId}/messages: get: - description: Returns a list of messages based on query parameters. + description: | + Returns a list of messages based on query parameters. + + **Rate Limit:** This endpoint is rate limited to 3500 requests per 5 minutes per Source IP address. Exceeding the limit returns HTTP 429 with a `Retry-After` header. operationId: listMessages parameters: - description: Your Bandwidth Account ID. @@ -709,6 +712,12 @@ paths: schema: $ref: "#/components/schemas/messagingRequestError" description: Not Found + "405": + content: + application/json: + schema: + $ref: "#/components/schemas/messagingRequestError" + description: Method Not Allowed "415": content: application/json: @@ -719,8 +728,16 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/messagingRequestError" + $ref: "#/components/schemas/customTooManyRequestsError" description: Too Many Requests + headers: + Retry-After: + description: The number of seconds to wait before retrying the request. + explode: false + schema: + example: 300 + type: integer + style: simple "500": content: application/json: @@ -7534,6 +7551,20 @@ components: schema: $ref: "#/components/schemas/multiChannelError" description: Internal Server Error + customTooManyRequestsError: + content: + application/json: + schema: + $ref: "#/components/schemas/customTooManyRequestsError" + description: Too Many Requests + headers: + Retry-After: + description: The number of seconds to wait before retrying the request. + explode: false + schema: + example: 300 + type: integer + style: simple createCallResponse: content: application/json: @@ -8860,7 +8891,9 @@ components: rbmMessageMedia: properties: media: - $ref: "#/components/schemas/rbmMessageContentFile" + items: + $ref: "#/components/schemas/rbmMessageContentFile" + type: array suggestions: description: An array of suggested actions for the recipient. items: @@ -9740,6 +9773,24 @@ components: - segmentCount - time - to + customTooManyRequestsError: + example: + description: Rate limit exceeded. Wait for Retry-After time before sending + another request. + type: rate_limit_exceeded + properties: + type: + example: rate_limit_exceeded + type: string + description: + example: Rate limit exceeded. Wait for Retry-After time before sending another + request. + type: string + required: + - description + - type + title: CustomTooManyRequestsError + type: object callbackMethodEnum: default: POST description: The HTTP method to use to deliver the callback. GET or POST. Default @@ -13851,6 +13902,16 @@ components: description: Indicates whether the content is age-gated. example: false type: boolean + cvToken: + description: "The token provided by Campaign Verify to validate your political\ + \ use case. Only required for 527 political organizations. If you are\ + \ not a 527 political organization, this field should be omitted. If you\ + \ pass an empty string, it will be passed along and potentially rejected." + example: cv.user123|sess456|mno|tfree|read_write|X7yZ9aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVw + maxLength: 500 + minLength: 0 + nullable: true + type: string required: - businessAddress - businessContact @@ -13945,6 +14006,16 @@ components: description: Indicates whether the content is age-gated. example: false type: boolean + cvToken: + description: "The token provided by Campaign Verify to validate your political\ + \ use case. Only required for 527 political organizations. If you are\ + \ not a 527 political organization, this field should be omitted. If you\ + \ pass an empty string, it will be passed along and potentially rejected." + example: cv.user123|sess456|mno|tfree|read_write|X7yZ9aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVw + maxLength: 500 + minLength: 0 + nullable: true + type: string required: - businessAddress - businessContact @@ -14603,6 +14674,7 @@ components: useCaseSummary: Text summarizing the use case for the toll-free number declineReasonDescription: Invalid Information - Can't Validate URL - Website is not accessible / not available + cvToken: cv.user123|sess456|mno|tfree|read_write|X7yZ9aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVw status: VERIFIED properties: phoneNumber: @@ -14654,6 +14726,16 @@ components: attribute will only be defined when the number is blocked. example: Toll-free number was used to send spam messages type: string + cvToken: + description: "The token provided by Campaign Verify to validate your political\ + \ use case. Only required for 527 political organizations. If you are\ + \ not a 527 political organization, this field should be omitted. If you\ + \ pass an empty string, it will be passed along and potentially rejected." + example: cv.user123|sess456|mno|tfree|read_write|X7yZ9aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVw + maxLength: 500 + minLength: 0 + nullable: true + type: string type: object tfvSubmissionInfo: example: @@ -14778,6 +14860,16 @@ components: nullable: true pattern: "^[ -~]{16,64}$" type: string + cvToken: + description: "The token provided by Campaign Verify to validate your political\ + \ use case. Only required for 527 political organizations. If you are not\ + \ a 527 political organization, this field should be omitted. If you pass\ + \ an empty string, it will be passed along and potentially rejected." + example: cv.user123|sess456|mno|tfree|read_write|X7yZ9aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVw + maxLength: 500 + minLength: 0 + nullable: true + type: string rbmCardContent_media: allOf: - $ref: "#/components/schemas/rbmMessageContentFile" diff --git a/bandwidth.yml b/bandwidth.yml index 207825dc..4c32a6b9 100644 --- a/bandwidth.yml +++ b/bandwidth.yml @@ -163,7 +163,13 @@ paths: /users/{accountId}/messages: get: summary: List Messages - description: Returns a list of messages based on query parameters. + description: > + Returns a list of messages based on query parameters. + + + **Rate Limit:** This endpoint is rate limited to 3500 requests per 5 + minutes per Source IP address. Exceeding the limit returns HTTP 429 with + a `Retry-After` header. operationId: listMessages tags: - Messages @@ -207,10 +213,12 @@ paths: $ref: '#/components/responses/messagingForbiddenError' '404': $ref: '#/components/responses/messagingNotFoundError' + '405': + $ref: '#/components/responses/messagingMethodNotAllowedError' '415': $ref: '#/components/responses/messagingInvalidMediaTypeError' '429': - $ref: '#/components/responses/messagingTooManyRequestsError' + $ref: '#/components/responses/customTooManyRequestsError' '500': $ref: '#/components/responses/messagingInternalServerError' post: @@ -2257,7 +2265,9 @@ components: type: object properties: media: - $ref: '#/components/schemas/rbmMessageContentFile' + type: array + items: + $ref: '#/components/schemas/rbmMessageContentFile' suggestions: $ref: '#/components/schemas/multiChannelFullActions' required: @@ -2944,6 +2954,21 @@ components: - direction - to - from + customTooManyRequestsError: + title: CustomTooManyRequestsError + type: object + properties: + type: + type: string + example: rate_limit_exceeded + description: + type: string + example: >- + Rate limit exceeded. Wait for Retry-After time before sending + another request. + required: + - type + - description callbackMethodEnum: type: string nullable: true @@ -5954,6 +5979,8 @@ components: $ref: '#/components/schemas/helpMessageResponse' ageGatedContent: $ref: '#/components/schemas/ageGatedContent' + cvToken: + $ref: '#/components/schemas/cvToken' verificationUpdateRequest: type: object required: @@ -6003,6 +6030,8 @@ components: $ref: '#/components/schemas/helpMessageResponse' ageGatedContent: $ref: '#/components/schemas/ageGatedContent' + cvToken: + $ref: '#/components/schemas/cvToken' tfvBasicAuthentication: type: object properties: @@ -6454,6 +6483,8 @@ components: $ref: '#/components/schemas/blocked' blockedReason: $ref: '#/components/schemas/blockedReason' + cvToken: + $ref: '#/components/schemas/cvToken' tfvSubmissionInfo: type: object properties: @@ -6518,6 +6549,18 @@ components: nullable: true pattern: ^[ -~]{16,64}$ type: string + cvToken: + type: string + description: >- + The token provided by Campaign Verify to validate your political use + case. Only required for 527 political organizations. If you are not a + 527 political organization, this field should be omitted. If you pass an + empty string, it will be passed along and potentially rejected. + minLength: 0 + maxLength: 500 + nullable: true + example: >- + cv.user123|sess456|mno|tfree|read_write|X7yZ9aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVw responses: createMessageResponse: description: Accepted @@ -6732,6 +6775,18 @@ components: - type: internal-server-error description: Internal server error. No further information available source: {} + customTooManyRequestsError: + description: Too Many Requests + headers: + Retry-After: + description: The number of seconds to wait before retrying the request. + schema: + type: integer + example: 300 + content: + application/json: + schema: + $ref: '#/components/schemas/customTooManyRequestsError' createCallResponse: description: Created headers: diff --git a/docs/CustomTooManyRequestsError.md b/docs/CustomTooManyRequestsError.md new file mode 100644 index 00000000..f4827874 --- /dev/null +++ b/docs/CustomTooManyRequestsError.md @@ -0,0 +1,14 @@ + + +# CustomTooManyRequestsError + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**type** | **String** | | | +|**description** | **String** | | | + + + diff --git a/docs/MessagesApi.md b/docs/MessagesApi.md index d10cc290..df40f8f0 100644 --- a/docs/MessagesApi.md +++ b/docs/MessagesApi.md @@ -97,7 +97,7 @@ public class Example { List Messages -Returns a list of messages based on query parameters. +Returns a list of messages based on query parameters. **Rate Limit:** This endpoint is rate limited to 3500 requests per 5 minutes per Source IP address. Exceeding the limit returns HTTP 429 with a `Retry-After` header. ### Example ```java @@ -220,7 +220,8 @@ public class Example { | **401** | Unauthorized | - | | **403** | Forbidden | - | | **404** | Not Found | - | +| **405** | Method Not Allowed | - | | **415** | Unsupported Media Type | - | -| **429** | Too Many Requests | - | +| **429** | Too Many Requests | * Retry-After - The number of seconds to wait before retrying the request.
| | **500** | Internal Server Error | - | diff --git a/docs/MultiChannelChannelListRBMObjectAllOfContent.md b/docs/MultiChannelChannelListRBMObjectAllOfContent.md index 6ff58ab3..740b8ea0 100644 --- a/docs/MultiChannelChannelListRBMObjectAllOfContent.md +++ b/docs/MultiChannelChannelListRBMObjectAllOfContent.md @@ -10,7 +10,7 @@ The content of the message. |------------ | ------------- | ------------- | -------------| |**text** | **String** | The text associated with the message. Must be 3270 characters or less | | |**suggestions** | [**List<MultiChannelAction>**](MultiChannelAction.md) | An array of suggested actions for the recipient. | [optional] | -|**media** | [**RbmMessageContentFile**](RbmMessageContentFile.md) | | | +|**media** | [**List<RbmMessageContentFile>**](RbmMessageContentFile.md) | | | |**orientation** | **StandaloneCardOrientationEnum** | | | |**thumbnailImageAlignment** | **ThumbnailAlignmentEnum** | | | |**cardContent** | [**RbmCardContent**](RbmCardContent.md) | | | diff --git a/docs/RbmMessageMedia.md b/docs/RbmMessageMedia.md index 71abb236..7f7dc009 100644 --- a/docs/RbmMessageMedia.md +++ b/docs/RbmMessageMedia.md @@ -7,7 +7,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| -|**media** | [**RbmMessageContentFile**](RbmMessageContentFile.md) | | | +|**media** | [**List<RbmMessageContentFile>**](RbmMessageContentFile.md) | | | |**suggestions** | [**List<MultiChannelAction>**](MultiChannelAction.md) | An array of suggested actions for the recipient. | [optional] | diff --git a/docs/TfvStatus.md b/docs/TfvStatus.md index eb0634de..2d7c13bc 100644 --- a/docs/TfvStatus.md +++ b/docs/TfvStatus.md @@ -17,6 +17,7 @@ |**submission** | [**TfvSubmissionInfo**](TfvSubmissionInfo.md) | | [optional] | |**blocked** | **Boolean** | Whether a Toll-Free Verification is blocked. This attribute will only be defined when the number is blocked. | [optional] | |**blockedReason** | **String** | The reason why the Toll-Free Verification is blocked. This attribute will only be defined when the number is blocked. | [optional] | +|**cvToken** | **String** | The token provided by Campaign Verify to validate your political use case. Only required for 527 political organizations. If you are not a 527 political organization, this field should be omitted. If you pass an empty string, it will be passed along and potentially rejected. | [optional] | diff --git a/docs/VerificationRequest.md b/docs/VerificationRequest.md index d1d9b545..20d07827 100644 --- a/docs/VerificationRequest.md +++ b/docs/VerificationRequest.md @@ -25,6 +25,7 @@ |**businessEntityType** | **BusinessEntityTypeEnum** | | [optional] | |**helpMessageResponse** | **String** | A message that gets sent to users requesting help. | [optional] | |**ageGatedContent** | **Boolean** | Indicates whether the content is age-gated. | [optional] | +|**cvToken** | **String** | The token provided by Campaign Verify to validate your political use case. Only required for 527 political organizations. If you are not a 527 political organization, this field should be omitted. If you pass an empty string, it will be passed along and potentially rejected. | [optional] | diff --git a/docs/VerificationUpdateRequest.md b/docs/VerificationUpdateRequest.md index d27ff3cc..c7b7d6fa 100644 --- a/docs/VerificationUpdateRequest.md +++ b/docs/VerificationUpdateRequest.md @@ -24,6 +24,7 @@ |**businessEntityType** | **BusinessEntityTypeEnum** | | [optional] | |**helpMessageResponse** | **String** | A message that gets sent to users requesting help. | [optional] | |**ageGatedContent** | **Boolean** | Indicates whether the content is age-gated. | [optional] | +|**cvToken** | **String** | The token provided by Campaign Verify to validate your political use case. Only required for 527 political organizations. If you are not a 527 political organization, this field should be omitted. If you pass an empty string, it will be passed along and potentially rejected. | [optional] | diff --git a/src/main/java/com/bandwidth/sdk/JSON.java b/src/main/java/com/bandwidth/sdk/JSON.java index 518e07dd..d4b4b787 100644 --- a/src/main/java/com/bandwidth/sdk/JSON.java +++ b/src/main/java/com/bandwidth/sdk/JSON.java @@ -184,6 +184,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.CreateMultiChannelMessageResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.CreateSyncLookupResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.CreateSyncLookupResponseData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.CustomTooManyRequestsError.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.DisconnectCallback.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.Diversion.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.DtmfCallback.CustomTypeAdapterFactory()); diff --git a/src/main/java/com/bandwidth/sdk/api/MessagesApi.java b/src/main/java/com/bandwidth/sdk/api/MessagesApi.java index 12a1001f..c3cf7375 100644 --- a/src/main/java/com/bandwidth/sdk/api/MessagesApi.java +++ b/src/main/java/com/bandwidth/sdk/api/MessagesApi.java @@ -28,6 +28,7 @@ import com.bandwidth.sdk.model.CreateMessageRequestError; +import com.bandwidth.sdk.model.CustomTooManyRequestsError; import com.bandwidth.sdk.model.ListMessageDirectionEnum; import com.bandwidth.sdk.model.Message; import com.bandwidth.sdk.model.MessageRequest; @@ -295,8 +296,9 @@ public okhttp3.Call createMessageAsync(@javax.annotation.Nonnull String accountI 401 Unauthorized - 403 Forbidden - 404 Not Found - + 405 Method Not Allowed - 415 Unsupported Media Type - - 429 Too Many Requests - + 429 Too Many Requests * Retry-After - The number of seconds to wait before retrying the request.
500 Internal Server Error - */ @@ -466,7 +468,7 @@ private okhttp3.Call listMessagesValidateBeforeCall(@javax.annotation.Nonnull St /** * List Messages - * Returns a list of messages based on query parameters. + * Returns a list of messages based on query parameters. **Rate Limit:** This endpoint is rate limited to 3500 requests per 5 minutes per Source IP address. Exceeding the limit returns HTTP 429 with a `Retry-After` header. * @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) @@ -506,8 +508,9 @@ private okhttp3.Call listMessagesValidateBeforeCall(@javax.annotation.Nonnull St 401 Unauthorized - 403 Forbidden - 404 Not Found - + 405 Method Not Allowed - 415 Unsupported Media Type - - 429 Too Many Requests - + 429 Too Many Requests * Retry-After - The number of seconds to wait before retrying the request.
500 Internal Server Error - */ @@ -518,7 +521,7 @@ public MessagesList listMessages(@javax.annotation.Nonnull String accountId, @ja /** * List Messages - * Returns a list of messages based on query parameters. + * Returns a list of messages based on query parameters. **Rate Limit:** This endpoint is rate limited to 3500 requests per 5 minutes per Source IP address. Exceeding the limit returns HTTP 429 with a `Retry-After` header. * @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) @@ -558,8 +561,9 @@ public MessagesList listMessages(@javax.annotation.Nonnull String accountId, @ja 401 Unauthorized - 403 Forbidden - 404 Not Found - + 405 Method Not Allowed - 415 Unsupported Media Type - - 429 Too Many Requests - + 429 Too Many Requests * Retry-After - The number of seconds to wait before retrying the request.
500 Internal Server Error - */ @@ -571,7 +575,7 @@ public ApiResponse listMessagesWithHttpInfo(@javax.annotation.Nonn /** * List Messages (asynchronously) - * Returns a list of messages based on query parameters. + * Returns a list of messages based on query parameters. **Rate Limit:** This endpoint is rate limited to 3500 requests per 5 minutes per Source IP address. Exceeding the limit returns HTTP 429 with a `Retry-After` header. * @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) @@ -612,8 +616,9 @@ public ApiResponse listMessagesWithHttpInfo(@javax.annotation.Nonn 401 Unauthorized - 403 Forbidden - 404 Not Found - + 405 Method Not Allowed - 415 Unsupported Media Type - - 429 Too Many Requests - + 429 Too Many Requests * Retry-After - The number of seconds to wait before retrying the request.
500 Internal Server Error - */ diff --git a/src/main/java/com/bandwidth/sdk/model/CustomTooManyRequestsError.java b/src/main/java/com/bandwidth/sdk/model/CustomTooManyRequestsError.java new file mode 100644 index 00000000..bfaa61c4 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/CustomTooManyRequestsError.java @@ -0,0 +1,324 @@ +/* + * 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 java.util.Locale; +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.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 java.util.Locale; + +import com.bandwidth.sdk.JSON; + +/** + * CustomTooManyRequestsError + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0") +public class CustomTooManyRequestsError { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nonnull + private String description; + + public CustomTooManyRequestsError() { + } + + public CustomTooManyRequestsError 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 CustomTooManyRequestsError 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; + } + + /** + * 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 CustomTooManyRequestsError instance itself + */ + public CustomTooManyRequestsError 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; + } + CustomTooManyRequestsError customTooManyRequestsError = (CustomTooManyRequestsError) o; + return Objects.equals(this.type, customTooManyRequestsError.type) && + Objects.equals(this.description, customTooManyRequestsError.description)&& + Objects.equals(this.additionalProperties, customTooManyRequestsError.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(type, description, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomTooManyRequestsError {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).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(Arrays.asList("type", "description")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("type", "description")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CustomTooManyRequestsError + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CustomTooManyRequestsError.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in CustomTooManyRequestsError is not found in the empty JSON string", CustomTooManyRequestsError.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CustomTooManyRequestsError.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "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(Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CustomTooManyRequestsError.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CustomTooManyRequestsError' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CustomTooManyRequestsError.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CustomTooManyRequestsError 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 CustomTooManyRequestsError read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CustomTooManyRequestsError 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(Locale.ROOT, "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 CustomTooManyRequestsError given an JSON string + * + * @param jsonString JSON string + * @return An instance of CustomTooManyRequestsError + * @throws IOException if the JSON string is invalid with respect to CustomTooManyRequestsError + */ + public static CustomTooManyRequestsError fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CustomTooManyRequestsError.class); + } + + /** + * Convert an instance of CustomTooManyRequestsError 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/RbmMessageMedia.java b/src/main/java/com/bandwidth/sdk/model/RbmMessageMedia.java index a2ca3bb6..704e36dd 100644 --- a/src/main/java/com/bandwidth/sdk/model/RbmMessageMedia.java +++ b/src/main/java/com/bandwidth/sdk/model/RbmMessageMedia.java @@ -59,7 +59,7 @@ public class RbmMessageMedia { public static final String SERIALIZED_NAME_MEDIA = "media"; @SerializedName(SERIALIZED_NAME_MEDIA) @javax.annotation.Nonnull - private RbmMessageContentFile media; + private List media = new ArrayList<>(); public static final String SERIALIZED_NAME_SUGGESTIONS = "suggestions"; @SerializedName(SERIALIZED_NAME_SUGGESTIONS) @@ -69,21 +69,29 @@ public class RbmMessageMedia { public RbmMessageMedia() { } - public RbmMessageMedia media(@javax.annotation.Nonnull RbmMessageContentFile media) { + public RbmMessageMedia media(@javax.annotation.Nonnull List media) { this.media = media; return this; } + public RbmMessageMedia addMediaItem(RbmMessageContentFile mediaItem) { + if (this.media == null) { + this.media = new ArrayList<>(); + } + this.media.add(mediaItem); + return this; + } + /** * Get media * @return media */ @javax.annotation.Nonnull - public RbmMessageContentFile getMedia() { + public List getMedia() { return media; } - public void setMedia(@javax.annotation.Nonnull RbmMessageContentFile media) { + public void setMedia(@javax.annotation.Nonnull List media) { this.media = media; } @@ -233,8 +241,16 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the required field `media` - RbmMessageContentFile.validateJsonElement(jsonObj.get("media")); + // ensure the json data is an array + if (!jsonObj.get("media").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `media` to be an array in the JSON string but got `%s`", jsonObj.get("media").toString())); + } + + JsonArray jsonArraymedia = jsonObj.getAsJsonArray("media"); + // validate the required field `media` (array) + for (int i = 0; i < jsonArraymedia.size(); i++) { + RbmMessageContentFile.validateJsonElement(jsonArraymedia.get(i)); + }; if (jsonObj.get("suggestions") != null && !jsonObj.get("suggestions").isJsonNull()) { JsonArray jsonArraysuggestions = jsonObj.getAsJsonArray("suggestions"); if (jsonArraysuggestions != null) { diff --git a/src/main/java/com/bandwidth/sdk/model/TfvStatus.java b/src/main/java/com/bandwidth/sdk/model/TfvStatus.java index 3a5e1810..c78cdbda 100644 --- a/src/main/java/com/bandwidth/sdk/model/TfvStatus.java +++ b/src/main/java/com/bandwidth/sdk/model/TfvStatus.java @@ -25,6 +25,7 @@ import java.io.IOException; import java.time.OffsetDateTime; import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -105,6 +106,11 @@ public class TfvStatus { @javax.annotation.Nullable private String blockedReason; + public static final String SERIALIZED_NAME_CV_TOKEN = "cvToken"; + @SerializedName(SERIALIZED_NAME_CV_TOKEN) + @javax.annotation.Nullable + private String cvToken; + public TfvStatus() { } @@ -297,6 +303,25 @@ public void setBlockedReason(@javax.annotation.Nullable String blockedReason) { this.blockedReason = blockedReason; } + + public TfvStatus cvToken(@javax.annotation.Nullable String cvToken) { + this.cvToken = cvToken; + return this; + } + + /** + * The token provided by Campaign Verify to validate your political use case. Only required for 527 political organizations. If you are not a 527 political organization, this field should be omitted. If you pass an empty string, it will be passed along and potentially rejected. + * @return cvToken + */ + @javax.annotation.Nullable + public String getCvToken() { + return cvToken; + } + + public void setCvToken(@javax.annotation.Nullable String cvToken) { + this.cvToken = cvToken; + } + /** * A container for additional, undeclared properties. * This is a holder for any undeclared properties as specified with @@ -361,13 +386,25 @@ public boolean equals(Object o) { Objects.equals(this.modifiedDateTime, tfvStatus.modifiedDateTime) && Objects.equals(this.submission, tfvStatus.submission) && Objects.equals(this.blocked, tfvStatus.blocked) && - Objects.equals(this.blockedReason, tfvStatus.blockedReason)&& + Objects.equals(this.blockedReason, tfvStatus.blockedReason) && + Objects.equals(this.cvToken, tfvStatus.cvToken)&& Objects.equals(this.additionalProperties, tfvStatus.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(phoneNumber, status, internalTicketNumber, declineReasonDescription, resubmitAllowed, createdDateTime, modifiedDateTime, submission, blocked, blockedReason, additionalProperties); + return Objects.hash(phoneNumber, status, internalTicketNumber, declineReasonDescription, resubmitAllowed, createdDateTime, modifiedDateTime, submission, blocked, blockedReason, cvToken, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; } @Override @@ -384,6 +421,7 @@ public String toString() { sb.append(" submission: ").append(toIndentedString(submission)).append("\n"); sb.append(" blocked: ").append(toIndentedString(blocked)).append("\n"); sb.append(" blockedReason: ").append(toIndentedString(blockedReason)).append("\n"); + sb.append(" cvToken: ").append(toIndentedString(cvToken)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); @@ -406,7 +444,7 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("phoneNumber", "status", "internalTicketNumber", "declineReasonDescription", "resubmitAllowed", "createdDateTime", "modifiedDateTime", "submission", "blocked", "blockedReason")); + openapiFields = new HashSet(Arrays.asList("phoneNumber", "status", "internalTicketNumber", "declineReasonDescription", "resubmitAllowed", "createdDateTime", "modifiedDateTime", "submission", "blocked", "blockedReason", "cvToken")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(0); @@ -445,6 +483,9 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if ((jsonObj.get("blockedReason") != null && !jsonObj.get("blockedReason").isJsonNull()) && !jsonObj.get("blockedReason").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `blockedReason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("blockedReason").toString())); } + if ((jsonObj.get("cvToken") != null && !jsonObj.get("cvToken").isJsonNull()) && !jsonObj.get("cvToken").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `cvToken` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cvToken").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/src/main/java/com/bandwidth/sdk/model/VerificationRequest.java b/src/main/java/com/bandwidth/sdk/model/VerificationRequest.java index 1f78f0c2..e053dde4 100644 --- a/src/main/java/com/bandwidth/sdk/model/VerificationRequest.java +++ b/src/main/java/com/bandwidth/sdk/model/VerificationRequest.java @@ -150,6 +150,11 @@ public class VerificationRequest { @javax.annotation.Nullable private Boolean ageGatedContent; + public static final String SERIALIZED_NAME_CV_TOKEN = "cvToken"; + @SerializedName(SERIALIZED_NAME_CV_TOKEN) + @javax.annotation.Nullable + private String cvToken; + public VerificationRequest() { } @@ -504,6 +509,25 @@ public void setAgeGatedContent(@javax.annotation.Nullable Boolean ageGatedConten this.ageGatedContent = ageGatedContent; } + + public VerificationRequest cvToken(@javax.annotation.Nullable String cvToken) { + this.cvToken = cvToken; + return this; + } + + /** + * The token provided by Campaign Verify to validate your political use case. Only required for 527 political organizations. If you are not a 527 political organization, this field should be omitted. If you pass an empty string, it will be passed along and potentially rejected. + * @return cvToken + */ + @javax.annotation.Nullable + public String getCvToken() { + return cvToken; + } + + public void setCvToken(@javax.annotation.Nullable String cvToken) { + this.cvToken = cvToken; + } + /** * A container for additional, undeclared properties. * This is a holder for any undeclared properties as specified with @@ -576,7 +600,8 @@ public boolean equals(Object o) { Objects.equals(this.businessRegistrationType, verificationRequest.businessRegistrationType) && Objects.equals(this.businessEntityType, verificationRequest.businessEntityType) && Objects.equals(this.helpMessageResponse, verificationRequest.helpMessageResponse) && - Objects.equals(this.ageGatedContent, verificationRequest.ageGatedContent)&& + Objects.equals(this.ageGatedContent, verificationRequest.ageGatedContent) && + Objects.equals(this.cvToken, verificationRequest.cvToken)&& Objects.equals(this.additionalProperties, verificationRequest.additionalProperties); } @@ -586,7 +611,7 @@ private static boolean equalsNullable(JsonNullable a, JsonNullable b) @Override public int hashCode() { - return Objects.hash(businessAddress, businessContact, messageVolume, phoneNumbers, useCase, useCaseSummary, productionMessageContent, optInWorkflow, additionalInformation, isvReseller, privacyPolicyUrl, termsAndConditionsUrl, businessDba, businessRegistrationNumber, businessRegistrationType, businessEntityType, helpMessageResponse, ageGatedContent, additionalProperties); + return Objects.hash(businessAddress, businessContact, messageVolume, phoneNumbers, useCase, useCaseSummary, productionMessageContent, optInWorkflow, additionalInformation, isvReseller, privacyPolicyUrl, termsAndConditionsUrl, businessDba, businessRegistrationNumber, businessRegistrationType, businessEntityType, helpMessageResponse, ageGatedContent, cvToken, additionalProperties); } private static int hashCodeNullable(JsonNullable a) { @@ -618,6 +643,7 @@ public String toString() { sb.append(" businessEntityType: ").append(toIndentedString(businessEntityType)).append("\n"); sb.append(" helpMessageResponse: ").append(toIndentedString(helpMessageResponse)).append("\n"); sb.append(" ageGatedContent: ").append(toIndentedString(ageGatedContent)).append("\n"); + sb.append(" cvToken: ").append(toIndentedString(cvToken)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); @@ -640,7 +666,7 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("businessAddress", "businessContact", "messageVolume", "phoneNumbers", "useCase", "useCaseSummary", "productionMessageContent", "optInWorkflow", "additionalInformation", "isvReseller", "privacyPolicyUrl", "termsAndConditionsUrl", "businessDba", "businessRegistrationNumber", "businessRegistrationType", "businessEntityType", "helpMessageResponse", "ageGatedContent")); + openapiFields = new HashSet(Arrays.asList("businessAddress", "businessContact", "messageVolume", "phoneNumbers", "useCase", "useCaseSummary", "productionMessageContent", "optInWorkflow", "additionalInformation", "isvReseller", "privacyPolicyUrl", "termsAndConditionsUrl", "businessDba", "businessRegistrationNumber", "businessRegistrationType", "businessEntityType", "helpMessageResponse", "ageGatedContent", "cvToken")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(Arrays.asList("businessAddress", "businessContact", "messageVolume", "phoneNumbers", "useCase", "useCaseSummary", "productionMessageContent", "optInWorkflow")); @@ -716,6 +742,9 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if ((jsonObj.get("helpMessageResponse") != null && !jsonObj.get("helpMessageResponse").isJsonNull()) && !jsonObj.get("helpMessageResponse").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `helpMessageResponse` to be a primitive type in the JSON string but got `%s`", jsonObj.get("helpMessageResponse").toString())); } + if ((jsonObj.get("cvToken") != null && !jsonObj.get("cvToken").isJsonNull()) && !jsonObj.get("cvToken").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `cvToken` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cvToken").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/src/main/java/com/bandwidth/sdk/model/VerificationUpdateRequest.java b/src/main/java/com/bandwidth/sdk/model/VerificationUpdateRequest.java index 01fc2b18..744fc8d5 100644 --- a/src/main/java/com/bandwidth/sdk/model/VerificationUpdateRequest.java +++ b/src/main/java/com/bandwidth/sdk/model/VerificationUpdateRequest.java @@ -143,6 +143,11 @@ public class VerificationUpdateRequest { @javax.annotation.Nullable private Boolean ageGatedContent; + public static final String SERIALIZED_NAME_CV_TOKEN = "cvToken"; + @SerializedName(SERIALIZED_NAME_CV_TOKEN) + @javax.annotation.Nullable + private String cvToken; + public VerificationUpdateRequest() { } @@ -470,6 +475,25 @@ public void setAgeGatedContent(@javax.annotation.Nullable Boolean ageGatedConten this.ageGatedContent = ageGatedContent; } + + public VerificationUpdateRequest cvToken(@javax.annotation.Nullable String cvToken) { + this.cvToken = cvToken; + return this; + } + + /** + * The token provided by Campaign Verify to validate your political use case. Only required for 527 political organizations. If you are not a 527 political organization, this field should be omitted. If you pass an empty string, it will be passed along and potentially rejected. + * @return cvToken + */ + @javax.annotation.Nullable + public String getCvToken() { + return cvToken; + } + + public void setCvToken(@javax.annotation.Nullable String cvToken) { + this.cvToken = cvToken; + } + /** * A container for additional, undeclared properties. * This is a holder for any undeclared properties as specified with @@ -541,7 +565,8 @@ public boolean equals(Object o) { Objects.equals(this.businessRegistrationType, verificationUpdateRequest.businessRegistrationType) && Objects.equals(this.businessEntityType, verificationUpdateRequest.businessEntityType) && Objects.equals(this.helpMessageResponse, verificationUpdateRequest.helpMessageResponse) && - Objects.equals(this.ageGatedContent, verificationUpdateRequest.ageGatedContent)&& + Objects.equals(this.ageGatedContent, verificationUpdateRequest.ageGatedContent) && + Objects.equals(this.cvToken, verificationUpdateRequest.cvToken)&& Objects.equals(this.additionalProperties, verificationUpdateRequest.additionalProperties); } @@ -551,7 +576,7 @@ private static boolean equalsNullable(JsonNullable a, JsonNullable b) @Override public int hashCode() { - return Objects.hash(businessAddress, businessContact, messageVolume, useCase, useCaseSummary, productionMessageContent, optInWorkflow, additionalInformation, isvReseller, privacyPolicyUrl, termsAndConditionsUrl, businessDba, businessRegistrationNumber, businessRegistrationType, businessEntityType, helpMessageResponse, ageGatedContent, additionalProperties); + return Objects.hash(businessAddress, businessContact, messageVolume, useCase, useCaseSummary, productionMessageContent, optInWorkflow, additionalInformation, isvReseller, privacyPolicyUrl, termsAndConditionsUrl, businessDba, businessRegistrationNumber, businessRegistrationType, businessEntityType, helpMessageResponse, ageGatedContent, cvToken, additionalProperties); } private static int hashCodeNullable(JsonNullable a) { @@ -582,6 +607,7 @@ public String toString() { sb.append(" businessEntityType: ").append(toIndentedString(businessEntityType)).append("\n"); sb.append(" helpMessageResponse: ").append(toIndentedString(helpMessageResponse)).append("\n"); sb.append(" ageGatedContent: ").append(toIndentedString(ageGatedContent)).append("\n"); + sb.append(" cvToken: ").append(toIndentedString(cvToken)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); @@ -604,7 +630,7 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("businessAddress", "businessContact", "messageVolume", "useCase", "useCaseSummary", "productionMessageContent", "optInWorkflow", "additionalInformation", "isvReseller", "privacyPolicyUrl", "termsAndConditionsUrl", "businessDba", "businessRegistrationNumber", "businessRegistrationType", "businessEntityType", "helpMessageResponse", "ageGatedContent")); + openapiFields = new HashSet(Arrays.asList("businessAddress", "businessContact", "messageVolume", "useCase", "useCaseSummary", "productionMessageContent", "optInWorkflow", "additionalInformation", "isvReseller", "privacyPolicyUrl", "termsAndConditionsUrl", "businessDba", "businessRegistrationNumber", "businessRegistrationType", "businessEntityType", "helpMessageResponse", "ageGatedContent", "cvToken")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(Arrays.asList("businessAddress", "businessContact", "messageVolume", "useCase", "useCaseSummary", "productionMessageContent", "optInWorkflow")); @@ -674,6 +700,9 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if ((jsonObj.get("helpMessageResponse") != null && !jsonObj.get("helpMessageResponse").isJsonNull()) && !jsonObj.get("helpMessageResponse").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `helpMessageResponse` to be a primitive type in the JSON string but got `%s`", jsonObj.get("helpMessageResponse").toString())); } + if ((jsonObj.get("cvToken") != null && !jsonObj.get("cvToken").isJsonNull()) && !jsonObj.get("cvToken").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `cvToken` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cvToken").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { From 7e425ef5e61edeb3c5b63fe3b1c6396f747a0998 Mon Sep 17 00:00:00 2001 From: ckoegel Date: Thu, 22 Jan 2026 17:05:25 -0500 Subject: [PATCH 2/5] undo custom 429 --- .openapi-generator/FILES | 2 - README.md | 1 - api/openapi.yaml | 32 +- bandwidth.yml | 24 +- src/main/java/com/bandwidth/sdk/JSON.java | 1 - .../com/bandwidth/sdk/api/MessagesApi.java | 1 - .../sdk/model/CustomTooManyRequestsError.java | 324 ------------------ 7 files changed, 17 insertions(+), 368 deletions(-) delete mode 100644 src/main/java/com/bandwidth/sdk/model/CustomTooManyRequestsError.java diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 1dcce599..15c18499 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -48,7 +48,6 @@ docs/CreateMessageRequestError.md docs/CreateMultiChannelMessageResponse.md docs/CreateSyncLookupResponse.md docs/CreateSyncLookupResponseData.md -docs/CustomTooManyRequestsError.md docs/DeactivationEventEnum.md docs/DisconnectCallback.md docs/Diversion.md @@ -276,7 +275,6 @@ src/main/java/com/bandwidth/sdk/model/CreateMessageRequestError.java src/main/java/com/bandwidth/sdk/model/CreateMultiChannelMessageResponse.java src/main/java/com/bandwidth/sdk/model/CreateSyncLookupResponse.java src/main/java/com/bandwidth/sdk/model/CreateSyncLookupResponseData.java -src/main/java/com/bandwidth/sdk/model/CustomTooManyRequestsError.java src/main/java/com/bandwidth/sdk/model/DeactivationEventEnum.java src/main/java/com/bandwidth/sdk/model/DisconnectCallback.java src/main/java/com/bandwidth/sdk/model/Diversion.java diff --git a/README.md b/README.md index b05ebb4f..11380861 100644 --- a/README.md +++ b/README.md @@ -226,7 +226,6 @@ Class | Method | HTTP request | Description - [CreateMultiChannelMessageResponse](docs/CreateMultiChannelMessageResponse.md) - [CreateSyncLookupResponse](docs/CreateSyncLookupResponse.md) - [CreateSyncLookupResponseData](docs/CreateSyncLookupResponseData.md) - - [CustomTooManyRequestsError](docs/CustomTooManyRequestsError.md) - [DeactivationEventEnum](docs/DeactivationEventEnum.md) - [DisconnectCallback](docs/DisconnectCallback.md) - [Diversion](docs/Diversion.md) diff --git a/api/openapi.yaml b/api/openapi.yaml index debf5003..b5b2311e 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -727,8 +727,12 @@ paths: "429": content: application/json: + example: + type: rate_limit_exceeded + description: Rate limit exceeded. Wait for Retry-After time before + sending another request. schema: - $ref: "#/components/schemas/customTooManyRequestsError" + $ref: "#/components/schemas/messagingRequestError" description: Too Many Requests headers: Retry-After: @@ -7551,11 +7555,15 @@ components: schema: $ref: "#/components/schemas/multiChannelError" description: Internal Server Error - customTooManyRequestsError: + listMessagesTooManyRequestsError: content: application/json: + example: + type: rate_limit_exceeded + description: Rate limit exceeded. Wait for Retry-After time before sending + another request. schema: - $ref: "#/components/schemas/customTooManyRequestsError" + $ref: "#/components/schemas/messagingRequestError" description: Too Many Requests headers: Retry-After: @@ -9773,24 +9781,6 @@ components: - segmentCount - time - to - customTooManyRequestsError: - example: - description: Rate limit exceeded. Wait for Retry-After time before sending - another request. - type: rate_limit_exceeded - properties: - type: - example: rate_limit_exceeded - type: string - description: - example: Rate limit exceeded. Wait for Retry-After time before sending another - request. - type: string - required: - - description - - type - title: CustomTooManyRequestsError - type: object callbackMethodEnum: default: POST description: The HTTP method to use to deliver the callback. GET or POST. Default diff --git a/bandwidth.yml b/bandwidth.yml index 4c32a6b9..7c08f291 100644 --- a/bandwidth.yml +++ b/bandwidth.yml @@ -218,7 +218,7 @@ paths: '415': $ref: '#/components/responses/messagingInvalidMediaTypeError' '429': - $ref: '#/components/responses/customTooManyRequestsError' + $ref: '#/components/responses/listMessagesTooManyRequestsError' '500': $ref: '#/components/responses/messagingInternalServerError' post: @@ -2954,21 +2954,6 @@ components: - direction - to - from - customTooManyRequestsError: - title: CustomTooManyRequestsError - type: object - properties: - type: - type: string - example: rate_limit_exceeded - description: - type: string - example: >- - Rate limit exceeded. Wait for Retry-After time before sending - another request. - required: - - type - - description callbackMethodEnum: type: string nullable: true @@ -6775,7 +6760,7 @@ components: - type: internal-server-error description: Internal server error. No further information available source: {} - customTooManyRequestsError: + listMessagesTooManyRequestsError: description: Too Many Requests headers: Retry-After: @@ -6786,7 +6771,10 @@ components: content: application/json: schema: - $ref: '#/components/schemas/customTooManyRequestsError' + $ref: "#/components/schemas/messagingRequestError" + example: + type: rate_limit_exceeded + description: Rate limit exceeded. Wait for Retry-After time before sending another request. createCallResponse: description: Created headers: diff --git a/src/main/java/com/bandwidth/sdk/JSON.java b/src/main/java/com/bandwidth/sdk/JSON.java index d4b4b787..518e07dd 100644 --- a/src/main/java/com/bandwidth/sdk/JSON.java +++ b/src/main/java/com/bandwidth/sdk/JSON.java @@ -184,7 +184,6 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.CreateMultiChannelMessageResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.CreateSyncLookupResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.CreateSyncLookupResponseData.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.CustomTooManyRequestsError.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.DisconnectCallback.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.Diversion.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.DtmfCallback.CustomTypeAdapterFactory()); diff --git a/src/main/java/com/bandwidth/sdk/api/MessagesApi.java b/src/main/java/com/bandwidth/sdk/api/MessagesApi.java index c3cf7375..052fbc78 100644 --- a/src/main/java/com/bandwidth/sdk/api/MessagesApi.java +++ b/src/main/java/com/bandwidth/sdk/api/MessagesApi.java @@ -28,7 +28,6 @@ import com.bandwidth.sdk.model.CreateMessageRequestError; -import com.bandwidth.sdk.model.CustomTooManyRequestsError; import com.bandwidth.sdk.model.ListMessageDirectionEnum; import com.bandwidth.sdk.model.Message; import com.bandwidth.sdk.model.MessageRequest; diff --git a/src/main/java/com/bandwidth/sdk/model/CustomTooManyRequestsError.java b/src/main/java/com/bandwidth/sdk/model/CustomTooManyRequestsError.java deleted file mode 100644 index bfaa61c4..00000000 --- a/src/main/java/com/bandwidth/sdk/model/CustomTooManyRequestsError.java +++ /dev/null @@ -1,324 +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 java.util.Locale; -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.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 java.util.Locale; - -import com.bandwidth.sdk.JSON; - -/** - * CustomTooManyRequestsError - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0") -public class CustomTooManyRequestsError { - public static final String SERIALIZED_NAME_TYPE = "type"; - @SerializedName(SERIALIZED_NAME_TYPE) - @javax.annotation.Nonnull - private String type; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - @javax.annotation.Nonnull - private String description; - - public CustomTooManyRequestsError() { - } - - public CustomTooManyRequestsError 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 CustomTooManyRequestsError 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; - } - - /** - * 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 CustomTooManyRequestsError instance itself - */ - public CustomTooManyRequestsError 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; - } - CustomTooManyRequestsError customTooManyRequestsError = (CustomTooManyRequestsError) o; - return Objects.equals(this.type, customTooManyRequestsError.type) && - Objects.equals(this.description, customTooManyRequestsError.description)&& - Objects.equals(this.additionalProperties, customTooManyRequestsError.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(type, description, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CustomTooManyRequestsError {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).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(Arrays.asList("type", "description")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("type", "description")); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to CustomTooManyRequestsError - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!CustomTooManyRequestsError.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in CustomTooManyRequestsError is not found in the empty JSON string", CustomTooManyRequestsError.openapiRequiredFields.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CustomTooManyRequestsError.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException(String.format(Locale.ROOT, "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(Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); - } - if (!jsonObj.get("description").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CustomTooManyRequestsError.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CustomTooManyRequestsError' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CustomTooManyRequestsError.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CustomTooManyRequestsError 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 CustomTooManyRequestsError read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - CustomTooManyRequestsError 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(Locale.ROOT, "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 CustomTooManyRequestsError given an JSON string - * - * @param jsonString JSON string - * @return An instance of CustomTooManyRequestsError - * @throws IOException if the JSON string is invalid with respect to CustomTooManyRequestsError - */ - public static CustomTooManyRequestsError fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CustomTooManyRequestsError.class); - } - - /** - * Convert an instance of CustomTooManyRequestsError to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - From 17900324b4fae1a72bf3ee9af854c17bdd071a70 Mon Sep 17 00:00:00 2001 From: ckoegel Date: Thu, 22 Jan 2026 17:12:05 -0500 Subject: [PATCH 3/5] update rbm tests --- .../com/bandwidth/sdk/smoke/MultiChannelApiTest.java | 12 ++++++------ .../sdk/unit/models/RbmMessageMediaTest.java | 5 +++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/test/java/com/bandwidth/sdk/smoke/MultiChannelApiTest.java b/src/test/java/com/bandwidth/sdk/smoke/MultiChannelApiTest.java index 42761d1f..27389e4e 100644 --- a/src/test/java/com/bandwidth/sdk/smoke/MultiChannelApiTest.java +++ b/src/test/java/com/bandwidth/sdk/smoke/MultiChannelApiTest.java @@ -244,7 +244,6 @@ public void createMultiChannelRBMTextMessageTest() throws ApiException { } @Test - @Disabled("skip until messaging updates API") public void createMultiChannelRBMMediaMessageTest() throws ApiException { MultiChannelChannelListRequestObject channelListRBMObject = new MultiChannelChannelListRequestObject( new MultiChannelChannelListRBMObject() @@ -253,10 +252,10 @@ public void createMultiChannelRBMMediaMessageTest() throws ApiException { .channel(MultiChannelMessageChannelEnum.RBM) .content(new MultiChannelChannelListRBMObjectAllOfContent( new RbmMessageMedia() - .media(new RbmMessageContentFile() + .media(Arrays.asList(new RbmMessageContentFile() .fileUrl(URI.create("https://www.example.com/image1.png")) .thumbnailUrl(URI.create("https://www.example.com/thumbnail")) - ) + )) .suggestions(Arrays.asList( new MultiChannelAction(new RbmActionDial() .type(RbmActionTypeEnum.DIAL_PHONE) @@ -305,9 +304,10 @@ public void createMultiChannelRBMMediaMessageTest() throws ApiException { assertThat(channelListObject.getContent(), instanceOf(MultiChannelChannelListRBMObjectAllOfContent.class)); assertThat(channelListObject.getContent().getActualInstance(), instanceOf(RbmMessageMedia.class)); RbmMessageMedia rbmContent = channelListObject.getContent().getRbmMessageMedia(); - assertThat(rbmContent.getMedia(), instanceOf(RbmMessageContentFile.class)); - assertThat(rbmContent.getMedia().getFileUrl(), instanceOf(URI.class)); - assertThat(rbmContent.getMedia().getThumbnailUrl(), instanceOf(URI.class)); + assertThat(rbmContent.getMedia(), instanceOf(List.class)); + assertThat(rbmContent.getMedia().get(0), instanceOf(RbmMessageContentFile.class)); + assertThat(rbmContent.getMedia().get(0).getFileUrl(), instanceOf(URI.class)); + assertThat(rbmContent.getMedia().get(0).getThumbnailUrl(), instanceOf(URI.class)); assertThat(rbmContent.getSuggestions(), instanceOf(List.class)); assertThat(rbmContent.getSuggestions().get(0), instanceOf(MultiChannelAction.class)); assertThat(rbmContent.getSuggestions().get(0).getActualInstance(), instanceOf(RbmActionDial.class)); diff --git a/src/test/java/com/bandwidth/sdk/unit/models/RbmMessageMediaTest.java b/src/test/java/com/bandwidth/sdk/unit/models/RbmMessageMediaTest.java index ec06d363..fc1276cb 100644 --- a/src/test/java/com/bandwidth/sdk/unit/models/RbmMessageMediaTest.java +++ b/src/test/java/com/bandwidth/sdk/unit/models/RbmMessageMediaTest.java @@ -30,7 +30,7 @@ */ public class RbmMessageMediaTest { private final RbmMessageMedia model = new RbmMessageMedia() - .media(new RbmMessageContentFile()) + .media(new ArrayList(Arrays.asList(new RbmMessageContentFile()))) .suggestions(new ArrayList(Arrays.asList(new MultiChannelAction()))); /** @@ -46,7 +46,8 @@ public void testRbmMessageMedia() { */ @Test public void mediaTest() { - assertThat(model.getMedia(), instanceOf(RbmMessageContentFile.class)); + assertThat(model.getMedia(), instanceOf(ArrayList.class)); + assertThat(model.getMedia().get(0), instanceOf(RbmMessageContentFile.class)); } /** From db06d0378fa06faa64114f744ea84890fd6fb294 Mon Sep 17 00:00:00 2001 From: ckoegel Date: Tue, 27 Jan 2026 10:54:46 -0500 Subject: [PATCH 4/5] remove doc --- docs/CustomTooManyRequestsError.md | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 docs/CustomTooManyRequestsError.md diff --git a/docs/CustomTooManyRequestsError.md b/docs/CustomTooManyRequestsError.md deleted file mode 100644 index f4827874..00000000 --- a/docs/CustomTooManyRequestsError.md +++ /dev/null @@ -1,14 +0,0 @@ - - -# CustomTooManyRequestsError - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**type** | **String** | | | -|**description** | **String** | | | - - - From 29d2f53072f27c7ec85b4be4b20301031eb8ac94 Mon Sep 17 00:00:00 2001 From: ckoegel Date: Tue, 27 Jan 2026 12:21:46 -0500 Subject: [PATCH 5/5] update rbm smoke test --- .../sdk/smoke/MultiChannelApiTest.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/test/java/com/bandwidth/sdk/smoke/MultiChannelApiTest.java b/src/test/java/com/bandwidth/sdk/smoke/MultiChannelApiTest.java index 27389e4e..3e16d942 100644 --- a/src/test/java/com/bandwidth/sdk/smoke/MultiChannelApiTest.java +++ b/src/test/java/com/bandwidth/sdk/smoke/MultiChannelApiTest.java @@ -465,6 +465,27 @@ public void createMultiChannelRBMRichCarouselMessageTest() throws ApiException { assertThat(rbmCard.getCardWidth(), instanceOf(CardWidthEnum.class)); assertThat(rbmCard.getCardWidth(), equalTo(CardWidthEnum.MEDIUM)); assertThat(rbmCard.getCardContents(), instanceOf(List.class)); + assertThat(rbmCard.getCardContents().get(0), instanceOf(RbmCardContent.class)); + RbmCardContent card1 = rbmCard.getCardContents().get(0); + assertThat(card1.getTitle(), instanceOf(String.class)); + assertThat(card1.getDescription(), instanceOf(String.class)); + assertThat(card1.getMedia(), instanceOf(RbmCardContentMedia.class)); + RbmCardContentMedia media = card1.getMedia(); + assertThat(media.getFileUrl(), instanceOf(URI.class)); + assertThat(media.getThumbnailUrl(), instanceOf(URI.class)); + assertThat(media.getHeight(), instanceOf(RbmMediaHeightEnum.class)); + assertThat(card1.getSuggestions(), instanceOf(List.class)); + assertThat(card1.getSuggestions().get(0), instanceOf(MultiChannelAction.class)); + assertThat(card1.getSuggestions().get(0).getActualInstance(), instanceOf(RbmActionDial.class)); + RbmActionDial rbmActionDial = card1.getSuggestions().get(0).getRbmActionDial(); + assertThat(rbmActionDial.getType(), instanceOf(RbmActionTypeEnum.class)); + assertThat(rbmActionDial.getType(), equalTo(RbmActionTypeEnum.DIAL_PHONE)); + assertThat(rbmActionDial.getText(), instanceOf(String.class)); + assertThat(rbmActionDial.getPostbackData(), instanceOf(byte[].class)); + assertThat(rbmActionDial.getPhoneNumber(), instanceOf(String.class)); + assertThat(rbmCard.getCardContents().get(0), instanceOf(RbmCardContent.class)); + RbmCardContent card2 = rbmCard.getCardContents().get(1); + assertThat(card2.getTitle(), instanceOf(String.class)); assertThat(channelListObject.getOwner(), equalTo(BW_NUMBER)); } }