list method

Future<ListAttributeMetadataResponse> list({
  1. String? categoryName,
  2. String? languageCode,
  3. int? pageSize,
  4. String? pageToken,
  5. String? parent,
  6. String? regionCode,
  7. bool? showAll,
  8. String? $fields,
})

Returns the list of attributes that would be available for a location with the given primary category and country.

Request parameters:

categoryName - The primary category stable ID to find available attributes. Must be of the format categories/{category_id}.

languageCode - The BCP 47 code of language to get attribute display names in. If this language is not available, they will be provided in English.

pageSize - How many attributes to include per page. Default is 200, minimum is 1.

pageToken - If specified, the next page of attribute metadata is retrieved.

parent - Resource name of the location to look up available attributes. If this field is set, category_name, region_code, language_code and show_all are not required and must not be set.

regionCode - The ISO 3166-1 alpha-2 country code to find available attributes.

showAll - Metadata for all available attributes are returned when this field is set to true, disregarding parent and category_name fields. language_code and region_code are required when show_all is set to true.

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

Completes with a ListAttributeMetadataResponse.

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<ListAttributeMetadataResponse> list({
  core.String? categoryName,
  core.String? languageCode,
  core.int? pageSize,
  core.String? pageToken,
  core.String? parent,
  core.String? regionCode,
  core.bool? showAll,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (categoryName != null) 'categoryName': [categoryName],
    if (languageCode != null) 'languageCode': [languageCode],
    if (pageSize != null) 'pageSize': ['${pageSize}'],
    if (pageToken != null) 'pageToken': [pageToken],
    if (parent != null) 'parent': [parent],
    if (regionCode != null) 'regionCode': [regionCode],
    if (showAll != null) 'showAll': ['${showAll}'],
    if ($fields != null) 'fields': [$fields],
  };

  const url_ = 'v1/attributes';

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