twitter

package
v0.0.0-...-87675f5 Latest Latest
Warning

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

Go to latest
Published: May 13, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient() (*http.Client, error)

NewClient implements application-only authentication for CLI usage https://developer.twitter.com/en/docs/basics/authentication/overview/application-only

Types

type APIError

type APIError struct {
	Message string `json:"message"`
	Code    int    `json:"code"`
}

APIError to hold message and code

type APIErrors

type APIErrors struct {
	Errors []APIError `json:"errors"`
}

APIErrors holds a collection of errors

type IdsResult

type IdsResult struct {
	IDs        []string `json:"ids"`
	NextCursor uint64   `json:"next_cursor"`
}

IdsResult for ids REST call

type MembersResult

type MembersResult struct {
	Users      []types.UserObject
	NextCursor uint64 `json:"next_cursor"`
}

MembersResult for members REST call

type NucollTransport

type NucollTransport struct {
	Config    *util.NucollConfig
	Transport http.RoundTripper
}

NucollTransport holds the config and the structure to deal with throttling

func (*NucollTransport) RoundTrip

func (t *NucollTransport) RoundTrip(req *http.Request) (res *http.Response, err error)

RoundTrip intercepts API responses and checks if throttling pauses is required

type SearchResult

type SearchResult struct {
	Statuses []TweetObject
}

SearchResult for search REST call

type TweetObject

type TweetObject struct {
	CreatedAt string `json:"created_at"`
	ID        uint64 `json:"id"`
	User      struct {
		ScreenName string `json:"screen_name"`
	} `json:"user"`
	Text                string `json:"text"`
	InReplyToTweet      uint64 `json:"in_reply_to_status_id"`
	InReplyToUser       uint64 `json:"in_reply_to_user_id"`
	InReplyToScreenName string `json:"in_reply_to_screen_name"`
	//QuoteCount          int    `json:"quote_count"`
	//ReplyCount          int    `json:"reply_count"`
	RetweetCount  int `json:"retweet_count"`
	FavoriteCount int `json:"favorite_count"`
}

TweetObject defines attributes retrieved by client for a given post

type Twitter

type Twitter struct {
	Client *http.Client
}

Twitter client with custom RoundTripper to handle throttling

func (Twitter) Edgelist

func (ns Twitter) Edgelist(egoFlag bool, missingFlag bool, args []string)

Edgelist constructs the network of who is "friends" with whom among handles returned by Init

func (Twitter) Fetch

func (ns Twitter) Fetch(forceFlag bool, fetchCount int, args []string)

Fetch retrieves second-degree "friends" from handles collected with Init

func (Twitter) Init

func (ns Twitter) Init(followersFlag bool, maxPostCount int, queryFlag bool, nomentionFlag bool, membership string, imageFlag bool, args []string)

Init supports retrieving from: list membership, a query file, followers who retweet or a friend/follow relationship

func (Twitter) Posts

func (ns Twitter) Posts(queryFlag bool, list string, postID uint64, args []string)

Posts retrieves tweets from a search query, user list, replies to a given tweet ID or from a handle

func (Twitter) Resolve

func (ns Twitter) Resolve(args []string)

Resolve converts screen names to IDs and vice versa along with basic stats

Jump to

Keyboard shortcuts

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