Add Search users support (#92)
Signed-off-by: Serhii Kuts <sergeykuc@gmail.com>
This commit is contained in:
parent
0489f9e4e0
commit
649bdad70e
1 changed files with 14 additions and 0 deletions
14
gitea/user_search.go
Normal file
14
gitea/user_search.go
Normal 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
|
||||
}
|
Loading…
Reference in a new issue