forgejo-sdk/gitea/user_search.go
Serhii Kuts 649bdad70e Add Search users support (#92)
Signed-off-by: Serhii Kuts <sergeykuc@gmail.com>
2018-02-15 19:59:44 -06:00

14 lines
374 B
Go

package gitea
import "fmt"
type searchUsersResponse struct {
Users []*User `json:"data"`
}
// SearchUsers finds users by query
func (c *Client) SearchUsers(query string, limit int) ([]*User, error) {
resp := new(searchUsersResponse)
err := c.getParsedResponse("GET", fmt.Sprintf("/users/search?q=%s&limit=%d", query, limit), nil, nil, &resp)
return resp.Users, err
}