twitter

package module
v2.1.5 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2022 License: MIT Imports: 13 Imported by: 542

README

golangci-lint go-test

go-twitter v2

It seems like every v1 is just a prototype.

One of my co-workers said that when we were working on a project, released the first version and then realizing that there were many improvements that needed to be done. That seems to ring true, and this library is not exception. When looking at the improvements that needed to be done, unfortunately these improvements will introduce breaking changes. This version will focus on giving the caller more information from the callouts to allow for better response handling. Another factor is to think about improvements, but first delivering the information first then providing more functionality second.

There will be beta releases throughout this process and if there are any new functionality requested, it will be discussed to try and get it into this version. Version 1 will still be maintained as I believe that version 2 will need to be mature before the pervious version is even considered to be sunset.

This project will track the process of this initial version.

go get -u github.com/g8rswimmer/go-twitter/v2

Table Of Contents

Changes

The following are changes between v1 and v2 of the library.

  • One structure for all endpoint callouts. In v1 there were two structures, Tweet and User, to preform callouts. This required management of two structures and knowledge which structure contained the desired method callouts. At the time, the grouping looked logical. However with the addition of the timeline endpoints, it makes more sense to have a single structure Client to handle all of the callouts. If the user would like to separate the functionality, interfaces can be used to achieve this.
  • Endpoint methods will return the entire response. One of the major drawbacks of v1 was the object returned was not the entire response sent by the callout. For example, the errors object in the response is included in v1 response which does not allow the caller to properly handle partial errors. In v2, the first focus is to return the response from twitter to allow the caller to use it as they see fit. However, it does not mean that methods can not be added to the response object to provide groupings, etc.
Breaking Changes

These are some breaking changes and what release they are from. These type of changes will try to be avoided but if necessary for a better library, it will be done.

v2.0.0-beta11
  • The client callout for tweet hide reply, TweetHideReplies, has been changed to return the response instead of just an error. This allow for the data and the rate limits of the callout to be returned.
Migration
	// old way
	err := client.TweetHideReplies(context.Background(), id, true)
	if err != nil {
		// handle error
	}
	// new way
	hideResponse, err := client.TweetHideReplies(context.Background(), id, true)
	if err != nil {
		// handle error
	}
v2.0.0-beta13
  • There was a typo in the user retweet lookup options and it was corrected.
UserRetweetLookuoOpts -> UserRetweetLookupOpts
v2.0.0-beta16
  • There was a typo in the user following metadata.
UserFollowinghMeta -> UserFollowingMeta
  • There was a typo in the delete user likes response
DeteleUserLikesResponse -> DeleteUserLikesResponse
  • There was a typo in the EntityURLObj
EntityURLObj.Desription -> EntityURLObj.Description
  • There was a typo in the TweetObj and the JSON tag
TweetObj.PossibySensitive -> TweetObj.PossiblySensitive

json: possiby_sensitive -> possibly_sensitive

Features

Here are the current twitter v2 API features supported.

Tweets

The following APIs are supported, with the examples here

Users

The following APIs are supported, with the examples here

Spaces

The following APIs are supported, with the examples here

Lists

The following APIs are supported, with the examples here

Compliance

The following APIs are supported, with the examples here

Rate Limiting

With each response, the rate limits from the response header are returned. This allows the caller to manage any limits that are imposed. Along with the response, errors that are returned may have rate limits as well. If the error occurs after the request is sent, then rate limits may apply and are returned.

There is an example of rate limiting from a response here.

This is an example of a twitter callout and if the limits have been reached, then it will back off and try again.

func TweetLikes(ctx context.Context, id string, client *twitter.Client) (*twitter.TweetLikesLookupResponse, error) {
	var er *ErrorResponse

	opts := twitter.ListUserMembersOpts{
		MaxResults: 1,
	}
	tweetResponse, err := client.TweetLikesLookup(ctx, id, opts)

	if rateLimit, has := twitter.RateLimitFromError(err); has && rateLimit.Remaining == 0 {
		time.Sleep(time.Until(rateLimit.Reset.Time()))
		return client.TweetLikesLookup(ctx, id, opts)
	}
	return tweetResponse, err
}

Error Handling

There are different types of error handling within the library. The library supports errors and partial errors defined by twitter.

Parameter Errors

The library does some error checking before a callout. This checking is very basic, like making sure an id is not an empty string. If there is an parameter error, it will be wrapped with ErrParameter.

	opts := twitter.ListUserMembersOpts{
		MaxResults: 1,
	}
	tweetResponse, err := client.TweetLikesLookup(ctx, id, opts)
	switch {
	case errors.Is(err, twitter.ErrParameter):
		// handle a parameter error
	case err != nil:
		// handle other errors
	default:
		// happy path
	}
Callout Errors

The library will return any errors from when creating and doing the callout. These errors might be, but not limited to, json encoding error or http request or client error. These errors are also wrapped to allow for the caller to handle specific errors.

	opts := twitter.ListUserMembersOpts{
		MaxResults: 1,
	}
	tweetResponse, err := client.TweetLikesLookup(ctx, id, opts)
	jErr := &json.UnsupportedValueError{}
	switch {
	case errors.As(err, &jErr):
		// handle a json error
	case err != nil:
		// handle other errors
	default:
		// happy path
	}
Response Decode Errors

The library will return a json decode error, ResponseDecodeError, when the response is malformed. This is done to allow for the rate limits to be part of the error.

	opts := twitter.ListUserMembersOpts{
		MaxResults: 1,
	}
	tweetResponse, err := client.TweetLikesLookup(ctx, id, opts)
	
	rdErr := &twitter.ResponseDecodeError{}
	switch {
	case errors.As(err, &rdErr):
		// handle response decode error
	case err != nil:
		// handle other errors
	default:
		// happy path
	}
Twitter HTTP Response Errors

The library will return a HTTP error, HTTPError, when a HTTP status is not successful. This allows for the twitter error response to be decoded and the rate limits to be part of the error.

	opts := twitter.ListUserMembersOpts{
		MaxResults: 1,
	}
	tweetResponse, err := client.TweetLikesLookup(ctx, id, opts)
	
	httpErr := &twitter.HTTPError{}
	switch {
	case errors.As(err, &httpErr):
		// handle http response error
	case err != nil:
		// handle other errors
	default:
		// happy path
	}
Twitter Partial Errors

The library will return what twitter defines as partial errors. These errors are not return as an error in the callout, but in the response as the callout was returned as successful.

	opts := twitter.ListUserMembersOpts{
		MaxResults: 1,
	}
	tweetResponse, err := client.TweetLikesLookup(ctx, id, opts)
	if err != nil {
		/// handle error
	}	
	// handle response
	if len(tweetResponse.Raw.Errors) > 0 {
		// handle partial errors
	}

Examples

Much like v1, there is an _example directory to demonstrate library usage.

Simple Usage

import (
	"encoding/json"
	"log"
	"flag"
	"fmt"
	"net/http"
	"context"
	"strings"

	twitter "github.com/g8rswimmer/go-twitter/v2"
)

type authorize struct {
	Token string
}

func (a authorize) Add(req *http.Request) {
	req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", a.Token))
}

/**
	In order to run, the user will need to provide the bearer token and the list of ids.
**/
func main() {
	token := flag.String("token", "", "twitter API token")
	ids := flag.String("ids", "", "twitter ids")
	flag.Parse()

	client := &twitter.Client{
		Authorizer: authorize{
			Token: *token,
		},
		Client: http.DefaultClient,
		Host:   "https://api.twitter.com",
	}
	opts := twitter.TweetLookupOpts{
		Expansions:  []twitter.Expansion{twitter.ExpansionEntitiesMentionsUserName, twitter.ExpansionAuthorID},
		TweetFields: []twitter.TweetField{twitter.TweetFieldCreatedAt, twitter.TweetFieldConversationID, twitter.TweetFieldAttachments},
	}

	fmt.Println("Callout to tweet lookup callout")

	tweetDictionary, err := client.TweetLookup(context.Background(), strings.Split(*ids, ","), opts)
	if err != nil {
		log.Panicf("tweet lookup error: %v", err)
	}

	enc, err := json.MarshalIndent(tweetDictionary, "", "    ")
	if err != nil {
		log.Panic(err)
	}
	fmt.Println(string(enc))
}

Documentation

Index

Constants

View Source
const (
	// InfoMessageType is the information system message type
	InfoMessageType SystemMessageType = "info"
	// WarnMessageType is the warning system message type
	WarnMessageType SystemMessageType = "warn"
	// ErrorMessageType is the error system message type
	ErrorMessageType SystemMessageType = "error"

	// TweetErrorType represents the tweet stream errors
	TweetErrorType StreamErrorType = "tweet"
	// SystemErrorType represents the system stream errors
	SystemErrorType StreamErrorType = "system"
	// DisconnectErrorType represents the disconnection errors
	DisconnectErrorType StreamErrorType = "disconnect"
)

Variables

View Source
var ErrParameter = errors.New("twitter input parameter error")

ErrParameter will indicate that the error is from an invalid input parameter

Functions

This section is empty.

Types

type AddTweetBookmarkResponse

type AddTweetBookmarkResponse struct {
	Tweet     *TweetBookmarkData `json:"data"`
	RateLimit *RateLimit
}

AddTweetBookmarkResponse is the response for adding a bookmark

type Authorizer

type Authorizer interface {
	Add(req *http.Request)
}

Authorizer will add the authorization to the HTTP request

type Client

type Client struct {
	Authorizer Authorizer
	Client     *http.Client
	Host       string
}

Client is used to make twitter v2 API callouts.

Authorizer is used to add auth to the request

Client is the HTTP client to use for all requests

Host is the base URL to use like, https://api.twitter.com

func (*Client) AddListMember

func (c *Client) AddListMember(ctx context.Context, listID, userID string) (*ListAddMemberResponse, error)

AddListMember enables the authenticated user to add a member to a list

func (*Client) AddTweetBookmark

func (c *Client) AddTweetBookmark(ctx context.Context, userID, tweetID string) (*AddTweetBookmarkResponse, error)

AddTweetBookmark causes the user ID identified in the path parameter to Bookmark the target Tweet provided in the request body

func (*Client) AuthUserLookup

func (c *Client) AuthUserLookup(ctx context.Context, opts UserLookupOpts) (*UserLookupResponse, error)

AuthUserLookup will return the authorized user lookup

func (*Client) ComplianceBatchJob

func (c *Client) ComplianceBatchJob(ctx context.Context, id string) (*ComplianceBatchJobResponse, error)

ComplianceBatchJob returns a single compliance job

func (*Client) ComplianceBatchJobLookup

ComplianceBatchJobLookup returns a list of compliance jobs

func (*Client) CreateComplianceBatchJob

CreateComplianceBatchJob creates a new compliance job for tweet or user IDs.

func (*Client) CreateList

func (c *Client) CreateList(ctx context.Context, list ListMetaData) (*ListCreateResponse, error)

CreateList enables the authenticated user to create a list

func (*Client) CreateTweet

func (c *Client) CreateTweet(ctx context.Context, tweet CreateTweetRequest) (*CreateTweetResponse, error)

CreateTweet will let a user post polls, quote tweets, tweet with reply setting, tweet with geo, attach perviously uploaded media toa tweet and tag users, tweet to super followers, etc.

func (*Client) DeleteList

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

DeleteList enables the authenticated user to delete a list

func (*Client) DeleteTweet

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

DeleteTweet allow the user to delete a specific tweet

func (*Client) DeleteUserBlocks

func (c *Client) DeleteUserBlocks(ctx context.Context, userID, targetUserID string) (*UserDeleteBlocksResponse, error)

DeleteUserBlocks will remove the target user block

func (*Client) DeleteUserFollows

func (c *Client) DeleteUserFollows(ctx context.Context, userID, targetUserID string) (*UserDeleteFollowsResponse, error)

DeleteUserFollows allows a user ID to unfollow another user

func (*Client) DeleteUserLikes

func (c *Client) DeleteUserLikes(ctx context.Context, userID, tweetID string) (*DeleteUserLikesResponse, error)

DeleteUserLikes will unlike the targeted tweet

func (*Client) DeleteUserMutes

func (c *Client) DeleteUserMutes(ctx context.Context, userID, targetUserID string) (*UserDeleteMutesResponse, error)

DeleteUserMutes allows an authenticated user ID to unmute the target user

func (*Client) DeleteUserRetweet

func (c *Client) DeleteUserRetweet(ctx context.Context, userID, tweetID string) (*DeleteUserRetweetResponse, error)

DeleteUserRetweet will delete a retweet from a user

func (*Client) ListLookup

func (c *Client) ListLookup(ctx context.Context, listID string, opts ListLookupOpts) (*ListLookupResponse, error)

ListLookup returns the details of a specified list

func (*Client) ListTweetLookup

func (c *Client) ListTweetLookup(ctx context.Context, listID string, opts ListTweetLookupOpts) (*ListTweetLookupResponse, error)

ListTweetLookup returns a list of tweets from the specified list

func (*Client) ListUserFollowers

func (c *Client) ListUserFollowers(ctx context.Context, listID string, opts ListUserFollowersOpts) (*ListUserFollowersResponse, error)

ListUserFollowers returns a list of users who are followers of a list

func (*Client) ListUserMembers

func (c *Client) ListUserMembers(ctx context.Context, listID string, opts ListUserMembersOpts) (*ListUserMembersResponse, error)

ListUserMembers returns a list of users who are member of the list

func (*Client) QuoteTweetsLookup

func (c *Client) QuoteTweetsLookup(ctx context.Context, tweetID string, opts QuoteTweetsLookupOpts) (*QuoteTweetsLookupResponse, error)

QuoteTweetsLookup returns quote tweets for a tweet specified by the requested tweet id

func (*Client) RemoveListMember

func (c *Client) RemoveListMember(ctx context.Context, listID, userID string) (*ListRemoveMemberResponse, error)

RemoveListMember enables the authenticated user to remove a member to a list

func (*Client) RemoveTweetBookmark

func (c *Client) RemoveTweetBookmark(ctx context.Context, userID, tweetID string) (*RemoveTweetBookmarkResponse, error)

RemoveTweetBookmark allows a user or authenticated user ID to remove a Bookmark of a Tweet

func (*Client) SpaceBuyersLookup

func (c *Client) SpaceBuyersLookup(ctx context.Context, spaceID string, opts SpaceBuyersLookupOpts) (*SpaceBuyersLookupResponse, error)

SpaceBuyersLookup returns a list of users who purchased a ticket to the requested space

func (*Client) SpaceTweetsLookup

func (c *Client) SpaceTweetsLookup(ctx context.Context, spaceID string, opts SpaceTweetsLookupOpts) (*SpaceTweetsLookupResponse, error)

SpaceTweetsLookup returns tweets shared in the request space

func (*Client) SpacesByCreatorLookup

func (c *Client) SpacesByCreatorLookup(ctx context.Context, userIDs []string, opts SpacesByCreatorLookupOpts) (*SpacesByCreatorLookupResponse, error)

SpacesByCreatorLookup returns live or scheduled spaces created by a specific user ids

func (*Client) SpacesLookup

func (c *Client) SpacesLookup(ctx context.Context, ids []string, opts SpacesLookupOpts) (*SpacesLookupResponse, error)

SpacesLookup returns information about a space from the requested ids

func (*Client) SpacesSearch

func (c *Client) SpacesSearch(ctx context.Context, query string, opts SpacesSearchOpts) (*SpacesSearchResponse, error)

SpacesSearch returns live or scheduled spaces matching the specified search terms.

func (*Client) TweetAllCounts

func (c *Client) TweetAllCounts(ctx context.Context, query string, opts TweetAllCountsOpts) (*TweetAllCountsResponse, error)

TweetAllCounts receive a count of Tweets that match a query

func (*Client) TweetBookmarksLookup

func (c *Client) TweetBookmarksLookup(ctx context.Context, userID string, opts TweetBookmarksLookupOpts) (*TweetBookmarksLookupResponse, error)

TweetBookmarksLookup allows you to get an authenticated user's 800 most recent bookmarked Tweets

func (Client) TweetHideReplies

func (c Client) TweetHideReplies(ctx context.Context, id string, hide bool) (*TweetHideReplyResponse, error)

TweetHideReplies will hide the replies for a given tweet

func (*Client) TweetLikesLookup

func (c *Client) TweetLikesLookup(ctx context.Context, tweetID string, opts TweetLikesLookupOpts) (*TweetLikesLookupResponse, error)

TweetLikesLookup gets information about a tweet's liking users. The response will have at most 100 users who liked the tweet

func (*Client) TweetLookup

func (c *Client) TweetLookup(ctx context.Context, ids []string, opts TweetLookupOpts) (*TweetLookupResponse, error)

TweetLookup returns information about a tweet or group of tweets specified by a group of tweet ids.

func (*Client) TweetRecentCounts

func (c *Client) TweetRecentCounts(ctx context.Context, query string, opts TweetRecentCountsOpts) (*TweetRecentCountsResponse, error)

TweetRecentCounts will return a recent tweet counts based of a query

func (*Client) TweetRecentSearch

func (c *Client) TweetRecentSearch(ctx context.Context, query string, opts TweetRecentSearchOpts) (*TweetRecentSearchResponse, error)

TweetRecentSearch will return a recent search based of a query

func (*Client) TweetSampleStream

func (c *Client) TweetSampleStream(ctx context.Context, opts TweetSampleStreamOpts) (*TweetStream, error)

TweetSampleStream will return a streamer for streaming 1% of all tweets real-time

func (*Client) TweetSearch

func (c *Client) TweetSearch(ctx context.Context, query string, opts TweetSearchOpts) (*TweetSearchResponse, error)

TweetSearch is a full-archive search endpoint returns the complete history of public Tweets matching a search query.

This endpoint is only available to those users who have been approved for Academic Research access.

func (*Client) TweetSearchStream

func (c *Client) TweetSearchStream(ctx context.Context, opts TweetSearchStreamOpts) (*TweetStream, error)

TweetSearchStream will stream in real-time based on a specific set of filter rules

func (*Client) TweetSearchStreamAddRule

func (c *Client) TweetSearchStreamAddRule(ctx context.Context, rules []TweetSearchStreamRule, dryRun bool) (*TweetSearchStreamAddRuleResponse, error)

TweetSearchStreamAddRule will create on or more rules for search sampling. Set dry run to true to validate the rules before commit

func (*Client) TweetSearchStreamDeleteRuleByID

func (c *Client) TweetSearchStreamDeleteRuleByID(ctx context.Context, ruleIDs []TweetSearchStreamRuleID, dryRun bool) (*TweetSearchStreamDeleteRuleResponse, error)

TweetSearchStreamDeleteRuleByID will delete one or more rules for search sampling using the rule ids. Set dry run to true to validate the rules before commit

func (*Client) TweetSearchStreamDeleteRuleByValue

func (c *Client) TweetSearchStreamDeleteRuleByValue(ctx context.Context, ruleValues []string, dryRun bool) (*TweetSearchStreamDeleteRuleResponse, error)

TweetSearchStreamDeleteRuleByValue will delete one or more rules for search sampling using the rule values. Set dry run to true to validate the rules before commit

func (*Client) TweetSearchStreamRules

func (c *Client) TweetSearchStreamRules(ctx context.Context, ruleIDs []TweetSearchStreamRuleID) (*TweetSearchStreamRulesResponse, error)

TweetSearchStreamRules will return a list of rules active on the streaming endpoint

func (*Client) UpdateList

func (c *Client) UpdateList(ctx context.Context, listID string, update ListMetaData) (*ListUpdateResponse, error)

UpdateList enables the authenticated user to update the meta data of a list

func (*Client) UserBlocks

func (c *Client) UserBlocks(ctx context.Context, userID, targetUserID string) (*UserBlocksResponse, error)

UserBlocks will have the user block the targeted user ID

func (*Client) UserBlocksLookup

func (c *Client) UserBlocksLookup(ctx context.Context, userID string, opts UserBlocksLookupOpts) (*UserBlocksLookupResponse, error)

UserBlocksLookup returns a list of users who are blocked by the user ID

func (*Client) UserFollowList

func (c *Client) UserFollowList(ctx context.Context, userID, listID string) (*UserFollowListResponse, error)

UserFollowList enables an user to follow a list

func (*Client) UserFollowedLists

func (c *Client) UserFollowedLists(ctx context.Context, userID string, opts UserFollowedListsOpts) (*UserFollowedListsResponse, error)

UserFollowedLists returns all list an user follows

func (*Client) UserFollowersLookup

func (c *Client) UserFollowersLookup(ctx context.Context, id string, opts UserFollowersLookupOpts) (*UserFollowersLookupResponse, error)

UserFollowersLookup will return a user's followers

func (*Client) UserFollowingLookup

func (c *Client) UserFollowingLookup(ctx context.Context, id string, opts UserFollowingLookupOpts) (*UserFollowingLookupResponse, error)

UserFollowingLookup will return a user's following users

func (*Client) UserFollows

func (c *Client) UserFollows(ctx context.Context, userID, targetUserID string) (*UserFollowsResponse, error)

UserFollows allows a user ID to follow another user

func (*Client) UserLikes

func (c *Client) UserLikes(ctx context.Context, userID, tweetID string) (*UserLikesResponse, error)

UserLikes will like the targeted tweet

func (*Client) UserLikesLookup

func (c *Client) UserLikesLookup(ctx context.Context, userID string, opts UserLikesLookupOpts) (*UserLikesLookupResponse, error)

UserLikesLookup gets information about a user's liked tweets.

func (*Client) UserListLookup

func (c *Client) UserListLookup(ctx context.Context, userID string, opts UserListLookupOpts) (*UserListLookupResponse, error)

UserListLookup returns all lists owned by the specified user

func (*Client) UserListMemberships

func (c *Client) UserListMemberships(ctx context.Context, userID string, opts UserListMembershipsOpts) (*UserListMembershipsResponse, error)

UserListMemberships returns all list a user is a member of

func (*Client) UserLookup

func (c *Client) UserLookup(ctx context.Context, ids []string, opts UserLookupOpts) (*UserLookupResponse, error)

UserLookup returns information about an user or group of users specified by a group of user ids.

func (*Client) UserMentionTimeline

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

UserMentionTimeline will return the user's mentions timeline

func (*Client) UserMutes

func (c *Client) UserMutes(ctx context.Context, userID, targetUserID string) (*UserMutesResponse, error)

UserMutes allows an authenticated user ID to mute the target user

func (*Client) UserMutesLookup

func (c *Client) UserMutesLookup(ctx context.Context, userID string, opts UserMutesLookupOpts) (*UserMutesLookupResponse, error)

UserMutesLookup returns a list of users who are muted by the user ID

func (*Client) UserNameLookup

func (c *Client) UserNameLookup(ctx context.Context, usernames []string, opts UserLookupOpts) (*UserLookupResponse, error)

UserNameLookup returns information about an user or group of users specified by a group of usernames.

func (*Client) UserPinList

func (c *Client) UserPinList(ctx context.Context, userID, listID string) (*UserPinListResponse, error)

UserPinList enables the user to pin a list

func (*Client) UserPinnedLists

func (c *Client) UserPinnedLists(ctx context.Context, userID string, opts UserPinnedListsOpts) (*UserPinnedListsResponse, error)

UserPinnedLists returns the lists pinned by a user

func (*Client) UserRetweet

func (c *Client) UserRetweet(ctx context.Context, userID, tweetID string) (*UserRetweetResponse, error)

UserRetweet will retweet a tweet for a user

func (*Client) UserRetweetLookup

func (c *Client) UserRetweetLookup(ctx context.Context, tweetID string, opts UserRetweetLookupOpts) (*UserRetweetLookupResponse, error)

UserRetweetLookup allows you to get information about users that have retweeted a tweet

func (*Client) UserTweetReverseChronologicalTimeline added in v2.1.0

func (c *Client) UserTweetReverseChronologicalTimeline(ctx context.Context, userID string, opts UserTweetReverseChronologicalTimelineOpts) (*UserTweetReverseChronologicalTimelineResponse, error)

UserTweetReverseChronologicalTimeline allows you to retrieve a collection of the most recent Tweets and Retweets posted by you and users you follow. This endpoint returns up to the last 3200 Tweets.

func (*Client) UserTweetTimeline

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

UserTweetTimeline will return the user tweet timeline

func (*Client) UserUnfollowList

func (c *Client) UserUnfollowList(ctx context.Context, userID, listID string) (*UserUnfollowListResponse, error)

UserUnfollowList enables an user to unfollow a list

func (*Client) UserUnpinList

func (c *Client) UserUnpinList(ctx context.Context, userID, listID string) (*UserUnpinListResponse, error)

UserUnpinList enables a user to unpin a list

type ComplianceBatchJobDownloadResponse

type ComplianceBatchJobDownloadResponse struct {
	Results   []*ComplianceBatchJobResult
	RateLimit *RateLimit
}

ComplianceBatchJobDownloadResponse is the response from dowload results

type ComplianceBatchJobLookupOpts

type ComplianceBatchJobLookupOpts struct {
	Status ComplianceBatchJobStatus
}

ComplianceBatchJobLookupOpts is the compliance batch lookups options

type ComplianceBatchJobLookupResponse

type ComplianceBatchJobLookupResponse struct {
	Raw       *ComplianceBatchJobsRaw
	RateLimit *RateLimit
}

ComplianceBatchJobLookupResponse is the response from the compliance batch lookup

type ComplianceBatchJobObj

type ComplianceBatchJobObj struct {
	Resumable         bool                     `json:"resumable"`
	Type              ComplianceBatchJobType   `json:"type"`
	ID                string                   `json:"id"`
	CreatedAt         string                   `json:"created_at"`
	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            ComplianceBatchJobStatus `json:"status"`
	Error             string                   `json:"error"`
	// contains filtered or unexported fields
}

ComplianceBatchJobObj is the compliance batch job

func (ComplianceBatchJobObj) Download

Download will download the results of the job

func (ComplianceBatchJobObj) Upload

func (c ComplianceBatchJobObj) Upload(ctx context.Context, ids io.Reader) error

Upload will upload ids from a reader

type ComplianceBatchJobRaw

type ComplianceBatchJobRaw struct {
	Job *ComplianceBatchJobObj `json:"data"`
}

ComplianceBatchJobRaw is the raw data from a response

type ComplianceBatchJobResponse

type ComplianceBatchJobResponse struct {
	Raw       *ComplianceBatchJobRaw
	RateLimit *RateLimit
}

ComplianceBatchJobResponse is the compliance batch job response

type ComplianceBatchJobResult

type ComplianceBatchJobResult struct {
	ID         string `json:"id"`
	Action     string `json:"action"`
	CreatedAt  string `json:"created_at"`
	RedactedAt string `json:"redacted_at"`
	Reason     string `json:"reason"`
}

ComplianceBatchJobResult is the downloaded result

type ComplianceBatchJobStatus

type ComplianceBatchJobStatus string

ComplianceBatchJobStatus is the compliance batch job status

const (
	// ComplianceBatchJobStatusCreated is the created status
	ComplianceBatchJobStatusCreated ComplianceBatchJobStatus = "created"
	// ComplianceBatchJobStatusComplete is the complete status
	ComplianceBatchJobStatusComplete ComplianceBatchJobStatus = "complete"
	// ComplianceBatchJobStatusInProgress is the in_progress status
	ComplianceBatchJobStatusInProgress ComplianceBatchJobStatus = "in_progress"
	// ComplianceBatchJobStatusFailed is the failed status
	ComplianceBatchJobStatusFailed ComplianceBatchJobStatus = "failed"
	// ComplianceBatchJobStatusExpired is the expired status
	ComplianceBatchJobStatusExpired ComplianceBatchJobStatus = "expired"
)

type ComplianceBatchJobType

type ComplianceBatchJobType string

ComplianceBatchJobType is the compliance batch job type

const (
	// ComplianceBatchJobTypeTweets is the tweets job
	ComplianceBatchJobTypeTweets ComplianceBatchJobType = "tweets"
	// ComplianceBatchJobTypeUsers is the users job
	ComplianceBatchJobTypeUsers ComplianceBatchJobType = "users"
)

type ComplianceBatchJobsRaw

type ComplianceBatchJobsRaw struct {
	Jobs []*ComplianceBatchJobObj `json:"data"`
}

ComplianceBatchJobsRaw is the jobs

type Connection added in v2.1.5

type Connection struct {
	Title           string `json:"title"`
	ConnectionIssue string `json:"connection_issue"`
	Detail          string `json:"detail"`
	Type            string `json:"type"`
}

Connection has the connection error

type CreateComplianceBatchJobOpts

type CreateComplianceBatchJobOpts struct {
	Name      string
	Resumable bool
}

CreateComplianceBatchJobOpts are the create compliance batch job options

type CreateComplianceBatchJobResponse

type CreateComplianceBatchJobResponse struct {
	Raw       *ComplianceBatchJobRaw
	RateLimit *RateLimit
}

CreateComplianceBatchJobResponse is the response from creating a compliance batch job

type CreateTweetData

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

CreateTweetData is the data returned when creating a tweet

type CreateTweetGeo

type CreateTweetGeo struct {
	PlaceID string `json:"place_id,omitempty"`
}

CreateTweetGeo allows for the tweet to coontain geo

type CreateTweetMedia

type CreateTweetMedia struct {
	IDs           []string `json:"media_ids,omitempty"`
	TaggedUserIDs []string `json:"tagged_user_ids,omitempty"`
}

CreateTweetMedia allows for updated media to attached. If the tagged user ids are present, then ids must be present.

type CreateTweetPoll

type CreateTweetPoll struct {
	DurationMinutes int      `json:"duration_minutes,omitempty"`
	Options         []string `json:"options,omitempty"`
}

CreateTweetPoll allows for a poll to be posted as the tweet

type CreateTweetReply

type CreateTweetReply struct {
	ExcludeReplyUserIDs []string `json:"exclude_reply_user_ids,omitempty"`
	InReplyToTweetID    string   `json:"in_reply_to_tweet_id,omitempty"`
}

CreateTweetReply sets the reply setting for the tweet

type CreateTweetRequest

type CreateTweetRequest struct {
	DirectMessageDeepLink string            `json:"direct_message_deep_link,omitempty"`
	ForSuperFollowersOnly bool              `json:"for_super_followers_only,omitempty"`
	QuoteTweetID          string            `json:"quote_tweet_id,omitempty"`
	Text                  string            `json:"text,omitempty"`
	ReplySettings         string            `json:"reply_settings,omitempty"`
	Geo                   *CreateTweetGeo   `json:"geo,omitempty"`
	Media                 *CreateTweetMedia `json:"media,omitempty"`
	Poll                  *CreateTweetPoll  `json:"poll,omitempty"`
	Reply                 *CreateTweetReply `json:"reply,omitempty"`
}

CreateTweetRequest is the details of a tweet to create

type CreateTweetResponse

type CreateTweetResponse struct {
	Tweet     *CreateTweetData `json:"data"`
	RateLimit *RateLimit
}

CreateTweetResponse is the response returned by the create tweet

type DeleteTweetData

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

DeleteTweetData is the indication of the deletion of tweet

type DeleteTweetResponse

type DeleteTweetResponse struct {
	Tweet     *DeleteTweetData `json:"data"`
	RateLimit *RateLimit
}

DeleteTweetResponse is the response returned by the delete tweet

type DeleteUserLikesResponse

type DeleteUserLikesResponse struct {
	Data      *UserLikesData `json:"data"`
	RateLimit *RateLimit
}

DeleteUserLikesResponse the response for the user unlike

type DeleteUserRetweetResponse

type DeleteUserRetweetResponse struct {
	Data      *RetweetData `json:"data"`
	RateLimit *RateLimit
}

DeleteUserRetweetResponse is the response with a user retweet

type Disconnection added in v2.1.5

type Disconnection struct {
	Title          string `json:"title"`
	DisconnectType string `json:"disconnect_type"`
	Detail         string `json:"detail"`
	Type           string `json:"type"`
}

Disconnection has the disconnection error

type DisconnectionError added in v2.1.5

type DisconnectionError struct {
	Disconnections []*Disconnection
	Connections    []*Connection
}

DisconnectionError contains the disconnection messages

type EntitiesObj

type EntitiesObj struct {
	Annotations []EntityAnnotationObj `json:"annotations"`
	URLs        []EntityURLObj        `json:"urls"`
	HashTags    []EntityTagObj        `json:"hashtags"`
	Mentions    []EntityMentionObj    `json:"mentions"`
	CashTags    []EntityTagObj        `json:"cashtags"`
}

EntitiesObj contains details about text that has a special meaning.

type EntityAnnotationObj

type EntityAnnotationObj struct {
	EntityObj
	Probability    float64 `json:"probability"`
	Type           string  `json:"type"`
	NormalizedText string  `json:"normalized_text"`
}

EntityAnnotationObj contains details about annotations relative to the text.

type EntityMentionObj

type EntityMentionObj struct {
	EntityObj
	UserName string `json:"username"`
}

EntityMentionObj contains details about text recognized as a user mention.

type EntityObj

type EntityObj struct {
	Start int `json:"start"`
	End   int `json:"end"`
}

EntityObj contains the start and end positions of the text

type EntityTagObj

type EntityTagObj struct {
	EntityObj
	Tag string `json:"tag"`
}

EntityTagObj contains details about text recognized as a tag

type EntityURLImageObj added in v2.1.5

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

EntityURLImageObj defines the array of images that are associated with the entity URL object

type EntityURLObj

type EntityURLObj struct {
	EntityObj
	URL         string              `json:"url"`
	ExpandedURL string              `json:"expanded_url"`
	DisplayURL  string              `json:"display_url"`
	Status      int                 `json:"status"`
	Title       string              `json:"title"`
	Description string              `json:"description"`
	UnwoundURL  string              `json:"unwound_url"`
	MediaKey    string              `json:"media_key"`
	Images      []EntityURLImageObj `json:"images"`
}

EntityURLObj contains details about text recognized as a URL.

type Epoch

type Epoch int

Epoch is the UNIX seconds from 1/1/1970

func (Epoch) Time

func (e Epoch) Time() time.Time

Time returns the epoch time

type Error

type Error struct {
	Parameters interface{} `json:"parameters"`
	Message    string      `json:"message"`
}

Error is part of the HTTP response error

type ErrorObj

type ErrorObj struct {
	Title        string      `json:"title"`
	Detail       string      `json:"detail"`
	Type         string      `json:"type"`
	ResourceType string      `json:"resource_type"`
	Parameter    string      `json:"parameter"`
	Value        interface{} `json:"value"`
}

ErrorObj is part of the partial errors in the response

type ErrorResponse

type ErrorResponse struct {
	StatusCode int
	Errors     []Error    `json:"errors"`
	Title      string     `json:"title"`
	Detail     string     `json:"detail"`
	Type       string     `json:"type"`
	RateLimit  *RateLimit `json:"-"`
}

ErrorResponse is returned by a non-success callout

func (ErrorResponse) Error

func (e ErrorResponse) Error() string

type Exclude

type Exclude string

Exclude are the exclusions in the request

const (
	// ExcludeRetweets will exclude a tweet's retweets
	ExcludeRetweets Exclude = "retweets"
	// ExcludeReplies will exclude a tweet's replies
	ExcludeReplies Exclude = "replies"
)

type Expansion

type Expansion string

Expansion can expand objects referenced in the payload

const (
	// ExpansionAttachmentsPollIDs returns a poll object containing metadata for the poll included in the Tweet
	ExpansionAttachmentsPollIDs Expansion = "attachments.poll_ids"
	// ExpansionAttachmentsMediaKeys returns a media object representing the images, videos, GIFs included in the Tweet
	ExpansionAttachmentsMediaKeys Expansion = "attachments.media_keys"
	// ExpansionAuthorID returns a user object representing the Tweet’s author
	ExpansionAuthorID Expansion = "author_id"
	// ExpansionEntitiesMentionsUserName returns a user object for the user mentioned in the Tweet
	ExpansionEntitiesMentionsUserName Expansion = "entities.mentions.username"
	// ExpansionGeoPlaceID returns a place object containing metadata for the location tagged in the Tweet
	ExpansionGeoPlaceID Expansion = "geo.place_id"
	// ExpansionInReplyToUserID returns a user object representing the Tweet author this requested Tweet is a reply of
	ExpansionInReplyToUserID Expansion = "in_reply_to_user_id"
	// ExpansionReferencedTweetsID returns a Tweet object that this Tweet is referencing (either as a Retweet, Quoted Tweet, or reply)
	ExpansionReferencedTweetsID Expansion = "referenced_tweets.id"
	// ExpansionReferencedTweetsIDAuthorID returns a user object for the author of the referenced Tweet
	ExpansionReferencedTweetsIDAuthorID Expansion = "referenced_tweets.id.author_id"
	// ExpansionPinnedTweetID returns a Tweet object representing the Tweet pinned to the top of the user’s profile
	ExpansionPinnedTweetID Expansion = "pinned_tweet_id"
	// ExpansionOwnerID returns an owner in the includes
	ExpansionOwnerID Expansion = "owner_id"
	// ExpansionCreatorID returns the creator id
	ExpansionCreatorID Expansion = "creator_id"
	// ExpansionSpeakerIDS returns the speaker ids
	ExpansionSpeakerIDS Expansion = "speaker_ids"
	// ExpansionInvitedUserIDs returns the invited user ids
	ExpansionInvitedUserIDs Expansion = "invited_user_ids"
	// ExpansionHostIDs returns the host ids
	ExpansionHostIDs Expansion = "host_ids"
)

type Granularity

type Granularity string

Granularity is the granularity that you want the timeseries count data to be grouped by

const (
	// GranularityMinute will group tweet in minutes
	GranularityMinute Granularity = "minute"
	// GranularityHour is the default granularity
	GranularityHour Granularity = "hour"
	// GranularityDay will group tweet on a daily basis
	GranularityDay Granularity = "day"
)

type HTTPError

type HTTPError struct {
	Status     string
	StatusCode int
	URL        string
	RateLimit  *RateLimit
}

HTTPError is a response error where the body is not JSON, but XML. This commonly seen in 404 errors.

func (HTTPError) Error

func (h HTTPError) Error() string

type ListAddMemberResponse

type ListAddMemberResponse struct {
	List      *ListMemberData `json:"data"`
	RateLimit *RateLimit
}

ListAddMemberResponse is the list add member response

type ListCreateData

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

ListCreateData is the data returned from creating a list

type ListCreateResponse

type ListCreateResponse struct {
	List      *ListCreateData `json:"data"`
	RateLimit *RateLimit
}

ListCreateResponse is the response to creating a list

type ListDeleteData

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

ListDeleteData is the data returned from deleting a list

type ListDeleteResponse

type ListDeleteResponse struct {
	List      *ListDeleteData `json:"data"`
	RateLimit *RateLimit
}

ListDeleteResponse is the response to deleting a list

type ListField

type ListField string

ListField are the optional fields that can be included in the response

const (
	// ListFieldCreatedAt is the UTC datetime that the List was created on Twitter.
	ListFieldCreatedAt ListField = "created_at"
	// ListFieldFollowerCount shows how many users follow this List
	ListFieldFollowerCount ListField = "follower_count"
	// ListFieldMemberCount shows how many members are part of this List.
	ListFieldMemberCount ListField = "member_count"
	// ListFieldPrivate indicates if the list is private
	ListFieldPrivate ListField = "private"
	// ListFieldDescription is a brief description to let users know about the List.
	ListFieldDescription ListField = "description"
	// ListFieldOwnerID is unique identifier of this List's owner.
	ListFieldOwnerID ListField = "owner_id"
)

type ListLookupOpts

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

ListLookupOpts are the options for the list lookup

type ListLookupResponse

type ListLookupResponse struct {
	Raw       *ListRaw
	RateLimit *RateLimit
}

ListLookupResponse is the response from the list lookup

type ListMemberData

type ListMemberData struct {
	Member bool `json:"is_member"`
}

ListMemberData is the list member data

type ListMetaData

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

ListMetaData is a list meta data

type ListObj

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

ListObj is the metadata for twitter lists

type ListRaw

type ListRaw struct {
	List     *ListObj         `json:"data"`
	Includes *ListRawIncludes `json:"includes,omitempty"`
	Errors   []*ErrorObj      `json:"errors,omitempty"`
}

ListRaw the raw list response

type ListRawIncludes

type ListRawIncludes struct {
	Users []*UserObj `json:"users,omitempty"`
}

ListRawIncludes the data include from the expansion

type ListRemoveMemberResponse

type ListRemoveMemberResponse struct {
	List      *ListMemberData `json:"data"`
	RateLimit *RateLimit
}

ListRemoveMemberResponse is the list remove member response

type ListTweetLookupMeta

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

ListTweetLookupMeta is the meta data associated with the list tweet lookup

type ListTweetLookupOpts

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

ListTweetLookupOpts are the response field options

type ListTweetLookupResponse

type ListTweetLookupResponse struct {
	Raw       *TweetRaw
	Meta      *ListTweetLookupMeta `json:"meta"`
	RateLimit *RateLimit
}

ListTweetLookupResponse is the response to the list tweet lookup

type ListUpdateData

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

ListUpdateData is the data returned from updating a list

type ListUpdateResponse

type ListUpdateResponse struct {
	List      *ListUpdateData `json:"data"`
	RateLimit *RateLimit
}

ListUpdateResponse is the response to updating a list

type ListUserFollowersMeta

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

ListUserFollowersMeta is the meta for the list followers

type ListUserFollowersOpts

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

ListUserFollowersOpts is the list followers options

type ListUserFollowersResponse

type ListUserFollowersResponse struct {
	Raw       *UserRaw
	Meta      *ListUserFollowersMeta `json:"meta"`
	RateLimit *RateLimit
}

ListUserFollowersResponse is the response for the list followers

type ListUserMembersMeta

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

ListUserMembersMeta is the meta data of the response

type ListUserMembersOpts

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

ListUserMembersOpts is the list user member options

type ListUserMembersResponse

type ListUserMembersResponse struct {
	Raw       *UserRaw
	Meta      *ListUserMembersMeta `json:"meta"`
	RateLimit *RateLimit
}

ListUserMembersResponse is the response to the list user members

type MediaField

type MediaField string

MediaField can expand the fields that are returned in the media object

const (
	// MediaFieldDurationMS available when type is video. Duration in milliseconds of the video.
	MediaFieldDurationMS MediaField = "duration_ms"
	// MediaFieldHeight of this content in pixels.
	MediaFieldHeight MediaField = "height"
	// MediaFieldMediaKey unique identifier of the expanded media content.
	MediaFieldMediaKey MediaField = "media_key"
	// MediaFieldPreviewImageURL is the URL to the static placeholder preview of this content.
	MediaFieldPreviewImageURL MediaField = "preview_image_url"
	// MediaFieldType is the type of content (animated_gif, photo, video)
	MediaFieldType MediaField = "type"
	// MediaFieldURL is the URL of the content
	MediaFieldURL MediaField = "url"
	// MediaFieldWidth is the width of this content in pixels
	MediaFieldWidth MediaField = "width"
	// MediaFieldPublicMetrics is the public engagement metrics for the media content at the time of the request.
	MediaFieldPublicMetrics MediaField = "public_metrics"
	// MediaFieldNonPublicMetrics is the non-public engagement metrics for the media content at the time of the request.
	MediaFieldNonPublicMetrics MediaField = "non_public_metrics"
	// MediaFieldOrganicMetrics is the engagement metrics for the media content, tracked in an organic context, at the time of the request.
	MediaFieldOrganicMetrics MediaField = "organic_metrics"
	// MediaFieldPromotedMetrics is the URL to the static placeholder preview of this content.
	MediaFieldPromotedMetrics MediaField = "promoted_metrics"
	// MediaFieldAltText is a description of an image to enable and support accessibility.
	MediaFieldAltText MediaField = "alt_text"
	// MediaFieldVariants is the list of multiple display or playback variants.
	MediaFieldVariants MediaField = "variants"
)

type MediaMetricsObj

type MediaMetricsObj struct {
	Playback0   int `json:"playback_0_count"`
	Playback100 int `json:"playback_100_count"`
	Playback25  int `json:"playback_25_count"`
	Playback50  int `json:"playback_50_count"`
	Playback75  int `json:"playback_75_count"`
	Views       int `json:"view_count"`
}

MediaMetricsObj engagement metrics for the media content at the time of the request

type MediaObj

type MediaObj struct {
	Key              string             `json:"media_key"`
	Type             string             `json:"type"`
	URL              string             `json:"url"`
	DurationMS       int                `json:"duration_ms"`
	Height           int                `json:"height,omitempty"`
	NonPublicMetrics *MediaMetricsObj   `json:"non_public_metrics,omitempty"`
	OrganicMetrics   *MediaMetricsObj   `json:"organic_metrics,omitempty"`
	PreviewImageURL  string             `json:"preview_image_url,omitempty"`
	PromotedMetrics  *MediaMetricsObj   `json:"promoted_metrics,omitempty"`
	PublicMetrics    *MediaMetricsObj   `json:"public_metrics,omitempty"`
	Width            int                `json:"width,omitempty"`
	AltText          string             `json:"alt_text,omitempty"`
	Variants         []*MediaVariantObj `json:"variants,omitempty"`
}

MediaObj refers to any image, GIF, or video attached to a Tweet

type MediaVariantObj added in v2.1.2

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

MediaVariantObj the media object display or playback variants with resolution and format

type PlaceField

type PlaceField string

PlaceField can expand the tweet primary object

const (
	// PlaceFieldContainedWithin returns the identifiers of known places that contain the referenced place.
	PlaceFieldContainedWithin PlaceField = "contained_within"
	// PlaceFieldCountry is the full-length name of the country this place belongs to.
	PlaceFieldCountry PlaceField = "country"
	// PlaceFieldCountryCode is the ISO Alpha-2 country code this place belongs to.
	PlaceFieldCountryCode PlaceField = "country_code"
	// PlaceFieldFullName is a longer-form detailed place name.
	PlaceFieldFullName PlaceField = "full_name"
	// PlaceFieldGeo contains place details in GeoJSON format.
	PlaceFieldGeo PlaceField = "geo"
	// PlaceFieldID is the unique identifier of the expanded place, if this is a point of interest tagged in the Tweet.
	PlaceFieldID PlaceField = "id"
	// PlaceFieldName is the short name of this place
	PlaceFieldName PlaceField = "name"
	// PlaceFieldPlaceType is specified the particular type of information represented by this place information, such as a city name, or a point of interest.
	PlaceFieldPlaceType PlaceField = "place_type"
)

type PlaceGeoObj

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

PlaceGeoObj contains place details

type PlaceObj

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

PlaceObj tagged in a Tweet is not a primary object on any endpoint

type PollField

type PollField string

PollField defines the fields of the expanded tweet

const (
	// PollFieldDurationMinutes specifies the total duration of this poll.
	PollFieldDurationMinutes PollField = "duration_minutes"
	// PollFieldEndDateTime specifies the end date and time for this poll.
	PollFieldEndDateTime PollField = "end_datetime"
	// PollFieldID is unique identifier of the expanded poll.
	PollFieldID PollField = "id"
	// PollFieldOptions contains objects describing each choice in the referenced poll.
	PollFieldOptions PollField = "options"
	// PollFieldVotingStatus indicates if this poll is still active and can receive votes, or if the voting is now closed.
	PollFieldVotingStatus PollField = "voting_status"
)

type PollObj

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

PollObj included in a Tweet is not a primary object on any endpoint

type PollOptionObj

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

PollOptionObj contains objects describing each choice in the referenced poll.

type QuoteTweetsLookupMeta

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

QuoteTweetsLookupMeta is the meta data from the response

type QuoteTweetsLookupOpts

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

QuoteTweetsLookupOpts are the options for the quote tweets

type QuoteTweetsLookupResponse

type QuoteTweetsLookupResponse struct {
	Raw       *TweetRaw
	Meta      *QuoteTweetsLookupMeta
	RateLimit *RateLimit
}

QuoteTweetsLookupResponse is the response from the quote tweet

type RateLimit

type RateLimit struct {
	Limit     int
	Remaining int
	Reset     Epoch
}

RateLimit are the rate limit values from the response header

func RateLimitFromError

func RateLimitFromError(err error) (*RateLimit, bool)

RateLimitFromError returns the rate limits from an error. If there are not any limits, false is returned.

type RemoveTweetBookmarkResponse

type RemoveTweetBookmarkResponse struct {
	Tweet     *TweetBookmarkData `json:"data"`
	RateLimit *RateLimit
}

RemoveTweetBookmarkResponse is the response for removing a bookmark

type ResponseDecodeError

type ResponseDecodeError struct {
	Name      string
	Err       error
	RateLimit *RateLimit
}

ResponseDecodeError is an error when a response has a decoding error, JSON.

func (*ResponseDecodeError) Error

func (r *ResponseDecodeError) Error() string

func (*ResponseDecodeError) Unwrap

func (r *ResponseDecodeError) Unwrap() error

Unwrap will return the wrapped error

type RetweetData

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

RetweetData will be returned by the manage retweet APIs

type SpaceBuyersLookupOpts

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

SpaceBuyersLookupOpts are the options for the space buyer lookup

type SpaceBuyersLookupResponse

type SpaceBuyersLookupResponse struct {
	Raw       *UserRaw
	RateLimit *RateLimit
}

SpaceBuyersLookupResponse is the space buyers lookup response

type SpaceField

type SpaceField string

SpaceField are the space field options

const (
	// SpaceFieldHostIDs is the space host ids field
	SpaceFieldHostIDs SpaceField = "host_ids"
	// SpaceFieldCreatedAt is the space created at field
	SpaceFieldCreatedAt SpaceField = "created_at"
	// SpaceFieldCreatorID is the space creator id field
	SpaceFieldCreatorID SpaceField = "creator_id"
	// SpaceFieldID is the space field id field
	SpaceFieldID SpaceField = "id"
	// SpaceFieldLang is the space language field
	SpaceFieldLang SpaceField = "lang"
	// SpaceFieldInvitedUserIDs is the space invited user ids field
	SpaceFieldInvitedUserIDs SpaceField = "invited_user_ids"
	// SpaceFieldParticipantCount is the space participant count field
	SpaceFieldParticipantCount SpaceField = "participant_count"
	// SpaceFieldSpeakerIDs is the space speaker ids field
	SpaceFieldSpeakerIDs SpaceField = "speaker_ids"
	// SpaceFieldStartedAt is the space started at field
	SpaceFieldStartedAt SpaceField = "started_at"
	// SpaceFieldEndedAt is the space ended at field
	SpaceFieldEndedAt SpaceField = "ended_at"
	// SpaceFieldSubscriberCount is the space subscriber count field
	SpaceFieldSubscriberCount SpaceField = "subscriber_count"
	// SpaceFieldTopicIDs is the space topic ids field
	SpaceFieldTopicIDs SpaceField = "topic_ids"
	// SpaceFieldState is the space state field
	SpaceFieldState SpaceField = "state"
	// SpaceFieldTitle is the space title field
	SpaceFieldTitle SpaceField = "title"
	// SpaceFieldUpdatedAt is the space updated at field
	SpaceFieldUpdatedAt SpaceField = "updated_at"
	// SpaceFieldScheduledStart is the space scheduled start field
	SpaceFieldScheduledStart SpaceField = "scheduled_start"
	// SpaceFieldTicketed is the space is ticketed field
	SpaceFieldTicketed SpaceField = "is_ticketed"
)

type SpaceObj

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

SpaceObj is the spaces object

type SpaceState

type SpaceState string

SpaceState is the enumeration of the space states

const (
	// SpaceStateAll is for all of the possible states
	SpaceStateAll SpaceState = "all"
	// SpaceStateLive is for only live states
	SpaceStateLive SpaceState = "live"
	// SpaceStateScheduled is for only scheduled states
	SpaceStateScheduled SpaceState = "scheduled"
)

type SpaceTweetsLookupMeta

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

SpaceTweetsLookupMeta is the space tweets lookup meta

type SpaceTweetsLookupOpts

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

SpaceTweetsLookupOpts are the options for the space tweets lookup

type SpaceTweetsLookupResponse

type SpaceTweetsLookupResponse struct {
	Raw       *TweetRaw
	Meta      *SpaceTweetsLookupMeta `json:"meta"`
	RateLimit *RateLimit
}

SpaceTweetsLookupResponse is the response for the space tweets lookup

type SpacesByCreatorLookupOpts

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

SpacesByCreatorLookupOpts are the options for the space by creator

type SpacesByCreatorLookupResponse

type SpacesByCreatorLookupResponse struct {
	Raw       *SpacesRaw
	Meta      *SpacesByCreatorMeta `json:"meta"`
	RateLimit *RateLimit
}

SpacesByCreatorLookupResponse is the response to the space by creator

type SpacesByCreatorMeta

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

SpacesByCreatorMeta the meta for the space by creator

type SpacesLookupOpts

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

SpacesLookupOpts are the options for the space lookup

type SpacesLookupResponse

type SpacesLookupResponse struct {
	Raw       *SpacesRaw
	RateLimit *RateLimit
}

SpacesLookupResponse is the response for the space lookup

type SpacesRaw

type SpacesRaw struct {
	Spaces   []*SpaceObj        `json:"data"`
	Includes *SpacesRawIncludes `json:"includes,omitempty"`
	Errors   []*ErrorObj        `json:"errors,omitempty"`
}

SpacesRaw the raw space objects

type SpacesRawIncludes

type SpacesRawIncludes struct {
	Users  []*UserObj  `json:"users,omitempty"`
	Topics []*TopicObj `json:"topics,omitempty"`
}

SpacesRawIncludes are the includes for a space

type SpacesSearchMeta

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

SpacesSearchMeta is the search meta

type SpacesSearchOpts

type SpacesSearchOpts struct {
	Expansions  []Expansion
	SpaceFields []SpaceField
	TopicFields []TopicField
	UserFields  []UserField
	State       SpaceState
}

SpacesSearchOpts are the space search options

type SpacesSearchResponse

type SpacesSearchResponse struct {
	Raw       *SpacesRaw
	Meta      *SpacesSearchMeta `json:"meta"`
	RateLimit *RateLimit
}

SpacesSearchResponse is the respones from the search

type StreamError

type StreamError struct {
	Type StreamErrorType
	Msg  string
	Err  error
}

StreamError is the error from the streaming

func (StreamError) Error

func (e StreamError) Error() string

func (*StreamError) Is

func (e *StreamError) Is(target error) bool

Is will compare the error against the stream error and type

func (*StreamError) Unwrap

func (e *StreamError) Unwrap() error

Unwrap will return any error associated

type StreamErrorType

type StreamErrorType string

StreamErrorType is the type of streaming error

type SystemMessage

type SystemMessage struct {
	Message string    `json:"message"`
	Sent    time.Time `json:"sent"`
}

SystemMessage is the system stream message

type SystemMessageType

type SystemMessageType string

SystemMessageType stream system message types

type TopicField

type TopicField string

TopicField are the topic field options

const (
	// TopicFieldID is the topic id field
	TopicFieldID TopicField = "id"
	// TopicFieldName is the topic name field
	TopicFieldName TopicField = "name"
	// TopicFieldDescription is the topic description field
	TopicFieldDescription TopicField = "description"
)

type TopicObj

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

TopicObj is the topic object

type TweetAllCountsMeta

type TweetAllCountsMeta struct {
	TotalTweetCount int    `json:"total_tweet_count"`
	NextToken       string `json:"next_token"`
}

TweetAllCountsMeta is the meta data from the all counts information

type TweetAllCountsOpts

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

TweetAllCountsOpts are the optional paramters that can be passed to the tweet all counts callout

type TweetAllCountsResponse

type TweetAllCountsResponse struct {
	TweetCounts []*TweetCount       `json:"data"`
	Meta        *TweetAllCountsMeta `json:"meta"`
	RateLimit   *RateLimit
}

TweetAllCountsResponse contain all fo the information from a tweet all counts

type TweetAttachmentsObj

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

TweetAttachmentsObj specifics the type of attachment present in the tweet

type TweetBookmarkData

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

TweetBookmarkData is the data from adding or removing a bookmark

type TweetBookmarksLookupMeta

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

TweetBookmarksLookupMeta is the meta for the bookmark lookup

type TweetBookmarksLookupOpts

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

TweetBookmarksLookupOpts are the tweet bookmark lookup options

type TweetBookmarksLookupResponse

type TweetBookmarksLookupResponse struct {
	Raw       *TweetRaw
	Meta      *TweetBookmarksLookupMeta
	RateLimit *RateLimit
}

TweetBookmarksLookupResponse is the response to the bookmark lookup

type TweetContextAnnotationObj

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

TweetContextAnnotationObj contain the context annotation

type TweetContextObj

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

TweetContextObj contains the elements which identify detailed information regarding the domain classification based on the Tweet text

type TweetCount

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

TweetCount is the object on the tweet counts endpoints

type TweetDictionary

type TweetDictionary struct {
	Tweet            TweetObj
	Author           *UserObj
	InReplyUser      *UserObj
	Place            *PlaceObj
	AttachmentPolls  []*PollObj
	AttachmentMedia  []*MediaObj
	Mentions         []*TweetMention
	ReferencedTweets []*TweetReference
}

TweetDictionary is a struct of a tweet and all of the reference objects

func CreateTweetDictionary

func CreateTweetDictionary(tweet TweetObj, includes *TweetRawIncludes) *TweetDictionary

CreateTweetDictionary will create a dictionary from a tweet and the includes

type TweetField

type TweetField string

TweetField defines the fields of the basic building block of all things twitter

const (
	// TweetFieldID is the unique identifier of the requested Tweet.
	TweetFieldID TweetField = "id"
	// TweetFieldText is the actual UTF-8 text of the Tweet. See twitter-text for details on what characters are currently considered valid.
	TweetFieldText TweetField = "text"
	// TweetFieldAttachments specifies the type of attachments (if any) present in this Tweet.
	TweetFieldAttachments TweetField = "attachments"
	// TweetFieldAuthorID is the unique identifier of the User who posted this Tweet
	TweetFieldAuthorID TweetField = "author_id"
	// TweetFieldContextAnnotations contains context annotations for the Tweet.
	TweetFieldContextAnnotations TweetField = "context_annotations"
	// TweetFieldConversationID is the Tweet ID of the original Tweet of the conversation (which includes direct replies, replies of replies).
	TweetFieldConversationID TweetField = "conversation_id"
	// TweetFieldCreatedAt is the creation time of the Tweet.
	TweetFieldCreatedAt TweetField = "created_at"
	// TweetFieldEntities are the entities which have been parsed out of the text of the Tweet. Additionally see entities in Twitter Objects.
	TweetFieldEntities TweetField = "entities"
	// TweetFieldGeo contains details about the location tagged by the user in this Tweet, if they specified one.
	TweetFieldGeo TweetField = "geo"
	// TweetFieldInReplyToUserID will contain the original Tweet’s author ID
	TweetFieldInReplyToUserID TweetField = "in_reply_to_user_id"
	// TweetFieldLanguage is the language of the Tweet, if detected by Twitter. Returned as a BCP47 language tag.
	TweetFieldLanguage TweetField = "lang"
	// TweetFieldNonPublicMetrics are the non-public engagement metrics for the Tweet at the time of the request.
	TweetFieldNonPublicMetrics TweetField = "non_public_metrics"
	// TweetFieldPublicMetrics are the public engagement metrics for the Tweet at the time of the request.
	TweetFieldPublicMetrics TweetField = "public_metrics"
	// TweetFieldOrganicMetrics are the engagement metrics, tracked in an organic context, for the Tweet at the time of the request.
	TweetFieldOrganicMetrics TweetField = "organic_metrics"
	// TweetFieldPromotedMetrics are the engagement metrics, tracked in a promoted context, for the Tweet at the time of the request.
	TweetFieldPromotedMetrics TweetField = "promoted_metrics"
	// TweetFieldPossiblySensitve is an indicator that the URL contained in the Tweet may contain content or media identified as sensitive content.
	TweetFieldPossiblySensitve TweetField = "possibly_sensitive"
	// TweetFieldReferencedTweets is a list of Tweets this Tweet refers to.
	TweetFieldReferencedTweets TweetField = "referenced_tweets"
	// TweetFieldSource is the name of the app the user Tweeted from.
	TweetFieldSource TweetField = "source"
	// TweetFieldWithHeld contains withholding details
	TweetFieldWithHeld TweetField = "withheld"
)

type TweetGeoCoordinatesObj

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

TweetGeoCoordinatesObj contains details about the coordinates of the location tagged by the user in this Tweet, if they specified one.

type TweetGeoObj

type TweetGeoObj struct {
	PlaceID     string                 `json:"place_id"`
	Coordinates TweetGeoCoordinatesObj `json:"coordinates"`
}

TweetGeoObj contains details about the location tagged by the user in this Tweet, if they specified one.

type TweetHideReplyData

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

TweetHideReplyData is the hide reply data

type TweetHideReplyResponse

type TweetHideReplyResponse struct {
	Reply     *TweetHideReplyData `json:"data"`
	RateLimit *RateLimit
}

TweetHideReplyResponse is the response from the hide replies

type TweetLikesLookupOpts

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

TweetLikesLookupOpts the user like lookup options

type TweetLikesLookupResponse

type TweetLikesLookupResponse struct {
	Raw       *UserRaw
	Meta      *TweetLikesMeta `json:"meta"`
	RateLimit *RateLimit
}

TweetLikesLookupResponse is the user from the tweet likes

type TweetLikesMeta

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

TweetLikesMeta is the meta data from the response

type TweetLookupOpts

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

TweetLookupOpts are the optional paramters that can be passed to the lookup callout

type TweetLookupResponse

type TweetLookupResponse struct {
	Raw       *TweetRaw
	RateLimit *RateLimit
}

TweetLookupResponse contains all of the information from a tweet lookup callout

type TweetMention

type TweetMention struct {
	Mention *EntityMentionObj
	User    *UserObj
}

TweetMention is the mention and the user associated with it

type TweetMessage

type TweetMessage struct {
	Raw *TweetRaw
}

TweetMessage is the tweet stream message

type TweetMetricsObj

type TweetMetricsObj struct {
	Impressions       int `json:"impression_count"`
	URLLinkClicks     int `json:"url_link_clicks"`
	UserProfileClicks int `json:"user_profile_clicks"`
	Likes             int `json:"like_count"`
	Replies           int `json:"reply_count"`
	Retweets          int `json:"retweet_count"`
	Quotes            int `json:"quote_count"`
}

TweetMetricsObj engagement metrics for the Tweet at the time of the request

type TweetObj

type TweetObj struct {
	ID                 string                       `json:"id"`
	Text               string                       `json:"text"`
	Attachments        *TweetAttachmentsObj         `json:"attachments,omitempty"`
	AuthorID           string                       `json:"author_id,omitempty"`
	ContextAnnotations []*TweetContextAnnotationObj `json:"context_annotations,omitempty"`
	ConversationID     string                       `json:"conversation_id,omitempty"`
	CreatedAt          string                       `json:"created_at,omitempty"`
	Entities           *EntitiesObj                 `json:"entities,omitempty"`
	Geo                *TweetGeoObj                 `json:"geo,omitempty"`
	InReplyToUserID    string                       `json:"in_reply_to_user_id,omitempty"`
	Language           string                       `json:"lang,omitempty"`
	NonPublicMetrics   *TweetMetricsObj             `json:"non_public_metrics,omitempty"`
	OrganicMetrics     *TweetMetricsObj             `json:"organic_metrics,omitempty"`
	PossiblySensitive  bool                         `json:"possibly_sensitive,omitempty"`
	PromotedMetrics    *TweetMetricsObj             `json:"promoted_metrics,omitempty"`
	PublicMetrics      *TweetMetricsObj             `json:"public_metrics,omitempty"`
	ReferencedTweets   []*TweetReferencedTweetObj   `json:"referenced_tweets,omitempty"`
	Source             string                       `json:"source,omitempty"`
	WithHeld           *WithHeldObj                 `json:"withheld,omitempty"`
}

TweetObj is the primary object on the tweets endpoints

type TweetRaw

type TweetRaw struct {
	Tweets   []*TweetObj       `json:"data"`
	Includes *TweetRawIncludes `json:"includes,omitempty"`
	Errors   []*ErrorObj       `json:"errors,omitempty"`
	// contains filtered or unexported fields
}

TweetRaw is the raw response from the tweet lookup endpoint

func (*TweetRaw) TweetDictionaries

func (t *TweetRaw) TweetDictionaries() map[string]*TweetDictionary

TweetDictionaries create a map of tweet dictionaries from the raw tweet response

type TweetRawIncludes

type TweetRawIncludes struct {
	Tweets []*TweetObj `json:"tweets,omitempty"`
	Users  []*UserObj  `json:"users,omitempty"`
	Places []*PlaceObj `json:"places,omitempty"`
	Media  []*MediaObj `json:"media,omitempty"`
	Polls  []*PollObj  `json:"polls,omitempty"`
	// contains filtered or unexported fields
}

TweetRawIncludes contains any additional information from the tweet callout

func (*TweetRawIncludes) MediaByKeys

func (t *TweetRawIncludes) MediaByKeys() map[string]*MediaObj

MediaByKeys will return a map of media keys to object

func (*TweetRawIncludes) PlacesByID

func (t *TweetRawIncludes) PlacesByID() map[string]*PlaceObj

PlacesByID will return a map of place ids to object

func (*TweetRawIncludes) PollsByID

func (t *TweetRawIncludes) PollsByID() map[string]*PollObj

PollsByID will return a map of poll ids to object

func (*TweetRawIncludes) TweetsByID

func (t *TweetRawIncludes) TweetsByID() map[string]*TweetObj

TweetsByID will return a map of tweet ids to object

func (*TweetRawIncludes) UsersByID

func (t *TweetRawIncludes) UsersByID() map[string]*UserObj

UsersByID will return a map of user ids to object

func (*TweetRawIncludes) UsersByUserName

func (t *TweetRawIncludes) UsersByUserName() map[string]*UserObj

UsersByUserName will return a map of user names to object

type TweetRecentCountsMeta

type TweetRecentCountsMeta struct {
	TotalTweetCount int `json:"total_tweet_count"`
}

TweetRecentCountsMeta contains the meta data from the recent counts information

type TweetRecentCountsOpts

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

TweetRecentCountsOpts are the optional paramters that can be passed to the tweet recent counts callout

type TweetRecentCountsResponse

type TweetRecentCountsResponse struct {
	TweetCounts []*TweetCount          `json:"data"`
	Meta        *TweetRecentCountsMeta `json:"meta"`
	RateLimit   *RateLimit
}

TweetRecentCountsResponse contains all of the information from a tweet recent counts

type TweetRecentSearchMeta

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

TweetRecentSearchMeta contains the recent search information

type TweetRecentSearchOpts

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

TweetRecentSearchOpts are the optional parameters for the recent search API

type TweetRecentSearchResponse

type TweetRecentSearchResponse struct {
	Raw       *TweetRaw
	Meta      *TweetRecentSearchMeta `json:"meta"`
	RateLimit *RateLimit
}

TweetRecentSearchResponse contains all of the information from a tweet recent search

type TweetReference

type TweetReference struct {
	Reference       *TweetReferencedTweetObj
	TweetDictionary *TweetDictionary
}

TweetReference is the tweet referenced and it's dictionary

type TweetReferencedTweetObj

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

TweetReferencedTweetObj is a Tweet this Tweet refers to

type TweetSampleStreamOpts

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

TweetSampleStreamOpts are the options for sample tweet stream

type TweetSearchMeta

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

TweetSearchMeta is the tweet search meta data

type TweetSearchOpts

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

TweetSearchOpts are the tweet search options

type TweetSearchResponse

type TweetSearchResponse struct {
	Raw       *TweetRaw
	Meta      *TweetSearchMeta `json:"meta"`
	RateLimit *RateLimit
}

TweetSearchResponse is the tweet search response

type TweetSearchSortOrder

type TweetSearchSortOrder string

TweetSearchSortOrder specifies the order the tweets are returned

const (
	// TweetSearchSortOrderRecency will return the tweets in order of recency
	TweetSearchSortOrderRecency TweetSearchSortOrder = "recency"
	// TweetSearchSortOrderRelevancy will return the tweets in order of relevancy
	TweetSearchSortOrderRelevancy TweetSearchSortOrder = "relevancy"
)

type TweetSearchStreamAddRuleResponse

type TweetSearchStreamAddRuleResponse struct {
	Rules     []*TweetSearchStreamRuleEntity `json:"data"`
	Meta      *TweetSearchStreamRuleMeta     `json:"meta"`
	Errors    []*ErrorObj                    `json:"errors,omitempty"`
	RateLimit *RateLimit
}

TweetSearchStreamAddRuleResponse is the response from adding rules

type TweetSearchStreamDeleteRuleResponse

type TweetSearchStreamDeleteRuleResponse struct {
	Meta      *TweetSearchStreamRuleMeta `json:"meta"`
	Errors    []*ErrorObj                `json:"errors,omitempty"`
	RateLimit *RateLimit
}

TweetSearchStreamDeleteRuleResponse is the response from deleting rules

type TweetSearchStreamOpts

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

TweetSearchStreamOpts are the options for the search stream

type TweetSearchStreamRule

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

TweetSearchStreamRule is the search stream filter rule

type TweetSearchStreamRuleEntity

type TweetSearchStreamRuleEntity struct {
	ID TweetSearchStreamRuleID `json:"id"`
	TweetSearchStreamRule
}

TweetSearchStreamRuleEntity is the search filter rule entity

type TweetSearchStreamRuleID

type TweetSearchStreamRuleID string

TweetSearchStreamRuleID is the filter rule id

type TweetSearchStreamRuleMeta

type TweetSearchStreamRuleMeta struct {
	Sent    time.Time                    `json:"sent"`
	Summary TweetSearchStreamRuleSummary `json:"summary"`
}

TweetSearchStreamRuleMeta is the meta data object from the request

type TweetSearchStreamRuleSummary

type TweetSearchStreamRuleSummary struct {
	Created    int `json:"created"`
	NotCreated int `json:"not_created"`
	Deleted    int `json:"deleted"`
	NotDeleted int `json:"not_deleted"`
}

TweetSearchStreamRuleSummary is the summary of the search filters

type TweetSearchStreamRulesResponse

type TweetSearchStreamRulesResponse struct {
	Rules     []*TweetSearchStreamRuleEntity `json:"data"`
	Meta      *TweetSearchStreamRuleMeta     `json:"meta"`
	Errors    []*ErrorObj                    `json:"errors,omitempty"`
	RateLimit *RateLimit
}

TweetSearchStreamRulesResponse is the response to getting the search rules

type TweetStream

type TweetStream struct {
	RateLimit *RateLimit
	// contains filtered or unexported fields
}

TweetStream is the stream handler

func StartTweetStream

func StartTweetStream(stream io.ReadCloser) *TweetStream

StartTweetStream will start the tweet streaming

func (*TweetStream) Close

func (ts *TweetStream) Close()

Close will close the stream and all channels

func (*TweetStream) Connection

func (ts *TweetStream) Connection() bool

Connection returns if the connect is still alive

func (*TweetStream) DisconnectionError added in v2.1.5

func (ts *TweetStream) DisconnectionError() <-chan *DisconnectionError

DisconnectionError will return the channel to receive disconnect error messages

func (*TweetStream) Err

func (ts *TweetStream) Err() <-chan error

Err will return the channel to receive any stream errors

func (*TweetStream) SystemMessages

func (ts *TweetStream) SystemMessages() <-chan map[SystemMessageType]SystemMessage

SystemMessages will return the channel to receive system stream messages

func (*TweetStream) Tweets

func (ts *TweetStream) Tweets() <-chan *TweetMessage

Tweets will return the channel to receive tweet stream messages

type UserBlocksData

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

UserBlocksData indicates if the user is blocked

type UserBlocksLookupMeta

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

UserBlocksLookupMeta is the meta associated with the blocked users lookup

type UserBlocksLookupOpts

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

UserBlocksLookupOpts are the options for the users blocked API

type UserBlocksLookupResponse

type UserBlocksLookupResponse struct {
	Raw       *UserRaw
	Meta      *UserBlocksLookupMeta `json:"meta"`
	RateLimit *RateLimit
}

UserBlocksLookupResponse is the list of users that are blocked

type UserBlocksResponse

type UserBlocksResponse struct {
	Data      *UserBlocksData `json:"data"`
	RateLimit *RateLimit
}

UserBlocksResponse is when a user blocks another

type UserDeleteBlocksResponse

type UserDeleteBlocksResponse struct {
	Data      *UserBlocksData `json:"data"`
	RateLimit *RateLimit
}

UserDeleteBlocksResponse is when a user unblocks another

type UserDeleteFollowsData

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

UserDeleteFollowsData is the data from the unfollows API

type UserDeleteFollowsResponse

type UserDeleteFollowsResponse struct {
	Data      *UserDeleteFollowsData `json:"data"`
	RateLimit *RateLimit
}

UserDeleteFollowsResponse is the response from the unfollows API

type UserDeleteMutesResponse

type UserDeleteMutesResponse struct {
	Data      *UserMutesData `json:"data"`
	RateLimit *RateLimit
}

UserDeleteMutesResponse is when a user unmutes another

type UserDictionary

type UserDictionary struct {
	User        UserObj
	PinnedTweet *TweetObj
}

UserDictionary is a struct of an user and all of the reference objects

func CreateUserDictionary

func CreateUserDictionary(user UserObj, includes *UserRawIncludes) *UserDictionary

CreateUserDictionary will create a dictionary from a user and the includes

type UserField

type UserField string

UserField defines the twitter user account metadata fields

const (
	// UserFieldCreatedAt is the UTC datetime that the user account was created on Twitter.
	UserFieldCreatedAt UserField = "created_at"
	// UserFieldDescription is the text of this user's profile description (also known as bio), if the user provided one.
	UserFieldDescription UserField = "description"
	// UserFieldEntities contains details about text that has a special meaning in the user's description.
	UserFieldEntities UserField = "entities"
	// UserFieldID is the unique identifier of this user.
	UserFieldID UserField = "id"
	// UserFieldLocation is the location specified in the user's profile, if the user provided one.
	UserFieldLocation UserField = "location"
	// UserFieldName is the name of the user, as they’ve defined it on their profile
	UserFieldName UserField = "name"
	// UserFieldPinnedTweetID is the unique identifier of this user's pinned Tweet.
	UserFieldPinnedTweetID UserField = "pinned_tweet_id"
	// UserFieldProfileImageURL is the URL to the profile image for this user, as shown on the user's profile.
	UserFieldProfileImageURL UserField = "profile_image_url"
	// UserFieldProtected indicates if this user has chosen to protect their Tweets (in other words, if this user's Tweets are private).
	UserFieldProtected UserField = "protected"
	// UserFieldPublicMetrics contains details about activity for this user.
	UserFieldPublicMetrics UserField = "public_metrics"
	// UserFieldURL is the URL specified in the user's profile, if present.
	UserFieldURL UserField = "url"
	// UserFieldUserName is the Twitter screen name, handle, or alias that this user identifies themselves with
	UserFieldUserName UserField = "username"
	// UserFieldVerified indicates if this user is a verified Twitter User.
	UserFieldVerified UserField = "verified"
	// UserFieldWithHeld contains withholding details
	UserFieldWithHeld UserField = "withheld"
)

type UserFollowListData

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

UserFollowListData is the list following data

type UserFollowListResponse

type UserFollowListResponse struct {
	List      *UserFollowListData `json:"data"`
	RateLimit *RateLimit
}

UserFollowListResponse is the user follow response

type UserFollowedListsMeta

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

UserFollowedListsMeta is the meta for the user followed

type UserFollowedListsOpts

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

UserFollowedListsOpts are the options for the user followed lists

type UserFollowedListsRaw

type UserFollowedListsRaw struct {
	Lists    []*ListObj       `json:"data"`
	Includes *ListRawIncludes `json:"includes,omitempty"`
	Errors   []*ErrorObj      `json:"errors,omitempty"`
}

UserFollowedListsRaw is the raw response for the user followed

type UserFollowedListsResponse

type UserFollowedListsResponse struct {
	Raw       *UserFollowedListsRaw
	Meta      *UserFollowedListsMeta `json:"meta"`
	RateLimit *RateLimit
}

UserFollowedListsResponse is the user followed response

type UserFollowersLookupOpts

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

UserFollowersLookupOpts are the options for the user followers API

type UserFollowersLookupResponse

type UserFollowersLookupResponse struct {
	Raw       *UserRaw
	Meta      *UserFollowershMeta `json:"meta"`
	RateLimit *RateLimit
}

UserFollowersLookupResponse is the response for the user followers API

type UserFollowershMeta

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

UserFollowershMeta is the meta data returned by the user followers API

type UserFollowingLookupOpts

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

UserFollowingLookupOpts are the options for the user following API

type UserFollowingLookupResponse

type UserFollowingLookupResponse struct {
	Raw       *UserRaw
	Meta      *UserFollowingMeta `json:"meta"`
	RateLimit *RateLimit
}

UserFollowingLookupResponse is the response for the user following API

type UserFollowingMeta

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

UserFollowingMeta is the meta data returned by the user following API

type UserFollowsData

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

UserFollowsData is the data from the follows API

type UserFollowsResponse

type UserFollowsResponse struct {
	Data      *UserFollowsData `json:"data"`
	RateLimit *RateLimit
}

UserFollowsResponse is the response from the follows API

type UserLikesData

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

UserLikesData is the data from the user like management

type UserLikesLookupOpts

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

UserLikesLookupOpts the tweet like lookup options

type UserLikesLookupResponse

type UserLikesLookupResponse struct {
	Raw       *TweetRaw
	Meta      *UserLikesMeta `json:"meta"`
	RateLimit *RateLimit
}

UserLikesLookupResponse is the tweets from the user likes

type UserLikesMeta

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

UserLikesMeta is the meta data from the response

type UserLikesResponse

type UserLikesResponse struct {
	Data      *UserLikesData `json:"data"`
	RateLimit *RateLimit
}

UserLikesResponse the response for the user likes

type UserListLookupMeta

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

UserListLookupMeta is the meta data for the lists

type UserListLookupOpts

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

UserListLookupOpts are the response field options

type UserListLookupResponse

type UserListLookupResponse struct {
	Raw       *UserListRaw
	Meta      *UserListLookupMeta `json:"meta"`
	RateLimit *RateLimit
}

UserListLookupResponse is the raw response with meta

type UserListMembershipsMeta

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

UserListMembershipsMeta the response meta data

type UserListMembershipsOpts

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

UserListMembershipsOpts the user list member options

type UserListMembershipsRaw

type UserListMembershipsRaw struct {
	Lists    []*ListObj       `json:"data"`
	Includes *ListRawIncludes `json:"includes,omitempty"`
	Errors   []*ErrorObj      `json:"errors,omitempty"`
}

UserListMembershipsRaw the raw data from the user list memberships

type UserListMembershipsResponse

type UserListMembershipsResponse struct {
	Raw       *UserListMembershipsRaw
	Meta      *UserListMembershipsMeta `json:"meta"`
	RateLimit *RateLimit
}

UserListMembershipsResponse the user list membership response

type UserListRaw

type UserListRaw struct {
	Lists    []*ListObj       `json:"data"`
	Includes *ListRawIncludes `json:"includes,omitempty"`
	Errors   []*ErrorObj      `json:"errors,omitempty"`
}

UserListRaw is the raw response

type UserLookupOpts

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

UserLookupOpts are the optional paramters that can be passed to the lookup callout

type UserLookupResponse

type UserLookupResponse struct {
	Raw       *UserRaw
	RateLimit *RateLimit
}

UserLookupResponse contains all of the information from an user lookup callout

type UserMentionTimelineOpts

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

UserMentionTimelineOpts are the options for the user mention timeline request

type UserMentionTimelineResponse

type UserMentionTimelineResponse struct {
	Raw       *TweetRaw
	Meta      *UserTimelineMeta `json:"meta"`
	RateLimit *RateLimit
}

UserMentionTimelineResponse contains the information from the user mention timeline callout

type UserMetricsObj

type UserMetricsObj struct {
	Followers int `json:"followers_count"`
	Following int `json:"following_count"`
	Tweets    int `json:"tweet_count"`
	Listed    int `json:"listed_count"`
}

UserMetricsObj contains details about activity for this user

type UserMutesData

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

UserMutesData indicates if the user is muted

type UserMutesLookupMeta

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

UserMutesLookupMeta is the meta associated with the muted users lookup

type UserMutesLookupOpts

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

UserMutesLookupOpts are the options for the users muted API

type UserMutesLookupResponse

type UserMutesLookupResponse struct {
	Raw       *UserRaw
	Meta      *UserMutesLookupMeta `json:"meta"`
	RateLimit *RateLimit
}

UserMutesLookupResponse is the list of users that are muted

type UserMutesResponse

type UserMutesResponse struct {
	Data      *UserMutesData `json:"data"`
	RateLimit *RateLimit
}

UserMutesResponse is when a user mutes another

type UserObj

type UserObj 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        *EntitiesObj    `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   *UserMetricsObj `json:"public_metrics,omitempty"`
	URL             string          `json:"url,omitempty"`
	Verified        bool            `json:"verified,omitempty"`
	WithHeld        *WithHeldObj    `json:"withheld,omitempty"`
}

UserObj contains Twitter user account metadata describing the referenced user

type UserPinListData

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

UserPinListData pinned data

type UserPinListResponse

type UserPinListResponse struct {
	List      *UserPinListData `json:"data"`
	RateLimit *RateLimit
}

UserPinListResponse pin list response

type UserPinnedListsMeta

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

UserPinnedListsMeta the meta for pinned lists

type UserPinnedListsOpts

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

UserPinnedListsOpts pinned list options

type UserPinnedListsRaw

type UserPinnedListsRaw struct {
	Lists    []*ListObj       `json:"data"`
	Includes *ListRawIncludes `json:"includes,omitempty"`
	Errors   []*ErrorObj      `json:"errors,omitempty"`
}

UserPinnedListsRaw the raw data for pinned lists

type UserPinnedListsResponse

type UserPinnedListsResponse struct {
	Raw       *UserPinnedListsRaw
	Meta      *UserPinnedListsMeta `json:"meta"`
	RateLimit *RateLimit
}

UserPinnedListsResponse pinned list response

type UserRaw

type UserRaw struct {
	Users    []*UserObj       `json:"data"`
	Includes *UserRawIncludes `json:"includes,omitempty"`
	Errors   []*ErrorObj      `json:"errors,omitempty"`
	// contains filtered or unexported fields
}

UserRaw is the raw response from the user lookup endpoint

func (*UserRaw) UserDictionaries

func (u *UserRaw) UserDictionaries() map[string]*UserDictionary

UserDictionaries create a map of user dictionaries from the raw user response

type UserRawIncludes

type UserRawIncludes struct {
	Tweets []*TweetObj `json:"tweets,omitempty"`
	// contains filtered or unexported fields
}

UserRawIncludes contains any additional information from the user callout

func (*UserRawIncludes) TweetsByID

func (u *UserRawIncludes) TweetsByID() map[string]*TweetObj

TweetsByID will return a map of tweet ids to object

type UserRetweetLookupOpts

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

UserRetweetLookupOpts are the options for the user retweet loopup

type UserRetweetLookupResponse

type UserRetweetLookupResponse struct {
	Raw       *UserRetweetRaw
	Meta      *UserRetweetMeta `json:"meta"`
	RateLimit *RateLimit
}

UserRetweetLookupResponse os the response that contains the users

type UserRetweetMeta

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

UserRetweetMeta is the meta data returned by the retweet user lookup

type UserRetweetRaw

type UserRetweetRaw struct {
	Users    []*UserObj              `json:"data"`
	Includes *UserRetweetRawIncludes `json:"includes,omitempty"`
	Errors   []*ErrorObj             `json:"errors,omitempty"`
}

UserRetweetRaw is the raw data and includes from the response

type UserRetweetRawIncludes

type UserRetweetRawIncludes struct {
	Tweets []*TweetObj `json:"tweets,omitempty"`
}

UserRetweetRawIncludes are the includes from the options

type UserRetweetResponse

type UserRetweetResponse struct {
	Data      *RetweetData `json:"data"`
	RateLimit *RateLimit
}

UserRetweetResponse is the response with a user retweet

type UserReverseChronologicalTimelineMeta added in v2.1.0

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

UserReverseChronologicalTimelineMeta has the meta data from the reverse chronological timeline

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"`
	PreviousToken string `json:"previous_token"`
}

UserTimelineMeta contains the meta data from the timeline callout

type UserTweetReverseChronologicalTimelineOpts added in v2.1.0

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

UserTweetReverseChronologicalTimelineOpts are the options for the user tweet reverse chronological timeline

type UserTweetReverseChronologicalTimelineResponse added in v2.1.0

type UserTweetReverseChronologicalTimelineResponse struct {
	Raw       *TweetRaw
	Meta      *UserReverseChronologicalTimelineMeta `json:"meta"`
	RateLimit *RateLimit
}

UserTweetReverseChronologicalTimelineResponse contains the tweet timeline for the reverse chronological timeline

type UserTweetTimelineOpts

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

UserTweetTimelineOpts are the options for the user tweet timeline request

type UserTweetTimelineResponse

type UserTweetTimelineResponse struct {
	Raw       *TweetRaw
	Meta      *UserTimelineMeta `json:"meta"`
	RateLimit *RateLimit
}

UserTweetTimelineResponse contains the information from the user tweet timeline callout

type UserUnfollowListResponse

type UserUnfollowListResponse struct {
	List      *UserFollowListData `json:"data"`
	RateLimit *RateLimit
}

UserUnfollowListResponse is the user unfollow response

type UserUnpinListResponse

type UserUnpinListResponse struct {
	List      *UserPinListData `json:"data"`
	RateLimit *RateLimit
}

UserUnpinListResponse unpin list response

type WithHeldObj

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

WithHeldObj contains withholding details

Directories

Path Synopsis
_examples

Jump to

Keyboard shortcuts

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