twitter

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Baseurl    = "https://api.twitter.com/2"
	HttpGet    = resty.MethodGet
	HttpPost   = resty.MethodPost
	HttpPut    = resty.MethodPut
	HttpDelete = resty.MethodDelete
)

Variables

View Source
var AuthorizeEndpoint = oauth1.Endpoint{
	RequestTokenURL: "https://api.twitter.com/oauth/request_token",
	AuthorizeURL:    "https://api.twitter.com/oauth/authorize",
	AccessTokenURL:  "https://api.twitter.com/oauth/access_token",
}
View Source
var OAuth2Endpoint = oauth2.Endpoint{
	AuthURL:  "https://twitter.com/i/oauth2/authorize",
	TokenURL: "https://api.twitter.com/2/oauth2/token",
}

OAuth2Endpoint endpoint for twitter oauth2

View Source
var RateLimitResource = [...]Endpoint{
	{Resource: "/users", Regex: `^/users$`},
	{Resource: "/users/:id", Regex: `^/users/\d+$`},
	{Resource: "/users/by", Regex: `^/users/by$`},
	{Resource: "/users/by/username/:username", Regex: `^/users/by/username/\w+$`},
	{Resource: "/users/:id/following", Regex: `^/users/\d+/following$`},
	{Resource: "/users/:id/following/:target_user_id", Regex: `^/users/\d+/following/\d+$`},
	{Resource: "/users/:id/followers", Regex: `^/users/\d+/followers$`},
	{Resource: "/users/:id/blocking", Regex: `^/users/\d+/blocking$`},
	{Resource: "/users/:id/blocking/:target_user_id", Regex: `^/users/\d+/blocking/\d+$`},
	{Resource: "/users/:id/muting", Regex: `^/users/\d+/muting$`},
	{Resource: "/users/:id/muting/:target_user_id", Regex: `^/users/\d+/muting/\d+$`},
	{Resource: "/tweets/:id", Regex: `^/tweets/\d+$`},
	{Resource: "/tweets", Regex: `^/tweets$`},
	{Resource: "/tweets/search/recent", Regex: `^/tweets/search/recent$`},
	{Resource: "/tweets/search/all", Regex: `^/tweets/search/all$`},
	{Resource: "/users/:id/tweets", Regex: `^/users/\d+/tweets$`},
	{Resource: "/users/:id/timelines/reverse_chronological", Regex: `^/users/\d+/timelines/reverse_chronological$`},
	{Resource: "/users/:id/mentions", Regex: `^/users/\d+/mentions$`},
	{Resource: "/tweets/:id/liking_users", Regex: `^/tweets/\d+/liking_users$`},
	{Resource: "/tweets/:id/retweeted_by", Regex: `^/tweets/\d+/retweeted_by$`},
	{Resource: "/tweets/:id/quote_tweets", Regex: `^/tweets/\d+/quote_tweets$`},
	{Resource: "/users/:id/liked_tweets", Regex: `^/users/\d+/liked_tweets$`},
	{Resource: "/users/:id/likes", Regex: `^/users/\d+/likes$`},
	{Resource: "/users/:id/likes/:tweet_id", Regex: `^/users/\d+/likes/\d+$`},
	{Resource: "/users/:id/retweets", Regex: `^/users/\d+/retweets$`},
	{Resource: "/users/:id/retweets/:tweet_id", Regex: `^/users/\d+/retweets/\d+$`},
	{Resource: "/users/:id/followed_lists", Regex: `^/users/\d+/followed_lists`},
	{Resource: "/users/:id/followed_lists/:list_id", Regex: `^/users/\d+/followed_lists/\d+$`},
	{Resource: "/users/:id/pinned_lists", Regex: `^/users/\d+/retweets$`},
	{Resource: "/users/:id/pinned_lists/:list_id", Regex: `^/users/\d+/pinned_lists/\d+$`},
	{Resource: "/users/:id/bookmarks", Regex: `^/users/\d+/bookmarks$`},
	{Resource: "users/:id/bookmarks/:tweet_id", Regex: `^/users/\d+/bookmarks$/\d+$`},
	{Resource: "/tweets/:id/hidden", Regex: `^/tweets/\d+/hidden$`},
	{Resource: "/tweets/counts", Regex: `^tweets/counts/\w+$`},
	{Resource: "/spaces/:id", Regex: `^/spaces/\w+$`},
	{Resource: "/spaces", Regex: `^/spaces$`},
	{Resource: "/spaces/by/creator_ids", Regex: `^/spaces/by/creator_ids$`},
	{Resource: "/spaces/search", Regex: `^/spaces/search$`},
	{Resource: "/lists", Regex: `^/lists$`},
	{Resource: "/lists/:id", Regex: `^/lists/\d+$`},
	{Resource: "/users/:id/owned_lists", Regex: `^/users/\d+/owned_lists$`},
	{Resource: "/lists/:id/tweets", Regex: `^/lists/\d+/tweets$`},
	{Resource: "/lists/:id/members", Regex: `^/lists/\d+/members$`},
	{Resource: "/users/:id/list_memberships", Regex: `^/users/\d+/list_memberships$`},
	{Resource: "/lists/:id/members/:user_id", Regex: `^/lists/\d+/members/\d+$`},
	{Resource: "/lists/:id/followers", Regex: `^/lists/\d+/followers$`},
	{Resource: "/users/:id/followed_lists", Regex: `^/users/\d+/followed_lists`},
	{Resource: "/users/:id/followed_lists/:list_id", Regex: `^/users/\d+/followed_lists/\d+$`},
	{Resource: "/users/:id/pinned_lists", Regex: `^/users/\d+/pinned_lists`},
	{Resource: "/users/:id/pinned_lists/:list_id", Regex: `^/users/\d+/pinned_lists/\d+$`},
	{Resource: "/compliance/jobs/:job_id", Regex: `^/compliance/jobs/\d+$`},
	{Resource: "/compliance/jobs", Regex: `^/compliance/jobs$`},
	{Resource: "/dm_conversations/with/:participant_id/dm_events", Regex: `^/dm_conversations/with/\d+/dm_events`},
	{Resource: "/dm_conversations/:dm_conversation_id/dm_events", Regex: `^/dm_conversations/\d+/dm_events`},
	{Resource: "/dm_events", Regex: "^/dm_events"},
	{Resource: "/dm_conversations/with/:participant_id/messages", Regex: `^/dm_conversations/with/\d+/messages`},
	{Resource: "/dm_conversations/:dm_conversation_id/messages", Regex: `^/dm_conversations/\d+/messages`},
	{Resource: "/dm_conversations", Regex: `^/dm_conversations`},
}

Functions

func Bool added in v0.1.0

func Bool(v bool) *bool

Bool is a helper routine that allocates a new bool value to store v and returns a pointer to it.

func GenerateCodeVerifier added in v0.3.0

func GenerateCodeVerifier(length int) string

GenerateCodeVerifier Generate code verifier (length 43~128) for PKCE.

func GenerateNonce added in v0.3.0

func GenerateNonce() string

GenerateNonce Generate random nonce.

func Int added in v0.1.0

func Int(v int) *int

Int is a helper routine that allocates a new int value to store v and returns a pointer to it.

func Int64 added in v0.1.0

func Int64(v int64) *int64

Int64 is a helper routine that allocates a new int64 value to store v and returns a pointer to it.

func PkCEChallengeWithSHA256 added in v0.3.0

func PkCEChallengeWithSHA256(verifier string) string

PkCEChallengeWithSHA256 base64-URL-encoded SHA256 hash of verifier, per rfc 7636

func String added in v0.1.0

func String(v string) *string

String is a helper routine that allocates a new string value to store v and returns a pointer to it.

func Stringify added in v0.1.0

func Stringify(message interface{}) string

Stringify attempts to create a reasonable string representation of types in the GitHub library. It does things like resolve pointers to their values and omits struct fields with nil values.

Types

type APIError

type APIError struct {
	ClientID           string      `json:"client_id,omitempty"`
	RequiredEnrollment string      `json:"required_enrollment,omitempty"`
	RegistrationUrl    string      `json:"registration_url,omitempty"`
	Title              string      `json:"title"`
	Detail             string      `json:"detail"`
	Reason             string      `json:"reason,omitempty"`
	Type               string      `json:"type,omitempty"`
	Status             int         `json:"status,omitempty"`
	Errors             interface{} `json:"errors,omitempty"`
}

APIError Errors for twitter response or library error

func ParseDataResponse

func ParseDataResponse(response *resty.Response, d interface{}) *APIError

func (APIError) Error

func (e APIError) Error() string

func (APIError) String added in v0.1.0

func (e APIError) String() string

type Attachments added in v0.1.0

type Attachments struct {
	PollIDs   []*string `json:"poll_ids,omitempty"`
	MediaKeys []*string `json:"media_keys,omitempty"`
}

type AuthorizationAPP added in v0.1.0

type AuthorizationAPP struct {
	ConsumerKey       string         `json:"consumer_key"`
	ConsumerSecret    string         `json:"consumer_secret"`
	CallbackURL       string         `json:"callback_url,omitempty"`
	AccessTokenKey    string         `json:"access_token_key,omitempty"`
	AccessTokenSecret string         `json:"access_token_secret,omitempty"`
	RequestSecret     string         `json:"request_secret,omitempty"`
	Config            *oauth1.Config `json:"config,omitempty"`
}

AuthorizationAPP Twitter app config

func NewAuthorizationAPP added in v0.1.0

func NewAuthorizationAPP(app AuthorizationAPP) *AuthorizationAPP

NewAuthorizationAPP Return app for authorization

func (*AuthorizationAPP) GenerateAccessToken added in v0.1.0

func (app *AuthorizationAPP) GenerateAccessToken(response string) (*oauth1.Token, error)

GenerateAccessToken Generate user access token for the app

func (*AuthorizationAPP) GetAuthorizationURL added in v0.1.0

func (app *AuthorizationAPP) GetAuthorizationURL() (string, string, error)

GetAuthorizationURL Get authorization url for user

func (*AuthorizationAPP) GetAuthorizedHttpClient added in v0.1.0

func (app *AuthorizationAPP) GetAuthorizedHttpClient() *http.Client

GetAuthorizedHttpClient Get user authorized http client

func (*AuthorizationAPP) GetUserClient added in v0.1.0

func (app *AuthorizationAPP) GetUserClient() *Client

GetUserClient get library client with user authorization

func (AuthorizationAPP) String added in v0.1.0

func (app AuthorizationAPP) String() string

type BCSuite

type BCSuite struct {
	suite.Suite
	Tw *Client
}

BCSuite For the tests with app context

func (*BCSuite) SetupSuite

func (bc *BCSuite) SetupSuite()

func (*BCSuite) SetupTest

func (bc *BCSuite) SetupTest()

func (*BCSuite) TearDownTest

func (bc *BCSuite) TearDownTest()

type BaseData added in v0.1.0

type BaseData struct {
	Includes *Includes `json:"includes,omitempty"`
	Meta     *Meta     `json:"meta,omitempty"`
	Error    []*Error  `json:"error,omitempty"`
}

BaseData Additional response data for a request.

type BlockingResp added in v0.1.0

type BlockingResp struct {
	Data *BlockingStatus `json:"data,omitempty"`
}

BlockingResp data struct represents response for blocking

func (BlockingResp) String added in v0.1.0

func (b BlockingResp) String() string

type BlockingStatus added in v0.1.0

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

BlockingStatus represents the status for blocking

func (BlockingStatus) String added in v0.1.0

func (b BlockingStatus) String() string

type BookmarkedResp added in v0.4.7

type BookmarkedResp struct {
	Data *BookmarkedStatus `json:"data,omitempty"`
}

BookmarkedResp represents the response for bookmark tweet

func (BookmarkedResp) String added in v0.4.7

func (r BookmarkedResp) String() string

type BookmarkedStatus added in v0.4.7

type BookmarkedStatus struct {
	Bookmarked *bool `json:"bookmarked,omitempty"`
}

BookmarkedStatus represents the status for bookmark tweet

func (BookmarkedStatus) String added in v0.4.7

func (s BookmarkedStatus) String() string

type Client

type Client struct {
	Cli *resty.Client
	// API Resource
	Users         *UserResource
	Tweets        *TweetResource
	Spaces        *SpaceResource
	Lists         *ListsResource
	Compliance    *ComplianceResource
	DirectMessage *DirectMessageResource

	RateLimit *RateLimit
}

func NewBearerClient

func NewBearerClient(bearerToken string) *Client

func NewClient added in v0.1.0

func NewClient(client *resty.Client) *Client

func NewUserClint added in v0.1.0

func NewUserClint(hc *http.Client) *Client

func (*Client) Do

func (r *Client) Do(method, path string, queryParams interface{}, jsonParams interface{}, d interface{}) *APIError

func (*Client) DoDelete added in v0.1.0

func (r *Client) DoDelete(path string, d interface{}) *APIError

func (*Client) DoGet

func (r *Client) DoGet(path string, queryParams interface{}, d interface{}) *APIError

func (*Client) DoPost added in v0.1.0

func (r *Client) DoPost(path string, jsonParams interface{}, d interface{}) *APIError

func (*Client) DoPut added in v0.1.0

func (r *Client) DoPut(path string, jsonParams interface{}, d interface{}) *APIError

type ComplianceJob added in v0.2.0

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

ComplianceJob represents the data for compliance job. Refer: https://developer.twitter.com/en/docs/twitter-api/compliance/batch-compliance/api-reference/get-compliance-jobs-id

func (ComplianceJob) String added in v0.2.0

func (j ComplianceJob) String() string

type ComplianceJobResp added in v0.2.0

type ComplianceJobResp struct {
	Data *ComplianceJob `json:"data,omitempty"`
	*BaseData
}

ComplianceJobResp data struct represents the single compliance job response

func (ComplianceJobResp) String added in v0.2.0

func (j ComplianceJobResp) String() string

type ComplianceJobsResp added in v0.2.0

type ComplianceJobsResp struct {
	Data []*ComplianceJob `json:"data,omitempty"`
	*BaseData
}

ComplianceJobsResp data struct represents the list of compliance job response

func (ComplianceJobsResp) String added in v0.2.0

func (j ComplianceJobsResp) String() string

type ComplianceResource added in v0.2.0

type ComplianceResource Resource

func (*ComplianceResource) CreateJob added in v0.2.0

CreateJob Creates a new compliance job for Tweet IDs or user IDs. Refer: https://developer.twitter.com/en/docs/twitter-api/compliance/batch-compliance/api-reference/post-compliance-jobs

func (*ComplianceResource) LookupJobByID added in v0.2.0

func (r *ComplianceResource) LookupJobByID(id string) (*ComplianceJobResp, *APIError)

LookupJobByID Get a single compliance job with the specified ID. Refer: https://developer.twitter.com/en/docs/twitter-api/compliance/batch-compliance/api-reference/get-compliance-jobs-id

func (*ComplianceResource) LookupJobs added in v0.2.0

LookupJobs Returns a list of recent compliance jobs. Refer: https://developer.twitter.com/en/docs/twitter-api/compliance/batch-compliance/api-reference/get-compliance-jobs

type ContextAnnotation added in v0.1.0

type ContextAnnotation struct {
	Domain *ContextAnnotationDomain `json:"domain,omitempty"`
	Entity *ContextAnnotationEntity `json:"entity,omitempty"`
}

type ContextAnnotationDomain added in v0.1.0

type ContextAnnotationDomain struct {
	ID          *string `json:"id,omitempty"`
	Name        *string `json:"name,omitempty"`
	Description *string `json:"description,omitempty"`
}

type ContextAnnotationEntity added in v0.1.0

type ContextAnnotationEntity struct {
	ID   *string `json:"id,omitempty"`
	Name *string `json:"name,omitempty"`
}

type Coordinates added in v0.1.0

type Coordinates struct {
	Type        *string    `json:"type,omitempty"`
	Coordinates []*float64 `json:"coordinates,omitempty"`
}

type CreateGroupConversationOpts added in v0.5.0

type CreateGroupConversationOpts struct {
	ConversationType string                 `url:"conversation_type"`
	ParticipantIDs   []string               `url:"participant_ids"`
	Message          CreateGroupMessageOpts `url:"message"`
}

CreateGroupConversationOpts specifies the parameters for create conversation.

type CreateGroupMessageAttachmentOpts added in v0.5.0

type CreateGroupMessageAttachmentOpts struct {
	MediaID string `url:"media_id,omitempty"`
}

CreateGroupMessageAttachmentOpts specifies the parameters for message attachment

type CreateGroupMessageOpts added in v0.5.0

type CreateGroupMessageOpts struct {
	Attachments []CreateGroupMessageAttachmentOpts `url:"attachments,omitempty"`
	Text        string                             `url:"text,omitempty"`
}

CreateGroupMessageOpts specifies the parameters for message attachment

type CreateJobOpts added in v0.2.0

type CreateJobOpts struct {
	Type      string `url:"type"`
	Name      string `url:"name,omitempty"`
	Resumable bool   `url:"resumable,omitempty"`
}

CreateJobOpts specifies the parameters for create a compliance job.

type CreateTweetGeoOpts added in v0.4.0

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

CreateTweetGeoOpts A JSON object that contains location information for a Tweet. You can only add a location to Tweets if you have geo enabled in your profile settings. If you don't have geo enabled, you can still add a location parameter in your request body, but it won't get attached to your Tweet.

type CreateTweetMediaOpts added in v0.4.0

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

CreateTweetMediaOpts A JSON object that contains media information being attached to created Tweet. This is mutually exclusive from Quote Tweet ID and Poll.

type CreateTweetOpts added in v0.4.0

type CreateTweetOpts struct {
	DirectMessageDeepLink string                `json:"direct_message_deep_link,omitempty"`
	ForSuperFollowersOnly bool                  `json:"for_super_followers_only,omitempty"`
	Geo                   *CreateTweetGeoOpts   `json:"geo,omitempty"`
	Media                 *CreateTweetMediaOpts `json:"media,omitempty"`
	Poll                  *CreateTweetPollOpts  `json:"poll,omitempty"`
	QuoteTweetID          string                `json:"quote_tweet_id,omitempty"`
	Reply                 *CreateTweetReplyOpts `json:"reply,omitempty"`
	ReplySettings         string                `json:"reply_settings,omitempty"`
	Text                  string                `json:"text,omitempty"`
}

CreateTweetOpts parameters for create a Tweet. Refer: https://developer.twitter.com/en/docs/twitter-api/tweets/manage-tweets/api-reference/post-tweets

type CreateTweetPollOpts added in v0.4.0

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

CreateTweetPollOpts A JSON object that contains options for a Tweet with a poll. This is mutually exclusive from Media and Quote Tweet ID.

type CreateTweetReplyOpts added in v0.4.0

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

CreateTweetReplyOpts A JSON object that contains information of the Tweet being replied to.

type DMConversation added in v0.5.0

type DMConversation struct {
	DMConversationID *string `json:"dm_conversation_id,omitempty"`
	DMEventID        *string `json:"dm_event_id,omitempty"`
}

DMConversation represents a dm conversation for Twitter.

func (DMConversation) String added in v0.5.0

func (d DMConversation) String() string

type DMConversationResp added in v0.5.0

type DMConversationResp struct {
	Data *DMConversation `json:"data,omitempty"`
}

DMConversationResp data struct represents the

func (DMConversationResp) String added in v0.5.0

func (d DMConversationResp) String() string

type DMEAttachments added in v0.5.0

type DMEAttachments struct {
	MediaKeys []*string `json:"media_keys,omitempty"`
}

func (DMEAttachments) String added in v0.5.0

func (d DMEAttachments) String() string

type DMEReferencedTweet added in v0.5.0

type DMEReferencedTweet struct {
	ID *string `json:"id"`
}

func (DMEReferencedTweet) String added in v0.5.0

func (d DMEReferencedTweet) String() string

type DMEvent added in v0.5.0

type DMEvent struct {
	ID               *string               `json:"id,omitempty"`
	EventType        *string               `json:"event_type,omitempty"`
	Text             *string               `json:"text,omitempty"`
	SenderID         *string               `json:"sender_id,omitempty"`
	ParticipantIDs   []*string             `json:"participant_ids,omitempty"`
	DMConversationID *string               `json:"dm_conversation_id,omitempty"`
	CreatedAt        *string               `json:"created_at,omitempty"`
	ReferencedTweets []*DMEReferencedTweet `json:"referenced_tweets,omitempty"`
	Attachments      *DMEAttachments       `json:"attachments,omitempty"`
}

DMEvent represents a dm event for Twitter. Refer: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/dm-events

func (DMEvent) String added in v0.5.0

func (d DMEvent) String() string

type DMEventOpts added in v0.5.0

type DMEventOpts struct {
	DMEventFields   string `url:"dm_event.fields,omitempty"`
	EventTypes      string `url:"event_types,omitempty"`
	MaxResults      int    `url:"max_results,omitempty"`
	PaginationToken string `url:"pagination_token,omitempty"`
	Expansions      string `url:"expansions,omitempty"`
	UserFields      string `url:"user.fields,omitempty"`
	MediaFields     string `url:"media.fields,omitempty"`
	TweetFields     string `url:"tweet.fields,omitempty"`
}

DMEventOpts specifies the parameters for get DM events

type DMEventsResp added in v0.5.0

type DMEventsResp struct {
	Data []*DMEvent `json:"data,omitempty"`
	*BaseData
}

DMEventsResp data struct represents the list of

func (DMEventsResp) String added in v0.5.0

func (d DMEventsResp) String() string

type DirectMessageResource added in v0.5.0

type DirectMessageResource Resource

func (*DirectMessageResource) CreateGroupConversation added in v0.5.0

func (r *DirectMessageResource) CreateGroupConversation(args CreateGroupConversationOpts) (*DMConversationResp, *APIError)

CreateGroupConversation Creates a new group conversation and adds a Direct Message to it on behalf of an authenticated user. Refer: https://developer.twitter.com/en/docs/twitter-api/direct-messages/manage/api-reference/post-dm_conversations

func (*DirectMessageResource) CreateMessageToConversation added in v0.5.0

func (r *DirectMessageResource) CreateMessageToConversation(dmConversationID string, args CreateGroupMessageOpts) (*DMConversationResp, *APIError)

CreateMessageToConversation Creates a Direct Message on behalf of an authenticated user, and adds it to the specified conversation. Refer: https://developer.twitter.com/en/docs/twitter-api/direct-messages/manage/api-reference/post-dm_conversations-dm_conversation_id-messages

func (*DirectMessageResource) CreateMessageToParticipant added in v0.5.0

func (r *DirectMessageResource) CreateMessageToParticipant(participantID string, args CreateGroupMessageOpts) (*DMConversationResp, *APIError)

CreateMessageToParticipant Creates a one-to-one Direct Message and adds it to the one-to-one conversation. Refer: https://developer.twitter.com/en/docs/twitter-api/direct-messages/manage/api-reference/post-dm_conversations-with-participant_id-messages

func (*DirectMessageResource) Lookup added in v0.5.0

LookUp Returns a list of Direct Messages for the authenticated user, both sent and received. Refer: https://developer.twitter.com/en/docs/twitter-api/direct-messages/lookup/api-reference/get-dm_events

func (*DirectMessageResource) LookupByConversation added in v0.5.0

func (r *DirectMessageResource) LookupByConversation(id string, args DMEventOpts) (*DMEventsResp, *APIError)

LookUpByConversation Returns a list of Direct Messages within a conversation specified in the dm_conversation_id path parameter. Refer: https://developer.twitter.com/en/docs/twitter-api/direct-messages/lookup/api-reference/get-dm_conversations-dm_conversation_id-dm_events

func (*DirectMessageResource) LookupByParticipant added in v0.5.0

func (r *DirectMessageResource) LookupByParticipant(id string, args DMEventOpts) (*DMEventsResp, *APIError)

LookUpByParticipant Returns a list of Direct Messages (DM) events within a 1-1 conversation with the user specified in the participant_id path parameter. Refer: https://developer.twitter.com/en/docs/twitter-api/direct-messages/lookup/api-reference/get-dm_conversations-with-participant_id-dm_events

type Endpoint added in v0.3.0

type Endpoint struct {
	Resource string `json:"resource"`
	Regex    string `json:"regex"`
}

type Entities added in v0.1.0

type Entities struct {
	Urls     []*EntityUrl     `json:"urls"`
	HashTags []*EntityHashTag `json:"Hashtags"`
	Mentions []*EntityMention `json:"mentions"`
	CashTags []*EntityCashTag `json:"cashtags"`
}

Entities are JSON objects that provide additional information about hashtags, urls, user mentions, and cashtags associated with the description.

type EntityAnnotation added in v0.1.0

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

type EntityCashTag added in v0.1.0

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

type EntityHashTag added in v0.1.0

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

type EntityMention added in v0.1.0

type EntityMention struct {
	Start    *int    `json:"start"`
	End      *int    `json:"end"`
	Username *string `json:"username"`
}

type EntityUrl added in v0.1.0

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

type Error added in v0.1.0

type Error struct {
	Detail       *string `json:"detail"`
	Title        *string `json:"title"`
	ResourceType *string `json:"resource_type,omitempty"`
	Parameter    *string `json:"parameter,omitempty"`
	Value        *string `json:"value,omitempty"`
	Type         *string `json:"type,omitempty"`
}

Error represents the common error response

type FollowedListsOpts added in v0.4.0

type FollowedListsOpts struct {
	MaxResults      int    `url:"max_results,omitempty"`
	PaginationToken string `url:"pagination_token,omitempty"`
	ListOpts
}

FollowedListsOpts Specifies the parameters for get user followed lists.

type FollowingResp added in v0.1.0

type FollowingResp struct {
	Data *FollowingStatus `json:"data,omitempty"`
}

FollowingResp data struct represents response for following

func (FollowingResp) String added in v0.1.0

func (f FollowingResp) String() string

type FollowingStatus added in v0.1.0

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

FollowingStatus represents status for following

func (FollowingStatus) String added in v0.1.0

func (f FollowingStatus) String() string

type FollowsOpts added in v0.1.0

type FollowsOpts struct {
	MaxResults      string `url:"max_results,omitempty"`
	PaginationToken string `url:"pagination_token,omitempty"`
	UserFields      string `url:"user.fields,omitempty"`
	Expansions      string `url:"expansions,omitempty"`
	TweetFields     string `url:"tweet.fields,omitempty"`
}

FollowsOpts specifies the parameters for get follows

type GetBookmarksOpts added in v0.4.7

type GetBookmarksOpts struct {
	MaxResults      int    `url:"max_results,omitempty"`
	PaginationToken string `url:"pagination_token,omitempty"`
	TweetOpts
}

GetBookmarksOpts specifies the parameters for user get bookmark tweets.

type GetQuoteTweetsOpts added in v0.4.6

type GetQuoteTweetsOpts struct {
	MaxResults      int    `url:"max_results,omitempty"`
	PaginationToken string `url:"pagination_token,omitempty"`
	TweetOpts
}

GetQuoteTweetsOpts specifies the parameters for get quote tweets

type HiddenResp added in v0.1.0

type HiddenResp struct {
	Data *HiddenStatus `json:"data,omitempty"`
}

HiddenResp represents the response for hidden reply tweet

func (HiddenResp) String added in v0.1.0

func (h HiddenResp) String() string

type HiddenStatus added in v0.1.0

type HiddenStatus struct {
	Hidden *bool `json:"hidden,omitempty"`
}

HiddenStatus represents the status for hidden reply tweet

func (HiddenStatus) String added in v0.1.0

func (h HiddenStatus) String() string

type Image added in v0.1.0

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

type Includes added in v0.1.0

type Includes struct {
	Users  []*User  `json:"users,omitempty"`
	Tweets []*Tweet `json:"tweets,omitempty"`
	Media  []*Media `json:"media,omitempty"`
	Places []*Place `json:"places,omitempty"`
	Polls  []*Poll  `json:"polls,omitempty"`
	Topics []*Topic `json:"topics,omitempty"`
}

Includes represents the expansions objects for main request thread.

type JoinedListsOpts added in v0.4.0

type JoinedListsOpts struct {
	MaxResults      int    `url:"max_results,omitempty"`
	PaginationToken string `url:"pagination_token,omitempty"`
	ListOpts
}

JoinedListsOpts Specifies the parameters for get joined lists.

type LikedResp added in v0.1.0

type LikedResp struct {
	Data *LikedStatus `json:"data,omitempty"`
}

LikedResp represents the response for like tweet

func (LikedResp) String added in v0.1.0

func (r LikedResp) String() string

type LikedStatus added in v0.1.0

type LikedStatus struct {
	Liked *bool `json:"liked,omitempty"`
}

LikedStatus represents the status for like tweet

func (LikedStatus) String added in v0.1.0

func (s LikedStatus) String() string

type LikedTweetsOpts added in v0.1.0

type LikedTweetsOpts struct {
	MaxResults      int    `url:"max_results,omitempty"`
	PaginationToken string `url:"pagination_token,omitempty"`
	TweetOpts
}

LikedTweetsOpts specifies the parameters for tweet to get liked tweets

type LikingUsersOpts added in v0.4.4

type LikingUsersOpts struct {
	MaxResults      int    `url:"max_results,omitempty"`
	PaginationToken string `url:"pagination_token,omitempty"`
	UserOpts
}

LikingUsersOpts specifies the parameters for tweet to get linking users

type List added in v0.4.0

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

List represents a list for twitter. Refer: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/lists

func (List) String added in v0.4.0

func (l List) String() string

type ListDeletedResp added in v0.4.0

type ListDeletedResp struct {
	Data *ListDeletedStatus `json:"data,omitempty"`
}

ListDeletedResp represents the response for delete list

func (ListDeletedResp) String added in v0.4.0

func (l ListDeletedResp) String() string

type ListDeletedStatus added in v0.4.0

type ListDeletedStatus struct {
	Deleted *bool `json:"deleted,omitempty"`
}

ListDeletedStatus represents the status for update list

func (ListDeletedStatus) String added in v0.4.0

func (l ListDeletedStatus) String() string

type ListFollowersOpts added in v0.4.0

type ListFollowersOpts struct {
	MaxResults      int    `url:"max_results,omitempty"`
	PaginationToken string `url:"pagination_token,omitempty"`
	UserOpts
}

ListFollowersOpts Specifies the parameters for get list followers

type ListFollowingResp added in v0.4.0

type ListFollowingResp struct {
	Data *ListFollowingStatus `json:"data,omitempty"`
}

ListFollowingResp represents the response for user follow a list

func (ListFollowingResp) String added in v0.4.0

func (f ListFollowingResp) String() string

type ListFollowingStatus added in v0.4.0

type ListFollowingStatus struct {
	Following *bool `json:"following,omitempty"`
}

ListFollowingStatus represents the status for user follow a list

func (ListFollowingStatus) String added in v0.4.0

func (f ListFollowingStatus) String() string

type ListMemberResp added in v0.4.0

type ListMemberResp struct {
	Data *ListMemberStatus `json:"data,omitempty"`
}

ListMemberResp represents the response for member is belonged to the list

func (ListMemberResp) String added in v0.4.0

func (m ListMemberResp) String() string

type ListMemberStatus added in v0.4.0

type ListMemberStatus struct {
	IsMember *bool `json:"is_member,omitempty"`
}

ListMemberStatus represents the status for member is belonged to the list

func (ListMemberStatus) String added in v0.4.0

func (m ListMemberStatus) String() string

type ListMembersOpts added in v0.4.0

type ListMembersOpts struct {
	MaxResults      int    `url:"max_results,omitempty"`
	PaginationToken string `url:"pagination_token,omitempty"`
	UserOpts
}

ListMembersOpts specifies the parameters for get list members.

type ListOpts added in v0.4.0

type ListOpts struct {
	ListFields string `url:"list.fields,omitempty"`
	Expansions string `url:"expansions,omitempty"`
	UserFields string `url:"user.fields,omitempty"`
}

ListOpts specifies the parameter for get list

type ListPinnedResp added in v0.4.0

type ListPinnedResp struct {
	Data *ListPinnedStatus `json:"data,omitempty"`
}

ListPinnedResp represents the response for user pin a list

func (ListPinnedResp) String added in v0.4.0

func (p ListPinnedResp) String() string

type ListPinnedStatus added in v0.4.0

type ListPinnedStatus struct {
	Pinned *bool `json:"pinned,omitempty"`
}

ListPinnedStatus represents the status for user pinned a list

func (ListPinnedStatus) String added in v0.4.0

func (p ListPinnedStatus) String() string

type ListResp added in v0.4.0

type ListResp struct {
	Data *List `json:"data,omitempty"`
	*BaseData
}

ListResp represents the response for a list

func (ListResp) String added in v0.4.0

func (l ListResp) String() string

type ListTweetsOpts added in v0.4.0

type ListTweetsOpts struct {
	MaxResults      int    `url:"max_results,omitempty"`
	PaginationToken string `url:"pagination_token,omitempty"`
	TweetOpts
}

ListTweetsOpts specifies the parameters for get list tweets

type ListUpdatedResp added in v0.4.0

type ListUpdatedResp struct {
	Data *ListUpdatedStatus `json:"data,omitempty"`
}

ListUpdatedResp represents the response for update list

func (ListUpdatedResp) String added in v0.4.0

func (l ListUpdatedResp) String() string

type ListUpdatedStatus added in v0.4.0

type ListUpdatedStatus struct {
	Updated *bool `json:"updated,omitempty"`
}

ListUpdatedStatus represents the status for update list

func (ListUpdatedStatus) String added in v0.4.0

func (l ListUpdatedStatus) String() string

type ListsResource added in v0.4.0

type ListsResource Resource

func (*ListsResource) AddListMember added in v0.4.0

func (r *ListsResource) AddListMember(id, userID string) (*ListMemberResp, *APIError)

AddListMember Enables the authenticated user to add a member to a List they own. Refer: https://developer.twitter.com/en/docs/twitter-api/lists/manage-lists/api-reference/post-lists-id-members

func (*ListsResource) FollowList added in v0.4.0

func (r *ListsResource) FollowList(id, ListID string) (*ListFollowingResp, *APIError)

FollowList Enables the authenticated user to follow a List. Refer: https://developer.twitter.com/en/docs/twitter-api/lists/manage-lists/api-reference/post-users-id-followed-lists

func (*ListsResource) GetListFollowers added in v0.4.0

func (r *ListsResource) GetListFollowers(id string, args ListFollowersOpts) (*UsersResp, *APIError)

GetListFollowers Returns a list of users who are followers of the specified List. Refer: https://developer.twitter.com/en/docs/twitter-api/lists/list-follows/api-reference/get-lists-id-followers

func (*ListsResource) GetListMembers added in v0.4.0

func (r *ListsResource) GetListMembers(id string, args ListMembersOpts) (*UsersResp, *APIError)

GetListMembers Returns a list of users who are members of the specified List. Refer: https://developer.twitter.com/en/docs/twitter-api/lists/list-members/api-reference/get-lists-id-members

func (*ListsResource) GetListTweets added in v0.4.0

func (r *ListsResource) GetListTweets(id string, args ListTweetsOpts) (*TweetsResp, *APIError)

GetListTweets Returns a list of Tweets from the specified List. Refer: https://developer.twitter.com/en/docs/twitter-api/lists/list-tweets/api-reference/get-lists-id-tweets

func (*ListsResource) GetOwnedLists added in v0.4.0

func (r *ListsResource) GetOwnedLists(id string, args OwnedListsOpts) (*ListsResp, *APIError)

GetOwnedLists Returns all Lists owned by the specified user. Refer: https://developer.twitter.com/en/docs/twitter-api/lists/list-lookup/api-reference/get-users-id-owned_lists

func (*ListsResource) GetUserFollowedLists added in v0.4.0

func (r *ListsResource) GetUserFollowedLists(id string, args FollowedListsOpts) (*ListsResp, *APIError)

GetUserFollowedLists Returns all Lists a specified user follows. Refer: https://developer.twitter.com/en/docs/twitter-api/lists/list-follows/api-reference/get-users-id-followed_lists

func (*ListsResource) GetUserJoinedLists added in v0.4.0

func (r *ListsResource) GetUserJoinedLists(id string, args JoinedListsOpts) (*ListsResp, *APIError)

GetUserJoinedLists Returns all Lists a specified user is a member of. Refer: https://developer.twitter.com/en/docs/twitter-api/lists/list-members/api-reference/get-users-id-list_memberships

func (*ListsResource) GetUserPinnedLists added in v0.4.0

func (r *ListsResource) GetUserPinnedLists(id string, args ListOpts) (*ListsResp, *APIError)

GetUserPinnedLists Returns the Lists pinned by a specified user. Refer: https://developer.twitter.com/en/docs/twitter-api/lists/pinned-lists/api-reference/get-users-id-pinned_lists

func (*ListsResource) ListCreate added in v0.4.0

func (r *ListsResource) ListCreate(args ManageListOpts) (*ListResp, *APIError)

ListCreate Enables the authenticated user to create a List. Refer: https://developer.twitter.com/en/docs/twitter-api/lists/manage-lists/api-reference/post-lists

func (*ListsResource) ListDelete added in v0.4.0

func (r *ListsResource) ListDelete(id string) (*ListDeletedResp, *APIError)

ListDelete Enables the authenticated user to delete a List that they own. Refer: https://developer.twitter.com/en/docs/twitter-api/lists/manage-lists/api-reference/delete-lists-id

func (*ListsResource) ListUpdate added in v0.4.0

func (r *ListsResource) ListUpdate(id string, args ManageListOpts) (*ListUpdatedResp, *APIError)

ListUpdate Enables the authenticated user to update the metadata of a specified List that they own. Refer: https://developer.twitter.com/en/docs/twitter-api/lists/manage-lists/api-reference/put-lists-id

func (*ListsResource) LookupByID added in v0.4.0

func (r *ListsResource) LookupByID(id string, args ListOpts) (*ListResp, *APIError)

LookupByID Returns the details of a specified List. Refer: https://developer.twitter.com/en/docs/twitter-api/lists/list-lookup/api-reference/get-lists-id

func (*ListsResource) PinList added in v0.4.0

func (r *ListsResource) PinList(id, ListID string) (*ListPinnedResp, *APIError)

PinList Enables the authenticated user to pin a List. Refer: https://developer.twitter.com/en/docs/twitter-api/lists/manage-lists/api-reference/post-users-id-pinned-lists

func (*ListsResource) RemoveFollowedList added in v0.4.0

func (r *ListsResource) RemoveFollowedList(id, ListID string) (*ListFollowingResp, *APIError)

RemoveFollowedList Enables the authenticated user to unfollow a List. Refer: https://developer.twitter.com/en/docs/twitter-api/lists/manage-lists/api-reference/delete-users-id-followed-lists-list_id

func (*ListsResource) RemoveListMember added in v0.4.0

func (r *ListsResource) RemoveListMember(id, userID string) (*ListMemberResp, *APIError)

RemoveListMember Enables the authenticated user to remove a member from a List they own. Refer: https://developer.twitter.com/en/docs/twitter-api/lists/manage-lists/api-reference/delete-lists-id-members-user_id

func (*ListsResource) RemovePinnedList added in v0.4.0

func (r *ListsResource) RemovePinnedList(id, ListID string) (*ListPinnedResp, *APIError)

RemovePinnedList Enables the authenticated user to unfollow a List. Refer: https://developer.twitter.com/en/docs/twitter-api/lists/manage-lists/api-reference/delete-users-id-pinned-lists-list_id

type ListsResp added in v0.4.0

type ListsResp struct {
	Data []*List `json:"data,omitempty"`
	*BaseData
}

ListsResp represents the response for multi lists

func (ListsResp) String added in v0.4.0

func (l ListsResp) String() string

type LookupJobsOpts added in v0.2.0

type LookupJobsOpts struct {
	Type   string `url:"type"`
	Status string `url:"status,omitempty"`
}

LookupJobsOpts specifies the parameters for get recent jobs.

type ManageListOpts added in v0.4.0

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

ManageListOpts represents the parameters for manage list create and update

type Media added in v0.1.0

type Media struct {
	MediaKey         *string                `json:"media_key,omitempty"`
	Type             *string                `json:"type,omitempty"`
	URL              *string                `json:"url,omitempty"`
	DurationMS       *int                   `json:"duration_ms,omitempty"`
	Height           *int                   `json:"height,omitempty"`
	Width            *int                   `json:"width,omitempty"`
	NonPublicMetrics *MediaNonPublicMetrics `json:"non_public_metrics,omitempty"`
	OrganicMetrics   *MediaOrganicMetrics   `json:"organic_metrics,omitempty"`
	PreviewImageURL  *string                `json:"preview_image_url,omitempty"`
	PromotedMetrics  *MediaPromotedMetrics  `json:"promoted_metrics,omitempty"`
	PublicMetrics    *MediaNonPublicMetrics `json:"public_metrics,omitempty"`
	AltText          *string                `json:"alt_text,omitempty"`
	Variants         *MediaVariants         `json:"variants,omitempty"`
	ContainedWithin  []*string              `json:"contained_within,omitempty"`
}

Media refers to any image, GIF, or video attached to a Tweet. The media object is not a primary object on any endpoint, but can be found and expanded in the Tweet object. Refer: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/media

func (Media) String added in v0.1.0

func (m Media) String() string

type MediaNonPublicMetrics added in v0.1.0

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

type MediaOrganicMetrics added in v0.1.0

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

type MediaPromotedMetrics added in v0.1.0

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

type MediaPublicMetrics added in v0.1.0

type MediaPublicMetrics struct {
	ViewCount *int `json:"view_count,omitempty"`
}

type MediaVariants added in v0.5.0

type MediaVariants struct {
}

type MentionsOpts added in v0.1.0

type MentionsOpts struct {
	MaxResults      int    `url:"max_results,omitempty"`
	PaginationToken string `url:"pagination_token,omitempty"`
	SinceID         string `url:"since_id,omitempty"`
	UntilID         string `url:"until_id,omitempty"`
	StartTime       string `url:"start_time,omitempty"`
	EndTime         string `url:"end_time,omitempty"`
	TweetOpts
}

MentionsOpts specifies the parameters for get mentions

type Meta added in v0.1.0

type Meta struct {
	ResultCount     *int         `json:"result_count,omitempty"`
	PreviousToken   *string      `json:"previous_token,omitempty"`
	NextToken       *string      `json:"next_token,omitempty"`
	OldestID        *string      `json:"oldest_id,omitempty"`
	NewestID        *string      `json:"newest_id,omitempty"`
	Sent            *string      `json:"sent,omitempty"`
	Summary         *MetaSummary `json:"summary,omitempty"`
	TotalTweetCount *int         `json:"total_tweet_count,omitempty"`
}

Meta represents the Response meta data for request.

type MetaSummary added in v0.1.0

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

MetaSummary represents the Response meta summary data for request.

type MutingOpts added in v0.3.0

type MutingOpts struct {
	MaxResults      string `url:"max_results,omitempty"`
	PaginationToken string `url:"pagination_token,omitempty"`
	UserFields      string `url:"user.fields,omitempty"`
	Expansions      string `url:"expansions,omitempty"`
	TweetFields     string `url:"tweet.fields,omitempty"`
}

MutingOpts specifies the parameters for get muting

type MutingResp added in v0.1.0

type MutingResp struct {
	Data *MutingStatus `json:"data,omitempty"`
}

MutingResp data struct represents response for muting

func (MutingResp) String added in v0.1.0

func (m MutingResp) String() string

type MutingStatus added in v0.1.0

type MutingStatus struct {
	Muting *bool `json:"muting,omitempty"`
}

MutingStatus represents status for muting

func (MutingStatus) String added in v0.1.0

func (m MutingStatus) String() string

type NonPublicMetrics added in v0.1.0

type NonPublicMetrics struct {
	ImpressionCount   *int `json:"impression_count,omitempty"`
	URLLinkClicks     *int `json:"url_link_clicks,omitempty"`
	UserProfileClicks *int `json:"user_profile_clicks,omitempty"`
}

type OAuth2AuthorizationAPP added in v0.3.0

type OAuth2AuthorizationAPP struct {
	ClientID     string         `json:"client_id"`
	ClientSecret string         `json:"client_secret,omitempty"`
	CallbackURL  string         `json:"callback_url,omitempty"`
	Scopes       []string       `json:"scopes,omitempty"`
	Token        *oauth2.Token  `json:"access_token,omitempty"`
	Config       *oauth2.Config `json:"config,omitempty"`
}

OAuth2AuthorizationAPP Twitter OAuth2 app config

func NewOAuth2AuthorizationAPP added in v0.3.0

func NewOAuth2AuthorizationAPP(app OAuth2AuthorizationAPP) *OAuth2AuthorizationAPP

NewOAuth2AuthorizationAPP Return app for oauth2 authorization

func (*OAuth2AuthorizationAPP) GenerateAccessToken added in v0.3.0

func (app *OAuth2AuthorizationAPP) GenerateAccessToken(code, verifier string) (*oauth2.Token, error)

GenerateAccessToken Generate user access token for the app

func (*OAuth2AuthorizationAPP) GetAuthorizedHttpClient added in v0.3.0

func (app *OAuth2AuthorizationAPP) GetAuthorizedHttpClient() *http.Client

GetAuthorizedHttpClient Get user authorized http client

func (*OAuth2AuthorizationAPP) GetOAuth2AuthorizationURL added in v0.3.0

func (app *OAuth2AuthorizationAPP) GetOAuth2AuthorizationURL() (string, string, string)

GetOAuth2AuthorizationURL Return authorization url and code verifier for user

func (*OAuth2AuthorizationAPP) GetUserClient added in v0.3.0

func (app *OAuth2AuthorizationAPP) GetUserClient() *Client

GetUserClient get library client with user authorization

func (OAuth2AuthorizationAPP) String added in v0.3.0

func (app OAuth2AuthorizationAPP) String() string

type OrganicMetrics added in v0.1.0

type OrganicMetrics struct {
	LikeCount    *int `json:"like_count,omitempty"`
	ReplyCount   *int `json:"reply_count,omitempty"`
	RetweetCount *int `json:"retweet_count,omitempty"`
}

type OwnedListsOpts added in v0.4.0

type OwnedListsOpts struct {
	MaxResults      string `url:"max_results,omitempty"`
	PaginationToken string `url:"pagination_token,omitempty"`
	ListOpts
}

OwnedListsOpts Specifies the parameter for get owned lists.

type Place added in v0.1.0

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

Place tagged in a Tweet is not a primary object on any endpoint, but can be found and expanded in the Tweet resource. Refer: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/place

func (Place) String added in v0.1.0

func (p Place) String() string

type PlaceGeo added in v0.1.0

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

type Poll added in v0.1.0

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

Poll included in a Tweet is not a primary object on any endpoint, but can be found and expanded in the Tweet object. Refer: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/poll

func (Poll) String added in v0.1.0

func (p Poll) String() string

type PollOption added in v0.1.0

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

type PromotedMetrics added in v0.1.0

type PromotedMetrics struct {
	ImpressionCount   *int `json:"impression_count,omitempty"`
	LikeCount         *int `json:"like_count,omitempty"`
	ReplyCount        *int `json:"reply_count,omitempty"`
	RetweetCount      *int `json:"retweet_count,omitempty"`
	URLLinkClicks     *int `json:"url_link_clicks,omitempty"`
	UserProfileClicks *int `json:"user_profile_clicks,omitempty"`
}

type RateLimit added in v0.3.0

type RateLimit struct {
	// Mapping container rate limit for resource.
	// Ex: {map[users:map[GET:twitter.RateLimitData{Limit:300, Remaining:300, Reset:1123124}]]}
	Mapping map[string]map[string]RateLimitData `json:"mapping"`
}

func (*RateLimit) Get added in v0.3.0

func (r *RateLimit) Get() string

func (*RateLimit) GetByURL added in v0.3.0

func (r *RateLimit) GetByURL(url, method string) string

func (*RateLimit) Set added in v0.3.0

func (r *RateLimit) Set(url, method string, header http.Header)

func (*RateLimit) String added in v0.3.0

func (r *RateLimit) String() string

type RateLimitData added in v0.3.0

type RateLimitData struct {
	Limit     int `json:"x-rate-limit-limit,omitempty"`
	Remaining int `json:"x-rate-limit-remaining,omitempty"`
	Reset     int `json:"x-rate-limit-reset,omitempty"`
}

func (RateLimitData) String added in v0.3.0

func (r RateLimitData) String() string

type ReferencedTweet added in v0.1.0

type ReferencedTweet struct {
	Type *string `json:"type,omitempty"`
	ID   *string `json:"id,omitempty"`
}

type Resource

type Resource struct {
	Cli *Client
}

type RetweetedByOpts added in v0.4.4

type RetweetedByOpts struct {
	MaxResults      int    `url:"max_results,omitempty"`
	PaginationToken string `url:"pagination_token,omitempty"`
	UserOpts
}

RetweetedByOpts specifies the parameters for tweet to get retweeted users

type RetweetedResp added in v0.1.0

type RetweetedResp struct {
	Data *RetweetedStatus `json:"data,omitempty"`
}

RetweetedResp represents the response for retweet tweet

func (RetweetedResp) String added in v0.1.0

func (r RetweetedResp) String() string

type RetweetedStatus added in v0.1.0

type RetweetedStatus struct {
	Retweeted *bool `json:"retweeted,omitempty"`
}

RetweetedStatus represents the status for retweet tweet

func (RetweetedStatus) String added in v0.1.0

func (r RetweetedStatus) String() string

type Space added in v0.1.1

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

Space represent a Twitter space Refer: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/space

func (Space) String added in v0.1.1

func (s Space) String() string

type SpaceOpts added in v0.1.1

type SpaceOpts struct {
	SpaceFields string `url:"space.fields,omitempty"`
	Expansions  string `url:"expansions,omitempty"`
	UserFields  string `url:"user.fields,omitempty"`
	TopicFields string `url:"topic.fields,omitempty"`
}

SpaceOpts specifies the parameters for get space

type SpaceResource added in v0.1.1

type SpaceResource Resource

func (*SpaceResource) GetBuyers added in v0.4.6

func (r *SpaceResource) GetBuyers(id string, args UserOpts) (*UsersResp, *APIError)

GetBuyers Returns a list of user who purchased a ticket to the requested Space. You must authenticate the request using the Access Token of the creator of the requested Space. Refer: https://developer.twitter.com/en/docs/twitter-api/spaces/lookup/api-reference/get-spaces-id-buyers

func (*SpaceResource) GetTweets added in v0.4.6

func (r *SpaceResource) GetTweets(id string, args TweetOpts) (*TweetsResp, *APIError)

GetTweets Returns Tweets shared in the requested Spaces. Refer: https://developer.twitter.com/en/docs/twitter-api/spaces/lookup/api-reference/get-spaces-id-tweets

func (*SpaceResource) LookupByCreators added in v0.1.1

func (r *SpaceResource) LookupByCreators(userIDs string, args SpaceOpts) (*SpacesResp, *APIError)

LookupByCreators Returns live or scheduled Spaces created by the specified user IDs. Refer: https://developer.twitter.com/en/docs/twitter-api/spaces/lookup/api-reference/get-spaces-by-creator-ids

func (*SpaceResource) LookupByID added in v0.1.1

func (r *SpaceResource) LookupByID(id string, args SpaceOpts) (*SpaceResp, *APIError)

LookupByID Returns a variety of information about a single Space specified by the requested ID. Refer: https://developer.twitter.com/en/docs/twitter-api/spaces/lookup/api-reference/get-spaces-id

func (*SpaceResource) LookupByIDs added in v0.1.1

func (r *SpaceResource) LookupByIDs(ids string, args SpaceOpts) (*SpacesResp, *APIError)

LookupByIDs Returns details about multiple Spaces. Up to 100 comma-separated Spaces IDs can be looked up using this endpoint. Refer: https://developer.twitter.com/en/docs/twitter-api/spaces/lookup/api-reference/get-spaces

type SpaceResp added in v0.1.1

type SpaceResp struct {
	Data *Space `json:"data,omitempty"`
	*BaseData
}

SpaceResp data struct represents the single space response

func (SpaceResp) String added in v0.1.1

func (s SpaceResp) String() string

type SpaceSearchOpts added in v0.1.1

type SpaceSearchOpts struct {
	Query       string `url:"query"`
	State       string `url:"state"`
	MaxResults  int    `url:"max_results,omitempty"`
	TopicFields string `url:"topic.fields,omitempty"`
	SpaceOpts
}

SpaceSearchOpts specifies the parameters for search spaces

type SpacesResp added in v0.1.1

type SpacesResp struct {
	Data []*Space `json:"data,omitempty"`
	*BaseData
}

SpacesResp data struct represents the list spaces response

func (SpacesResp) String added in v0.1.1

func (s SpacesResp) String() string

type TimelinesOpts added in v0.1.0

type TimelinesOpts struct {
	Exclude         string `url:"exclude,omitempty"`
	MaxResults      int    `url:"max_results,omitempty"`
	PaginationToken string `url:"pagination_token,omitempty"`
	SinceID         string `url:"since_id,omitempty"`
	UntilID         string `url:"until_id,omitempty"`
	StartTime       string `url:"start_time,omitempty"`
	EndTime         string `url:"end_time,omitempty"`
	TweetOpts
}

TimelinesOpts specifies the parameters for get timelines

type Topic added in v0.4.6

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

Topic represents space topic info.

func (Topic) String added in v0.4.6

func (t Topic) String() string

type Tweet added in v0.1.0

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

Tweet are the basic building block of all things Twitter Refer: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/tweet

func (Tweet) String added in v0.1.0

func (t Tweet) String() string

type TweetCountsOpts added in v0.1.0

type TweetCountsOpts struct {
	Query       string `url:"query"`
	Granularity string `url:"granularity,omitempty"`
	StartTime   string `url:"start_time,omitempty"`
	EndTime     string `url:"end_time,omitempty"`
	SinceID     string `url:"since_id,omitempty"`
	UntilID     string `url:"until_id,omitempty"`
}

TweetCountsOpts specifies the parameters for get tweet counts.

type TweetDeletedResp added in v0.4.0

type TweetDeletedResp struct {
	Data *TweetDeletedStatus `json:"data,omitempty"`
}

TweetDeletedResp represents the response for delete tweet

func (TweetDeletedResp) String added in v0.4.0

func (t TweetDeletedResp) String() string

type TweetDeletedStatus added in v0.4.0

type TweetDeletedStatus struct {
	Deleted *bool `json:"deleted,omitempty"`
}

TweetDeletedStatus represents the status for tweet delete.

func (TweetDeletedStatus) String added in v0.4.0

func (t TweetDeletedStatus) String() string

type TweetEditControls added in v0.5.0

type TweetEditControls struct {
	EditsRemaining *int    `json:"edits_remaining,omitempty"`
	IsEditEligible *bool   `json:"is_edit_eligible,omitempty"`
	EditableUntil  *string `json:"editable_until,omitempty"`
}

type TweetEntities added in v0.1.0

type TweetEntities struct {
	*Entities
	Annotations []*EntityAnnotation `json:"annotations"`
}

type TweetGeo added in v0.1.0

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

type TweetOpts added in v0.1.0

type TweetOpts struct {
	TweetFields string `url:"tweet.fields,omitempty"`
	Expansions  string `url:"expansions,omitempty"`
	MediaFields string `url:"media.fields,omitempty"`
	PlaceFields string `url:"place.fields,omitempty"`
	PollFields  string `url:"poll.fields,omitempty"`
	UserFields  string `url:"user.fields,omitempty"`
}

TweetOpts specifies the parameters for get tweet

type TweetPublicMetrics added in v0.1.0

type TweetPublicMetrics struct {
	RetweetCount    *int `json:"retweet_count,omitempty"`
	ReplyCount      *int `json:"reply_count,omitempty"`
	LikeCount       *int `json:"like_count,omitempty"`
	QuoteCount      *int `json:"quote_count,omitempty"`
	ImpressionCount *int `json:"impression_count,omitempty"`
}

type TweetResource

type TweetResource Resource

func (*TweetResource) BookmarkTweet added in v0.4.7

func (r *TweetResource) BookmarkTweet(id, tweetID string) (*BookmarkedResp, *APIError)

BookmarkTweet Causes the user ID of an authenticated user identified in the path parameter to Bookmark the target Tweet provided in the request body. Refer: https://developer.twitter.com/en/docs/twitter-api/tweets/bookmarks/api-reference/post-users-id-bookmarks

func (*TweetResource) BookmarkTweetRemove added in v0.4.7

func (r *TweetResource) BookmarkTweetRemove(id, tweetID string) (*BookmarkedResp, *APIError)

BookmarkTweetRemove Allows a user or authenticated user ID to remove a Bookmark of a Tweet. Refer: https://developer.twitter.com/en/docs/twitter-api/tweets/bookmarks/api-reference/delete-users-id-bookmarks-tweet_id

func (*TweetResource) CountsALL

func (r *TweetResource) CountsALL(args TweetCountsOpts) (*TweetsCountsResp, *APIError)

CountsALL Returns the complete history of public Tweets matching a search query Refer: https://developer.twitter.com/en/docs/twitter-api/tweets/counts/api-reference/get-tweets-counts-all

func (*TweetResource) CountsRecent

func (r *TweetResource) CountsRecent(args TweetCountsOpts) (*TweetsCountsResp, *APIError)

CountsRecent Returns count of Tweets from the last seven days that match a search query. Refer: https://developer.twitter.com/en/docs/twitter-api/tweets/counts/api-reference/get-tweets-counts-recent

func (*TweetResource) GetBookmarks added in v0.4.7

func (r *TweetResource) GetBookmarks(id string, args GetBookmarksOpts) (*TweetsResp, *APIError)

GetBookmarks Allows you to get information about an authenticated user’s 800 most recent bookmarked Tweets. Refer: https://developer.twitter.com/en/docs/twitter-api/tweets/bookmarks/api-reference/get-users-id-bookmarks

func (*TweetResource) GetLikedTweets

func (r *TweetResource) GetLikedTweets(id string, args LikedTweetsOpts) (*TweetsResp, *APIError)

GetLikedTweets Return information about a user’s liked Tweets. Refer: https://developer.twitter.com/en/docs/twitter-api/tweets/likes/api-reference/get-users-id-liked_tweets

func (*TweetResource) GetLikingUsers

func (r *TweetResource) GetLikingUsers(id string, args LikingUsersOpts) (*UsersResp, *APIError)

GetLikingUsers Return information about a Tweet’s liking users. Refer: https://developer.twitter.com/en/docs/twitter-api/tweets/likes/api-reference/get-tweets-id-liking_users

func (*TweetResource) GetMentions

func (r *TweetResource) GetMentions(id string, args MentionsOpts) (*TweetsResp, *APIError)

GetMentions Returns Tweets mentioning a single user specified by the requested user ID Refer: https://developer.twitter.com/en/docs/twitter-api/tweets/timelines/api-reference/get-users-id-mentions

func (*TweetResource) GetQuoteTweets added in v0.4.6

func (r *TweetResource) GetQuoteTweets(id string, args GetQuoteTweetsOpts) (*TweetsResp, *APIError)

GetQuoteTweets Returns Quote Tweets for a Tweet specified by the requested Tweet ID. Refer: https://developer.twitter.com/en/docs/twitter-api/tweets/quote-tweets/api-reference/get-tweets-id-quote_tweets

func (*TweetResource) GetRetweetedBy added in v0.1.0

func (r *TweetResource) GetRetweetedBy(id string, args RetweetedByOpts) (*UsersResp, *APIError)

GetRetweetedBy Return information about who has Retweeted a Tweet. Refer: https://developer.twitter.com/en/docs/twitter-api/tweets/retweets/api-reference/get-tweets-id-retweeted_by

func (*TweetResource) GetTimelines

func (r *TweetResource) GetTimelines(id string, args TimelinesOpts) (*TweetsResp, *APIError)

GetTimelines Returns Tweets composed by a single user, specified by the requested user ID. Refer: https://developer.twitter.com/en/docs/twitter-api/tweets/timelines/api-reference/get-users-id-tweets

func (*TweetResource) GetTimelinesReverseChronological added in v0.4.8

func (r *TweetResource) GetTimelinesReverseChronological(id string, args TimelinesOpts) (*TweetsResp, *APIError)

GetTimelinesReverseChronological Allows you to retrieve a collection of the most recent Tweets and Retweets posted by you and users you follow Refer: https://developer.twitter.com/en/docs/twitter-api/tweets/timelines/api-reference/get-users-id-reverse-chronological

func (*TweetResource) HideReply added in v0.1.0

func (r *TweetResource) HideReply(id string) (*HiddenResp, *APIError)

HideReply Hide a reply to a Tweet. Refer: https://developer.twitter.com/en/docs/twitter-api/tweets/hide-replies/api-reference/put-tweets-id-hidden

func (*TweetResource) HideReplyDestroy added in v0.1.0

func (r *TweetResource) HideReplyDestroy(id string) (*HiddenResp, *APIError)

HideReplyDestroy Remove hide a reply to a Tweet. Refer: https://developer.twitter.com/en/docs/twitter-api/tweets/hide-replies/api-reference/put-tweets-id-hidden

func (*TweetResource) LikeCreate added in v0.1.0

func (r *TweetResource) LikeCreate(id, tweetID string) (*LikedResp, *APIError)

LikeCreate Allows an authenticated user ID to Like the target Tweet. Refer: https://developer.twitter.com/en/docs/twitter-api/tweets/likes/api-reference/post-users-id-likes

func (*TweetResource) LikeDestroy added in v0.1.0

func (r *TweetResource) LikeDestroy(id, tweetID string) (*LikedResp, *APIError)

LikeDestroy Allows a user or authenticated user ID to unlike a Tweet. Refer: https://developer.twitter.com/en/docs/twitter-api/tweets/likes/api-reference/delete-users-id-likes-tweet_id

func (*TweetResource) LookupByID

func (r *TweetResource) LookupByID(id string, args TweetOpts) (*TweetResp, *APIError)

LookupByID Returns a variety of information about a single Tweet specified by the requested ID. Refer: https://developer.twitter.com/en/docs/twitter-api/tweets/lookup/api-reference/get-tweets-id

func (*TweetResource) LookupByIDs

func (r *TweetResource) LookupByIDs(ids string, args TweetOpts) (*TweetsResp, *APIError)

LookupByIDs Returns a variety of information about the Tweet specified by the requested ID or list of IDs. Refer: https://developer.twitter.com/en/docs/twitter-api/tweets/lookup/api-reference/get-tweets

func (*TweetResource) RetweetCreate added in v0.1.0

func (r *TweetResource) RetweetCreate(id, tweetID string) (*RetweetedResp, *APIError)

RetweetCreate Allows an authenticated user ID to Retweet the target Tweet. Refer: https://developer.twitter.com/en/docs/twitter-api/tweets/retweets/api-reference/post-users-id-retweets

func (*TweetResource) RetweetDestroy added in v0.1.0

func (r *TweetResource) RetweetDestroy(id, tweetID string) (*RetweetedResp, *APIError)

RetweetDestroy Allows an authenticated user ID to remove the Retweet of a Tweet. Refer: https://developer.twitter.com/en/docs/twitter-api/tweets/retweets/api-reference/delete-users-id-retweets-tweet_id

func (*TweetResource) SearchAll

func (r *TweetResource) SearchAll(args TweetSearchOpts) (*TweetsResp, *APIError)

SearchAll Returns the complete history of public Tweets matching a search query. Refer: https://developer.twitter.com/en/docs/twitter-api/tweets/search/api-reference/get-tweets-search-all

func (*TweetResource) SearchRecent

func (r *TweetResource) SearchRecent(args TweetSearchOpts) (*TweetsResp, *APIError)

SearchRecent Returns Tweets from the last seven days that match a search query. Refer: https://developer.twitter.com/en/docs/twitter-api/tweets/search/api-reference/get-tweets-search-recent

func (*TweetResource) TweetCreate added in v0.4.0

func (r *TweetResource) TweetCreate(args CreateTweetOpts) (*TweetResp, *APIError)

TweetCreate Creates a Tweet on behalf of an authenticated user. Refer: https://developer.twitter.com/en/docs/twitter-api/tweets/manage-tweets/api-reference/post-tweets

func (*TweetResource) TweetRemove added in v0.4.0

func (r *TweetResource) TweetRemove(id string) (*TweetDeletedResp, *APIError)

TweetRemove Allows a user or authenticated user ID to delete a Tweet. Refer: https://developer.twitter.com/en/docs/twitter-api/tweets/manage-tweets/api-reference/delete-tweets-id

type TweetResp added in v0.1.0

type TweetResp struct {
	Data *Tweet `json:"data,omitempty"`
	*BaseData
}

TweetResp data struct represents the single tweet response

func (TweetResp) String added in v0.1.0

func (t TweetResp) String() string

type TweetSearchOpts added in v0.1.0

type TweetSearchOpts struct {
	Query      string `url:"query"`
	StartTime  string `url:"start_time,omitempty"`
	EndTime    string `url:"end_time,omitempty"`
	SinceID    string `url:"since_id,omitempty"`
	UntilID    string `url:"until_id,omitempty"`
	SortOrder  string `url:"sort_order,omitempty"`
	MaxResults int    `url:"max_results,omitempty"`
	NextToken  string `url:"next_token,omitempty"`
	TweetOpts
}

TweetSearchOpts specifies the parameters for search tweets

type TweetWithheld added in v0.1.0

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

type TweetsCounts added in v0.1.0

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

TweetsCounts represents the struct for counts for tweet. Refer: https://developer.twitter.com/en/docs/twitter-api/tweets/counts/api-reference

func (TweetsCounts) String added in v0.1.0

func (t TweetsCounts) String() string

type TweetsCountsResp added in v0.1.0

type TweetsCountsResp struct {
	Data []*TweetsCounts `json:"data,omitempty"`
	*BaseData
}

TweetsCountsResp data struct represents tweet counts response

func (TweetsCountsResp) String added in v0.1.0

func (t TweetsCountsResp) String() string

type TweetsResp added in v0.1.0

type TweetsResp struct {
	Data []*Tweet `json:"data,omitempty"`
	*BaseData
}

TweetsResp data struct represents list tweets response

func (TweetsResp) String added in v0.1.0

func (t TweetsResp) String() string

type UCSuite added in v0.1.0

type UCSuite struct {
	suite.Suite
	Tw *Client
}

UCSuite For the tests with user context

func (*UCSuite) SetupSuite added in v0.1.0

func (uc *UCSuite) SetupSuite()

func (*UCSuite) SetupTest added in v0.1.0

func (uc *UCSuite) SetupTest()

func (*UCSuite) TearDownTest added in v0.1.0

func (uc *UCSuite) TearDownTest()

type User added in v0.1.0

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

User represent a Twitter user. Refer: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/user

func (User) String added in v0.1.0

func (u User) String() string

type UserBlockingOpts added in v0.1.0

type UserBlockingOpts struct {
	MaxResults      int    `url:"max_results,omitempty"`
	PaginationToken string `url:"pagination_token,omitempty"`
	UserOpts
}

UserBlockingOpts specifies the parameters for get blocking users

type UserEntities added in v0.1.0

type UserEntities struct {
	URL         *Entities `json:"url"`
	Description *Entities `json:"description"`
}

type UserOpts added in v0.1.0

type UserOpts struct {
	UserFields  string `url:"user.fields,omitempty"`
	Expansions  string `url:"expansions,omitempty"`
	TweetFields string `url:"tweet.fields,omitempty"`
}

UserOpts specifies the parameters for get user

type UserPublicMetrics added in v0.1.0

type UserPublicMetrics struct {
	FollowerCount  *int `json:"follower_count,omitempty"`
	FollowingCount *int `json:"following_count,omitempty"`
	TweetCount     *int `json:"tweet_count,omitempty"`
	ListCount      *int `json:"list_count,omitempty"`
}

type UserResource

type UserResource Resource

func (*UserResource) BlockingCreate added in v0.1.0

func (r *UserResource) BlockingCreate(id, targetUserID string) (*BlockingResp, *APIError)

BlockingCreate Causes the user (in the path) to block the target user. Refer: https://developer.twitter.com/en/docs/twitter-api/users/blocks/api-reference/post-users-user_id-blocking

func (*UserResource) BlockingDestroy added in v0.1.0

func (r *UserResource) BlockingDestroy(id, targetUserID string) (*BlockingResp, *APIError)

BlockingDestroy Allows authenticated user ID to unblock another user. Refer: https://developer.twitter.com/en/docs/twitter-api/users/blocks/api-reference/delete-users-user_id-blocking

func (*UserResource) FollowingCreate added in v0.1.0

func (r *UserResource) FollowingCreate(id, targetUserID string) (*FollowingResp, *APIError)

FollowingCreate Allows a user ID to follow another user. Refer: https://developer.twitter.com/en/docs/twitter-api/users/follows/api-reference/post-users-source_user_id-following

func (*UserResource) FollowingDestroy added in v0.1.0

func (r *UserResource) FollowingDestroy(id, targetUserID string) (*FollowingResp, *APIError)

FollowingDestroy Allows a user ID to unfollow another user. Refer: https://developer.twitter.com/en/docs/twitter-api/users/follows/api-reference/delete-users-source_id-following

func (*UserResource) GetBlocking added in v0.1.0

func (r *UserResource) GetBlocking(id string, args UserBlockingOpts) (*UsersResp, *APIError)

GetBlocking Returns a list of users who are blocked by the specified user ID. Refer: https://developer.twitter.com/en/docs/twitter-api/users/blocks/api-reference/get-users-blocking

func (*UserResource) GetFollowers

func (r *UserResource) GetFollowers(id string, args FollowsOpts) (*UsersResp, *APIError)

GetFollowers Returns a list of users who are followers of the specified user ID. Refer: https://developer.twitter.com/en/docs/twitter-api/users/follows/api-reference/get-users-id-followers

func (*UserResource) GetFollowing

func (r *UserResource) GetFollowing(id string, args FollowsOpts) (*UsersResp, *APIError)

GetFollowing Returns a list of users the specified user ID is following. Refer: https://developer.twitter.com/en/docs/twitter-api/users/follows/api-reference/get-users-id-following

func (*UserResource) GetMuting added in v0.3.0

func (r *UserResource) GetMuting(id string, args MutingOpts) (*UsersResp, *APIError)

GetMuting Returns a list of users who are muted by the specified user ID. Refer: https://developer.twitter.com/en/docs/twitter-api/users/mutes/api-reference/get-users-muting

func (*UserResource) LookupByID

func (r *UserResource) LookupByID(id string, args UserOpts) (*UserResp, *APIError)

LookupByID Returns a variety of information about a single user specified by the requested ID. Refer: https://developer.twitter.com/en/docs/twitter-api/users/lookup/api-reference/get-users-id

func (*UserResource) LookupByIDs

func (r *UserResource) LookupByIDs(ids string, args UserOpts) (*UsersResp, *APIError)

LookupByIDs Returns a variety of information about one or more users specified by the requested IDs. Refer: https://developer.twitter.com/en/docs/twitter-api/users/lookup/api-reference/get-users

func (*UserResource) LookupByUsername

func (r *UserResource) LookupByUsername(username string, args UserOpts) (*UserResp, *APIError)

LookupByUsername Returns a variety of information about a single user specified by his username. Refer: https://developer.twitter.com/en/docs/twitter-api/users/lookup/api-reference/get-users-by-username-username

func (*UserResource) LookupByUsernames

func (r *UserResource) LookupByUsernames(usernames string, args UserOpts) (*UsersResp, *APIError)

LookupByUsernames Returns a variety of information about one or more users specified by their usernames. Refer: https://developer.twitter.com/en/docs/twitter-api/users/lookup/api-reference/get-users-by

func (*UserResource) LookupMe added in v0.4.0

func (r *UserResource) LookupMe(args UserOpts) (*UserResp, *APIError)

LookupMe Returns information about an authorized user. Refer: https://developer.twitter.com/en/docs/twitter-api/users/lookup/api-reference/get-users-me

func (*UserResource) MutingCreate added in v0.1.0

func (r *UserResource) MutingCreate(id, targetUserID string) (*MutingResp, *APIError)

MutingCreate Allows an authenticated user ID to mute the target user. Refer: https://developer.twitter.com/en/docs/twitter-api/users/mutes/api-reference/post-users-user_id-muting

func (*UserResource) MutingDestroy added in v0.1.0

func (r *UserResource) MutingDestroy(id, targetUserID string) (*MutingResp, *APIError)

MutingDestroy Allows an authenticated user ID to unmute the target user. Refer: https://developer.twitter.com/en/docs/twitter-api/users/mutes/api-reference/delete-users-user_id-muting

type UserResp added in v0.1.0

type UserResp struct {
	Data *User `json:"data,omitempty"`
	*BaseData
}

UserResp data struct represents the single user response

func (UserResp) String added in v0.1.0

func (u UserResp) String() string

type UserWithheld added in v0.1.0

type UserWithheld struct {
	Scope        *string   `json:"scope,omitempty"`
	CountryCodes []*string `json:"country_codes,omitempty"`
}

type UsersResp added in v0.1.0

type UsersResp struct {
	Data []*User `json:"data,omitempty"`
	*BaseData
}

UsersResp data struct represents list users response

func (UsersResp) String added in v0.1.0

func (u UsersResp) String() string

Jump to

Keyboard shortcuts

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