Skip to content
This repository was archived by the owner on Jun 8, 2019. It is now read-only.

Commit 649bdad

Browse files
DrMegavoltlunny
authored andcommitted
Add Search users support (#92)
Signed-off-by: Serhii Kuts <[email protected]>
1 parent 0489f9e commit 649bdad

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

gitea/user_search.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package gitea
2+
3+
import "fmt"
4+
5+
type searchUsersResponse struct {
6+
Users []*User `json:"data"`
7+
}
8+
9+
// SearchUsers finds users by query
10+
func (c *Client) SearchUsers(query string, limit int) ([]*User, error) {
11+
resp := new(searchUsersResponse)
12+
err := c.getParsedResponse("GET", fmt.Sprintf("/users/search?q=%s&limit=%d", query, limit), nil, nil, &resp)
13+
return resp.Users, err
14+
}

0 commit comments

Comments
 (0)