gotwtr

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2024 License: MIT Imports: 12 Imported by: 0

README

gotwtr

Go Reference reviewdog test

gotwtr is a Go client library for the Twitter v2 API.

Note

We covers only Twitter v2 API supported by OAuth 2.0 Bearer Token.

We will had worked on it, when new one is be handled OAuth 2.0.

Installation

go get github.com/sivchari/gotwtr

Documentation

Please see GoDoc

Example

Tweet lookup
package main

import (
	"context"
	"fmt"

	"github.com/sivchari/gotwtr"
)

func main() {
	client := gotwtr.New("YOUR_TWITTER_BEARER_TOKEN")
	// look up multiple tweets
	ts, err := client.RetrieveMultipleTweets(context.Background(), []string{"id", "id2"})
	if err != nil {
		panic(err)
	}
	for _, t := range ts.Tweets {
		fmt.Println(t)
	}

	// look up single tweet
	t, err := client.RetrieveSingleTweet(context.Background(), "id")
	if err != nil {
		panic(err)
	}
	fmt.Println(t.Tweet)
}

If you wanna more example, please see examples dir.

These are covered all code gotwtr provides Twitter v2 API interface.

Contributing

We are welcome to contribute to this project.

Fork and make a Pull Request, or create an Issue if you see any problem or any enhancement, feature request.

Documentation

Overview

Package gotwtr provides a Client for the Twitter v2 API.

Note

This library will cover all Twitter v2 API in the future, but please note that not all Twitter API are currently compatible with v2.

Because, Twitter announced Twitter v2 API is ready for prime time.

FYI https://twittercommunity.com/t/ushering-in-a-new-era-for-the-twitter-developer-platform-with-the-twitter-api-v2/162087

So, we covers only Twitter v2 API supported by OAuth 2.0 Bearer Token.

We will had worked on it, when new one is be handled OAuth 2.0.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIResponseError

type APIResponseError struct {
	Title              string      `json:"title"`
	Detail             string      `json:"detail"`
	Type               string      `json:"type"`
	ResourceType       string      `json:"resource_type"`
	ResourceID         string      `json:"resource_id"`
	Parameter          string      `json:"parameter"`
	Parameters         Parameter   `json:"parameters"`
	Message            string      `json:"message"`
	Value              interface{} `json:"value"`
	Reason             string      `json:"reason,omitempty"`
	ClientID           string      `json:"client_id,omitempty"`
	RequiredEnrollment string      `json:"required_enrollment,omitempty"`
	RegistrationURL    string      `json:"registration_url,omitempty"`
	ConnectionIssue    string      `json:"connection_issue,omitempty"`
	Status             int         `json:"status,omitempty"`
}

type AddOrDeleteJSONBody

type AddOrDeleteJSONBody struct {
	Add    []*AddRule  `json:"add,omitempty"`
	Delete *DeleteRule `json:"delete,omitempty"`
}

type AddOrDeleteMetaSummary

type AddOrDeleteMetaSummary struct {
	Created    int `json:"created"`
	NotCreated int `json:"not_created"`
	Deleted    int `json:"deleted"`
	NotDeleted int `json:"not_deleted"`
	Valid      int `json:"valid"`
	Invalid    int `json:"invalid"`
}

type AddOrDeleteRulesMeta

type AddOrDeleteRulesMeta struct {
	Sent    string                  `json:"sent"`
	Summary *AddOrDeleteMetaSummary `json:"summary"`
}

type AddOrDeleteRulesOption

type AddOrDeleteRulesOption struct {
	DryRun bool // If it is true, test a the syntax of your rule without submitting it
}

type AddOrDeleteRulesResponse

type AddOrDeleteRulesResponse struct {
	Rules  []*FilteredRule       `json:"data"`
	Meta   *AddOrDeleteRulesMeta `json:"meta"`
	Errors []*APIResponseError   `json:"errors,omitempty"`
}

type AddRule

type AddRule struct {
	Value string `json:"value"`
	Tag   string `json:"tag,omitempty"`
}

type AllListsOwnedOption

type AllListsOwnedOption struct {
	Expansions      []Expansion
	ListFields      []ListField
	MaxResults      int
	PaginationToken string
	UserFields      []UserField
}

type AllListsOwnedResponse

type AllListsOwnedResponse struct {
	Lists    []*List             `json:"data"`
	Includes *ListIncludes       `json:"includes,omitempty"`
	Errors   []*APIResponseError `json:"errors,omitempty"`
	Meta     *ListMeta           `json:"meta"`
	Title    string              `json:"title,omitempty"`
	Detail   string              `json:"detail,omitempty"`
	Type     string              `json:"type,omitempty"`
}

type AllListsUserFollowsResponse

type AllListsUserFollowsResponse struct {
	Lists    []*List             `json:"data"`
	Includes *ListIncludes       `json:"includes,omitempty"`
	Errors   []*APIResponseError `json:"errors,omitempty"`
	Meta     *ListMeta           `json:"meta"`
	Title    string              `json:"title,omitempty"`
	Detail   string              `json:"detail,omitempty"`
	Type     string              `json:"type,omitempty"`
}

type BlockOption

type BlockOption struct {
	Expansions      []Expansion
	MaxResults      int
	PaginationToken string
	TweetFields     []TweetField
	UserFields      []UserField
}

type Blocking

type Blocking struct {
	Blocking bool `json:"blocking"`
}

type BlockingBody

type BlockingBody struct {
	TargetUserID string `json:"target_user_id"`
}

type BlockingResponse

type BlockingResponse struct {
	Users    []*User             `json:"data"`
	Includes *UserIncludes       `json:"includes,omitempty"`
	Errors   []*APIResponseError `json:"errors,omitempty"`
	Meta     *BlocksMeta         `json:"meta"`
	Title    string              `json:"title,omitempty"`
	Detail   string              `json:"detail,omitempty"`
	Type     string              `json:"type,omitempty"`
}

type BlocksMeta

type BlocksMeta struct {
	ResultCount   int    `json:"result_count"`
	PreviousToken string `json:"previous_token,omitempty"`
	NextToken     string `json:"next_token,omitempty"`
}

type BookmarkTweetBody

type BookmarkTweetBody struct {
	TweetID string `json:"tweet_id"`
}

type BookmarkTweetData

type BookmarkTweetData struct {
	Bookmarked bool `json:"bookmarked"`
}

type BookmarkTweetResponse

type BookmarkTweetResponse struct {
	BookmarkTweetData *BookmarkTweetData  `json:"data"`
	Errors            []*APIResponseError `json:"errors,omitempty"`
	Title             string              `json:"title,omitempty"`
	Detail            string              `json:"detail,omitempty"`
	Type              string              `json:"type,omitempty"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is an API client for Twitter v2 API.

func New

func New(bearerToken string, opts ...ClientOption) *Client

func (*Client) AddOrDeleteRules

func (c *Client) AddOrDeleteRules(ctx context.Context, body *AddOrDeleteJSONBody, opt ...*AddOrDeleteRulesOption) (*AddOrDeleteRulesResponse, error)

AddOrDeleteRules To create one or more rules, submit an add JSON body with an array of rules and operators. Similarly, to delete one or more rules, submit a delete JSON body with an array of list of existing rule IDs.

Example (Add)
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	_, err := client.AddOrDeleteRules(context.Background(), &gotwtr.AddOrDeleteJSONBody{
		Add: []*gotwtr.AddRule{
			{
				Value: "puppy has:media",
				Tag:   "puppies with media",
			},
			{
				Value: "meme has:images",
			},
		},
	})
	if err != nil {
		log.Fatal(err)
	}
}
Output:

Example (Delete)
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	// retrieve Stream rules
	ts, err := client.RetrieveStreamRules(context.Background())
	if err != nil {
		panic(err)
	}
	var ids []string
	for _, t := range ts.Rules {
		log.Println(t)
		ids = append(ids, t.ID)
	}

	// delete Stream rules
	_, err = client.AddOrDeleteRules(context.Background(), &gotwtr.AddOrDeleteJSONBody{
		Delete: &gotwtr.DeleteRule{
			IDs: ids,
		},
	})
	if err != nil {
		panic(err)
	}
}
Output:

func (*Client) AllListsUserFollows

func (c *Client) AllListsUserFollows(ctx context.Context, userID string, opt ...*ListFollowsOption) (*AllListsUserFollowsResponse, error)

AllListsUserFollows returns all Lists a specified user follows.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	lists, err := client.AllListsUserFollows(context.Background(), "user_id")
	if err != nil {
		log.Fatal(err)
	}
	for _, list := range lists.Lists {
		log.Println(list)
	}
}
Output:

func (Client) BearerToken

func (c Client) BearerToken(ctx context.Context) string

func (*Client) Blocking

func (c *Client) Blocking(ctx context.Context, userID string, opt ...*BlockOption) (*BlockingResponse, error)

Blocking returns a list of users who are blocked by the specified user ID.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	b, err := client.Blocking(context.Background(), "user_id")
	if err != nil {
		log.Fatal(err)
	}
	for _, user := range b.Users {
		log.Println(user)
	}
}
Output:

func (*Client) BookmarkTweet

func (c *Client) BookmarkTweet(ctx context.Context, userID string, body *BookmarkTweetBody) (*BookmarkTweetResponse, error)

BookmarkTweet returns the count of Tweets from the last seven days that match a query.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	l, err := client.BookmarkTweet(context.Background(), "user_id", &gotwtr.BookmarkTweetBody{
		TweetID: "2022",
	})
	if err != nil {
		log.Fatal(err)
	}
	log.Println(l)
}
Output:

func (*Client) ComplianceJob

func (c *Client) ComplianceJob(ctx context.Context, complianceJobID int) (*ComplianceJobResponse, error)

ComplianceJob returns a single compliance job with the specified ID.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	cj, err := client.ComplianceJob(context.Background(), 1382081613278814209)
	if err != nil {
		log.Fatal(err)
	}
	log.Println(cj)
	for _, e := range cj.Errors {
		log.Println(e)
	}
}
Output:

func (*Client) ComplianceJobs

func (c *Client) ComplianceJobs(ctx context.Context, opt *ComplianceJobsOption) (*ComplianceJobsResponse, error)

ComplianceJobs returns a list of recent compliance jobs.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	cj, err := client.ComplianceJobs(context.Background(), &gotwtr.ComplianceJobsOption{
		Type: gotwtr.ComplianceFieldTypeTweets,
	})
	if err != nil {
		log.Fatal(err)
	}
	log.Println(cj)
}
Output:

func (*Client) ConnectToStream

func (c *Client) ConnectToStream(ctx context.Context, ch chan<- ConnectToStreamResponse, errCh chan<- error, opt ...*ConnectToStreamOption) *ConnectToStream

ConnectToStream streams Tweets in real-time based on a specific set of filter rules.

Example
package main

import (
	"context"
	"log"
	"time"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	ch := make(chan gotwtr.ConnectToStreamResponse, 5)
	errCh := make(chan error)
	stream := client.ConnectToStream(context.Background(), ch, errCh)
	log.Println("streaming...")
	ctx, cancel := context.WithCancel(context.Background())
	go func(ctx context.Context) {
		for {
			select {
			case data := <-ch:
				log.Println(data.Tweet)
			case err := <-errCh:
				log.Println(err)
			case <-ctx.Done():
				return
			}
		}
	}(ctx)
	time.Sleep(time.Second * 10)
	cancel()
	stream.Stop()
	log.Println("done")
}
Output:

func (*Client) CountAllTweets

func (c *Client) CountAllTweets(ctx context.Context, tweet string, opt ...*TweetCountsAllOption) (*TweetCountsResponse, error)

CountAllTweets returns the count of Tweets that match your query from the complete history of public Tweets; since the first Tweet was created March 26, 2006.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	ts, err := client.CountAllTweets(context.Background(), "lakers")
	if err != nil {
		log.Fatal(err)
	}
	log.Println(ts.Meta.TotalTweetCount)
	for _, t := range ts.Counts {
		log.Println(t)
	}
}
Output:

func (*Client) CountRecentTweets

func (c *Client) CountRecentTweets(ctx context.Context, tweet string, opt ...*TweetCountsOption) (*TweetCountsResponse, error)

CountRecentTweets returns the count of Tweets from the last seven days that match a query.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	ts, err := client.CountRecentTweets(context.Background(), "lakers")
	if err != nil {
		log.Fatal(err)
	}
	log.Println(ts.Meta.TotalTweetCount)
	for _, t := range ts.Counts {
		log.Println(t)
	}
}
Output:

func (*Client) CreateComplianceJob

func (c *Client) CreateComplianceJob(ctx context.Context, opt ...*CreateComplianceJobOption) (*CreateComplianceJobResponse, error)

CreateComplianceJob create a compliance job.

func (*Client) CreateNewGroupDM

func (c *Client) CreateNewGroupDM(ctx context.Context, conversationID string, body *CreateNewGroupDMBody) (*CreateNewGroupDMResponse, error)

CreateNewGroupDM enables create a Direct Message on behalf of an authenticated user, and adds it to the specified conversation.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	d, err := client.CreateNewGroupDM(context.Background(), "conversation_id", &gotwtr.CreateNewGroupDMBody{
		Text: "Hello World",
	})
	if err != nil {
		log.Fatal(err)
	}
	log.Println(d)
}
Output:

func (*Client) CreateNewList

func (c *Client) CreateNewList(ctx context.Context, body *CreateNewListBody) (*CreateNewListResponse, error)

CreateNewList enables the authenticated user to create a List.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	l, err := client.CreateNewList(context.Background(), &gotwtr.CreateNewListBody{
		Name: "test v2 create list",
	})
	if err != nil {
		log.Fatal(err)
	}
	log.Println(l)
}
Output:

func (*Client) CreateOneToOneDM

func (c *Client) CreateOneToOneDM(ctx context.Context, participantID string, body *CreateOneToOneDMBody) (*CreateOneToOneDMResponse, error)

CreateOneToOneDM enables create a new one-to-one conversation or retrieves the current conversation and adds the Direct Message to it.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	d, err := client.CreateOneToOneDM(context.Background(), "participant_id", &gotwtr.CreateOneToOneDMBody{
		Text: "Hello World",
	})
	if err != nil {
		log.Fatal(err)
	}
	log.Println(d)
}
Output:

func (*Client) DeleteList

func (c *Client) DeleteList(ctx context.Context, listID string) (*DeleteListResponse, error)

DeleteList enables the authenticated user to delete a List that they own.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	l, err := client.DeleteList(context.Background(), "list_id")
	if err != nil {
		log.Fatal(err)
	}
	log.Println(l)
}
Output:

func (Client) DeleteTweet

func (c Client) DeleteTweet(ctx context.Context, tweetID string) (*DeleteTweetResponse, error)

DeleteTweet allows a user or authenticated user ID to delete a Tweet.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	_, err := client.DeleteTweet(context.Background(), "tweet_id")
	if err != nil {
		log.Fatal(err)
	}
}
Output:

func (*Client) DiscoverSpaces

func (c *Client) DiscoverSpaces(ctx context.Context, userIDs []string, opt ...*DiscoverSpacesOption) (*DiscoverSpacesResponse, error)

DiscoverSpaces returns live or scheduled Spaces created by the specified userIDs. Up to 100 comma-separated IDs can be looked up using this endpoint.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	discover, err := client.DiscoverSpaces(context.Background(), []string{"user_id", "user_id2"})
	if err != nil {
		log.Fatal(err)
	}
	for _, space := range discover.Spaces {
		log.Println(space)
	}
}
Output:

func (*Client) Followers

func (c *Client) Followers(ctx context.Context, userID string, opt ...*FollowOption) (*FollowersResponse, error)

Followers returns a list of users who are followers of the specified userID.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	f, err := client.Followers(context.Background(), "user_id")
	if err != nil {
		log.Fatal(err)
	}
	for _, user := range f.Users {
		log.Println(user)
	}
}
Output:

func (*Client) Following

func (c *Client) Following(ctx context.Context, userID string, opt ...*FollowOption) (*FollowingResponse, error)

Following returns a list of users the specified userID is following.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	f, err := client.Following(context.Background(), "user_id")
	if err != nil {
		log.Fatal(err)
	}
	for _, user := range f.Users {
		log.Println(user)
	}
}
Output:

func (Client) GenerateAppOnlyBearerToken

func (c Client) GenerateAppOnlyBearerToken(ctx context.Context) (bool, error)

GenerateAppOnlyBearerToken generates a bearer token for app-only auth.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	c := gotwtr.New(
		"key",
		gotwtr.WithConsumerSecret("sec"),
	)
	b, err := c.GenerateAppOnlyBearerToken(context.Background())
	if err != nil {
		log.Fatal(err)
	}
	if !b {
		log.Fatal("failed to generate bearer token")
	}
}
Output:

func (Client) HideReplies

func (c Client) HideReplies(ctx context.Context, tweetID string, hidden bool) (*HideRepliesResponse, error)

HideReplies hides or unhides a reply to a Tweet.

func (*Client) ListFollowers

func (c *Client) ListFollowers(ctx context.Context, listID string, opt ...*ListFollowersOption) (*ListFollowersResponse, error)

ListFollowers returns a list of users who are followers of the specified List.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	followers, err := client.ListFollowers(context.Background(), "list_id")
	if err != nil {
		log.Fatal(err)
	}
	for _, user := range followers.Users {
		log.Println(user)
	}
}
Output:

func (*Client) ListMembers

func (c *Client) ListMembers(ctx context.Context, listID string, opt ...*ListMembersOption) (*ListMembersResponse, error)

ListMembers returns a list of users who are members of the specified List.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	members, err := client.ListMembers(context.Background(), "list_id")
	if err != nil {
		log.Fatal(err)
	}
	for _, member := range members.Users {
		log.Println(member)
	}
}
Output:

func (*Client) ListsSpecifiedUser

func (c *Client) ListsSpecifiedUser(ctx context.Context, userID string, opt ...*ListsSpecifiedUserOption) (*ListsSpecifiedUserResponse, error)

ListsSpecifiedUser returns all Lists a specified user is a member of that.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	lists, err := client.ListsSpecifiedUser(context.Background(), "user_id")
	if err != nil {
		log.Fatal(err)
	}
	for _, list := range lists.Lists {
		log.Println(list)
	}
}
Output:

func (*Client) LookUpAllDM

func (c *Client) LookUpAllDM(ctx context.Context, opt ...*DirectMessageOption) (*LookUpAllDMResponse, error)

LookUpAllDM returns a list of Direct Messages for the authenticated user, both sent and received. Direct Message events are returned in reverse chronological order. Supports retrieving events from the previous 30 days.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	dm, err := client.LookUpAllDM(context.Background(), &gotwtr.DirectMessageOption{
		EventTypes: "MessageCreate",
	})
	if err != nil {
		log.Fatal(err)
	}
	log.Println(dm)
}
Output:

func (*Client) LookUpAllListsOwned

func (c *Client) LookUpAllListsOwned(ctx context.Context, userID string, opt ...*AllListsOwnedOption) (*AllListsOwnedResponse, error)

LookUpAllListsOwned returns all Lists owned by the specified user.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	lists, err := client.LookUpAllListsOwned(context.Background(), "user_id")
	if err != nil {
		log.Fatal(err)
	}
	for _, list := range lists.Lists {
		log.Println(list)
	}
}
Output:

func (*Client) LookUpAllOneToOneDM

func (c *Client) LookUpAllOneToOneDM(ctx context.Context, participantID string, opt ...*DirectMessageOption) (*LookUpAllOneToOneDMResponse, error)

LookUpAllOneToOneDM returns a list of Direct Messages (DM) events within a 1-1 conversation with the user specified in the participant_id path parameter. Messages are returned in reverse chronological order.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	dm, err := client.LookUpAllOneToOneDM(context.Background(), "participant_id", &gotwtr.DirectMessageOption{
		EventTypes: "MessageCreate",
	})
	if err != nil {
		log.Fatal(err)
	}
	log.Println(dm)
}
Output:

func (*Client) LookUpDM

func (c *Client) LookUpDM(ctx context.Context, dmConversationID string, opt ...*DirectMessageOption) (*LookUpDMResponse, error)

LookUpDM returns a list of Direct Messages within a conversation specified in the dm_conversation_id path parameter. Messages are returned in reverse chronological order.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	dm, err := client.LookUpDM(context.Background(), "participant_id", &gotwtr.DirectMessageOption{
		EventTypes: "MessageCreate",
	})
	if err != nil {
		log.Fatal(err)
	}
	log.Println(dm)
}
Output:

func (*Client) LookUpList

func (c *Client) LookUpList(ctx context.Context, listID string, opt ...*LookUpListOption) (*ListResponse, error)

LookUpList returns the details of a specified List.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	l, err := client.LookUpList(context.Background(), "list_id")
	if err != nil {
		log.Fatal(err)
	}
	log.Println(l)
}
Output:

func (*Client) LookUpListTweets

func (c *Client) LookUpListTweets(ctx context.Context, listID string, opt ...*ListTweetsOption) (*ListTweetsResponse, error)

LookUpListTweets returns a list of Tweets from the specified List.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	lt, err := client.LookUpListTweets(context.Background(), "list_id")
	if err != nil {
		log.Fatal(err)
	}
	for _, tweet := range lt.Tweets {
		log.Println(tweet)
	}
}
Output:

func (*Client) LookUpSpace

func (c *Client) LookUpSpace(ctx context.Context, spaceID string, opt ...*SpaceOption) (*SpaceResponse, error)

LookUpSpace returns a variety of information about a single Space specified by the requested ID.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	s, err := client.LookUpSpace(context.Background(), "space_id")
	if err != nil {
		log.Fatal(err)
	}
	log.Println(s)
}
Output:

func (*Client) LookUpSpaces

func (c *Client) LookUpSpaces(ctx context.Context, spaceIDs []string, opt ...*SpaceOption) (*SpacesResponse, error)

LookUpSpaces returns details about multiple Spaces. Up to 100 comma-separated SpacesIDs can be looked up using this endpoint.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	ss, err := client.LookUpSpaces(context.Background(), []string{"space_id", "space_id2"})
	if err != nil {
		log.Fatal(err)
	}
	for _, s := range ss.Spaces {
		log.Println(s)
	}
}
Output:

func (*Client) LookupUserBookmarks

func (c *Client) LookupUserBookmarks(ctx context.Context, userID string, opt ...*LookupUserBookmarksOption) (*LookupUserBookmarksResponse, error)

LookupUserBookmarks returns the count of Tweets from the last seven days that match a query.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	l, err := client.LookupUserBookmarks(context.Background(), "userID")
	if err != nil {
		log.Fatal(err)
	}
	log.Println(l)
}
Output:

func (*Client) Me

func (c *Client) Me(ctx context.Context, opt ...*MeOption) (*MeResponse, error)

Me returns information about an authorized user.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	me, err := client.Me(context.Background())
	if err != nil {
		log.Fatal(err)
	}
	log.Printf("me is %+v", me)
}
Output:

func (*Client) Muting

func (c *Client) Muting(ctx context.Context, userID string, opt ...*MuteOption) (*MutingResponse, error)

Muting returns a list of users who are muted by the specified user ID.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	m, err := client.Muting(context.Background(), "user_id")
	if err != nil {
		log.Fatal(err)
	}
	for _, user := range m.Users {
		log.Println(user)
	}
}
Output:

func (*Client) PinnedLists

func (c *Client) PinnedLists(ctx context.Context, userID string, opt ...*PinnedListsOption) (*PinnedListsResponse, error)

PinnedLists returns the Lists pinned by a specified user.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	pl, err := client.PinnedLists(context.Background(), "user_id")
	if err != nil {
		log.Fatal(err)
	}
	for _, l := range pl.Lists {
		log.Println(l)
	}
}
Output:

func (*Client) PostBlocking

func (c *Client) PostBlocking(ctx context.Context, userID string, targetUserID string) (*PostBlockingResponse, error)

PostBlocking causes the user (in the path) to block the target user. The user (in the path) must match the user Access Tokens being used to authorize the request.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	pb, err := client.PostBlocking(context.Background(), "user_id", "target_user_id")
	if err != nil {
		log.Println(err)
	}
	log.Println(pb)
}
Output:

func (*Client) PostDM

func (c *Client) PostDM(ctx context.Context, body *PostDMBody) (*PostDMResponse, error)

PostDM enables create a new group conversation and adds a Direct Message to it on behalf of an authenticated user.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	d, err := client.PostDM(context.Background(), &gotwtr.PostDMBody{
		ConversationType: "Group",
		ParticipantIDs: []string{
			"944480690",
			"906948460078698496",
		},
		Message: &gotwtr.DirectMessage{
			Text: "Hello to you two, this is a new group conversation",
		},
	})
	if err != nil {
		log.Fatal(err)
	}
	log.Println(d)
}
Output:

func (*Client) PostFollowing

func (c *Client) PostFollowing(ctx context.Context, userID string, targetUserID string) (*PostFollowingResponse, error)

PostFollowing allows a user ID to follow another user. If the target user does not have public Tweets, this method will send a follow request.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	pf, err := client.PostFollowing(context.Background(), "user_id", "target_user_id")
	if err != nil {
		panic(err)
	}
	log.Println(pf)
}
Output:

func (*Client) PostListFollows

func (c *Client) PostListFollows(ctx context.Context, listID string, userID string) (*PostListFollowsResponse, error)

PostListFollows enables the authenticated user to follow a List.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	plf, err := client.PostListFollows(context.Background(), "list_id", "user_id")
	if err != nil {
		log.Println(err)
	}
	log.Println(plf)
}
Output:

func (*Client) PostListMembers

func (c *Client) PostListMembers(ctx context.Context, listID string, userID string) (*PostListMembersResponse, error)

PostListMembers enables the authenticated user to add a member to a List they own.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	plm, err := client.PostListMembers(context.Background(), "list_id", "user_id")
	if err != nil {
		log.Println(err)
	}
	log.Println(plm)
}
Output:

func (*Client) PostMuting

func (c *Client) PostMuting(ctx context.Context, userID string, targetUserID string) (*PostMutingResponse, error)

PostMuting allows an authenticated user ID to mute the target user.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	pm, err := client.PostMuting(context.Background(), "user_id", "target_user_id")
	if err != nil {
		panic(err)
	}
	log.Println(pm)
}
Output:

func (*Client) PostPinnedLists

func (c *Client) PostPinnedLists(ctx context.Context, listID string, userID string) (*PostPinnedListsResponse, error)

PostPinnedLists enables the authenticated user to pin a List.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	ppl, err := client.PostPinnedLists(context.Background(), "list_id", "user_id")
	if err != nil {
		log.Println(err)
	}
	log.Println(ppl)
}
Output:

func (Client) PostRetweet

func (c Client) PostRetweet(ctx context.Context, userID string, tweetID string) (*PostRetweetResponse, error)

PostRetweet causes the user ID identified in the path parameter to Retweet the target Tweet.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	pr, err := client.PostRetweet(context.Background(), "user_id", "tweet_id")
	if err != nil {
		log.Println(err)
	}
	log.Println(pr)
}
Output:

func (Client) PostTweet

func (c Client) PostTweet(ctx context.Context, body *PostTweetOption) (*PostTweetResponse, error)

PostTweet creates a Tweet on behalf of an authenticated user.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	t, err := client.PostTweet(context.Background(), &gotwtr.PostTweetOption{
		Text: "Hello World",
	})
	if err != nil {
		log.Fatal(err)
	}
	log.Println(t)
}
Output:

func (Client) PostUsersLikingTweet

func (c Client) PostUsersLikingTweet(ctx context.Context, userID string, tweetID string) (*PostUsersLikingTweetResponse, error)

PostUsersLikingTweet causes the user ID identified in the path parameter to Like the target Tweet.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	pult, err := client.PostUsersLikingTweet(context.Background(), "user_id", "tweet_id")
	if err != nil {
		log.Println(err)
	}
	log.Println(pult)
}
Output:

func (*Client) RemoveBookmarkOfTweet

func (c *Client) RemoveBookmarkOfTweet(ctx context.Context, userID string, tweetID string) (*RemoveBookmarkOfTweetResponse, error)

RemoveBookmarkOfTweet returns the count of Tweets from the last seven days that match a query.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	l, err := client.RemoveBookmarkOfTweet(context.Background(), "user_id", "tweet_id")
	if err != nil {
		log.Fatal(err)
	}
	log.Println(l)
}
Output:

func (*Client) RetrieveMultipleTweets

func (c *Client) RetrieveMultipleTweets(ctx context.Context, tweetIDs []string, opt ...*RetriveTweetOption) (*TweetsResponse, error)

RetrieveMultipleTweets returns a variety of information about the Tweet specified by the requested ID or list of IDs.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	ts, err := client.RetrieveMultipleTweets(context.Background(), []string{"tweet_id", "tweet_id2"})
	if err != nil {
		log.Fatal(err)
	}
	for _, t := range ts.Tweets {
		log.Println(t)
	}
}
Output:

func (*Client) RetrieveMultipleUsersWithIDs

func (c *Client) RetrieveMultipleUsersWithIDs(ctx context.Context, userIDs []string, opt ...*RetrieveUserOption) (*UsersResponse, error)

RetrieveMultipleUsersWithIDs returns a variety of information about one or more users specified by the requested userIDs.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	// look up users
	us, err := client.RetrieveMultipleUsersWithIDs(context.Background(), []string{"user_id", "user_id2"})
	if err != nil {
		log.Fatal(err)
	}
	for _, u := range us.Users {
		log.Println(u)
	}
}
Output:

func (*Client) RetrieveMultipleUsersWithUserNames

func (c *Client) RetrieveMultipleUsersWithUserNames(ctx context.Context, userNames []string, opt ...*RetrieveUserOption) (*UsersResponse, error)

RetrieveMultipleUsersWithUserNames returns a variety of information about one or more users specified by their usernames.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	uns, err := client.RetrieveMultipleUsersWithUserNames(context.Background(), []string{"username", "username2"})
	if err != nil {
		log.Fatal(err)
	}
	for _, un := range uns.Users {
		log.Println(un)
	}
}
Output:

func (*Client) RetrieveSingleTweet

func (c *Client) RetrieveSingleTweet(ctx context.Context, tweetID string, opt ...*RetriveTweetOption) (*TweetResponse, error)

RetrieveSingleTweet returns a variety of information about a single Tweet specified by the requested ID.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	t, err := client.RetrieveSingleTweet(context.Background(), "tweet_id")
	if err != nil {
		log.Fatal(err)
	}
	log.Println(*t.Tweet)
}
Output:

func (*Client) RetrieveSingleUserWithID

func (c *Client) RetrieveSingleUserWithID(ctx context.Context, userID string, opt ...*RetrieveUserOption) (*UserResponse, error)

RetrieveSingleUserWithID returns a variety of information about a single user specified by the requested userID.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	u, err := client.RetrieveSingleUserWithID(context.Background(), "user_id")
	if err != nil {
		log.Fatal(err)
	}
	log.Println(u)
}
Output:

func (*Client) RetrieveSingleUserWithUserName

func (c *Client) RetrieveSingleUserWithUserName(ctx context.Context, userName string, opt ...*RetrieveUserOption) (*UserResponse, error)

RetrieveSingleUserWithUserName returns a variety of information about one or more users specified by their username.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	un, err := client.RetrieveSingleUserWithUserName(context.Background(), "username")
	if err != nil {
		log.Fatal(err)
	}
	log.Println(un)
}
Output:

func (*Client) RetrieveStreamRules

func (c *Client) RetrieveStreamRules(ctx context.Context, opt ...*RetrieveStreamRulesOption) (*RetrieveStreamRulesResponse, error)

RetrieveStreamRules return a list of rules currently active on the streaming endpoint, either as a list or individually.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	ts, err := client.RetrieveStreamRules(context.Background())
	if err != nil {
		log.Fatal(err)
	}
	for _, t := range ts.Rules {
		log.Println(t)
	}
}
Output:

func (*Client) RetweetsLookup

func (c *Client) RetweetsLookup(ctx context.Context, tweetID string, opt ...*RetweetsLookupOption) (*RetweetsResponse, error)

RetweetsLookup allows you to get information about who has Retweeted a Tweet.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	t, err := client.RetweetsLookup(context.Background(), "tweet_id")
	if err != nil {
		log.Println(err)
	}
	log.Println(t)
}
Output:

func (Client) SearchAllTweets

func (c Client) SearchAllTweets(ctx context.Context, tweet string, opt ...*SearchTweetsOption) (*SearchTweetsResponse, error)

SearchAllTweets returns Tweets since the first Tweet was created on March 26, 2006. This endpoint is only available to those users who have been approved for Academic Research access.

func (*Client) SearchRecentTweets

func (c *Client) SearchRecentTweets(ctx context.Context, tweet string, opt ...*SearchTweetsOption) (*SearchTweetsResponse, error)

SearchRecentTweets returns Tweets from the last seven days that match a search query.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	tsr, err := client.SearchRecentTweets(context.Background(), "go", &gotwtr.SearchTweetsOption{
		TweetFields: []gotwtr.TweetField{
			gotwtr.TweetFieldAuthorID,
			gotwtr.TweetFieldAttachments,
		},
		MaxResults: 10,
	})
	if err != nil {
		log.Fatal(err)
	}
	for _, t := range tsr.Tweets {
		log.Println("---")
		log.Println(t.Text)
	}

	log.Println("---meta---")
	log.Println(tsr.Meta)

}
Output:

func (*Client) SearchSpaces

func (c *Client) SearchSpaces(ctx context.Context, searchTerm string, opt ...*SearchSpacesOption) (*SearchSpacesResponse, error)

SearchSpaces return live or scheduled Spaces matching your specified search terms. This endpoint performs a keyword search, meaning that it will return Spaces that are an exact case-insensitive match of the specified search term. The search term will match the original title of the Space.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	spaces, err := client.SearchSpaces(context.Background(), "query")
	if err != nil {
		log.Fatal(err)
	}
	for _, space := range spaces.Spaces {
		log.Println(space)
	}
}
Output:

func (*Client) TweetsUserLiked

func (c *Client) TweetsUserLiked(ctx context.Context, userID string, opt ...*TweetsUserLikedOption) (*TweetsUserLikedResponse, error)

TweetsUserLiked allows you to get information about a Tweet’s liking users. You will receive the most recent 100 users who liked the specified Tweet.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	tulr, err := client.TweetsUserLiked(context.Background(), "user_id")
	if err != nil {
		log.Println(err)
	}
	for _, tweet := range tulr.Tweets {
		log.Printf("id: %s, text: %s\n", tweet.ID, tweet.Text)
	}
}
Output:

func (*Client) UndoBlocking

func (c *Client) UndoBlocking(ctx context.Context, sourceUserID string, targetUserID string) (*UndoBlockingResponse, error)

UndoBlocking allows a user or authenticated user ID to unblock another user.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	ub, err := client.UndoBlocking(context.Background(), "source_user_id", "target_user_id")
	if err != nil {
		log.Println(err)
	}
	log.Println(ub)
}
Output:

func (*Client) UndoFollowing

func (c *Client) UndoFollowing(ctx context.Context, sourceUserID string, targetUserID string) (*UndoFollowingResponse, error)

UndoFollowing allows a user ID to unfollow another user.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	uf, err := client.UndoFollowing(context.Background(), "source_user_id", "target_user_id")
	if err != nil {
		panic(err)
	}
	log.Println(uf)
}
Output:

func (*Client) UndoListFollows

func (c *Client) UndoListFollows(ctx context.Context, listID string, userID string) (*UndoListFollowsResponse, error)

UndoListFollows enables the authenticated user to unfollow a List.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	ulf, err := client.UndoListFollows(context.Background(), "list_id", "user_id")
	if err != nil {
		log.Println(err)
	}
	log.Println(ulf)
}
Output:

func (*Client) UndoListMembers

func (c *Client) UndoListMembers(ctx context.Context, listID string, userID string) (*UndoListMembersResponse, error)

UndoListMembers enables the authenticated user to remove a member from a List they own.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	ulm, err := client.UndoListMembers(context.Background(), "list_id", "user_id")
	if err != nil {
		log.Println(err)
	}
	log.Println(ulm)
}
Output:

func (*Client) UndoMuting

func (c *Client) UndoMuting(ctx context.Context, sourceUserID string, targetUserID string) (*UndoMutingResponse, error)

UndoMuting allows an authenticated user ID to unmute the target user.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	um, err := client.UndoMuting(context.Background(), "source_user_id", "target_user_id")
	if err != nil {
		panic(err)
	}
	log.Println(um)
}
Output:

func (*Client) UndoPinnedLists

func (c *Client) UndoPinnedLists(ctx context.Context, listID string, userID string) (*UndoPinnedListsResponse, error)

UndoPinnedLists enables the authenticated user to unpin a List.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	upl, err := client.UndoPinnedLists(context.Background(), "list_id", "user_id")
	if err != nil {
		log.Println(err)
	}
	log.Println(upl)
}
Output:

func (Client) UndoRetweet

func (c Client) UndoRetweet(ctx context.Context, userID string, sourceTweetID string) (*UndoRetweetResponse, error)

UndoRetweet allows a user or authenticated user ID to remove the Retweet of a Tweet.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	ur, err := client.UndoRetweet(context.Background(), "user_id", "source_tweet_id")
	if err != nil {
		log.Println(err)
	}
	log.Println(ur)
}
Output:

func (Client) UndoUsersLikingTweet

func (c Client) UndoUsersLikingTweet(ctx context.Context, userID string, tweetID string) (*UndoUsersLikingTweetResponse, error)

UndoUsersLikingTweet allows a user or authenticated user ID to unlike a Tweet. The request succeeds with no action when the user sends a request to a user they're not liking the Tweet or have already unliked the Tweet.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	uult, err := client.UndoUsersLikingTweet(context.Background(), "user_id", "tweet_id")
	if err != nil {
		log.Println(err)
	}
	log.Println(uult)
}
Output:

func (*Client) UpdateMetaDataForList

func (c *Client) UpdateMetaDataForList(ctx context.Context, listID string, body ...*UpdateMetaDataForListBody) (*UpdateMetaDataForListResponse, error)

UpdateMetaDataForList enables the authenticated user to update the meta data of a specified List that they own.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	l, err := client.UpdateMetaDataForList(context.Background(), "list_id")
	if err != nil {
		log.Fatal(err)
	}
	log.Println(l)
}
Output:

func (*Client) UserMentionTimeline

func (c *Client) UserMentionTimeline(ctx context.Context, userID string, opt ...*UserMentionTimelineOption) (*UserMentionTimelineResponse, error)

UserMentionTimeline returns Tweets mentioning a single user specified by the requested userID. By default, the most recent ten Tweets are returned per request. Using pagination, up to the most recent 800 Tweets can be retrieved.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	tws, err := client.UserMentionTimeline(context.Background(), "user_id")
	if err != nil {
		log.Fatal(err)
	}
	for _, tw := range tws.Tweets {
		log.Println(tw)
	}
}
Output:

func (*Client) UserTweetTimeline

func (c *Client) UserTweetTimeline(ctx context.Context, userID string, opt ...*UserTweetTimelineOption) (*UserTweetTimelineResponse, error)

UserTweetTimeline returns Tweets composed by a single user, specified by the requested userID. By default, the most recent ten Tweets are returned per request. Using pagination, the most recent 3,200 Tweets can be retrieved.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	ts, err := client.UserTweetTimeline(context.Background(), "user_id")
	if err != nil {
		log.Fatal(err)
	}
	for _, t := range ts.Tweets {
		log.Println(t)
	}
}
Output:

func (*Client) UsersLikingTweet

func (c *Client) UsersLikingTweet(ctx context.Context, tweetID string, opt ...*UsersLikingTweetOption) (*UsersLikingTweetResponse, error)

UsersLikingTweet allows you to get information about a user’s liked Tweets.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	ultr, err := client.UsersLikingTweet(context.Background(), "tweet_id")
	if err != nil {
		log.Fatal(err)
	}
	for _, user := range ultr.Users {
		log.Printf("id: %s, name: %s\n", user.ID, user.UserName)
	}
}
Output:

func (*Client) UsersPurchasedSpaceTicket

func (c *Client) UsersPurchasedSpaceTicket(ctx context.Context, spaceID string, opt ...*UsersPurchasedSpaceTicketOption) (*UsersPurchasedSpaceTicketResponse, error)

UsersPurchasedSpaceTicket returns a list of user who purchased a ticket to the requested Space. You must authenticate the request using the access token of the creator of the requested Space.

Example
package main

import (
	"context"
	"log"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	tickets, err := client.UsersPurchasedSpaceTicket(context.Background(), "space_id")
	if err != nil {
		log.Fatal(err)
	}
	for _, user := range tickets.Users {
		log.Println(user)
	}
}
Output:

func (*Client) VolumeStreams

func (c *Client) VolumeStreams(ctx context.Context, ch chan<- VolumeStreamsResponse, errCh chan<- error, opt ...*VolumeStreamsOption) *VolumeStreams

VolumeStreams streams about 1% of all Tweets in real-time.

Example
package main

import (
	"context"
	"log"
	"time"

	"github.com/928799934/gotwtr"
)

func main() {
	client := gotwtr.New("key")
	ch := make(chan gotwtr.VolumeStreamsResponse, 5)
	errCh := make(chan error)
	stream := client.VolumeStreams(context.Background(), ch, errCh)
	log.Println("streaming...")
	done := make(chan struct{})
	go func(done chan struct{}) {
		for {
			select {
			case data := <-ch:
				log.Println(data.Tweet)
			case err := <-errCh:
				log.Println(err)
			case <-done:
				return
			}
		}
	}(done)
	time.Sleep(time.Second * 10)
	close(done)
	stream.Stop()
	log.Println("done")
}
Output:

type ClientOption

type ClientOption func(*client)

func WithConsumerKey

func WithConsumerKey(consumerKey string) ClientOption

func WithConsumerSecret

func WithConsumerSecret(consumerSecret string) ClientOption

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) ClientOption

type ComplianceFieldStatus

type ComplianceFieldStatus string
const (
	ComplianseFieldStatusCreated    ComplianceFieldStatus = "created"
	ComplianseFieldStatusInProgress ComplianceFieldStatus = "in_progress"
	ComplianseFieldStatusFailed     ComplianceFieldStatus = "failed"
	ComplianseFieldStatusCompletae  ComplianceFieldStatus = "complete"
)

type ComplianceFieldType

type ComplianceFieldType string
const (
	ComplianceFieldTypeTweets ComplianceFieldType = "tweets"
	ComplianceFieldTypeUsers  ComplianceFieldType = "users"
)

type ComplianceJobData

type ComplianceJobData struct {
	ID                string `json:"id"`
	CreatedAt         string `json:"created_at"`
	Type              string `json:"type"`
	Name              string `json:"name"`
	UploadURL         string `json:"upload_url"`
	UploadExpiresAt   string `json:"upload_expires_at"`
	DownloadURL       string `json:"download_url"`
	DownloadExpiresAt string `json:"download_expires_at"`
	Status            string `json:"status"`
	Resumable         bool   `json:"resumable"`
	Error             string `json:"error,omitempty"`
}

type ComplianceJobResponse

type ComplianceJobResponse struct {
	ComplianceJobData *ComplianceJobData  `json:"data"`
	Errors            []*APIResponseError `json:"errors"`
}

type ComplianceJobsData

type ComplianceJobsData struct {
	ID                string `json:"id"`
	CreatedAt         string `json:"created_at"`
	Type              string `json:"type"`
	Name              string `json:"name"`
	UploadURL         string `json:"upload_url"`
	UploadExpiresAt   string `json:"upload_expires_at"`
	DownloadURL       string `json:"download_url"`
	DownloadExpiresAt string `json:"download_expires_at"`
	Status            string `json:"status"`
	Resumable         bool   `json:"resumable"`
	Error             string `json:"error,omitempty"`
}

type ComplianceJobsOption

type ComplianceJobsOption struct {
	Type   ComplianceFieldType
	Status ComplianceFieldStatus
}

type ComplianceJobsResponse

type ComplianceJobsResponse struct {
	ComplianceJobsData []*ComplianceJobsData `json:"data"`
	Errors             []*APIResponseError   `json:"errors"`
}

type Compliances

type Compliances interface {
	// Batch compliance
	ComplianceJobs(ctx context.Context, opt *ComplianceJobsOption) (*ComplianceJobsResponse, error)
	ComplianceJob(ctx context.Context, complianceJobID int) (*ComplianceJobResponse, error)
	CreateComplianceJob(ctx context.Context, opt ...*CreateComplianceJobOption) (*CreateComplianceJobResponse, error)
}

type ConnectToStream

type ConnectToStream struct {
	// contains filtered or unexported fields
}

func (*ConnectToStream) Stop

func (s *ConnectToStream) Stop()

type ConnectToStreamOption

type ConnectToStreamOption struct {
	// BackfillMinutes int // This feature is currently only available to the Academic Research product track.
	Expansions  []Expansion
	MediaFields []MediaField
	PlaceFields []PlaceField
	PollFields  []PollField
	TweetFields []TweetField
	UserFields  []UserField
}

type ConnectToStreamResponse

type ConnectToStreamResponse struct {
	Tweet         *Tweet          `json:"data"`
	Includes      *TweetIncludes  `json:"includes,omitempty"`
	MatchingRules []*MatchingRule `json:"matching_rules"`
}

type CreateComplianceJobData

type CreateComplianceJobData struct {
	ID                string `json:"id"`
	CreatedAt         string `json:"created_at"`
	Type              string `json:"type"`
	Name              string `json:"name"`
	UploadURL         string `json:"upload_url"`
	UploadExpiresAt   string `json:"upload_expires_at"`
	DownloadURL       string `json:"download_url"`
	DownloadExpiresAt string `json:"download_expires_at"`
	Status            string `json:"status"`
	Resumable         bool   `json:"resumable"`
	Error             string `json:"error,omitempty"`
}

type CreateComplianceJobOption

type CreateComplianceJobOption struct {
	Type      ComplianceFieldType `json:"type"`
	Name      string              `json:"name,omitempty"`
	Resumable bool                `json:"resumable,omitempty"`
}

type CreateComplianceJobResponse

type CreateComplianceJobResponse struct {
	CreateComplianceJobData *CreateComplianceJobData `json:"data"`
	Errors                  []*APIResponseError      `json:"errors"`
}

type CreateNewGroupDMBody

type CreateNewGroupDMBody struct {
	Text        string                    `json:"text,omitempty"`
	Attachments []DirectMessageAttachment `json:"attachments,omitempty"`
}

type CreateNewGroupDMResponse

type CreateNewGroupDMResponse struct {
	DMConversationID string              `json:"dm_conversation_id,omitempty"`
	DMEventFieldID   string              `json:"dm_event_id,omitempty"`
	Errors           []*APIResponseError `json:"errors,omitempty"`
	Title            string              `json:"title,omitempty"`
	Detail           string              `json:"detail,omitempty"`
	Type             string              `json:"type,omitempty"`
}

type CreateNewListBody

type CreateNewListBody struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Private     bool   `json:"private,omitempty"`
}

type CreateNewListData

type CreateNewListData struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type CreateNewListResponse

type CreateNewListResponse struct {
	CreateNewListData *CreateNewListData  `json:"data"`
	Errors            []*APIResponseError `json:"errors,omitempty"`
	Title             string              `json:"title,omitempty"`
	Detail            string              `json:"detail,omitempty"`
	Type              string              `json:"type,omitempty"`
}

type CreateOneToOneDMBody

type CreateOneToOneDMBody struct {
	Text        string                    `json:"text,omitempty"`
	Attachments []DirectMessageAttachment `json:"attachments,omitempty"`
}

type CreateOneToOneDMResponse

type CreateOneToOneDMResponse struct {
	DMConversationID string              `json:"dm_conversation_id,omitempty"`
	DMEventFieldID   string              `json:"dm_event_id,omitempty"`
	Errors           []*APIResponseError `json:"errors,omitempty"`
	Title            string              `json:"title,omitempty"`
	Detail           string              `json:"detail,omitempty"`
	Type             string              `json:"type,omitempty"`
}

type DMEventField

type DMEventField string
const (
	DirectMessageFieldID               DMEventField = "id"
	DirectMessageFieldText             DMEventField = "text"
	DirectMessageFieldEventType        DMEventField = "event_type"
	DirectMessageFieldCreatedAt        DMEventField = "created_at"
	DirectMessageFieldDMConversationID DMEventField = "dm_conversation_id"
	DirectMessageFieldSenderID         DMEventField = "sender_id"
	DirectMessageFieldParticipantIDs   DMEventField = "participant_ids"
	DirectMessageFieldReferencedTweets DMEventField = "referenced_tweets"
	DirectMessageFieldAttachments      DMEventField = "attachments"
)

type DeleteListData

type DeleteListData struct {
	Deleted bool `json:"deleted"`
}

type DeleteListResponse

type DeleteListResponse struct {
	DeleteListData *DeleteListData     `json:"data"`
	Errors         []*APIResponseError `json:"errors,omitempty"`
	Title          string              `json:"title,omitempty"`
	Detail         string              `json:"detail,omitempty"`
	Type           string              `json:"type,omitempty"`
}

type DeleteRule

type DeleteRule struct {
	IDs []string `json:"ids"`
}

type DeleteTweetData

type DeleteTweetData struct {
	Deleted bool `json:"deleted"`
}

type DeleteTweetResponse

type DeleteTweetResponse struct {
	Data DeleteTweetData `json:"data"`
}

type DirectMessage

type DirectMessage struct {
	Attachments      []DirectMessageAttachment `json:"attachments,omitempty"`
	CreatedAt        string                    `json:"created_at"`
	DMConversationID string                    `json:"dm_conversation_id"`
	EventType        string                    `json:"event_type"`
	ID               string                    `json:"id"`
	SenderID         string                    `json:"sender_id"`
	Text             string                    `json:"text,omitempty"`
}

type DirectMessageAttachment

type DirectMessageAttachment struct {
	MediaID string `json:"media_id"`
}

type DirectMessageMeta

type DirectMessageMeta struct {
	ResultCount   int    `json:"result_count"`
	PreviousToken string `json:"previous_token,omitempty"`
	NextToken     string `json:"next_token,omitempty"`
}

type DirectMessageOption

type DirectMessageOption struct {
	DMEventFields   []DMEventField
	EventTypes      EventTypes
	Expansions      []Expansion
	MaxResults      int
	MediaFields     []MediaField
	PaginationToken string
	TweetFields     []TweetField
	UserFields      []UserField
}

type DirectMessages

type DirectMessages interface {
	// Direct Message
	CreateOneToOneDM(ctx context.Context, participantID string, body *CreateOneToOneDMBody) (*CreateOneToOneDMResponse, error)
	CreateNewGroupDM(ctx context.Context, conversationID string, body *CreateNewGroupDMBody) (*CreateNewGroupDMResponse, error)
	PostDM(ctx context.Context, body *PostDMBody) (*PostDMResponse, error)
	LookUpAllOneToOneDM(ctx context.Context, participantID string, opt ...*DirectMessageOption) (*LookUpAllOneToOneDMResponse, error)
	LookUpDM(ctx context.Context, dmConversationID string, opt ...*DirectMessageOption) (*LookUpDMResponse, error)
	LookUpAllDM(ctx context.Context, opt ...*DirectMessageOption) (*LookUpAllDMResponse, error)
}

type DiscoverSpacesMeta

type DiscoverSpacesMeta struct {
	ResultCount int `json:"result_count"`
}

type DiscoverSpacesOption

type DiscoverSpacesOption struct {
	Expansions  []Expansion
	SpaceFields []SpaceField
	TopicFields []TopicField
	UserFields  []UserField
}

type DiscoverSpacesResponse

type DiscoverSpacesResponse struct {
	Spaces   []*Space            `json:"data"`
	Includes *SpaceIncludes      `json:"includes,omitempty"`
	Errors   []*APIResponseError `json:"errors,omitempty"`
	Meta     *DiscoverSpacesMeta `json:"meta"`
}

type EventTypes

type EventTypes string
const (
	EventTypesFieldMessageCreate     EventTypes = "MessageCreate"
	EventTypesFieldParticipantsJoin  EventTypes = "ParticipantsJoin"
	EventTypesFieldParticipantsLeave EventTypes = "ParticipantsLeave"
)

type Exclude

type Exclude string

Exclude used in the timeline parameters

const (
	ExcludeRetweets Exclude = "retweets"
	ExcludeReplies  Exclude = "replies"
)

type Expansion

type Expansion string
const (
	// Tweet payloads
	ExpansionAuthorID                   Expansion = "author_id"
	ExpansionReferencedTweetsID         Expansion = "referenced_tweets.id"
	ExpansionEditHistoryTweetIDs        Expansion = "edit_history_tweet_ids"
	ExpansionInReplyToUserID            Expansion = "in_reply_to_user_id"
	ExpansionAttachmentsMediaKeys       Expansion = "attachments.media_keys"
	ExpansionAttachmentsPollIDs         Expansion = "attachments.poll_ids"
	ExpansionGeoPlaceID                 Expansion = "geo.place_id"
	ExpansionEntitiesMentionsUserName   Expansion = "entities.mentions.username"
	ExpansionReferencedTweetsIDAuthorID Expansion = "referenced_tweets.id.author_id"
	ExpansionContextAnnotations         Expansion = "context_annotations"
	// USer payloads
	ExpansionPinnedTweetID Expansion = "pinned_tweet_id"
	// Direct Message event payloads with attachments.media_keys + referenced_tweets.id
	ExpansionSenderID       Expansion = "sender_id"
	ExpansionParticipantIDs Expansion = "participant_ids"
	// Space payloads
	ExpansionInvitedUserIDs Expansion = "invited_user_ids"
	ExpansionSpeakerIDs     Expansion = "speaker_ids"
	ExpansionCreatorID      Expansion = "creator_id"
	ExpansionHostIDs        Expansion = "host_ids"
	ExpansionTopicIDs       Expansion = "topic_ids"
	// List payloads
	ExpansionOwnerID Expansion = "owner_id"
)

type FilteredRule

type FilteredRule struct {
	ID    string `json:"id"`
	Value string `json:"value"`
	Tag   string `json:"tag,omitempty"`
}

type FollowOption

type FollowOption struct {
	Expansions      []Expansion
	MaxResults      int
	PaginationToken string
	TweetFields     []TweetField
	UserFields      []UserField
}

type FollowersResponse

type FollowersResponse struct {
	Users    []*User             `json:"data"`
	Includes *UserIncludes       `json:"includes,omitempty"`
	Errors   []*APIResponseError `json:"errors,omitempty"`
	Meta     *FollowsMeta        `json:"meta"`
	Title    string              `json:"title,omitempty"`
	Detail   string              `json:"detail,omitempty"`
	Type     string              `json:"type,omitempty"`
}

type Following

type Following struct {
	Following     bool `json:"following"`
	PendingFollow bool `json:"pending_follow,omitempty"`
}

type FollowingBody

type FollowingBody struct {
	TargetUserID string `json:"target_user_id"`
}

type FollowingResponse

type FollowingResponse struct {
	Users    []*User             `json:"data"`
	Includes *UserIncludes       `json:"includes,omitempty"`
	Errors   []*APIResponseError `json:"errors,omitempty"`
	Meta     *FollowsMeta        `json:"meta"`
	Title    string              `json:"title,omitempty"`
	Detail   string              `json:"detail,omitempty"`
	Type     string              `json:"type,omitempty"`
}

type FollowsMeta

type FollowsMeta struct {
	ResultCount   int    `json:"result_count"`
	PreviousToken string `json:"previous_token,omitempty"`
	NextToken     string `json:"next_token,omitempty"`
}

type HTTPError

type HTTPError struct {
	APIName string
	Status  string
	URL     string
}

func (*HTTPError) Error

func (e *HTTPError) Error() string

type HideRepliesResponse

type HideRepliesResponse struct {
	HideRepliesResponseData *HideRepliesResponseData `json:"data"`
	Errors                  []*APIResponseError      `json:"errors,omitempty"`
}

type HideRepliesResponseData

type HideRepliesResponseData struct {
	Hidden bool `json:"hidden"`
}

type IsMember

type IsMember struct {
	IsMember bool `json:"is_member"`
}

type Liked

type Liked struct {
	Liked bool `json:"liked"`
}

type List

type List struct {
	ID            string `json:"id"`
	Name          string `json:"name"`
	CreatedAt     string `json:"created_at,omitempty"`
	Private       bool   `json:"private,omitempty"`
	FollowerCount int    `json:"follower_count,omitempty"`
	MemberCount   int    `json:"member_count,omitempty"`
	OwnerID       string `json:"owner_id,omitempty"`
	Description   string `json:"description,omitempty"`
}

type ListField

type ListField string
const (
	ListFieldCreatedAt   ListField = "created_at"
	ListFollowerCount    ListField = "follower_count"
	ListMemberCount      ListField = "member_count"
	ListFieldPrivate     ListField = "private"
	ListFieldDescription ListField = "description"
	ListOwnerID          ListField = "owner_id"
)

type ListFollowersOption

type ListFollowersOption struct {
	Expansions      []Expansion
	MaxResults      int
	PaginationToken string
	TweetFields     []TweetField
	UserFields      []UserField
}

type ListFollowersResponse

type ListFollowersResponse struct {
	Users    []*User             `json:"data"`
	Includes *ListIncludes       `json:"includes,omitempty"`
	Errors   []*APIResponseError `json:"errors,omitempty"`
	Meta     *ListMeta           `json:"meta"`
	Title    string              `json:"title,omitempty"`
	Detail   string              `json:"detail,omitempty"`
	Type     string              `json:"type,omitempty"`
}

type ListFollows

type ListFollows struct {
	Following bool `json:"following"`
}

type ListFollowsBody

type ListFollowsBody struct {
	ListID string `json:"list_id"`
}

type ListFollowsOption

type ListFollowsOption struct {
	Expansions      []Expansion
	ListFields      []ListField
	MaxResults      int
	PaginationToken string
	UserFields      []UserField
}

type ListIncludes

type ListIncludes struct {
	Tweets []*Tweet
	Users  []*User
}

type ListMembersBody

type ListMembersBody struct {
	UserID string `json:"user_id"`
}

type ListMembersOption

type ListMembersOption struct {
	Expansions      []Expansion
	MaxResults      int
	PaginationToken string
	TweetFields     []TweetField
	UserFields      []UserField
}

type ListMembersResponse

type ListMembersResponse struct {
	Users    []*User             `json:"data"`
	Includes *ListIncludes       `json:"includes,omitempty"`
	Errors   []*APIResponseError `json:"errors,omitempty"`
	Meta     *ListMeta           `json:"meta"`
	Title    string              `json:"title,omitempty"`
	Detail   string              `json:"detail,omitempty"`
	Type     string              `json:"type,omitempty"`
}

type ListMeta

type ListMeta struct {
	ResultCount   int    `json:"result_count"`
	PreviousToken string `json:"previous_token,omitempty"`
	NextToken     string `json:"next_token,omitempty"`
}

type ListResponse

type ListResponse struct {
	List     *List               `json:"data"`
	Includes *ListIncludes       `json:"includes,omitempty"`
	Errors   []*APIResponseError `json:"errors,omitempty"`
	Title    string              `json:"title,omitempty"`
	Detail   string              `json:"detail,omitempty"`
	Type     string              `json:"type,omitempty"`
}

type ListTweetsOption

type ListTweetsOption struct {
	Expansions      []Expansion
	MaxResults      int
	PaginationToken string
	TweetFields     []TweetField
	UserFields      []UserField
}

type ListTweetsResponse

type ListTweetsResponse struct {
	Tweets   []*Tweet            `json:"data"`
	Includes *ListIncludes       `json:"includes,omitempty"`
	Errors   []*APIResponseError `json:"errors,omitempty"`
	Meta     *ListMeta           `json:"meta"`
	Title    string              `json:"title,omitempty"`
	Detail   string              `json:"detail,omitempty"`
	Type     string              `json:"type,omitempty"`
}

type Lists

type Lists interface {
	// List Tweets lookup
	LookUpListTweets(ctx context.Context, listID string, opt ...*ListTweetsOption) (*ListTweetsResponse, error)
	// List follows
	UndoListFollows(ctx context.Context, listID string, userID string) (*UndoListFollowsResponse, error)
	ListFollowers(ctx context.Context, listID string, opt ...*ListFollowersOption) (*ListFollowersResponse, error)
	AllListsUserFollows(ctx context.Context, userID string, opt ...*ListFollowsOption) (*AllListsUserFollowsResponse, error)
	PostListFollows(ctx context.Context, listID string, userID string) (*PostListFollowsResponse, error)
	// List lookup
	LookUpList(ctx context.Context, listID string, opt ...*LookUpListOption) (*ListResponse, error)
	LookUpAllListsOwned(ctx context.Context, userID string, opt ...*AllListsOwnedOption) (*AllListsOwnedResponse, error)
	// List members
	UndoListMembers(ctx context.Context, listID string, userID string) (*UndoListMembersResponse, error)
	ListMembers(ctx context.Context, listID string, opt ...*ListMembersOption) (*ListMembersResponse, error)
	ListsSpecifiedUser(ctx context.Context, userID string, opt ...*ListsSpecifiedUserOption) (*ListsSpecifiedUserResponse, error)
	PostListMembers(ctx context.Context, listID string, userID string) (*PostListMembersResponse, error)
	// Manage Lists
	DeleteList(ctx context.Context, listID string) (*DeleteListResponse, error)
	UpdateMetaDataForList(ctx context.Context, listID string, body ...*UpdateMetaDataForListBody) (*UpdateMetaDataForListResponse, error)
	CreateNewList(ctx context.Context, body *CreateNewListBody) (*CreateNewListResponse, error)
	// Pinned Lists
	UndoPinnedLists(ctx context.Context, listID string, userID string) (*UndoPinnedListsResponse, error)
	PinnedLists(ctx context.Context, userID string, opt ...*PinnedListsOption) (*PinnedListsResponse, error)
	PostPinnedLists(ctx context.Context, listID string, userID string) (*PostPinnedListsResponse, error)
}

type ListsSpecifiedUserOption

type ListsSpecifiedUserOption struct {
	Expansions      []Expansion
	ListFields      []ListField
	MaxResults      int
	PaginationToken string
	UserFields      []UserField
}

type ListsSpecifiedUserResponse

type ListsSpecifiedUserResponse struct {
	Lists    []*List             `json:"data"`
	Includes *ListIncludes       `json:"includes,omitempty"`
	Errors   []*APIResponseError `json:"errors,omitempty"`
	Meta     *ListMeta           `json:"meta"`
	Title    string              `json:"title,omitempty"`
	Detail   string              `json:"detail,omitempty"`
	Type     string              `json:"type,omitempty"`
}

type LookUpAllDMResponse

type LookUpAllDMResponse struct {
	Message []*DirectMessage    `json:"data"`
	Errors  []*APIResponseError `json:"errors,omitempty"`
	Meta    *DirectMessageMeta  `json:"meta,omitempty"`
	Title   string              `json:"title,omitempty"`
	Detail  string              `json:"detail,omitempty"`
	Type    string              `json:"type,omitempty"`
}

type LookUpAllOneToOneDMResponse

type LookUpAllOneToOneDMResponse struct {
	Message []*DirectMessage    `json:"data"`
	Errors  []*APIResponseError `json:"errors,omitempty"`
	Meta    *DirectMessageMeta  `json:"meta,omitempty"`
	Title   string              `json:"title,omitempty"`
	Detail  string              `json:"detail,omitempty"`
	Type    string              `json:"type,omitempty"`
}

type LookUpDMResponse

type LookUpDMResponse struct {
	Message []*DirectMessage    `json:"data"`
	Errors  []*APIResponseError `json:"errors,omitempty"`
	Meta    *DirectMessageMeta  `json:"meta,omitempty"`
	Title   string              `json:"title,omitempty"`
	Detail  string              `json:"detail,omitempty"`
	Type    string              `json:"type,omitempty"`
}

type LookUpListOption

type LookUpListOption struct {
	Expansions []Expansion
	ListFields []ListField
	UserFields []UserField
}

type LookUpUsersWhoLiked

type LookUpUsersWhoLiked struct {
	ID              string                            `json:"id"`
	Name            string                            `json:"name"`
	UserName        string                            `json:"username"`
	CreatedAt       string                            `json:"created_at,omitempty"`
	Protected       bool                              `json:"protected,omitempty"`
	Withheld        *LookUpUsersWhoLikedWithheld      `json:"withheld,omitempty"`
	Location        string                            `json:"location,omitempty"`
	URL             string                            `json:"url,omitempty"`
	Description     string                            `json:"description,omitempty"`
	Verified        bool                              `json:"verified,omitempty"`
	Entities        *LookUpUsersWhoLikedEntity        `json:"entities,omitempty"`
	ProfileImageURL string                            `json:"profile_image_url,omitempty"`
	PublicMetrics   *LookUpUsersWhoLikedPublicMetrics `json:"public_metrics,omitempty"`
	PinnedTweetID   string                            `json:"pinned_tweet_id,omitempty"`
}

type LookUpUsersWhoLikedCashTag

type LookUpUsersWhoLikedCashTag struct {
	Start   int    `json:"start"`
	End     int    `json:"end"`
	CashTag string `json:"cashtag"`
}

type LookUpUsersWhoLikedDescription

type LookUpUsersWhoLikedDescription struct {
	URLs     []*LookUpUsersWhoLikedURLContent `json:"urls"`
	HashTags []*LookUpUsersWhoLikedHashTag    `json:"hashtags"`
	Mentions []*LookUpUsersWhoLikedMention    `json:"mentions"`
}

type LookUpUsersWhoLikedEntity

type LookUpUsersWhoLikedEntity struct {
	URL         *LookUpUsersWhoLikedURL         `json:"url"`
	Description *LookUpUsersWhoLikedDescription `json:"description"`
}

type LookUpUsersWhoLikedHashTag

type LookUpUsersWhoLikedHashTag struct {
	Start   int    `json:"start"`
	End     int    `json:"end"`
	HashTag string `json:"hashtag"`
}

type LookUpUsersWhoLikedIncludes

type LookUpUsersWhoLikedIncludes struct {
	Tweets []*Tweet `json:"tweets"`
}

type LookUpUsersWhoLikedMention

type LookUpUsersWhoLikedMention struct {
	Start    int                           `json:"start"`
	End      int                           `json:"end"`
	UserName string                        `json:"username"`
	CashTags []*LookUpUsersWhoLikedCashTag `json:"cashtags"`
}

type LookUpUsersWhoLikedMeta

type LookUpUsersWhoLikedMeta struct {
	ResultCount int `json:"result_count"`
}

type LookUpUsersWhoLikedPublicMetrics

type LookUpUsersWhoLikedPublicMetrics struct {
	FollowersCount int `json:"followers_count"`
	FollowingCount int `json:"following_count"`
	TweetCount     int `json:"tweet_count"`
	ListedCount    int `json:"listed_count"`
}

type LookUpUsersWhoLikedURL

type LookUpUsersWhoLikedURL struct {
	URLs []*LookUpUsersWhoLikedURLContent `json:"urls"`
}

type LookUpUsersWhoLikedURLContent

type LookUpUsersWhoLikedURLContent struct {
	Start       int    `json:"start"`
	End         int    `json:"end"`
	URL         string `json:"url"`
	ExpandedURL string `json:"expanded_url"`
	DisplayURL  string `json:"display_url"`
}

type LookUpUsersWhoLikedWithheld

type LookUpUsersWhoLikedWithheld struct {
	Scope        string   `json:"scope"`
	CountryCodes []string `json:"country_codes"`
}

type LookUpUsersWhoPurchasedSpaceTicketIncludes

type LookUpUsersWhoPurchasedSpaceTicketIncludes struct {
	Tweets []*Tweet
}

type LookupUserBookmarksMeta

type LookupUserBookmarksMeta struct {
	ResultCount int    `json:"result_count"`
	NextToken   string `json:"next_token"`
}

type LookupUserBookmarksOption

type LookupUserBookmarksOption struct {
	Expansions      []Expansion
	MaxResults      int
	MediaFields     []MediaField
	PaginationToken string
	PlaceFields     []PlaceField
	PollFields      []PollField
	TweetFields     []TweetField
	UserFields      []UserField
}

type LookupUserBookmarksResponse

type LookupUserBookmarksResponse struct {
	Tweets   []*Tweet                 `json:"data"`
	Includes *TweetIncludes           `json:"includes,omitempty"`
	Meta     *LookupUserBookmarksMeta `json:"meta"`
	Errors   []*APIResponseError      `json:"errors,omitempty"`
	Title    string                   `json:"title,omitempty"`
	Detail   string                   `json:"detail,omitempty"`
	Type     string                   `json:"type,omitempty"`
}

type MatchingRule

type MatchingRule struct {
	ID  string `json:"id"`
	Tag string `json:"tag"`
}

type Me

type Me struct {
	ID              string             `json:"id"`
	Name            string             `json:"name"`
	UserName        string             `json:"username"`
	CreatedAt       string             `json:"created_at,omitempty"`
	Protected       bool               `json:"protected,omitempty"`
	Withheld        *MeWithheld        `json:"withheld,omitempty"`
	Location        string             `json:"location,omitempty"`
	URL             string             `json:"url,omitempty"`
	Description     string             `json:"description,omitempty"`
	Verified        bool               `json:"verified,omitempty"`
	Entities        *UserEntity        `json:"entities,omitempty"`
	ProfileImageURL string             `json:"profile_image_url,omitempty"`
	PublicMetrics   *UserPublicMetrics `json:"public_metrics,omitempty"`
	PinnedTweetID   string             `json:"pinned_tweet_id,omitempty"`
	Includes        *MeIncludes        `json:"includes,omitempty"`
}

type MeIncludes

type MeIncludes struct {
	Tweets []*Tweet
}

type MeOption

type MeOption struct {
	Expansions  []Expansion
	TweetFields []TweetField
	UserFields  []UserField
}

type MeResponse

type MeResponse struct {
	Me     *Me                 `json:"data"`
	Errors []*APIResponseError `json:"errors,omitempty"`
}

type MeWithheld

type MeWithheld struct {
	CountryCodes []string `json:"country_codes"`
	Scope        string   `json:"scope"`
}

type Media

type Media struct {
	MediaKey         string         `json:"media_key"`
	Type             string         `json:"type"`
	URL              string         `json:"url,omitempty"`
	DurationMs       int            `json:"duration_ms,omitempty"`
	Height           int            `json:"height,omitempty"`
	NonPublicMetrics *MediaMetrics  `json:"non_public_metrics,omitempty"`
	OrganicMetrics   *MediaMetrics  `json:"organic_metrics,omitempty"`
	PreviewImageURL  string         `json:"preview_image_url,omitempty"`
	PromotedMetrics  *MediaMetrics  `json:"promoted_metrics,omitempty"`
	PublicMetrics    *MediaMetrics  `json:"public_metrics,omitempty"`
	Width            int            `json:"width,omitempty"`
	AltText          string         `json:"alt_text,omitempty"`
	MediaIDs         []string       `json:"media_ids,omitempty"`
	TaggedUserIDs    []string       `json:"tagged_user_ids,omitempty"`
	Variants         []MediaVariant `json:"variants,omitempty"`
}

type MediaField

type MediaField string
const (
	MediaFieldMediaKey         MediaField = "media_key"
	MediaFieldType             MediaField = "type"
	MediaFieldURL              MediaField = "url"
	MediaFieldDurationMS       MediaField = "duration_ms"
	MediaFieldHeight           MediaField = "height"
	MediaFieldNonPublicMetrics MediaField = "non_public_metrics"
	MediaFieldOrganicMetrics   MediaField = "organic_metrics"
	MediaFieldPreviewImageURL  MediaField = "preview_image_url"
	MediaFieldPromotedMetrics  MediaField = "promoted_metrics"
	MediaFieldPublicMetrics    MediaField = "public_metrics"
	MediaFieldWidth            MediaField = "width"
	MediaFieldAltText          MediaField = "alt_text"
	MediaFieldVariants         MediaField = "variants"
)

type MediaMetrics

type MediaMetrics struct {
	Playback0Count   int `json:"playback_0_count,omitempty"`
	Playback25Count  int `json:"playback_25_count,omitempty"`
	Playback50Count  int `json:"playback_50_count,omitempty"`
	Playback75Count  int `json:"playback_75_count,omitempty"`
	Playback100Count int `json:"playback_100_count,omitempty"`
	ViewCount        int `json:"view_count,omitempty"`
}

type MediaVariant

type MediaVariant struct {
	BitRate     int    `json:"bit_rate"`
	ContentType string `json:"content_type"`
	URL         string `json:"url"`
}

type MuteOption

type MuteOption struct {
	Expansions      []Expansion
	MaxResults      int
	PaginationToken string
	TweetFields     []TweetField
	UserFields      []UserField
}

type MutesMeta

type MutesMeta struct {
	ResultCount   int    `json:"result_count"`
	PreviousToken string `json:"previous_token,omitempty"`
	NextToken     string `json:"next_token,omitempty"`
}

type Muting

type Muting struct {
	Muting bool `json:"muting"`
}

type MutingBody

type MutingBody struct {
	TargetUserID string `json:"target_user_id"`
}

type MutingResponse

type MutingResponse struct {
	Users    []*User             `json:"data"`
	Includes *UserIncludes       `json:"includes,omitempty"`
	Errors   []*APIResponseError `json:"errors,omitempty"`
	Meta     *MutesMeta          `json:"meta"`
	Title    string              `json:"title,omitempty"`
	Detail   string              `json:"detail,omitempty"`
	Type     string              `json:"type,omitempty"`
}

type OAuth

type OAuth interface {
	GenerateAppOnlyBearerToken(ctx context.Context) (bool, error)
}

type Parameter

type Parameter struct {
	ID        []string `json:"id"`
	IDs       []string `json:"ids"`
	UserName  []string `json:"username"`
	UserNames []string `json:"usernames"`
}

type Pinned

type Pinned struct {
	Pinned bool `json:"pinned"`
}

type PinnedListsBody

type PinnedListsBody struct {
	ListID string `json:"list_id"`
}

type PinnedListsOption

type PinnedListsOption struct {
	Expansions []Expansion
	ListFields []ListField
	UserFields []UserField
}

type PinnedListsResponse

type PinnedListsResponse struct {
	Lists    []*List             `json:"data"`
	Includes *ListIncludes       `json:"includes,omitempty"`
	Errors   []*APIResponseError `json:"errors,omitempty"`
	Meta     *ListMeta           `json:"meta"`
	Title    string              `json:"title,omitempty"`
	Detail   string              `json:"detail,omitempty"`
	Type     string              `json:"type,omitempty"`
}

type Place

type Place struct {
	FullName        string    `json:"full_name"`
	ID              string    `json:"id"`
	ContainedWithin []string  `json:"contained_within,omitempty"`
	Country         string    `json:"country,omitempty"`
	CountryCode     string    `json:"country_code,omitempty"`
	Geo             *PlaceGeo `json:"geo,omitempty"`
	Name            string    `json:"name,omitempty"`
	PlaceType       string    `json:"place_type,omitempty"`
}

type PlaceField

type PlaceField string
const (
	PlaceFieldFullName        PlaceField = "full_name"
	PlaceFieldID              PlaceField = "id"
	PlaceFieldContainedWithin PlaceField = "contained_within"
	PlaceFieldCountry         PlaceField = "country"
	PlaceFieldCountryCode     PlaceField = "country_code"
	PlaceFieldGeo             PlaceField = "geo"
	PlaceFieldName            PlaceField = "name"
	PlaceFieldPlaceType       PlaceField = "place_type"
)

type PlaceGeo

type PlaceGeo struct {
	Type       string                 `json:"type"`
	BBox       []float64              `json:"bbox"`
	Properties map[string]interface{} `json:"properties"`
}

type Poll

type Poll struct {
	ID              string        `json:"id"`
	Options         []*PollOption `json:"options"`
	DurationMinutes int           `json:"duration_minutes,omitempty"`
	EndDatetime     string        `json:"end_datetime,omitempty"`
	VotingStatus    string        `json:"voting_status,omitempty"`
}

type PollField

type PollField string
const (
	PollFieldID              PollField = "id"
	PollFieldOptions         PollField = "options"
	PollFieldDurationMinutes PollField = "duration_minutes"
	PollFieldEndDateTime     PollField = "end_datetime"
	PollFieldVotingStatus    PollField = "voting_status"
)

type PollOption

type PollOption struct {
	Position int    `json:"position"`
	Label    string `json:"label"`
	Votes    int    `json:"votes"`
}

type PostBlockingResponse

type PostBlockingResponse struct {
	Blocking *Blocking           `json:"data"`
	Errors   []*APIResponseError `json:"errors,omitempty"`
}

type PostDMBody

type PostDMBody struct {
	ConversationType string         `json:"conversation_type"`
	Message          *DirectMessage `json:"message"`
	ParticipantIDs   []string       `json:"participant_id"`
}

type PostDMResponse

type PostDMResponse struct {
	DMConversationID string              `json:"dm_conversation_id,omitempty"`
	DMEventFieldID   string              `json:"dm_event_id,omitempty"`
	Errors           []*APIResponseError `json:"errors,omitempty"`
	Title            string              `json:"title,omitempty"`
	Detail           string              `json:"detail,omitempty"`
	Type             string              `json:"type,omitempty"`
}

type PostFollowingResponse

type PostFollowingResponse struct {
	Following *Following          `json:"data"`
	Errors    []*APIResponseError `json:"errors,omitempty"`
}

type PostListFollowsResponse

type PostListFollowsResponse struct {
	Following *ListFollows        `json:"data"`
	Errors    []*APIResponseError `json:"errors,omitempty"`
}

type PostListMembersResponse

type PostListMembersResponse struct {
	IsMember *IsMember           `json:"data"`
	Errors   []*APIResponseError `json:"errors,omitempty"`
}

type PostMutingResponse

type PostMutingResponse struct {
	Muting *Muting             `json:"data"`
	Errors []*APIResponseError `json:"errors,omitempty"`
}

type PostPinnedListsResponse

type PostPinnedListsResponse struct {
	Pinned *Pinned             `json:"data"`
	Errors []*APIResponseError `json:"errors,omitempty"`
}

type PostRetweetResponse

type PostRetweetResponse struct {
	Retweeted *Retweeted          `json:"data"`
	Errors    []*APIResponseError `json:"errors,omitempty"`
}

type PostTweetData

type PostTweetData struct {
	ID   string `json:"id"`
	Text string `json:"text"`
}

type PostTweetOption

type PostTweetOption struct {
	DirectMessageDeepLink string      `json:"direct_message_deep_link,omitempty"`
	ForSuperFollowersOnly bool        `json:"for_super_followers_only,omitempty"`
	Geo                   *TweetGeo   `json:"geo,omitempty"`
	Media                 *Media      `json:"media,omitempty"`
	Poll                  *Poll       `json:"poll,omitempty"`
	QuoteTweetID          string      `json:"quote_tweet_id,omitempty"`
	Reply                 *TweetReply `json:"reply,omitempty"`
	ReplySettings         string      `json:"reply_settings,omitempty"`
	Text                  string      `json:"text,omitempty"`
}

type PostTweetResponse

type PostTweetResponse struct {
	PostTweetData PostTweetData `json:"data"`
}

type PostUsersLikingTweetResponse

type PostUsersLikingTweetResponse struct {
	Liked  *Liked              `json:"data"`
	Errors []*APIResponseError `json:"errors,omitempty"`
}

type RemoveBookmarkOfTweetData

type RemoveBookmarkOfTweetData struct {
	Bookmarks bool `json:"bookmarks"`
}

type RemoveBookmarkOfTweetResponse

type RemoveBookmarkOfTweetResponse struct {
	RemoveBookmarkOfTweetData *RemoveBookmarkOfTweetData `json:"data"`
	Errors                    []*APIResponseError        `json:"errors,omitempty"`
	Title                     string                     `json:"title,omitempty"`
	Detail                    string                     `json:"detail,omitempty"`
	Type                      string                     `json:"type,omitempty"`
}

type RetrieveStreamRulesMeta

type RetrieveStreamRulesMeta struct {
	Sent string
}

type RetrieveStreamRulesOption

type RetrieveStreamRulesOption struct {
	IDs []string
}

type RetrieveStreamRulesResponse

type RetrieveStreamRulesResponse struct {
	Rules  []*FilteredRule          `json:"data"`
	Meta   *RetrieveStreamRulesMeta `json:"meta"`
	Errors []*APIResponseError      `json:"errors,omitempty"`
}

type RetrieveUserOption

type RetrieveUserOption struct {
	Expansions  []Expansion
	TweetFields []TweetField
	UserFields  []UserField
}

type RetriveTweetOption

type RetriveTweetOption struct {
	Expansions  []Expansion
	MediaFields []MediaField
	PlaceFields []PlaceField
	PollFields  []PollField
	TweetFields []TweetField
	UserFields  []UserField
}

type Retweeted

type Retweeted struct {
	Retweeted bool `json:"retweeted"`
}

type RetweetsLookupMeta

type RetweetsLookupMeta struct {
	ResultCount int `json:"result_count"`
}

type RetweetsLookupOption

type RetweetsLookupOption struct {
	Expansions  []Expansion
	MediaFields []MediaField
	PlaceFields []PlaceField
	PollFields  []PollField
	TweetFields []TweetField
	UserFields  []UserField
}

type RetweetsResponse

type RetweetsResponse struct {
	Users    []*User             `json:"data"`
	Includes *TweetIncludes      `json:"includes,omitempty"`
	Errors   []*APIResponseError `json:"errors,omitempty"`
	Meta     *RetweetsLookupMeta `json:"meta"`
	Title    string              `json:"title,omitempty"`
	Detail   string              `json:"detail,omitempty"`
	Type     string              `json:"type,omitempty"`
}

type SearchSpacesMeta

type SearchSpacesMeta struct {
	ResultCount int `json:"result_count"`
}

type SearchSpacesOption

type SearchSpacesOption struct {
	Expansions  []Expansion
	SpaceFields []SpaceField
	State       []StateOption
	TopicFields []TopicField
	UserFields  []UserField
}

type SearchSpacesResponse

type SearchSpacesResponse struct {
	Spaces   []*Space            `json:"data,omitempty"`
	Includes *SpaceIncludes      `json:"includes,omitempty"`
	Meta     *SearchSpacesMeta   `json:"meta"`
	Errors   []*APIResponseError `json:"errors,omitempty"`
}

type SearchTweetsMeta

type SearchTweetsMeta struct {
	ResultCount int    `json:"result_count"`
	NewestID    string `json:"newest_id"`
	OldestID    string `json:"oldest_id"`
	NextToken   string `json:"next_token,omitempty"`
}

type SearchTweetsOption

type SearchTweetsOption struct {
	EndTime     time.Time
	Expansions  []Expansion
	MaxResults  int
	MediaFields []MediaField
	NextToken   string
	PlaceFields []PlaceField
	PollFields  []PollField
	SinceID     string
	StartTime   time.Time
	TweetFields []TweetField
	UntilID     string
	UserFields  []UserField
}

type SearchTweetsResponse

type SearchTweetsResponse struct {
	Tweets   []*Tweet            `json:"data"`
	Includes *TweetIncludes      `json:"includes,omitempty"`
	Meta     *SearchTweetsMeta   `json:"meta"`
	Errors   []*APIResponseError `json:"errors,omitempty"`
	Title    string              `json:"title,omitempty"`
	Detail   string              `json:"detail,omitempty"`
	Type     string              `json:"type,omitempty"`
}

type Space

type Space struct {
	ID               string   `json:"id"`
	State            string   `json:"state"`
	CreatedAt        string   `json:"created_at,omitempty"`
	EndedAt          string   `json:"ended_at,omitempty"`
	HostIDs          []string `json:"host_ids,omitempty"`
	Lang             string   `json:"lang,omitempty"`
	IsTicketed       bool     `json:"is_ticketed,omitempty"`
	InvitedUserIDs   []string `json:"invited_user_ids,omitempty"`
	ParticipantCount int      `json:"participant_count,omitempty"`
	ScheduledStart   string   `json:"scheduled_start,omitempty"`
	SpeakerIDs       []string `json:"speaker_ids,omitempty"`
	StartedAt        string   `json:"started_at,omitempty"`
	TopicIDs         []string `json:"topic_ids,omitempty"`
	Title            string   `json:"title,omitempty"`
	UpdatedAt        string   `json:"updated_at,omitempty"`
	CreatorID        string   `json:"creator_id,omitempty"`
}

type SpaceField

type SpaceField string
const (
	SpaceFieldHostIDs          SpaceField = "host_ids"
	SpaceFieldCreatedAt        SpaceField = "created_at"
	SpaceFieldCreatorID        SpaceField = "creator_id"
	SpaceFieldID               SpaceField = "id"
	SpaceFieldLanguage         SpaceField = "lang"
	SpaceFieldInvittedUserIDs  SpaceField = "invited_user_ids"
	SpaceFieldParticipantCount SpaceField = "participant_count"
	SpaceFieldSpeakerIDs       SpaceField = "speaker_ids"
	SpaceFieldStartedAt        SpaceField = "started_at"
	SpaceFieldEndedAt          SpaceField = "ended_at"
	SpaceFieldTopicIDs         SpaceField = "topic_ids"
	SpaceFieldState            SpaceField = "state"
	SpaceFieldTitle            SpaceField = "title"
	SpaceFieldUpdatedAt        SpaceField = "updated_at"
	SpaceFieldScheduledStart   SpaceField = "scheduled_start"
	SpaceFieldIsTicketed       SpaceField = "is_ticketed"
)

type SpaceIncludes

type SpaceIncludes struct {
	Topics []*Topic
	Users  []*User
}

type SpaceOption

type SpaceOption struct {
	Expansions  []Expansion
	SpaceFields []SpaceField
	TopicFields []TopicField
	UserFields  []UserField
}

type SpaceResponse

type SpaceResponse struct {
	Space    *Space              `json:"data,omitempty"`
	Includes *SpaceIncludes      `json:"includes,omitempty"`
	Errors   []*APIResponseError `json:"errors,omitempty"`
	Title    string              `json:"title,omitempty"`
	Detail   string              `json:"detail,omitempty"`
	Type     string              `json:"type,omitempty"`
}

type Spaces

type Spaces interface {
	// Search Spaces
	SearchSpaces(ctx context.Context, searchTerm string, opt ...*SearchSpacesOption) (*SearchSpacesResponse, error)
	// Spaces lookup
	LookUpSpaces(ctx context.Context, spaceIDs []string, opt ...*SpaceOption) (*SpacesResponse, error)
	LookUpSpace(ctx context.Context, spaceID string, opt ...*SpaceOption) (*SpaceResponse, error)
	UsersPurchasedSpaceTicket(ctx context.Context, spaceID string, opt ...*UsersPurchasedSpaceTicketOption) (*UsersPurchasedSpaceTicketResponse, error)
	// TODO: /2/spaces/:id/tweets
	DiscoverSpaces(ctx context.Context, userIDs []string, opt ...*DiscoverSpacesOption) (*DiscoverSpacesResponse, error)
}

type SpacesResponse

type SpacesResponse struct {
	Spaces   []*Space            `json:"data,omitempty"`
	Includes *SpaceIncludes      `json:"includes,omitempty"`
	Errors   []*APIResponseError `json:"errors,omitempty"`
	Title    string              `json:"title,omitempty"`
	Detail   string              `json:"detail,omitempty"`
	Type     string              `json:"type,omitempty"`
}

type StateOption

type StateOption string
const (
	SpaceFieldAll       StateOption = "all"
	SpaceFieldLive      StateOption = "live"
	SpaceFieldScheduled StateOption = "scheduled"
)

type TimeseriesCount

type TimeseriesCount struct {
	Start      string `json:"start"`
	End        string `json:"end"`
	TweetCount int    `json:"tweet_count"`
}

type Topic

type Topic struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

type TopicField

type TopicField string
const (
	TopicFieldID          TopicField = "id"
	TopicFieldName        TopicField = "name"
	TopicFieldDescription TopicField = "description"
)

type Tweet

type Tweet struct {
	ID                 string                    `json:"id"`
	Text               string                    `json:"text"`
	EditHistoryIDs     []string                  `json:"edit_history_tweet_ids"`
	Attachments        *TweetAttachment          `json:"attachments,omitempty"`
	AuthorID           string                    `json:"author_id,omitempty"`
	ContextAnnotations []*TweetContextAnnotation `json:"context_annotations,omitempty"`
	ConversationID     string                    `json:"conversation_id,omitempty"`
	CreatedAt          string                    `json:"created_at"`
	Entities           *TweetEntity              `json:"entities,omitempty"`
	Geo                *TweetGeo                 `json:"geo,omitempty"`
	InReplyToUserID    string                    `json:"in_reply_to_user_id,omitempty"`
	Lang               string                    `json:"lang,omitempty"`
	NonPublicMetrics   *TweetMetrics             `json:"non_public_metrics,omitempty"`
	OrganicMetrics     *TweetMetrics             `json:"organic_metrics,omitempty"`
	PossiblySensitive  bool                      `json:"possibly_sensitive,omitempty"`
	PromotedMetrics    *TweetMetrics             `json:"promoted_metrics,omitempty"`
	PublicMetrics      *TweetMetrics             `json:"public_metrics,omitempty"`
	ReferencedTweets   []*TweetReferencedTweet   `json:"referenced_tweets,omitempty"`
	ReplySettings      string                    `json:"reply_settings,omitempty"`
	Source             string                    `json:"source,omitempty"`
	Withheld           *TweetWithheld            `json:"withheld,omitempty"`
}

type TweetAnnotation

type TweetAnnotation struct {
	Start          int     `json:"start"`
	End            int     `json:"end"`
	Probability    float64 `json:"probability"`
	Type           string  `json:"type"`
	NormalizedText string  `json:"normalized_text"`
}

type TweetAttachment

type TweetAttachment struct {
	PollIDs   []string `json:"poll_ids"`
	MediaKeys []string `json:"media_keys"`
}

type TweetBody

type TweetBody struct {
	TweetID string `json:"tweet_id"`
}

type TweetCashtag

type TweetCashtag struct {
	Start int    `json:"start"`
	End   int    `json:"end"`
	Tag   string `json:"tag"`
}

type TweetContextAnnotation

type TweetContextAnnotation struct {
	Domain *TweetContextObj `json:"domain"`
	Entity *TweetContextObj `json:"entity"`
}

type TweetContextObj

type TweetContextObj struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

type TweetCoordinates

type TweetCoordinates struct {
	Type        string    `json:"type"`
	Coordinates []float64 `json:"coordinates"`
}

type TweetCountMeta

type TweetCountMeta struct {
	TotalTweetCount int    `json:"total_tweet_count"`
	NextToken       string `json:"next_token,omitempty"`
}

type TweetCountsAllOption

type TweetCountsAllOption struct {
	StartTime   time.Time
	EndTime     time.Time
	SinceID     string
	UntilID     string
	Granularity string
	NextToken   string
}

type TweetCountsOption

type TweetCountsOption struct {
	StartTime   time.Time
	EndTime     time.Time
	SinceID     string
	UntilID     string
	Granularity string
}

type TweetCountsResponse

type TweetCountsResponse struct {
	Counts []*TimeseriesCount `json:"data"`
	Meta   *TweetCountMeta    `json:"meta"`
}

type TweetEntity

type TweetEntity struct {
	Annotations []*TweetAnnotation `json:"annotations"`
	Cashtags    []*TweetCashtag    `json:"cashtags"`
	Hashtags    []*TweetHashtag    `json:"hashtags"`
	Mentions    []*TweetMention    `json:"mentions"`
	URLs        []*TweetURL        `json:"urls"`
}

type TweetField

type TweetField string
const (
	TweetFieldID                 TweetField = "id"
	TweetFieldText               TweetField = "text"
	TweetEditHistoryIDs          TweetField = "edit_history_tweet_ids"
	TweetFieldAttachments        TweetField = "attachments"
	TweetFieldAuthorID           TweetField = "author_id"
	TweetFieldContextAnnotations TweetField = "context_annotations"
	TweetFieldConversationID     TweetField = "conversation_id"
	TweetFieldCreatedAt          TweetField = "created_at"
	TweetFieldEditControls       TweetField = "edit_controls"
	TweetFieldEntities           TweetField = "entities"
	TweetFieldInReplyToUserID    TweetField = "in_reply_to_user_id"
	TweetFieldLanguage           TweetField = "lang"
	TweetFieldNonPublicMetrics   TweetField = "non_public_metrics"
	TweetFieldOrganicMetrics     TweetField = "organic_metrics"
	TweetFieldPossiblySensitve   TweetField = "possibly_sensitive"
	TweetFieldPromotedMetrics    TweetField = "promoted_metrics"
	TweetFieldPublicMetrics      TweetField = "public_metrics"
	TweetFieldReferencedTweets   TweetField = "referenced_tweets"
	TweetReplySettings           TweetField = "reply_settings"
	TweetFieldSource             TweetField = "source"
	TweetFieldWithHeld           TweetField = "withheld"
	TweetFieldGeo                TweetField = "geo"
	TweetFieldMaxResults         TweetField = "max_results"
)

type TweetGeo

type TweetGeo struct {
	Coordinates *TweetCoordinates `json:"coordinates"`
	PlaceID     string            `json:"place_id"`
}

type TweetHashtag

type TweetHashtag struct {
	Start int    `json:"start"`
	End   int    `json:"end"`
	Tag   string `json:"tag"`
}

type TweetImage

type TweetImage struct {
	URL    string `json:"url"`
	Width  int    `json:"width"`
	Height int    `json:"height"`
}

type TweetIncludes

type TweetIncludes struct {
	Media  []*Media
	Places []*Place
	Polls  []*Poll
	Tweets []*Tweet
	Users  []*User
}

type TweetMention

type TweetMention struct {
	Start    int    `json:"start"`
	End      int    `json:"end"`
	UserName string `json:"user_name"`
}

type TweetMetrics

type TweetMetrics struct {
	ImpressionCount   int `json:"impression_count"`
	LikeCount         int `json:"like_count"`
	ReplyCount        int `json:"reply_count"`
	RetweetCount      int `json:"retweet_count"`
	URLLinkClicks     int `json:"url_link_clicks"`
	UserProfileClicks int `json:"user_profile_clicks"`
	QuoteCount        int `json:"quote_count"`
}

type TweetReferencedTweet

type TweetReferencedTweet struct {
	Type string `json:"type"`
	ID   string `json:"id"`
}

type TweetReply

type TweetReply struct {
	ExcludeReplyUserIDs []string `json:"exclude_reply_user_ids"`
	InReplyToTweetID    string   `json:"in_reply_to_tweet_id"`
}

type TweetResponse

type TweetResponse struct {
	Tweet    *Tweet              `json:"data"`
	Includes *TweetIncludes      `json:"includes,omitempty"`
	Errors   []*APIResponseError `json:"errors,omitempty"`
	Title    string              `json:"title,omitempty"`
	Detail   string              `json:"detail,omitempty"`
	Type     string              `json:"type,omitempty"`
}

type TweetURL

type TweetURL struct {
	Start       int           `json:"start"`
	End         int           `json:"end"`
	URL         string        `json:"url"`
	ExpandedURL string        `json:"expanded_url"`
	DisplayURL  string        `json:"display_url"`
	Images      []*TweetImage `json:"images"`
	Status      int           `json:"status"`
	Title       string        `json:"title"`
	Description string        `json:"description"`
	UnwoundURL  string        `json:"unwound_url"`
}

type TweetWithheld

type TweetWithheld struct {
	Copyright    bool     `json:"copyright"`
	CountryCodes []string `json:"country_codes"`
}

type Tweets

type Tweets interface {
	// Bookmarks
	RemoveBookmarkOfTweet(ctx context.Context, userID string, tweetID string) (*RemoveBookmarkOfTweetResponse, error)
	LookupUserBookmarks(ctx context.Context, userID string, opt ...*LookupUserBookmarksOption) (*LookupUserBookmarksResponse, error)
	BookmarkTweet(ctx context.Context, userID string, body *BookmarkTweetBody) (*BookmarkTweetResponse, error)
	// Filtered stream
	ConnectToStream(ctx context.Context, ch chan<- ConnectToStreamResponse, errCh chan<- error, opt ...*ConnectToStreamOption) *ConnectToStream
	RetrieveStreamRules(ctx context.Context, opt ...*RetrieveStreamRulesOption) (*RetrieveStreamRulesResponse, error)
	AddOrDeleteRules(ctx context.Context, body *AddOrDeleteJSONBody, opt ...*AddOrDeleteRulesOption) (*AddOrDeleteRulesResponse, error)
	// Hide replies
	HideReplies(ctx context.Context, tweetID string, hidden bool) (*HideRepliesResponse, error)
	// Likes
	UndoUsersLikingTweet(ctx context.Context, userID string, tweetID string) (*UndoUsersLikingTweetResponse, error)
	UsersLikingTweet(ctx context.Context, tweetID string, opt ...*UsersLikingTweetOption) (*UsersLikingTweetResponse, error)
	TweetsUserLiked(ctx context.Context, userID string, opt ...*TweetsUserLikedOption) (*TweetsUserLikedResponse, error)
	PostUsersLikingTweet(ctx context.Context, userID string, tweetID string) (*PostUsersLikingTweetResponse, error)
	// Manage Tweets
	DeleteTweet(ctx context.Context, tweetID string) (*DeleteTweetResponse, error)
	PostTweet(ctx context.Context, body *PostTweetOption) (*PostTweetResponse, error)
	// TODO: /2/tweets/:id/quote_tweets
	// Retweets
	UndoRetweet(ctx context.Context, userID string, sourceTweetID string) (*UndoRetweetResponse, error)
	RetweetsLookup(ctx context.Context, tweetID string, opt ...*RetweetsLookupOption) (*RetweetsResponse, error)
	PostRetweet(ctx context.Context, userID string, tweetID string) (*PostRetweetResponse, error)
	// Search Tweets
	SearchAllTweets(ctx context.Context, tweet string, opt ...*SearchTweetsOption) (*SearchTweetsResponse, error)
	SearchRecentTweets(ctx context.Context, tweet string, opt ...*SearchTweetsOption) (*SearchTweetsResponse, error)
	// Timelines
	UserMentionTimeline(ctx context.Context, userID string, opt ...*UserMentionTimelineOption) (*UserMentionTimelineResponse, error)
	// TODO: /2/users/:id/timelines/reverse_chronological
	UserTweetTimeline(ctx context.Context, userID string, opt ...*UserTweetTimelineOption) (*UserTweetTimelineResponse, error)
	// Tweet counts
	CountAllTweets(ctx context.Context, tweet string, opt ...*TweetCountsAllOption) (*TweetCountsResponse, error)
	CountRecentTweets(ctx context.Context, tweet string, opt ...*TweetCountsOption) (*TweetCountsResponse, error)
	// Tweets lookup
	RetrieveMultipleTweets(ctx context.Context, tweetIDs []string, opt ...*RetriveTweetOption) (*TweetsResponse, error)
	RetrieveSingleTweet(ctx context.Context, tweetID string, opt ...*RetriveTweetOption) (*TweetResponse, error)
	// Volume stream
	VolumeStreams(ctx context.Context, ch chan<- VolumeStreamsResponse, errCh chan<- error, opt ...*VolumeStreamsOption) *VolumeStreams
}

type TweetsResponse

type TweetsResponse struct {
	Tweets   []*Tweet            `json:"data"`
	Includes *TweetIncludes      `json:"includes,omitempty"`
	Errors   []*APIResponseError `json:"errors,omitempty"`
	Title    string              `json:"title,omitempty"`
	Detail   string              `json:"detail,omitempty"`
	Type     string              `json:"type,omitempty"`
}

type TweetsUserLiked

type TweetsUserLiked struct {
	ID                 string                               `json:"id"`
	Text               string                               `json:"text"`
	CreatedAt          string                               `json:"created_at,omitempty"`
	AuthorID           string                               `json:"author_id,omitempty"`
	ConversationID     string                               `json:"conversation_id,omitempty"`
	InReplyToUserID    string                               `json:"in_reply_to_user_id,omitempty"`
	ReferencedTweets   []*TweetsUserLikedReferencedTweets   `json:"referenced_tweets,omitempty"`
	Attachments        *TweetsUserLikedAttachments          `json:"attachments,omitempty"`
	Geo                *TweetsUserLikedGeo                  `json:"geo,omitempty"`
	ContextAnnotations []*TweetsUserLikedContextAnnotations `json:"context_annotations,omitempty"`
	Entities           *TweetsUserLikedEntities             `json:"entities,omitempty"`
	Withheld           *TweetsUserLikedWithheld             `json:"withheld,omitempty"`
	PublicMetrics      *TweetsUserLikedPublicMetrics        `json:"public_metrics,omitempty"`
	NonPublicMetrics   *TweetsUserLikedNonPublicMetrics     `json:"non_public_metrics,omitempty"` // requires the use of OAuth 1.0a User Context authentication.
	OrganicMetrics     *TweetsUserLikedOrganicMetrics       `json:"organic_metrics,omitempty"`    // requires user context authentication.
	PromotedMetrics    *TweetsUserLikedPromotedMetrics      `json:"promoted_metrics,omitempty"`   // requires user context authentication.
	PossiblySensitive  bool                                 `json:"possibly_sensitive,omitempty"`
	Lang               string                               `json:"lang,omitempty"`
	ReplySettings      string                               `json:"reply_settings,omitempty"`
	Source             string                               `json:"source,omitempty"`
	EditHistoryIDs     []string                             `json:"edit_history_ids,omitempty"`
	EditControls       *TweetsUserLikedEditControls         `json:"edit_controls,omitempty"`
}

type TweetsUserLikedAttachments

type TweetsUserLikedAttachments struct {
	MediaKeys []string `json:"media_keys"`
	PollIDs   []string `json:"poll_ids"`
}

type TweetsUserLikedContextAnnotations

type TweetsUserLikedContextAnnotations struct {
	Domain *TweetsUserLikedContextAnnotationsDomain `json:"domain"`
	Entity *TweetsUserLikedContextAnnotationsEntity `json:"entity"`
}

type TweetsUserLikedContextAnnotationsDomain

type TweetsUserLikedContextAnnotationsDomain struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

type TweetsUserLikedContextAnnotationsEntity

type TweetsUserLikedContextAnnotationsEntity struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

type TweetsUserLikedEditControls

type TweetsUserLikedEditControls struct {
	EditRemaining  int    `json:"edit_remaining"`
	IsEditEligible bool   `json:"is_edit_eligible"`
	EditableUntil  string `json:"editable_until"`
}

type TweetsUserLikedEntities

type TweetsUserLikedEntities struct {
	Annotations []*TweetsUserLikedEntitiesAnnotation `json:"annotations"`
	URLs        []*TweetsUserLikedEntitiesURLContent `json:"urls"`
	HashTags    []*TweetsUserLikedEntitiesHashTag    `json:"hashtags"`
	Mentions    []*TweetsUserLikedEntitiesMention    `json:"mentions"`
	CashTags    []*TweetsUserLikedEntitiesCashTag    `json:"cashtags"`
}

type TweetsUserLikedEntitiesAnnotation

type TweetsUserLikedEntitiesAnnotation struct {
	Start          int    `json:"start"`
	End            int    `json:"end"`
	Probability    int    `json:"probability"`
	Type           string `json:"type"`
	NormalizedText string `json:"normalized_text"`
}

type TweetsUserLikedEntitiesCashTag

type TweetsUserLikedEntitiesCashTag struct {
	Start int    `json:"start"`
	End   int    `json:"end"`
	Tag   string `json:"tag"`
}

type TweetsUserLikedEntitiesHashTag

type TweetsUserLikedEntitiesHashTag struct {
	Start int    `json:"start"`
	End   int    `json:"end"`
	Tag   string `json:"tag"`
}

type TweetsUserLikedEntitiesMention

type TweetsUserLikedEntitiesMention struct {
	Start    int    `json:"start"`
	End      int    `json:"end"`
	UserName string `json:"username"`
}

type TweetsUserLikedEntitiesURLContent

type TweetsUserLikedEntitiesURLContent struct {
	Start       int    `json:"start"`
	End         int    `json:"end"`
	URL         string `json:"url"`
	ExpandedURL string `json:"expanded_url"`
	DisplayURL  string `json:"display_url"`
	UnwoundURL  string `json:"unwound_url"`
}

type TweetsUserLikedGeo

type TweetsUserLikedGeo struct {
	Coordinates *TweetsUserLikedGeoCoordinates `json:"coordinates"`
	PlaceID     string                         `json:"place_id"`
}

type TweetsUserLikedGeoCoordinates

type TweetsUserLikedGeoCoordinates struct {
	Type        string    `json:"type"`
	Coordinates []float64 `json:"coordinates"`
}

type TweetsUserLikedMeta

type TweetsUserLikedMeta struct {
	ResultCount int    `json:"result_count"`
	NextToken   string `json:"next_token"`
}

type TweetsUserLikedNonPublicMetrics

type TweetsUserLikedNonPublicMetrics struct {
	ImpressionCount   int `json:"impression_count"`
	URLLinkClicks     int `json:"url_link_clicks"`
	UserProfileClicks int `json:"user_profile_clicks"`
}

type TweetsUserLikedOption

type TweetsUserLikedOption struct {
	Expansions      []Expansion
	MediaFields     []MediaField
	PlaceFields     []PlaceField
	PollFields      []PollField
	TweetFields     []TweetField
	UserFields      []UserField
	MaxResults      int
	PaginationToken string
}

type TweetsUserLikedOrganicMetrics

type TweetsUserLikedOrganicMetrics struct {
	ImpressionCount   int `json:"impression_count"`    // requires the use of OAuth 1.0a User Context authentication.
	URLLinkClicks     int `json:"url_link_clicks"`     // requires the use of OAuth 1.0a User Context authentication.
	UserProfileClicks int `json:"user_profile_clicks"` // requires the use of OAuth 1.0a User Context authentication.
	RetweetCount      int `json:"retweet_count"`
	ReplyCount        int `json:"reply_count"`
	LikeCount         int `json:"like_count"`
}

type TweetsUserLikedPromotedMetrics

type TweetsUserLikedPromotedMetrics struct {
	ImpressionCount   int `json:"impression_count"`    // requires the use of OAuth 1.0a User Context authentication.
	URLLinkClicks     int `json:"url_link_clicks"`     // requires the use of OAuth 1.0a User Context authentication.
	UserProfileClicks int `json:"user_profile_clicks"` // requires the use of OAuth 1.0a User Context authentication.
	RetweetCount      int `json:"retweet_count"`
	ReplyCount        int `json:"reply_count"`
	LikeCount         int `json:"like_count"`
}

type TweetsUserLikedPublicMetrics

type TweetsUserLikedPublicMetrics struct {
	RetweetCount int `json:"retweet_count"`
	ReplyCount   int `json:"reply_count"`
	LikeCount    int `json:"like_count"`
	QuoteCount   int `json:"quote_count"`
}

type TweetsUserLikedReferencedTweets

type TweetsUserLikedReferencedTweets struct {
	Type string `json:"type"`
	ID   string `json:"id"`
}

type TweetsUserLikedResponse

type TweetsUserLikedResponse struct {
	Tweets   []*TweetsUserLiked   `json:"data"`
	Includes *TweetIncludes       `json:"includes,omitempty"`
	Meta     *TweetsUserLikedMeta `json:"meta"`
	Errors   []*APIResponseError  `json:"errors,omitempty"`
}

type TweetsUserLikedWithheld

type TweetsUserLikedWithheld struct {
	Copyright    bool     `json:"copyright"`
	CountryCodes []string `json:"country_codes"`
	Scope        string   `json:"scope"`
}

type Twtr

Twtr is a main interface for all Twitter API calls.

type UndoBlockingResponse

type UndoBlockingResponse struct {
	Blocking *Blocking           `json:"data"`
	Errors   []*APIResponseError `json:"errors,omitempty"`
}

type UndoFollowingResponse

type UndoFollowingResponse struct {
	Following *Following          `json:"data"`
	Errors    []*APIResponseError `json:"errors,omitempty"`
}

type UndoListFollowsResponse

type UndoListFollowsResponse struct {
	Following *ListFollows        `json:"data"`
	Errors    []*APIResponseError `json:"errors,omitempty"`
}

type UndoListMembersResponse

type UndoListMembersResponse struct {
	IsMember *IsMember           `json:"data"`
	Errors   []*APIResponseError `json:"errors,omitempty"`
}

type UndoMutingResponse

type UndoMutingResponse struct {
	Muting *Muting             `json:"data"`
	Errors []*APIResponseError `json:"errors,omitempty"`
}

type UndoPinnedListsResponse

type UndoPinnedListsResponse struct {
	Pinned *Pinned             `json:"data"`
	Errors []*APIResponseError `json:"errors,omitempty"`
}

type UndoRetweetResponse

type UndoRetweetResponse struct {
	Retweeted *Retweeted          `json:"data"`
	Errors    []*APIResponseError `json:"errors,omitempty"`
}

type UndoUsersLikingTweetResponse

type UndoUsersLikingTweetResponse struct {
	Liked  *Liked              `json:"data"`
	Errors []*APIResponseError `json:"errors,omitempty"`
}

type UpdateMetaDataForListBody

type UpdateMetaDataForListBody struct {
	Description string `json:"description,omitempty"`
	Name        string `json:"name,omitempty"`
	Private     bool   `json:"private,omitempty"`
}

type UpdateMetaDataForListData

type UpdateMetaDataForListData struct {
	Updated bool `json:"updated"`
}

type UpdateMetaDataForListResponse

type UpdateMetaDataForListResponse struct {
	UpdateMetaDataForListData *UpdateMetaDataForListData `json:"data"`
	Errors                    []*APIResponseError        `json:"errors,omitempty"`
	Title                     string                     `json:"title,omitempty"`
	Detail                    string                     `json:"detail,omitempty"`
	Type                      string                     `json:"type,omitempty"`
}

type User

type User struct {
	ID              string             `json:"id"`
	Name            string             `json:"name"`
	UserName        string             `json:"username"`
	CreatedAt       string             `json:"created_at,omitempty"`
	Description     string             `json:"description,omitempty"`
	Entities        *UserEntity        `json:"entities,omitempty"`
	Location        string             `json:"location,omitempty"`
	PinnedTweetID   string             `json:"pinned_tweet_id,omitempty"`
	ProfileImageURL string             `json:"profile_image_url,omitempty"`
	Protected       bool               `json:"protected,omitempty"`
	PublicMetrics   *UserPublicMetrics `json:"public_metrics,omitempty"`
	URL             string             `json:"url,omitempty"`
	Verified        bool               `json:"verified,omitempty"`
	Withheld        *UserWithheld      `json:"withheld,omitempty"`
}

type UserCashtag

type UserCashtag struct {
	Start int    `json:"start"`
	End   int    `json:"end"`
	Tag   string `json:"tag"`
}

type UserDescription

type UserDescription struct {
	URLs     []*UserURLs    `json:"urls"`
	Hashtags []*UserHashtag `json:"hashtags"`
	Mentions []*UserMention `json:"user_mentions"`
	Cashtags []*UserCashtag `json:"cashtags"`
}

type UserEntity

type UserEntity struct {
	URL         *UserURL         `json:"url"`
	Description *UserDescription `json:"description"`
}

type UserField

type UserField string
const (
	UserFieldID              UserField = "id"
	UserFieldName            UserField = "name"
	UserFieldUserName        UserField = "username"
	UserFieldCreatedAt       UserField = "created_at"
	UserFieldDescription     UserField = "description"
	UserFieldEntities        UserField = "entities"
	UserFieldLocation        UserField = "location"
	UserFieldPinnedTweetID   UserField = "pinned_tweet_id"
	UserFieldProfileImageURL UserField = "profile_image_url"
	UserFieldProtected       UserField = "protected"
	UserFieldPublicMetrics   UserField = "public_metrics"
	UserFieldURL             UserField = "url"
	UserFieldVerified        UserField = "verified"
	UserFieldWithHeld        UserField = "withhel"
)

type UserHashtag

type UserHashtag struct {
	Start int    `json:"start"`
	End   int    `json:"end"`
	Tag   string `json:"tag"`
}

type UserIncludes

type UserIncludes struct {
	Users  []*User
	Tweets []*Tweet
}

type UserMention

type UserMention struct {
	Start    int    `json:"start"`
	End      int    `json:"end"`
	UserName string `json:"username"`
}

type UserMentionTimelineOption

type UserMentionTimelineOption struct {
	EndTime         time.Time
	Expansions      []Expansion
	MaxResults      int
	MediaFields     []MediaField
	PaginationToken string
	PlaceFields     []PlaceField
	PollFields      []PollField
	SinceID         string
	StartTime       time.Time
	TweetFields     []TweetField
	UntilID         string
	UserFields      []UserField
}

type UserMentionTimelineResponse

type UserMentionTimelineResponse struct {
	Tweets   []*Tweet            `json:"data"`
	Includes *TweetIncludes      `json:"includes,omitempty"`
	Errors   []*APIResponseError `json:"errors,omitempty"`
	Meta     *UserTimelineMeta   `json:"meta"`
	Title    string              `json:"title,omitempty"`
	Detail   string              `json:"detail,omitempty"`
	Type     string              `json:"type,omitempty"`
}

type UserPublicMetrics

type UserPublicMetrics struct {
	FollowersCount int `json:"followers_count"`
	FollowingCount int `json:"following_count"`
	TweetCount     int `json:"tweet_count"`
	ListedCount    int `json:"listed_count"`
}

type UserResponse

type UserResponse struct {
	User     *User               `json:"data"`
	Includes *UserIncludes       `json:"includes,omitempty"`
	Errors   []*APIResponseError `json:"errors,omitempty"`
	Title    string              `json:"title,omitempty"`
	Detail   string              `json:"detail,omitempty"`
	Type     string              `json:"type,omitempty"`
}

type UserTimelineMeta

type UserTimelineMeta struct {
	ResultCount int    `json:"result_count"`
	NewestID    string `json:"newest_id"`
	OldestID    string `json:"oldest_id"`
	NextToken   string `json:"next_token"`
}

type UserTweetTimelineOption

type UserTweetTimelineOption struct {
	EndTime         time.Time
	Exclude         []Exclude
	Expansions      []Expansion
	MaxResults      int
	MediaFields     []MediaField
	PaginationToken string
	PlaceFields     []PlaceField
	PollFields      []PollField
	SinceID         string
	StartTime       time.Time
	TweetFields     []TweetField
	UntilID         string
	UserFields      []UserField
}

type UserTweetTimelineResponse

type UserTweetTimelineResponse struct {
	Tweets   []*Tweet            `json:"data"`
	Includes *TweetIncludes      `json:"includes,omitempty"`
	Errors   []*APIResponseError `json:"errors,omitempty"`
	Meta     *UserTimelineMeta   `json:"meta"`
	Title    string              `json:"title,omitempty"`
	Detail   string              `json:"detail,omitempty"`
	Type     string              `json:"type,omitempty"`
}

type UserURL

type UserURL struct {
	URLs []*UserURLs `json:"urls"`
}

type UserURLs

type UserURLs struct {
	Start       int    `json:"start"`
	End         int    `json:"end"`
	URL         string `json:"url"`
	ExpandedURL string `json:"expanded_url"`
	DisplayURL  string `json:"display_url"`
}

type UserWithheld

type UserWithheld struct {
	Copyright    bool     `json:"copyright"`
	CountryCodes []string `json:"country_codes"`
}

type Users

type Users interface {
	// Blocks
	UndoBlocking(ctx context.Context, sourceUserID string, targetUserID string) (*UndoBlockingResponse, error)
	Blocking(ctx context.Context, userID string, opt ...*BlockOption) (*BlockingResponse, error)
	PostBlocking(ctx context.Context, userID string, targetUserID string) (*PostBlockingResponse, error)
	// Follows
	UndoFollowing(ctx context.Context, sourceUserID string, targetUserID string) (*UndoFollowingResponse, error)
	Followers(ctx context.Context, userID string, opt ...*FollowOption) (*FollowersResponse, error)
	Following(ctx context.Context, userID string, opt ...*FollowOption) (*FollowingResponse, error)
	PostFollowing(ctx context.Context, userID string, targetUserID string) (*PostFollowingResponse, error)
	// Mutes
	UndoMuting(ctx context.Context, sourceUserID string, targetUserID string) (*UndoMutingResponse, error)
	Muting(ctx context.Context, userID string, opt ...*MuteOption) (*MutingResponse, error)
	PostMuting(ctx context.Context, userID string, targetUserID string) (*PostMutingResponse, error)
	// Users lookup
	RetrieveMultipleUsersWithIDs(ctx context.Context, userIDs []string, opt ...*RetrieveUserOption) (*UsersResponse, error)
	RetrieveSingleUserWithID(ctx context.Context, userID string, opt ...*RetrieveUserOption) (*UserResponse, error)
	RetrieveMultipleUsersWithUserNames(ctx context.Context, userNames []string, opt ...*RetrieveUserOption) (*UsersResponse, error)
	RetrieveSingleUserWithUserName(ctx context.Context, userName string, opt ...*RetrieveUserOption) (*UserResponse, error)
	Me(ctx context.Context, opt ...*MeOption) (*MeResponse, error)
}

type UsersLikingBody

type UsersLikingBody struct {
	TweetID string `json:"tweet_id"`
}

type UsersLikingTweetOption

type UsersLikingTweetOption struct {
	Expansions  []Expansion
	MediaFields []MediaField
	PlaceFields []PlaceField
	PollFields  []PollField
	TweetFields []TweetField
	UserFields  []UserField
}

type UsersLikingTweetResponse

type UsersLikingTweetResponse struct {
	Users    []*LookUpUsersWhoLiked       `json:"data"`
	Includes *LookUpUsersWhoLikedIncludes `json:"includes,omitempty"`
	Meta     *LookUpUsersWhoLikedMeta     `json:"meta"`
	Errors   []*APIResponseError          `json:"errors,omitempty"`
}

type UsersPurchasedSpaceTicketOption

type UsersPurchasedSpaceTicketOption struct {
	Expansions  []Expansion
	MediaFields []MediaField
	PlaceFields []PlaceField
	PollFields  []PollField
	TweetFields []TweetField
	UserFields  []UserField
}

type UsersPurchasedSpaceTicketResponse

type UsersPurchasedSpaceTicketResponse struct {
	Users    []*User                                     `json:"data"`
	Includes *LookUpUsersWhoPurchasedSpaceTicketIncludes `json:"includes,omitempty"`
	Errors   []*APIResponseError                         `json:"errors,omitempty"`
}

type UsersResponse

type UsersResponse struct {
	Users    []*User             `json:"data"`
	Includes *UserIncludes       `json:"includes,omitempty"`
	Errors   []*APIResponseError `json:"errors,omitempty"`
	Title    string              `json:"title,omitempty"`
	Detail   string              `json:"detail,omitempty"`
	Type     string              `json:"type,omitempty"`
}

type VolumeStreams

type VolumeStreams struct {
	// contains filtered or unexported fields
}

func (*VolumeStreams) Stop

func (s *VolumeStreams) Stop()

type VolumeStreamsOption

type VolumeStreamsOption struct {
	// BackfillMinutes int // This feature is currently only available to the Academic Research product track.
	Expansions  []Expansion
	MediaFields []MediaField
	PlaceFields []PlaceField
	PollFields  []PollField
	TweetFields []TweetField
	UserFields  []UserField
}

type VolumeStreamsResponse

type VolumeStreamsResponse struct {
	Tweet    *Tweet              `json:"data"`
	Includes *TweetIncludes      `json:"includes,omitempty"`
	Errors   []*APIResponseError `json:"errors,omitempty"`
}

Jump to

Keyboard shortcuts

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