Skip to content

Commit 314b076

Browse files
authored
Fix #1237 TeamBillableInfoRequest missing 2 optional arguments (#1240)
1 parent d627815 commit 314b076

File tree

5 files changed

+36
-1
lines changed

5 files changed

+36
-1
lines changed

json-logs/samples/api/team.billableInfo.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,8 @@
1010
},
1111
"error": "",
1212
"needed": "",
13-
"provided": ""
13+
"provided": "",
14+
"response_metadata": {
15+
"next_cursor": ""
16+
}
1417
}

slack-api-client/src/main/java/com/slack/api/methods/RequestFormBuilder.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2469,6 +2469,8 @@ public static FormBody.Builder toForm(TeamBillableInfoRequest req) {
24692469
FormBody.Builder form = new FormBody.Builder();
24702470
setIfNotNull("user", req.getUser(), form);
24712471
setIfNotNull("team_id", req.getTeamId(), form);
2472+
setIfNotNull("cursor", req.getCursor(), form);
2473+
setIfNotNull("limit", req.getLimit(), form);
24722474
return form;
24732475
}
24742476

slack-api-client/src/main/java/com/slack/api/methods/request/team/TeamBillableInfoRequest.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,15 @@ public class TeamBillableInfoRequest implements SlackApiRequest {
2626
*/
2727
private String teamId;
2828

29+
/**
30+
* Set cursor to next_cursor returned by previous call,
31+
* to indicate from where you want to list next page of users list.
32+
* Default value fetches the first page.
33+
*/
34+
private String cursor;
35+
36+
/**
37+
* The maximum number of items to return.
38+
*/
39+
private Integer limit;
2940
}

slack-api-client/src/main/java/com/slack/api/methods/response/team/TeamBillableInfoResponse.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.slack.api.methods.SlackApiTextResponse;
44
import com.slack.api.model.BillableInfo;
5+
import com.slack.api.model.ResponseMetadata;
56
import lombok.Data;
67

78
import java.util.List;
@@ -18,4 +19,5 @@ public class TeamBillableInfoResponse implements SlackApiTextResponse {
1819
private transient Map<String, List<String>> httpResponseHeaders;
1920

2021
private Map<String, BillableInfo> billableInfo;
22+
private ResponseMetadata responseMetadata;
2123
}

slack-api-client/src/test/java/test_with_remote_apis/methods/team_Test.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,23 @@ public void teamBillableInfo() throws Exception {
109109
assertThat(response.isOk(), is(true));
110110
}
111111

112+
@Test
113+
public void teamBillableInfo_pagination() throws Exception {
114+
TeamBillableInfoResponse response = slack.methods().teamBillableInfo(r -> r
115+
.token(userToken).limit(1));
116+
int count = 0;
117+
String nextCursor = response.getResponseMetadata().getNextCursor();
118+
while (count < 5 && !nextCursor.equals("")) {
119+
final String _nextCursor = nextCursor;
120+
response = slack.methods().teamBillableInfo(r -> r
121+
.token(userToken).cursor(_nextCursor).limit(1));
122+
assertThat(response.getError(), is(nullValue()));
123+
assertThat(response.isOk(), is(true));
124+
nextCursor = response.getResponseMetadata().getNextCursor();
125+
count += 1;
126+
}
127+
}
128+
112129
@Test
113130
public void teamBillableInfo_async() throws Exception {
114131
// Using async client to avoid an exception due to rate limited errors

0 commit comments

Comments
 (0)