go-lemmy/search.go

24 lines
405 B
Go
Raw Normal View History

2022-12-10 20:07:19 +00:00
package lemmy
import (
"context"
"net/http"
"go.arsenm.dev/go-lemmy/types"
)
func (c *Client) Search(ctx context.Context, d types.Search) (*types.SearchResponse, error) {
ar := &types.SearchResponse{}
res, err := c.getReq(ctx, http.MethodGet, "/search", d, &ar)
if err != nil {
return nil, err
}
err = resError(res, ar.LemmyResponse)
if err != nil {
return nil, err
}
return ar, nil
}