Skip to content

Commit b421bba

Browse files
authored
Support getFollowers limit parameter (#715)
1 parent 80aec6e commit b421bba

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

line-bot-api-client/src/main/java/com/linecorp/bot/client/LineMessagingClientImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ public CompletableFuture<GetNumberOfFollowersResponse> getNumberOfFollowers(Stri
318318

319319
@Override
320320
public CompletableFuture<GetFollowersResponse> getFollowers(GetFollowersRequest request) {
321-
return toFuture(retrofitImpl.getFollowers(request.getNext()));
321+
return toFuture(retrofitImpl.getFollowers(request.getNext(), request.getLimit()));
322322
}
323323

324324
@Override

line-bot-api-client/src/main/java/com/linecorp/bot/client/LineMessagingService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ Call<Void> linkRichMenuToUser(
384384
* Get a list of users who added your LINE Official Account as a friend.
385385
*/
386386
@GET("v2/bot/followers/ids")
387-
Call<GetFollowersResponse> getFollowers(@Query("start") String next);
387+
Call<GetFollowersResponse> getFollowers(@Query("start") String next, @Query("limit") Integer limit);
388388

389389
/**
390390
* Returns statistics about how users interact with narrowcast messages or broadcast messages sent from your

line-bot-api-client/src/test/java/com/linecorp/bot/client/LineMessagingClientImplTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -870,9 +870,9 @@ public void getFollowers() throws Exception {
870870
.builder()
871871
.userIds(ImmutableList.of("U1234"))
872872
.build();
873-
whenCall(retrofitMock.getFollowers(nullable(String.class)), response);
873+
whenCall(retrofitMock.getFollowers(nullable(String.class), nullable(Integer.class)), response);
874874
final GetFollowersResponse actual = target.getFollowers(GetFollowersRequest.builder().build()).get();
875-
verify(retrofitMock, only()).getFollowers(null);
875+
verify(retrofitMock, only()).getFollowers(null, null);
876876
assertThat(actual).isEqualTo(response);
877877
}
878878

line-bot-model/src/main/java/com/linecorp/bot/model/request/GetFollowersRequest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ public class GetFollowersRequest {
5757
@Nullable
5858
String next;
5959

60+
/**
61+
* The maximum number of user IDs to retrieve in a single request.
62+
* The default value is 300. If you specify a value that exceeds the maximum, the maximum value will be set.
63+
* Max value: 1000
64+
*/
65+
@Nullable
66+
Integer limit;
67+
6068
public static GetFollowersRequestBuilder fromResponse(GetFollowersResponse response) {
6169
return builder().next(response.getNext());
6270
}

0 commit comments

Comments
 (0)