Add Search users support (#92)

Signed-off-by: Serhii Kuts <sergeykuc@gmail.com>
This commit is contained in:
Serhii Kuts 2018-02-16 03:59:44 +02:00 committed by Lunny Xiao
parent 0489f9e4e0
commit 649bdad70e

14
gitea/user_search.go Normal file
View file

@ -0,0 +1,14 @@
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
}