Skip to content

Commit 67c9345

Browse files
committed
Fix #92: Add pagination support for SuggestAccount
1 parent 5a2c9c2 commit 67c9345

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

accounts.go

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,19 @@ type AccountsService struct {
1212
}
1313

1414
// AccountInfo entity contains information about an account.
15+
//
16+
// TODO Add field secondary_emails
17+
// TODO Add field status
18+
// TODO Add field inactive
19+
// TODO Add field tags
20+
//
21+
// Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#account-info
1522
type AccountInfo struct {
16-
AccountID int `json:"_account_id,omitempty"`
17-
Name string `json:"name,omitempty"`
18-
Email string `json:"email,omitempty"`
19-
Username string `json:"username,omitempty"`
23+
AccountID int `json:"_account_id,omitempty"`
24+
Name string `json:"name,omitempty"`
25+
DisplayName string `json:"display_name,omitempty"`
26+
Email string `json:"email,omitempty"`
27+
Username string `json:"username,omitempty"`
2028

2129
// Avatars lists avatars of various sizes for the account.
2230
// This field is only populated if the avatars plugin is enabled.
@@ -27,6 +35,14 @@ type AccountInfo struct {
2735
MoreAccounts bool `json:"_more_accounts,omitempty"`
2836
}
2937

38+
// QueryAccountOptions queries accounts visible to the caller.
39+
type QueryAccountOptions struct {
40+
QueryOptions
41+
42+
// The `S` or `start` query parameter can be supplied to skip a number of accounts from the list.
43+
Start int `url:"S,omitempty"`
44+
}
45+
3046
// SSHKeyInfo entity contains information about an SSH key of a user.
3147
type SSHKeyInfo struct {
3248
Seq int `json:"seq"`
@@ -519,7 +535,7 @@ func (s *AccountsService) GetStarredChanges(accountID string) (*[]ChangeInfo, *R
519535
// Returns a list of matching AccountInfo entities.
520536
//
521537
// Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#query-account
522-
func (s *AccountsService) SuggestAccount(opt *QueryOptions) (*[]AccountInfo, *Response, error) {
538+
func (s *AccountsService) SuggestAccount(opt *QueryAccountOptions) (*[]AccountInfo, *Response, error) {
523539
u := "accounts/"
524540

525541
u, err := addOptions(u, opt)

0 commit comments

Comments
 (0)