add Search

pull/14/head
Yasuhiro Matsumoto 2017-04-15 23:21:16 +09:00
parent 07710230d9
commit 6e7ed9d9d9
1 changed files with 13 additions and 0 deletions

View File

@ -127,3 +127,16 @@ func (c *Client) PostStatus(toot *Toot) (*Status, error) {
func (c *Client) DeleteStatus(id int64) error {
return c.doAPI(http.MethodDelete, fmt.Sprintf("/api/v1/statuses/%d", id), nil, nil)
}
// Search search content with query.
func (c *Client) Search(q string, resolve bool) (*Results, error) {
params := url.Values{}
params.Set("q", q)
params.Set("resolve", fmt.Sprint(resolve))
var results Results
err := c.doAPI(http.MethodGet, "/api/v1/search", params, &results)
if err != nil {
return nil, err
}
return &results, nil
}