@@ -40,6 +40,19 @@ type QueryAccountOptions struct {
40
40
41
41
// The `S` or `start` query parameter can be supplied to skip a number of accounts from the list.
42
42
Start int `url:"S,omitempty"`
43
+
44
+ AccountOptions
45
+ }
46
+
47
+ // AccountOptions specifies parameters for Query Accounts.
48
+ //
49
+ // Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#query-account
50
+ type AccountOptions struct {
51
+ // Additional fields can be obtained by adding o parameters.
52
+ // Currently supported are "DETAILS" and "ALL_EMAILS".
53
+ //
54
+ // Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#query-account
55
+ AdditionalFields []string `url:"o,omitempty"`
43
56
}
44
57
45
58
// SSHKeyInfo entity contains information about an SSH key of a user.
@@ -244,6 +257,33 @@ type CapabilityOptions struct {
244
257
Filter []string `url:"q,omitempty"`
245
258
}
246
259
260
+ // QueryAccounts lists accounts visible to the caller.
261
+ // The query string must be provided by the q parameter.
262
+ // The n parameter can be used to limit the returned results.
263
+ //
264
+ // Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#query-accounts
265
+ func (s * AccountsService ) QueryAccounts (opt * QueryAccountOptions ) (* []AccountInfo , * Response , error ) {
266
+ u := "accounts/"
267
+
268
+ u , err := addOptions (u , opt )
269
+ if err != nil {
270
+ return nil , nil , err
271
+ }
272
+
273
+ req , err := s .client .NewRequest ("GET" , u , nil )
274
+ if err != nil {
275
+ return nil , nil , err
276
+ }
277
+
278
+ v := new ([]AccountInfo )
279
+ resp , err := s .client .Do (req , v )
280
+ if err != nil {
281
+ return nil , resp , err
282
+ }
283
+
284
+ return v , resp , err
285
+ }
286
+
247
287
// GetAccount returns an account as an AccountInfo entity.
248
288
// If account is "self" the current authenticated account will be returned.
249
289
//
0 commit comments