Documentation
¶
Overview ¶
Package users supports queries for user lookup.
To look up one or more users by ID, use users.Lookup. Additional IDs can be given in the options:
single := users.Lookup("12", nil) multi := users.Lookup("12", &users.LookupOpts{ More: []string{"16431281", "2805856351"}, })
By default only the default fields are returned (see types.User). To request additional fields or expansions, include them in the options:
q := users.Lookup("12", &users.LookupOpts{ Optional: []types.Fields{ types.UserFields{Description: true, PublicMetrics: true}, }, })
To look up users by username, use users.LookupByName. As above, additional usernames can be included in the option keys.
Index ¶
- type ListOpts
- type LookupOpts
- type Query
- func BlockedBy(userID string, opts *ListOpts) Query
- func FollowedBy(userID string, opts *ListOpts) Query
- func FollowersOf(userID string, opts *ListOpts) Query
- func LikersOf(id string, opts *ListOpts) Query
- func Lookup(id string, opts *LookupOpts) Query
- func LookupByName(name string, opts *LookupOpts) Query
- func Me(opts *LookupOpts) Query
- func MutedBy(userID string, opts *ListOpts) Query
- func RetweetersOf(tweetID string, opts *ListOpts) Query
- type Reply
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ListOpts ¶
type ListOpts struct { // A pagination token provided by the server. PageToken string // The maximum number of results to return; 0 means let the server choose. // The service will accept values up to 100. MaxResults int // Optional response fields and expansions. Optional []types.Fields }
ListOpts provide parameters for listing user memberships. A nil *ListOpts provides empty values for all fields.
type LookupOpts ¶
type LookupOpts struct { // Additional usernames or IDs to query More []string // Optional response fields and expansions. Optional []types.Fields }
LookupOpts provide parameters for user lookup. A nil *LookupOpts provides empty values for all fields.
type Query ¶
A Query performs a lookup query for one or more users.
func BlockedBy ¶
BlockedBy returns a query for those the specified user ID is blocking.
API: 2/users/:id/blocking
func FollowedBy ¶
FollowedBy returns a query for those the specified user ID is following.
API: 2/users/:id/following
func FollowersOf ¶
FollowersOf returns a query for the followers of the specified user ID.
API: 2/users/:id/followers
func LikersOf ¶
LikersOf constructs a query for the users who like a given tweet ID.
API: 2/tweets/:id/liking_users
BUG: The service does not understand pagination for this endpoint. It appears to return a fixed number of responses regardless how many there actually are. If you set MaxResults or PageToken in the options, the request will report an error.
func Lookup ¶
func Lookup(id string, opts *LookupOpts) Query
Lookup constructs a lookup query for one or more users by ID. To look up multiple IDs, add subsequent values to the opts.More field.
API: 2/users
func LookupByName ¶
func LookupByName(name string, opts *LookupOpts) Query
LookupByName constructs a lookup query for one or more users by username. To look up multiple usernames, add subsequent values to the opts.More field.
API: 2/users/by
func Me ¶
func Me(opts *LookupOpts) Query
func MutedBy ¶
MutedBy returns a query for those the specified user ID is muting.
API: 2/users/:id/muting
func RetweetersOf ¶
RetweetersOf returns a query for users who retweeted the specified tweet ID.
API: 2/tweets/:id/retweeted_by
func (Query) HasMorePages ¶
HasMorePages reports whether the query has more pages to fetch. This is true for a freshly-constructed query, and for an invoked query where the server has not reported a next-page token.
func (Query) ResetPageToken ¶
func (q Query) ResetPageToken()
ResetPageToken clears (resets) the query's current page token. Subsequently invoking the query will then fetch the first page of results.