add GetTimelineHashtagMultiple

This commit is contained in:
Rasmus Lindroth 2022-12-30 11:14:06 +01:00
parent e86f463667
commit ad3aa348dd
2 changed files with 79 additions and 0 deletions

View file

@ -103,6 +103,12 @@ type Media struct {
Focus string
}
type TagData struct {
Any []string
All []string
None []string
}
func (m *Media) bodyAndContentType() (io.Reader, string, error) {
var buf bytes.Buffer
mw := multipart.NewWriter(&buf)
@ -350,6 +356,32 @@ func (c *Client) GetTimelineHashtag(ctx context.Context, tag string, isLocal boo
return statuses, nil
}
// GetTimelineHashtag return statuses from tagged timeline.
func (c *Client) GetTimelineHashtagMultiple(ctx context.Context, tag string, isLocal bool, td *TagData, pg *Pagination) ([]*Status, error) {
params := url.Values{}
if isLocal {
params.Set("local", "t")
}
if td != nil {
for _, v := range td.Any {
params.Add("any[]", v)
}
for _, v := range td.All {
params.Add("all[]", v)
}
for _, v := range td.None {
params.Add("none[]", v)
}
}
var statuses []*Status
err := c.doAPI(ctx, http.MethodGet, fmt.Sprintf("/api/v1/timelines/tag/%s", url.PathEscape(tag)), params, &statuses, pg)
if err != nil {
return nil, err
}
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