mirror of
https://gitea.phreedom.club/localhost_frssoft/bloat.git
synced 2025-05-06 03:48:45 +00:00
Add search page
This commit is contained in:
parent
591360f2a8
commit
14bb18fbc7
10 changed files with 157 additions and 14 deletions
|
@ -336,7 +336,7 @@ type Emoji struct {
|
|||
type Results struct {
|
||||
Accounts []*Account `json:"accounts"`
|
||||
Statuses []*Status `json:"statuses"`
|
||||
Hashtags []string `json:"hashtags"`
|
||||
// Hashtags []string `json:"hashtags"`
|
||||
}
|
||||
|
||||
// Pagination is a struct for specifying the get range.
|
||||
|
|
|
@ -284,12 +284,15 @@ func (c *Client) DeleteStatus(ctx context.Context, id string) error {
|
|||
}
|
||||
|
||||
// Search search content with query.
|
||||
func (c *Client) Search(ctx context.Context, q string, resolve bool) (*Results, error) {
|
||||
func (c *Client) Search(ctx context.Context, q string, qType string, limit int, resolve bool, offset int) (*Results, error) {
|
||||
params := url.Values{}
|
||||
params.Set("q", q)
|
||||
params.Set("type", qType)
|
||||
params.Set("limit", fmt.Sprint(limit))
|
||||
params.Set("resolve", fmt.Sprint(resolve))
|
||||
params.Set("offset", fmt.Sprint(offset))
|
||||
var results Results
|
||||
err := c.doAPI(ctx, http.MethodGet, "/api/v1/search", params, &results, nil)
|
||||
err := c.doAPI(ctx, http.MethodGet, "/api/v2/search", params, &results, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue