Skip to content

Commit c0ab441

Browse files
band-swi-release-engineering[bot]DX-Bandwidthckoegel
authored
SWI-9389 Update SDK Based on Recent Spec Changes (#224)
* Generate SDK with OpenAPI Generator Version * undo custom 429 * update rbm tests * remove doc * update rbm smoke test --------- Co-authored-by: DX-Bandwidth <dx@bandwidth.com> Co-authored-by: ckoegel <ckoegel1006@gmail.com> Co-authored-by: Cameron Koegel <53310569+ckoegel@users.noreply.github.com>
1 parent 1ba0586 commit c0ab441

File tree

6 files changed

+103
-16
lines changed

6 files changed

+103
-16
lines changed

api/openapi.yaml

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,10 @@ paths:
399399
url: https://messaging.bandwidth.com/api/v2
400400
/users/{accountId}/messages:
401401
get:
402-
description: Returns a list of messages based on query parameters.
402+
description: |
403+
Returns a list of messages based on query parameters.
404+
405+
**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.
403406
operationId: listMessages
404407
parameters:
405408
- description: Your Bandwidth Account ID.
@@ -709,6 +712,12 @@ paths:
709712
schema:
710713
$ref: "#/components/schemas/messagingRequestError"
711714
description: Not Found
715+
"405":
716+
content:
717+
application/json:
718+
schema:
719+
$ref: "#/components/schemas/messagingRequestError"
720+
description: Method Not Allowed
712721
"415":
713722
content:
714723
application/json:
@@ -718,9 +727,21 @@ paths:
718727
"429":
719728
content:
720729
application/json:
730+
example:
731+
type: rate_limit_exceeded
732+
description: Rate limit exceeded. Wait for Retry-After time before
733+
sending another request.
721734
schema:
722735
$ref: "#/components/schemas/messagingRequestError"
723736
description: Too Many Requests
737+
headers:
738+
Retry-After:
739+
description: The number of seconds to wait before retrying the request.
740+
explode: false
741+
schema:
742+
example: 300
743+
type: integer
744+
style: simple
724745
"500":
725746
content:
726747
application/json:
@@ -7534,6 +7555,24 @@ components:
75347555
schema:
75357556
$ref: "#/components/schemas/multiChannelError"
75367557
description: Internal Server Error
7558+
listMessagesTooManyRequestsError:
7559+
content:
7560+
application/json:
7561+
example:
7562+
type: rate_limit_exceeded
7563+
description: Rate limit exceeded. Wait for Retry-After time before sending
7564+
another request.
7565+
schema:
7566+
$ref: "#/components/schemas/messagingRequestError"
7567+
description: Too Many Requests
7568+
headers:
7569+
Retry-After:
7570+
description: The number of seconds to wait before retrying the request.
7571+
explode: false
7572+
schema:
7573+
example: 300
7574+
type: integer
7575+
style: simple
75377576
createCallResponse:
75387577
content:
75397578
application/json:

bandwidth.yml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,13 @@ paths:
163163
/users/{accountId}/messages:
164164
get:
165165
summary: List Messages
166-
description: Returns a list of messages based on query parameters.
166+
description: >
167+
Returns a list of messages based on query parameters.
168+
169+
170+
**Rate Limit:** This endpoint is rate limited to 3500 requests per 5
171+
minutes per Source IP address. Exceeding the limit returns HTTP 429 with
172+
a `Retry-After` header.
167173
operationId: listMessages
168174
tags:
169175
- Messages
@@ -207,10 +213,12 @@ paths:
207213
$ref: '#/components/responses/messagingForbiddenError'
208214
'404':
209215
$ref: '#/components/responses/messagingNotFoundError'
216+
'405':
217+
$ref: '#/components/responses/messagingMethodNotAllowedError'
210218
'415':
211219
$ref: '#/components/responses/messagingInvalidMediaTypeError'
212220
'429':
213-
$ref: '#/components/responses/messagingTooManyRequestsError'
221+
$ref: '#/components/responses/listMessagesTooManyRequestsError'
214222
'500':
215223
$ref: '#/components/responses/messagingInternalServerError'
216224
post:
@@ -6752,6 +6760,21 @@ components:
67526760
- type: internal-server-error
67536761
description: Internal server error. No further information available
67546762
source: {}
6763+
listMessagesTooManyRequestsError:
6764+
description: Too Many Requests
6765+
headers:
6766+
Retry-After:
6767+
description: The number of seconds to wait before retrying the request.
6768+
schema:
6769+
type: integer
6770+
example: 300
6771+
content:
6772+
application/json:
6773+
schema:
6774+
$ref: "#/components/schemas/messagingRequestError"
6775+
example:
6776+
type: rate_limit_exceeded
6777+
description: Rate limit exceeded. Wait for Retry-After time before sending another request.
67556778
createCallResponse:
67566779
description: Created
67576780
headers:

docs/MessagesApi.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public class Example {
9797
9898
List Messages
9999

100-
Returns a list of messages based on query parameters.
100+
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.
101101

102102
### Example
103103
```java
@@ -220,7 +220,8 @@ public class Example {
220220
| **401** | Unauthorized | - |
221221
| **403** | Forbidden | - |
222222
| **404** | Not Found | - |
223+
| **405** | Method Not Allowed | - |
223224
| **415** | Unsupported Media Type | - |
224-
| **429** | Too Many Requests | - |
225+
| **429** | Too Many Requests | * Retry-After - The number of seconds to wait before retrying the request. <br> |
225226
| **500** | Internal Server Error | - |
226227

src/main/java/com/bandwidth/sdk/api/MessagesApi.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,9 @@ public okhttp3.Call createMessageAsync(@javax.annotation.Nonnull String accountI
295295
<tr><td> 401 </td><td> Unauthorized </td><td> - </td></tr>
296296
<tr><td> 403 </td><td> Forbidden </td><td> - </td></tr>
297297
<tr><td> 404 </td><td> Not Found </td><td> - </td></tr>
298+
<tr><td> 405 </td><td> Method Not Allowed </td><td> - </td></tr>
298299
<tr><td> 415 </td><td> Unsupported Media Type </td><td> - </td></tr>
299-
<tr><td> 429 </td><td> Too Many Requests </td><td> - </td></tr>
300+
<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>
300301
<tr><td> 500 </td><td> Internal Server Error </td><td> - </td></tr>
301302
</table>
302303
*/
@@ -466,7 +467,7 @@ private okhttp3.Call listMessagesValidateBeforeCall(@javax.annotation.Nonnull St
466467

467468
/**
468469
* List Messages
469-
* Returns a list of messages based on query parameters.
470+
* 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.
470471
* @param accountId Your Bandwidth Account ID. (required)
471472
* @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)
472473
* @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)
@@ -506,8 +507,9 @@ private okhttp3.Call listMessagesValidateBeforeCall(@javax.annotation.Nonnull St
506507
<tr><td> 401 </td><td> Unauthorized </td><td> - </td></tr>
507508
<tr><td> 403 </td><td> Forbidden </td><td> - </td></tr>
508509
<tr><td> 404 </td><td> Not Found </td><td> - </td></tr>
510+
<tr><td> 405 </td><td> Method Not Allowed </td><td> - </td></tr>
509511
<tr><td> 415 </td><td> Unsupported Media Type </td><td> - </td></tr>
510-
<tr><td> 429 </td><td> Too Many Requests </td><td> - </td></tr>
512+
<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>
511513
<tr><td> 500 </td><td> Internal Server Error </td><td> - </td></tr>
512514
</table>
513515
*/
@@ -518,7 +520,7 @@ public MessagesList listMessages(@javax.annotation.Nonnull String accountId, @ja
518520

519521
/**
520522
* List Messages
521-
* Returns a list of messages based on query parameters.
523+
* 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.
522524
* @param accountId Your Bandwidth Account ID. (required)
523525
* @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)
524526
* @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)
@@ -558,8 +560,9 @@ public MessagesList listMessages(@javax.annotation.Nonnull String accountId, @ja
558560
<tr><td> 401 </td><td> Unauthorized </td><td> - </td></tr>
559561
<tr><td> 403 </td><td> Forbidden </td><td> - </td></tr>
560562
<tr><td> 404 </td><td> Not Found </td><td> - </td></tr>
563+
<tr><td> 405 </td><td> Method Not Allowed </td><td> - </td></tr>
561564
<tr><td> 415 </td><td> Unsupported Media Type </td><td> - </td></tr>
562-
<tr><td> 429 </td><td> Too Many Requests </td><td> - </td></tr>
565+
<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>
563566
<tr><td> 500 </td><td> Internal Server Error </td><td> - </td></tr>
564567
</table>
565568
*/
@@ -571,7 +574,7 @@ public ApiResponse<MessagesList> listMessagesWithHttpInfo(@javax.annotation.Nonn
571574

572575
/**
573576
* List Messages (asynchronously)
574-
* Returns a list of messages based on query parameters.
577+
* 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.
575578
* @param accountId Your Bandwidth Account ID. (required)
576579
* @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)
577580
* @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)
@@ -612,8 +615,9 @@ public ApiResponse<MessagesList> listMessagesWithHttpInfo(@javax.annotation.Nonn
612615
<tr><td> 401 </td><td> Unauthorized </td><td> - </td></tr>
613616
<tr><td> 403 </td><td> Forbidden </td><td> - </td></tr>
614617
<tr><td> 404 </td><td> Not Found </td><td> - </td></tr>
618+
<tr><td> 405 </td><td> Method Not Allowed </td><td> - </td></tr>
615619
<tr><td> 415 </td><td> Unsupported Media Type </td><td> - </td></tr>
616-
<tr><td> 429 </td><td> Too Many Requests </td><td> - </td></tr>
620+
<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>
617621
<tr><td> 500 </td><td> Internal Server Error </td><td> - </td></tr>
618622
</table>
619623
*/

src/test/java/com/bandwidth/sdk/smoke/MultiChannelApiTest.java

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,8 @@ public void createMultiChannelRBMMediaMessageTest() throws ApiException {
306306
RbmMessageMedia rbmContent = channelListObject.getContent().getRbmMessageMedia();
307307
assertThat(rbmContent.getMedia(), instanceOf(List.class));
308308
assertThat(rbmContent.getMedia().get(0), instanceOf(RbmMessageContentFile.class));
309-
RbmMessageContentFile rbmMediaFile = rbmContent.getMedia().get(0);
310-
assertThat(rbmMediaFile.getFileUrl(), instanceOf(URI.class));
311-
assertThat(rbmMediaFile.getThumbnailUrl(), instanceOf(URI.class));
309+
assertThat(rbmContent.getMedia().get(0).getFileUrl(), instanceOf(URI.class));
310+
assertThat(rbmContent.getMedia().get(0).getThumbnailUrl(), instanceOf(URI.class));
312311
assertThat(rbmContent.getSuggestions(), instanceOf(List.class));
313312
assertThat(rbmContent.getSuggestions().get(0), instanceOf(MultiChannelAction.class));
314313
assertThat(rbmContent.getSuggestions().get(0).getActualInstance(), instanceOf(RbmActionDial.class));
@@ -466,6 +465,27 @@ public void createMultiChannelRBMRichCarouselMessageTest() throws ApiException {
466465
assertThat(rbmCard.getCardWidth(), instanceOf(CardWidthEnum.class));
467466
assertThat(rbmCard.getCardWidth(), equalTo(CardWidthEnum.MEDIUM));
468467
assertThat(rbmCard.getCardContents(), instanceOf(List.class));
468+
assertThat(rbmCard.getCardContents().get(0), instanceOf(RbmCardContent.class));
469+
RbmCardContent card1 = rbmCard.getCardContents().get(0);
470+
assertThat(card1.getTitle(), instanceOf(String.class));
471+
assertThat(card1.getDescription(), instanceOf(String.class));
472+
assertThat(card1.getMedia(), instanceOf(RbmCardContentMedia.class));
473+
RbmCardContentMedia media = card1.getMedia();
474+
assertThat(media.getFileUrl(), instanceOf(URI.class));
475+
assertThat(media.getThumbnailUrl(), instanceOf(URI.class));
476+
assertThat(media.getHeight(), instanceOf(RbmMediaHeightEnum.class));
477+
assertThat(card1.getSuggestions(), instanceOf(List.class));
478+
assertThat(card1.getSuggestions().get(0), instanceOf(MultiChannelAction.class));
479+
assertThat(card1.getSuggestions().get(0).getActualInstance(), instanceOf(RbmActionDial.class));
480+
RbmActionDial rbmActionDial = card1.getSuggestions().get(0).getRbmActionDial();
481+
assertThat(rbmActionDial.getType(), instanceOf(RbmActionTypeEnum.class));
482+
assertThat(rbmActionDial.getType(), equalTo(RbmActionTypeEnum.DIAL_PHONE));
483+
assertThat(rbmActionDial.getText(), instanceOf(String.class));
484+
assertThat(rbmActionDial.getPostbackData(), instanceOf(byte[].class));
485+
assertThat(rbmActionDial.getPhoneNumber(), instanceOf(String.class));
486+
assertThat(rbmCard.getCardContents().get(0), instanceOf(RbmCardContent.class));
487+
RbmCardContent card2 = rbmCard.getCardContents().get(1);
488+
assertThat(card2.getTitle(), instanceOf(String.class));
469489
assertThat(channelListObject.getOwner(), equalTo(BW_NUMBER));
470490
}
471491
}

src/test/java/com/bandwidth/sdk/unit/models/RbmMessageMediaTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public void testRbmMessageMedia() {
4747
@Test
4848
public void mediaTest() {
4949
assertThat(model.getMedia(), instanceOf(ArrayList.class));
50-
50+
assertThat(model.getMedia().get(0), instanceOf(RbmMessageContentFile.class));
5151
}
5252

5353
/**

0 commit comments

Comments
 (0)