list method
Returns a list of business categories.
Search will match the category name but not the category ID. Search only matches the front of a category name (that is, 'food' may return 'Food Court' but not 'Fast Food Restaurant').
Request parameters:
filter
- Optional. Filter string from user. The only field that
supported is displayName
. Eg: filter=displayName=foo
.
languageCode
- Required. The BCP 47 code of language.
pageSize
- Optional. How many categories to fetch per page. Default is
100, minimum is 1, and maximum page size is 100.
pageToken
- Optional. If specified, the next page of categories will be
fetched.
regionCode
- Required. The ISO 3166-1 alpha-2 country code.
view
- Required. Specifies which parts to the Category resource should
be returned in the response.
Possible string values are:
- "CATEGORY_VIEW_UNSPECIFIED" : Not specified, equivalent to CATEGORY_METADATA_ONLY.
- "BASIC" : The server response will only include Category fields display_name, category_id and language_code. It omits any service type metadata related fields.
- "FULL" : Returns all the fields in the response.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a ListCategoriesResponse.
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<ListCategoriesResponse> list({
core.String? filter,
core.String? languageCode,
core.int? pageSize,
core.String? pageToken,
core.String? regionCode,
core.String? view,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
if (filter != null) 'filter': [filter],
if (languageCode != null) 'languageCode': [languageCode],
if (pageSize != null) 'pageSize': ['${pageSize}'],
if (pageToken != null) 'pageToken': [pageToken],
if (regionCode != null) 'regionCode': [regionCode],
if (view != null) 'view': [view],
if ($fields != null) 'fields': [$fields],
};
const url_ = 'v1/categories';
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return ListCategoriesResponse.fromJson(
response_ as core.Map<core.String, core.dynamic>);
}