Module: Twttr::Client::Endpoint::V2::Users::Follows
- Included in:
- Twttr::Client
- Defined in:
- lib/twttr/client/endpoint/v2/users/follows.rb
Overview
Twitter API V2 User Follow related endpoints developer.twitter.com/en/docs/twitter-api/users/follows/api-reference
Constant Summary collapse
Instance Method Summary collapse
-
#following(user_id, max_results: nil, pagination_token: nil) {|Array<Twttr::Model::User>| ... } ⇒ Array<Twttr::Model::User>, ...
GET /2/users/:id/following developer.twitter.com/en/docs/twitter-api/users/follows/api-reference/get-users-id-following.
Instance Method Details
#following(user_id, max_results: nil, pagination_token: nil) {|Array<Twttr::Model::User>| ... } ⇒ Array<Twttr::Model::User>, ...
GET /2/users/:id/following developer.twitter.com/en/docs/twitter-api/users/follows/api-reference/get-users-id-following
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/twttr/client/endpoint/v2/users/follows.rb', line 22 def following(user_id, max_results: nil, pagination_token: nil) # rubocop:disable Metrics/MethodLength loop do response = get(FOLLOWING_PATH, params: { user_id: user_id }, query_params: { 'user.fields': config.user_fields, max_results: max_results, pagination_token: pagination_token }.compact) users = response['data'].map { |v| Model::User.new(v, self) } pagination_token = response['meta']['pagination_token'] return users, pagination_token unless block_given? yield users, pagination_token break if pagination_token.nil? end end |