list method

Future<ListLocationsResponse> list(
  1. String name, {
  2. List<String>? extraLocationTypes,
  3. String? filter,
  4. int? pageSize,
  5. String? pageToken,
  6. String? $fields,
})

Lists information about the supported locations for this service.This method lists locations based on the resource scope provided in the ListLocationsRequest.name field: Global locations: If name is empty, the method lists the public locations available to all projects.

Project-specific locations: If name follows the format projects/{project}, the method lists locations visible to that specific project. This includes public, private, or other project-specific locations enabled for the project.For gRPC and client library implementations, the resource name is passed as the name field. For direct service calls, the resource name is incorporated into the request path based on the specific service implementation and version.

Request parameters:

name - The resource that owns the locations collection, if applicable. Value must have pattern ^\[^/\]+/\[^/\]+$.

extraLocationTypes - Optional. Do not use this field unless explicitly documented otherwise. This is primarily for internal usage.

filter - A filter to narrow down results to a preferred subset. The filtering language accepts strings like "displayName=tokyo", and is documented in more detail in AIP-160 (https://google.aip.dev/160).

pageSize - The maximum number of results to return. If not set, the service selects a default.

pageToken - A page token received from the next_page_token field in the response. Send that page token to receive the subsequent page.

$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 name, {
  core.List<core.String>? extraLocationTypes,
  core.String? filter,
  core.int? pageSize,
  core.String? pageToken,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    'extraLocationTypes': ?extraLocationTypes,
    'filter': ?filter == null ? null : [filter],
    'pageSize': ?pageSize == null ? null : ['${pageSize}'],
    'pageToken': ?pageToken == null ? null : [pageToken],
    'fields': ?$fields == null ? null : [$fields],
  };

  final url_ = 'v2/' + core.Uri.encodeFull('$name') + '/locations';

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