15 // GetTimelines returns a timeline (a list of statuses |
15 // GetTimelines returns a timeline (a list of statuses |
16 // timeline can be "home", "public", a hashtag (use ":hashtag" or "#hashtag") |
16 // timeline can be "home", "public", a hashtag (use ":hashtag" or "#hashtag") |
17 // or a list (use "!N", e.g. "!42" for list ID #42). |
17 // or a list (use "!N", e.g. "!42" for list ID #42). |
18 // For the public timelines, you can set 'local' to true to get only the |
18 // For the public timelines, you can set 'local' to true to get only the |
19 // local instance. |
19 // local instance. |
|
20 // Set 'onlyMedia' to true to only get statuses that have media attachments. |
20 // If lopt.All is true, several requests will be made until the API server |
21 // If lopt.All is true, several requests will be made until the API server |
21 // has nothing to return. |
22 // has nothing to return. |
22 // If lopt.Limit is set (and not All), several queries can be made until the |
23 // If lopt.Limit is set (and not All), several queries can be made until the |
23 // limit is reached. |
24 // limit is reached. |
24 func (mc *Client) GetTimelines(timeline string, local bool, lopt *LimitParams) ([]Status, error) { |
25 func (mc *Client) GetTimelines(timeline string, local, onlyMedia bool, lopt *LimitParams) ([]Status, error) { |
25 var endPoint string |
26 var endPoint string |
26 |
27 |
27 switch { |
28 switch { |
28 case timeline == "home", timeline == "public": |
29 case timeline == "home", timeline == "public": |
29 endPoint = "timelines/" + timeline |
30 endPoint = "timelines/" + timeline |
47 |
48 |
48 params := make(apiCallParams) |
49 params := make(apiCallParams) |
49 if timeline == "public" && local { |
50 if timeline == "public" && local { |
50 params["local"] = "true" |
51 params["local"] = "true" |
51 } |
52 } |
|
53 if onlyMedia { |
|
54 params["only_media"] = "true" |
|
55 } |
52 |
56 |
53 return mc.getMultipleStatuses(endPoint, params, lopt) |
57 return mc.getMultipleStatuses(endPoint, params, lopt) |
54 } |
58 } |