2020-01-30 14:02:52 +00:00
|
|
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a MIT-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2018-02-16 01:59:44 +00:00
|
|
|
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
|
|
|
|
}
|