list method

Future<CitiesListResponse> list(
  1. String profileId, {
  2. List<String>? countryDartIds,
  3. List<String>? dartIds,
  4. String? namePrefix,
  5. List<String>? regionDartIds,
  6. String? $fields,
})

Retrieves a list of cities, possibly filtered.

Request parameters:

profileId - User profile ID associated with this request. Value must have pattern ^\[^/\]+$.

countryDartIds - Select only cities from these countries.

dartIds - Select only cities with these DART IDs.

namePrefix - Select only cities with names starting with this prefix.

regionDartIds - Select only cities from these regions.

$fields - Selector specifying which fields to include in a partial response.

Completes with a CitiesListResponse.

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<CitiesListResponse> list(
  core.String profileId, {
  core.List<core.String>? countryDartIds,
  core.List<core.String>? dartIds,
  core.String? namePrefix,
  core.List<core.String>? regionDartIds,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (countryDartIds != null) 'countryDartIds': countryDartIds,
    if (dartIds != null) 'dartIds': dartIds,
    if (namePrefix != null) 'namePrefix': [namePrefix],
    if (regionDartIds != null) 'regionDartIds': regionDartIds,
    if ($fields != null) 'fields': [$fields],
  };

  final url_ =
      'userprofiles/' + core.Uri.encodeFull('$profileId') + '/cities';

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