create method

Future<GoogleCloudDialogflowV2Conversation> create(
  1. GoogleCloudDialogflowV2Conversation request,
  2. String parent, {
  3. String? conversationId,
  4. String? $fields,
})

Creates a new conversation.

Conversations are auto-completed after 24 hours. Conversation Lifecycle: There are two stages during a conversation: Automated Agent Stage and Assist Stage. For Automated Agent Stage, there will be a dialogflow agent responding to user queries. For Assist Stage, there's no dialogflow agent responding to user queries. But we will provide suggestions which are generated from conversation. If Conversation.conversation_profile is configured for a dialogflow agent, conversation will start from Automated Agent Stage, otherwise, it will start from Assist Stage. And during Automated Agent Stage, once an Intent with Intent.live_agent_handoff is triggered, conversation will transfer to Assist Stage.

request - The metadata request object.

Request parameters:

parent - Required. Resource identifier of the project creating the conversation. Format: projects//locations/. Value must have pattern ^projects/\[^/\]+$.

conversationId - Optional. Identifier of the conversation. Generally it's auto generated by Google. Only set it if you cannot wait for the response to return a auto-generated one to you. The conversation ID must be compliant with the regression fomula a-zA-Z* with the characters length in range of [3,64]. If the field is provided, the caller is resposible for 1. the uniqueness of the ID, otherwise the request will be rejected. 2. the consistency for whether to use custom ID or not under a project to better ensure uniqueness.

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

Completes with a GoogleCloudDialogflowV2Conversation.

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

  final url_ = 'v2/' + core.Uri.encodeFull('$parent') + '/conversations';

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