generate method

Generates all the suggestions using generators configured in the conversation profile.

A generator is used only if its trigger event is matched.

request - The metadata request object.

Request parameters:

conversation - Required. The conversation for which the suggestions are generated. Format: projects//locations//conversations/. The conversation must be created with a conversation profile which has generators configured in it to be able to get suggestions. Value must have pattern ^projects/\[^/\]+/conversations/\[^/\]+$.

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

Completes with a GoogleCloudDialogflowV2GenerateSuggestionsResponse.

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<GoogleCloudDialogflowV2GenerateSuggestionsResponse> generate(
  GoogleCloudDialogflowV2GenerateSuggestionsRequest request,
  core.String conversation, {
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    if ($fields != null) 'fields': [$fields],
  };

  final url_ =
      'v2/' + core.Uri.encodeFull('$conversation') + '/suggestions:generate';

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