File tree 2 files changed +32
-1
lines changed
2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -337,9 +337,14 @@ def get_room_member_profile(room_id, user_id)
337
337
# @param limit [Integer] The maximum number of user IDs to retrieve in a single request
338
338
#
339
339
# @return [Net::HTTPResponse]
340
- def get_follower_ids ( start : nil , limit : nil )
340
+ def get_follower_ids ( deprecated_continuation_token = nil , start : nil , limit : nil )
341
341
channel_token_required
342
342
343
+ if deprecated_continuation_token
344
+ warn "continuation_token as the first argument is deprecated. Please use :start instead."
345
+ start = deprecated_continuation_token
346
+ end
347
+
343
348
params = { start : start , limit : limit } . compact
344
349
345
350
endpoint_path = "/bot/followers/ids"
Original file line number Diff line number Diff line change @@ -96,4 +96,30 @@ def generate_client
96
96
expect ( response ) . to be_a ( Net ::HTTPOK )
97
97
expect ( result [ 'userIds' ] ) . to eq [ "Uxxxxxxxxxxxxxx1" , "Uxxxxxxxxxxxxxx2" ]
98
98
end
99
+
100
+ it 'gets follower ids using deprecated_continuation_token argument' do
101
+ uri_template = Addressable ::Template . new Line ::Bot ::API ::DEFAULT_ENDPOINT + '/bot/followers/ids'
102
+ stub_request ( :get , uri_template ) . to_return { |request | { body : USER_ID_CONTENT , status : 200 } }
103
+
104
+ uri_template = Addressable ::Template . new Line ::Bot ::API ::DEFAULT_ENDPOINT + '/bot/followers/ids?start={start}'
105
+ stub_request ( :get , uri_template ) . to_return { |request | { body : NEXT_USER_ID_CONTENT , status : 200 } }
106
+
107
+ client = generate_client
108
+
109
+ # first page
110
+ response = client . get_follower_ids
111
+
112
+ expect ( response ) . to be_a ( Net ::HTTPOK )
113
+ result = JSON . parse ( response . body )
114
+ expect ( result [ 'userIds' ] ) . to eq [ "Uxxxxxxxxxxxxxx1" , "Uxxxxxxxxxxxxxx2" , "Uxxxxxxxxxxxxxx3" ]
115
+ expect ( result [ 'next' ] ) . to eq "jxEWCEEP"
116
+
117
+ # second page
118
+ response = client . get_follower_ids ( result [ 'next' ] )
119
+
120
+ expect ( response ) . to be_a ( Net ::HTTPOK )
121
+ result = JSON . parse ( response . body )
122
+ expect ( result [ 'userIds' ] ) . to eq [ "Uxxxxxxxxxxxxxx4" , "Uxxxxxxxxxxxxxx5" , "Uxxxxxxxxxxxxxx6" ]
123
+ expect ( result [ 'next' ] ) . to be nil
124
+ end
99
125
end
You can’t perform that action at this time.
0 commit comments