diff --git a/README.md b/README.md index 84e419f..21dca9a 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ if err != nil { * [ ] POST /api/v1/statuses/:id/unfavourite * [x] GET /api/v1/timelines/home * [x] GET /api/v1/timelines/public -* [ ] GET /api/v1/timelines/tag/:hashtag +* [x] GET /api/v1/timelines/tag/:hashtag ## Installation diff --git a/status.go b/status.go index 56f5fe1..a4235c6 100644 --- a/status.go +++ b/status.go @@ -95,6 +95,16 @@ func (c *Client) GetTimelineHome() ([]*Status, error) { return statuses, nil } +// GetTimelineHashtag return statuses from tagged timeline. +func (c *Client) GetTimelineHashtag(tag string) ([]*Status, error) { + var statuses []*Status + err := c.doAPI(http.MethodGet, fmt.Sprintf("/api/v1/timelines/tag/%s", (&url.URL{Path: tag}).EscapedPath()), nil, &statuses) + if err != nil { + return nil, err + } + return statuses, nil +} + // PostStatus post the toot. func (c *Client) PostStatus(toot *Toot) (*Status, error) { params := url.Values{}