Add GetTimelinePublic
This commit is contained in:
parent
adf4fbaa20
commit
315f7bbd29
2 changed files with 46 additions and 1 deletions
17
status.go
17
status.go
|
@ -5,8 +5,8 @@ import (
|
|||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"time"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Status is struct to hold status.
|
||||
|
@ -157,6 +157,21 @@ func (c *Client) GetTimelineHome(ctx context.Context) ([]*Status, error) {
|
|||
return statuses, nil
|
||||
}
|
||||
|
||||
// GetTimelinePublic return statuses from public timeline.
|
||||
func (c *Client) GetTimelinePublic(ctx context.Context, isLocal bool) ([]*Status, error) {
|
||||
params := url.Values{}
|
||||
if isLocal {
|
||||
params.Set("local", "t")
|
||||
}
|
||||
|
||||
var statuses []*Status
|
||||
err := c.doAPI(ctx, http.MethodGet, "/api/v1/timelines/public", params, &statuses, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return statuses, nil
|
||||
}
|
||||
|
||||
// GetTimelineHashtag return statuses from tagged timeline.
|
||||
func (c *Client) GetTimelineHashtag(ctx context.Context, tag string) ([]*Status, error) {
|
||||
var statuses []*Status
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue