Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 40 additions & 1 deletion api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
27 changes: 25 additions & 2 deletions bandwidth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
5 changes: 3 additions & 2 deletions docs/MessagesApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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. <br> |
| **500** | Internal Server Error | - |

18 changes: 11 additions & 7 deletions src/main/java/com/bandwidth/sdk/api/MessagesApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,9 @@ public okhttp3.Call createMessageAsync(@javax.annotation.Nonnull String accountI
<tr><td> 401 </td><td> Unauthorized </td><td> - </td></tr>
<tr><td> 403 </td><td> Forbidden </td><td> - </td></tr>
<tr><td> 404 </td><td> Not Found </td><td> - </td></tr>
<tr><td> 405 </td><td> Method Not Allowed </td><td> - </td></tr>
<tr><td> 415 </td><td> Unsupported Media Type </td><td> - </td></tr>
<tr><td> 429 </td><td> Too Many Requests </td><td> - </td></tr>
<tr><td> 429 </td><td> Too Many Requests </td><td> * Retry-After - The number of seconds to wait before retrying the request. <br> </td></tr>
<tr><td> 500 </td><td> Internal Server Error </td><td> - </td></tr>
</table>
*/
Expand Down Expand Up @@ -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 &#x60;Retry-After&#x60; 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. &#39;%2B1919&#39;). (optional)
Expand Down Expand Up @@ -506,8 +507,9 @@ private okhttp3.Call listMessagesValidateBeforeCall(@javax.annotation.Nonnull St
<tr><td> 401 </td><td> Unauthorized </td><td> - </td></tr>
<tr><td> 403 </td><td> Forbidden </td><td> - </td></tr>
<tr><td> 404 </td><td> Not Found </td><td> - </td></tr>
<tr><td> 405 </td><td> Method Not Allowed </td><td> - </td></tr>
<tr><td> 415 </td><td> Unsupported Media Type </td><td> - </td></tr>
<tr><td> 429 </td><td> Too Many Requests </td><td> - </td></tr>
<tr><td> 429 </td><td> Too Many Requests </td><td> * Retry-After - The number of seconds to wait before retrying the request. <br> </td></tr>
<tr><td> 500 </td><td> Internal Server Error </td><td> - </td></tr>
</table>
*/
Expand All @@ -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 &#x60;Retry-After&#x60; 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. &#39;%2B1919&#39;). (optional)
Expand Down Expand Up @@ -558,8 +560,9 @@ public MessagesList listMessages(@javax.annotation.Nonnull String accountId, @ja
<tr><td> 401 </td><td> Unauthorized </td><td> - </td></tr>
<tr><td> 403 </td><td> Forbidden </td><td> - </td></tr>
<tr><td> 404 </td><td> Not Found </td><td> - </td></tr>
<tr><td> 405 </td><td> Method Not Allowed </td><td> - </td></tr>
<tr><td> 415 </td><td> Unsupported Media Type </td><td> - </td></tr>
<tr><td> 429 </td><td> Too Many Requests </td><td> - </td></tr>
<tr><td> 429 </td><td> Too Many Requests </td><td> * Retry-After - The number of seconds to wait before retrying the request. <br> </td></tr>
<tr><td> 500 </td><td> Internal Server Error </td><td> - </td></tr>
</table>
*/
Expand All @@ -571,7 +574,7 @@ public ApiResponse<MessagesList> 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 &#x60;Retry-After&#x60; 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. &#39;%2B1919&#39;). (optional)
Expand Down Expand Up @@ -612,8 +615,9 @@ public ApiResponse<MessagesList> listMessagesWithHttpInfo(@javax.annotation.Nonn
<tr><td> 401 </td><td> Unauthorized </td><td> - </td></tr>
<tr><td> 403 </td><td> Forbidden </td><td> - </td></tr>
<tr><td> 404 </td><td> Not Found </td><td> - </td></tr>
<tr><td> 405 </td><td> Method Not Allowed </td><td> - </td></tr>
<tr><td> 415 </td><td> Unsupported Media Type </td><td> - </td></tr>
<tr><td> 429 </td><td> Too Many Requests </td><td> - </td></tr>
<tr><td> 429 </td><td> Too Many Requests </td><td> * Retry-After - The number of seconds to wait before retrying the request. <br> </td></tr>
<tr><td> 500 </td><td> Internal Server Error </td><td> - </td></tr>
</table>
*/
Expand Down
26 changes: 23 additions & 3 deletions src/test/java/com/bandwidth/sdk/smoke/MultiChannelApiTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

/**
Expand Down