list method

Future<ListAccountsResponse> list({
  1. String? filter,
  2. int? pageSize,
  3. String? pageToken,
  4. String? $fields,
})

Note: For the accounts.list method, quota and limits usage are charged for each user, and not for the Merchant Center ID or the advanced account ID.

To list several sub-accounts, you should use the accounts.listSubaccounts method, which is more suitable for advanced accounts use case.

Request parameters:

filter - Optional. Returns only accounts that match the filter. For more details, see the filter syntax reference.

pageSize - Optional. The maximum number of accounts to return. The service may return fewer than this value. If unspecified, at most 250 accounts are returned. The maximum value is 500; values above 500 are coerced to 500.

pageToken - Optional. A page token, received from a previous accounts.list call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided in the accounts.list request must match the call that provided the page token.

$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? $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 ($fields != null) 'fields': [$fields],
  };

  const url_ = 'accounts/v1/accounts';

  final response_ = await _requester.request(
    url_,
    'GET',
    queryParams: queryParams_,
  );
  return ListAccountsResponse.fromJson(
    response_ as core.Map<core.String, core.dynamic>,
  );
}