list method
Lists all of the accounts for the authenticated user.
This includes all accounts that the user owns, as well as any accounts for which the user has management rights.
Request parameters:
filter
- Optional. A filter constraining the accounts to return. The
response includes only entries that match the filter. If filter
is
empty, then no constraints are applied and all accounts (paginated) are
retrieved for the requested account. For example, a request with the
filter type=USER_GROUP
will only return user groups. The type
field is
the only supported filter.
pageSize
- Optional. How many accounts to fetch per page. The default
and maximum is 20.
pageToken
- Optional. If specified, the next page of accounts is
retrieved. The pageToken
is returned when a call to accounts.list
returns more results than can fit into the requested page size.
parentAccount
- Optional. The resource name of the account for which the
list of directly accessible accounts is to be retrieved. This only makes
sense for Organizations and User Groups. If empty, will return
ListAccounts
for the authenticated user. accounts/{account_id}
.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a ListAccountsResponse.
Completes with a commons.ApiRequestError if the API endpoint returned an error.
If the used http.Client
completes with an error when making a REST call,
this method will complete with the same error.
Implementation
async.Future<ListAccountsResponse> list({
core.String? filter,
core.int? pageSize,
core.String? pageToken,
core.String? parentAccount,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
if (filter != null) 'filter': [filter],
if (pageSize != null) 'pageSize': ['${pageSize}'],
if (pageToken != null) 'pageToken': [pageToken],
if (parentAccount != null) 'parentAccount': [parentAccount],
if ($fields != null) 'fields': [$fields],
};
const url_ = 'v1/accounts';
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return ListAccountsResponse.fromJson(
response_ as core.Map<core.String, core.dynamic>);
}