From 564554c1c98a315e38117bf6fb4951df76b6d45a Mon Sep 17 00:00:00 2001 From: Yasuhiro Matsumoto Date: Sat, 15 Apr 2017 21:02:55 +0900 Subject: [PATCH] add GetTimelineHashtag --- README.md | 2 +- status.go | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) 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{}