usersLookup method
Returns fully-hydrated user objects for up to 100 users per request, as
specified by comma-separated values passed to the userId
and/or
screenName
parameters.
This method is especially useful when used in conjunction with collections of user IDs returned from friendsIds and followersIds.
usersShow is used to retrieve a single user object.
There are a few things to note when using this method.
- You must be following a protected user to be able to see their most recent status update. If you don't follow a protected user their status will be removed.
- The order of user IDs or screen names may not match the order of users in the returned array.
- If a requested user is unknown, suspended, or deleted, then that user will not be returned in the results list.
- If none of your lookup criteria can be satisfied by returning a user object, a HTTP 404 will be thrown.
- You are strongly encouraged to use a POST for larger requests.
screenName
: The screen name of the user for whom to return results.
Either an id or screenName
is required for this method.
userId
: The ID of the user for whom to return results.
Either an id or screenName
is required for this method.
includeEntities
: The entities node will not be included in embedded
Tweet objects when set to false
.
tweetMode
: When set to extended
, uses the extended Tweets.
See https://developer.twitter.com/en/docs/tweets/data-dictionary/overview/intro-to-tweet-json#extendedtweet.
transform
: Can be used to parse the request. By default, the response is
parsed in an isolate.
Implementation
Future<List<User>> usersLookup({
String? screenName,
String? userId,
bool? includeEntities,
String tweetMode = 'extended',
TransformResponse<List<User>> transform = defaultUserListTransform,
}) async {
final params = <String, String>{}
..addParameter('screen_name', screenName)
..addParameter('user_id', userId)
..addParameter('include_entities', includeEntities)
..addParameter('tweet_mode', tweetMode);
return client
.get(Uri.https('api.twitter.com', '1.1/users/lookup.json', params))
.then(transform);
}