Documentation ¶
Overview ¶
Package twitterquerygo implements a search-optimized Twitter client library in Go.
Index ¶
- Constants
- type ISearchClient
- type SearchTweetsResponse
- type SearchTwitterClient
- func (c *SearchTwitterClient) Search(query string) (*SearchTweetsResponse, error)
- func (c *SearchTwitterClient) SetLanguage(language string)
- func (c *SearchTwitterClient) SetLogger(logger *logrus.Logger)
- func (c *SearchTwitterClient) SetMaxID(maxID uint64)
- func (c *SearchTwitterClient) SetResultType(resultType string)
- func (c *SearchTwitterClient) SetSinceID(sinceID uint64)
Constants ¶
const BatchSize = 100
BatchSize Query for tweets in batches of this size
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ISearchClient ¶
type ISearchClient interface { // SetSinceID sets the since_id query parameter SetSinceID(sinceID uint64) // SetMaxID sets the max_id query parameter SetMaxID(maxID uint64) // SetResultType sets the result_type query parameter SetResultType(resultType string) // SetLanguage sets the lang query parameter SetLanguage(language string) // SetLogger sets the logger SetLogger(logger *logrus.Logger) // Search searches tweets given a search parameter 'q' till either there are no more results or the rate limit is exceeded Search(query string) (*SearchTweetsResponse, error) }
ISearchClient defines the behaviour of a search-optimized Twitter client.
type SearchTweetsResponse ¶
type SearchTweetsResponse struct { Tweets []twittergo.Tweet HasRateLimit bool RateLimit uint32 RateLimitRemaining uint32 RateLimitReset time.Time }
SearchTweetsResponse implements the response of a search query, containing tweets and the timestamp when the rate limit resets
type SearchTwitterClient ¶
type SearchTwitterClient struct { TwitterClient twittergo.Client SinceID uint64 MaxID uint64 ResultType string Language string // contains filtered or unexported fields }
SearchTwitterClient implements a search-optimized Twitter client.
func NewClientUsingAppAuth ¶
func NewClientUsingAppAuth(consumerKey string, consumerSecret string) *SearchTwitterClient
NewClientUsingAppAuth creates a new SearchClient using application authentication, with a rate limited to 450 requests per 15 minutes
func NewClientUsingUserAuth ¶
func NewClientUsingUserAuth(consumerKey string, consumerSecret string, accessToken string, accessTokenSecret string) *SearchTwitterClient
NewClientUsingUserAuth creates a new SearchClient using user authentication, with a rate limited to 180 requests per 15 minutes
func (*SearchTwitterClient) Search ¶
func (c *SearchTwitterClient) Search(query string) (*SearchTweetsResponse, error)
Search searches tweets given a search parameter 'q' till either there are no more results or the rate limit is exceeded
func (*SearchTwitterClient) SetLanguage ¶
func (c *SearchTwitterClient) SetLanguage(language string)
SetLanguage sets the lang query parameter
func (*SearchTwitterClient) SetLogger ¶
func (c *SearchTwitterClient) SetLogger(logger *logrus.Logger)
SetLogger sets the logger
func (*SearchTwitterClient) SetMaxID ¶
func (c *SearchTwitterClient) SetMaxID(maxID uint64)
SetMaxID sets the max_id query parameter
func (*SearchTwitterClient) SetResultType ¶
func (c *SearchTwitterClient) SetResultType(resultType string)
SetResultType sets the result_type query parameter
func (*SearchTwitterClient) SetSinceID ¶
func (c *SearchTwitterClient) SetSinceID(sinceID uint64)
SetSinceID sets the since_id query parameter