Add list timeline support.

pull/94/head
Ben Lubar 2019-04-26 20:56:47 -05:00 committed by mattn
parent 3e2bdc63c7
commit 9427a55316
2 changed files with 12 additions and 1 deletions

View File

@ -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

View File

@ -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) {