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

Update SDK to match the return of /users/search #119

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions gitea/user_search.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ package gitea

import "fmt"

type searchUsersResponse struct {
Users []*User `json:"data"`
// UserSearchResults results of a succesful user search
type UserSearchResults struct {
OK bool `json:"ok"`
Data []*User `json:"data"`
}

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