equal
deleted
inserted
replaced
11 |
11 |
12 "github.com/pkg/errors" |
12 "github.com/pkg/errors" |
13 ) |
13 ) |
14 |
14 |
15 // GetTimelines returns a timeline (a list of statuses |
15 // GetTimelines returns a timeline (a list of statuses |
16 // timeline can be "home", "public", or 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 // 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 |
18 // local instance. |
19 // local instance. |
19 // If lopt.All is true, several requests will be made until the API server |
20 // If lopt.All is true, several requests will be made until the API server |
20 // has nothing to return. |
21 // has nothing to return. |
21 // If lopt.Limit is set (and not All), several queries can be made until the |
22 // If lopt.Limit is set (and not All), several queries can be made until the |
30 hashtag := timeline[1:] |
31 hashtag := timeline[1:] |
31 if hashtag == "" { |
32 if hashtag == "" { |
32 return nil, errors.New("timelines API: empty hashtag") |
33 return nil, errors.New("timelines API: empty hashtag") |
33 } |
34 } |
34 endPoint = "timelines/tag/" + hashtag |
35 endPoint = "timelines/tag/" + hashtag |
|
36 case len(timeline) > 1 && strings.HasPrefix(timeline, "!"): |
|
37 // Check the timeline is a number |
|
38 for _, n := range timeline[1:] { |
|
39 if n < '0' || n > '9' { |
|
40 return nil, errors.New("timelines API: invalid list ID") |
|
41 } |
|
42 } |
|
43 endPoint = "timelines/list/" + timeline[1:] |
35 default: |
44 default: |
36 return nil, errors.New("GetTimelines: bad timelines argument") |
45 return nil, errors.New("GetTimelines: bad timelines argument") |
37 } |
46 } |
38 |
47 |
39 params := make(apiCallParams) |
48 params := make(apiCallParams) |