list method
Lists the locations for the specified account.
Request parameters:
parent - Required. The name of the account to fetch locations from. *
Specific Account ID: If the account is of type AccountType.PERSONAL,
the response returns only locations directly owned by that account. For
all other types (e.g., AccountType.LOCATION_GROUP), it returns all
accessible locations. * Wildcard (-): Using accounts/- identifies
the authenticated user. This scope defaults to AccountType.PERSONAL but
includes both directly and indirectly owned locations (e.g., those
accessible via member groups).
Value must have pattern ^accounts/\[^/\]+$.
filter - Optional. A filter constraining the locations to return. The
response includes only entries that match the filter. If filter is
empty, then constraints are applied and all locations (paginated) are
retrieved for the requested account. For more information about valid
fields and example usage, see
Work with Location Data Guide.
orderBy - Optional. Sorting order for the request. Multiple fields
should be comma-separated, following SQL syntax. The default sorting order
is ascending. To specify descending order, a suffix " desc" should be
added. Valid fields to order_by are title and store_code. For example:
"title, store_code desc" or "title" or "store_code desc"
pageSize - Optional. How many locations to fetch per page. Default value
is 10 if not set. Minimum is 1, and maximum page size is 100.
pageToken - Optional. If specified, it fetches the next page of
locations. The page token is returned by previous calls to ListLocations
when there were more locations than could fit in the requested page size.
readMask - Required. Read mask to specify what fields will be returned
in the response.
$fields - Selector specifying which fields to include in a partial
response.
Completes with a ListLocationsResponse.
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<ListLocationsResponse> list(
core.String parent, {
core.String? filter,
core.String? orderBy,
core.int? pageSize,
core.String? pageToken,
core.String? readMask,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'filter': ?filter == null ? null : [filter],
'orderBy': ?orderBy == null ? null : [orderBy],
'pageSize': ?pageSize == null ? null : ['${pageSize}'],
'pageToken': ?pageToken == null ? null : [pageToken],
'readMask': ?readMask == null ? null : [readMask],
'fields': ?$fields == null ? null : [$fields],
};
final url_ = 'v1/' + core.Uri.encodeFull('$parent') + '/locations';
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return ListLocationsResponse.fromJson(
response_ as core.Map<core.String, core.dynamic>,
);
}