generate method

Future<GenerateRecommendationsResponse> generate(
  1. String merchantId, {
  2. List<String>? allowedTag,
  3. String? languageCode,
  4. String? $fields,
})

Generates recommendations for a merchant.

Request parameters:

merchantId - Required. The ID of the account to fetch recommendations for.

allowedTag - Optional. List of allowed tags. Tags are a set of predefined strings that describe the category that individual recommendation types belong to. User can specify zero or more tags in this field to indicate what categories of recommendations they want to receive. Current list of supported tags: - TREND

languageCode - Optional. Language code of the client. If not set, the result will be in default language (English). This language code affects all fields prefixed with "localized". This should be set to ISO 639-1 country code. List of currently verified supported language code: en, fr, cs, da, de, es, it, nl, no, pl, pt, pt, fi, sv, vi, tr, th, ko, zh-CN, zh-TW, ja, id, hi

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

Completes with a GenerateRecommendationsResponse.

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<GenerateRecommendationsResponse> generate(
  core.String merchantId, {
  core.List<core.String>? allowedTag,
  core.String? languageCode,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (allowedTag != null) 'allowedTag': allowedTag,
    if (languageCode != null) 'languageCode': [languageCode],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ =
      commons.escapeVariable('$merchantId') + '/recommendations/generate';

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