diff --git a/api/openapi.yaml b/api/openapi.yaml index 1ade1211..b5b2311e 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: @@ -718,9 +727,21 @@ 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/messagingRequestError" 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 +7555,24 @@ components: schema: $ref: "#/components/schemas/multiChannelError" description: Internal Server Error + 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/messagingRequestError" + 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: diff --git a/bandwidth.yml b/bandwidth.yml index 61f6cfc9..7c08f291 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/listMessagesTooManyRequestsError' '500': $ref: '#/components/responses/messagingInternalServerError' post: @@ -6752,6 +6760,21 @@ components: - type: internal-server-error description: Internal server error. No further information available source: {} + listMessagesTooManyRequestsError: + 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/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/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/src/main/java/com/bandwidth/sdk/api/MessagesApi.java b/src/main/java/com/bandwidth/sdk/api/MessagesApi.java index 12a1001f..052fbc78 100644 --- a/src/main/java/com/bandwidth/sdk/api/MessagesApi.java +++ b/src/main/java/com/bandwidth/sdk/api/MessagesApi.java @@ -295,8 +295,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 +467,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 +507,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 +520,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 +560,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 +574,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 +615,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/test/java/com/bandwidth/sdk/smoke/MultiChannelApiTest.java b/src/test/java/com/bandwidth/sdk/smoke/MultiChannelApiTest.java index 242f6582..3e16d942 100644 --- a/src/test/java/com/bandwidth/sdk/smoke/MultiChannelApiTest.java +++ b/src/test/java/com/bandwidth/sdk/smoke/MultiChannelApiTest.java @@ -306,9 +306,8 @@ public void createMultiChannelRBMMediaMessageTest() throws ApiException { RbmMessageMedia rbmContent = channelListObject.getContent().getRbmMessageMedia(); assertThat(rbmContent.getMedia(), instanceOf(List.class)); assertThat(rbmContent.getMedia().get(0), instanceOf(RbmMessageContentFile.class)); - RbmMessageContentFile rbmMediaFile = rbmContent.getMedia().get(0); - assertThat(rbmMediaFile.getFileUrl(), instanceOf(URI.class)); - assertThat(rbmMediaFile.getThumbnailUrl(), instanceOf(URI.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)); @@ -466,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)); } } 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 0838c1de..fc1276cb 100644 --- a/src/test/java/com/bandwidth/sdk/unit/models/RbmMessageMediaTest.java +++ b/src/test/java/com/bandwidth/sdk/unit/models/RbmMessageMediaTest.java @@ -47,7 +47,7 @@ public void testRbmMessageMedia() { @Test public void mediaTest() { assertThat(model.getMedia(), instanceOf(ArrayList.class)); - + assertThat(model.getMedia().get(0), instanceOf(RbmMessageContentFile.class)); } /**