-
Notifications
You must be signed in to change notification settings - Fork 246
/
timeline.go
45 lines (39 loc) · 2.2 KB
/
timeline.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package anaconda
import (
"net/url"
)
// GetHomeTimeline returns the most recent tweets and retweets posted by the user
// and the users that they follow.
// https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-home_timeline
// By default, include_entities is set to "true"
func (a TwitterApi) GetHomeTimeline(v url.Values) (timeline []Tweet, err error) {
v = cleanValues(v)
if val := v.Get("include_entities"); val == "" {
v.Set("include_entities", "true")
}
response_ch := make(chan response)
a.queryQueue <- query{a.baseUrl + "/statuses/home_timeline.json", v, &timeline, _GET, response_ch}
return timeline, (<-response_ch).err
}
// GetUserTimeline returns a collection of the most recent Tweets posted by the user indicated by the screen_name or user_id parameters.
// https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-user_timeline
func (a TwitterApi) GetUserTimeline(v url.Values) (timeline []Tweet, err error) {
response_ch := make(chan response)
a.queryQueue <- query{a.baseUrl + "/statuses/user_timeline.json", v, &timeline, _GET, response_ch}
return timeline, (<-response_ch).err
}
// GetMentionsTimeline returns the most recent mentions (Tweets containing a users’s @screen_name) for the authenticating user.
// The timeline returned is the equivalent of the one seen when you view your mentions on twitter.com.
// https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-mentions_timeline
func (a TwitterApi) GetMentionsTimeline(v url.Values) (timeline []Tweet, err error) {
response_ch := make(chan response)
a.queryQueue <- query{a.baseUrl + "/statuses/mentions_timeline.json", v, &timeline, _GET, response_ch}
return timeline, (<-response_ch).err
}
// GetRetweetsOfMe returns the most recent Tweets authored by the authenticating user that have been retweeted by others.
// https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-retweets_of_me
func (a TwitterApi) GetRetweetsOfMe(v url.Values) (tweets []Tweet, err error) {
response_ch := make(chan response)
a.queryQueue <- query{a.baseUrl + "/statuses/retweets_of_me.json", v, &tweets, _GET, response_ch}
return tweets, (<-response_ch).err
}