diff --git a/README.md b/README.md index 4932901..9be937f 100644 --- a/README.md +++ b/README.md @@ -125,6 +125,7 @@ func main() { * [x] GET /api/v1/timelines/home * [x] GET /api/v1/timelines/public * [x] GET /api/v1/timelines/tag/:hashtag +* [x] GET /api/v1/timelines/list/:id ## Installation diff --git a/status.go b/status.go index ce280c4..fa95ab8 100644 --- a/status.go +++ b/status.go @@ -3,10 +3,10 @@ package mastodon import ( "context" "fmt" + "io" "net/http" "net/url" "time" - "io" ) // Status is struct to hold status. @@ -201,6 +201,16 @@ func (c *Client) GetTimelineHashtag(ctx context.Context, tag string, isLocal boo return statuses, nil } +// GetTimelineList return statuses from a list timeline. +func (c *Client) GetTimelineList(ctx context.Context, id ID, pg *Pagination) ([]*Status, error) { + var statuses []*Status + err := c.doAPI(ctx, http.MethodGet, fmt.Sprintf("/api/v1/timelines/list/%s", url.PathEscape(string(id))), nil, &statuses, pg) + if err != nil { + return nil, err + } + return statuses, nil +} + // GetTimelineMedia return statuses from media timeline. // NOTE: This is an experimental feature of pawoo.net. func (c *Client) GetTimelineMedia(ctx context.Context, isLocal bool, pg *Pagination) ([]*Status, error) {