lists

package
v0.0.0-...-d727afa Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package lists supports queries for lists.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Followers

func Followers(listID string, opts *ListOpts) users.Query

Followers constructs a query to list the followers of a list. Note that the query reply contains user data, not lists.

API: 2/lists/:id/followers

func Members

func Members(listID string, opts *ListOpts) users.Query

Members constructs a query to list the members of a list. Note that the query reply contains user data, not lists.

API: 2/lists/:id/members

func Tweets

func Tweets(listID string, opts *ListOpts) tweets.Query

Tweets constructs a query for the tweets by members of a list. Note that the query reply contains tweets, not lists.

API: 2/lists/:id/tweets

Types

type Edit

type Edit struct {
	*jape.Request
	// contains filtered or unexported fields
}

An Edit is a query to edit or delete a list or list membership.

func AddMember

func AddMember(listID, userID string) Edit

AddMember constructs a query to add a member to an existing list.

API: POST 2/lists/:id/members

func Delete

func Delete(id string) Edit

Delete constructs a query to delete an existing list.

API: DELETE 2/lists/:id

func RemoveMember

func RemoveMember(listID, userID string) Edit

RemoveMember constructs a query to remove a member from a list.

API: DELETE 2/lists/:id/members/:userid

func Update

func Update(id string, opts UpdateOpts) Edit

Update constructs a query to update an existing list.

API: PUT 2/lists/:id

func (Edit) Invoke

func (e Edit) Invoke(ctx context.Context, cli *twitter.Client) (bool, error)

Invoke executes the query on the given context and client. A successful response reports whether the edit took effect.

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 list queries. A nil *ListOpts provides empty values for all fields.

type Query

type Query struct {
	*jape.Request
	// contains filtered or unexported fields
}

A Query performs a query for list metadata.

func Create

func Create(name, description string, private bool) Query

Create constructs a query to create a new list. A successful reply contains a single List value for the created list.

API: POST 2/lists

func FollowedBy

func FollowedBy(userID string, opts *ListOpts) Query

FollowedBy constructs a query for the metadata of lists followed by the specified user ID.

API: 2/users/:id/followed_lists

func Lookup

func Lookup(id string, opts *ListOpts) Query

Lookup constructs a query for the metadata of a list by ID. A successful reply contains a single List value for the matching list.

API: 2/lists

func MemberOf

func MemberOf(userID string, opts *ListOpts) Query

MemberOf constructs a query for the metadata of lists the specified user ID belongs to.

API: 2/users/:id/list_memberships

func OwnedBy

func OwnedBy(userID string, opts *ListOpts) Query

OwnedBy constructs a query for the metadata of lists owned by the specified user ID.

API: 2/users/:id/owned_lists

func PinnedBy

func PinnedBy(userID string, opts *ListOpts) Query

PinnedBy constructs a query for the metadata of lists pinned by the specified user ID.

API: 2/users/:id/pinned_lists

func (Query) HasMorePages

func (q Query) HasMorePages() bool

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) Invoke

func (q Query) Invoke(ctx context.Context, cli *twitter.Client) (*Reply, error)

Invoke executes the query on the given context and client.

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.

type Reply

type Reply struct {
	*twitter.Reply
	Lists types.Lists
	Meta  *twitter.Pagination
}

A Reply is the response from a Query.

type UpdateOpts

type UpdateOpts struct {
	Name    *string `json:"name,omitempty"`
	Desc    *string `json:"description,omitempty"`
	Private *bool   `json:"private,omitempty"`
}

UpdateOpts provide parameters for list update queries. The fields that are non-nil are modified to the given values. Fields that are nil are not changed from their existing settings.

func (*UpdateOpts) SetDescription

func (u *UpdateOpts) SetDescription(desc string) *UpdateOpts

SetDescription sets the option to update the description of the list.

func (*UpdateOpts) SetName

func (u *UpdateOpts) SetName(name string) *UpdateOpts

SetName sets the option to update the name of the list.

func (*UpdateOpts) SetPrivate

func (u *UpdateOpts) SetPrivate(private bool) *UpdateOpts

SetPrivate sets the option to mark a list private or non-private.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL