lib/google_api/dialogflow/v2/model/google_cloud_dialogflow_cx_v3beta1_fulfillment.ex

# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3beta1Fulfillment do
  @moduledoc """
  A fulfillment can do one or more of the following actions at the same time: * Generate rich message responses. * Set parameter values. * Call the webhook. Fulfillments can be called at various stages in the Page or Form lifecycle. For example, when a DetectIntentRequest drives a session to enter a new page, the page's entry fulfillment can add a static response to the QueryResult in the returning DetectIntentResponse, call the webhook (for example, to load user data from a database), or both.

  ## Attributes

  *   `advancedSettings` (*type:* `GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3beta1AdvancedSettings.t`, *default:* `nil`) - Hierarchical advanced settings for this fulfillment. The settings exposed at the lower level overrides the settings exposed at the higher level.
  *   `conditionalCases` (*type:* `list(GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3beta1FulfillmentConditionalCases.t)`, *default:* `nil`) - Conditional cases for this fulfillment.
  *   `enableGenerativeFallback` (*type:* `boolean()`, *default:* `nil`) - If the flag is true, the agent will utilize LLM to generate a text response. If LLM generation fails, the defined responses in the fulfillment will be respected. This flag is only useful for fulfillments associated with no-match event handlers.
  *   `messages` (*type:* `list(GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3beta1ResponseMessage.t)`, *default:* `nil`) - The list of rich message responses to present to the user.
  *   `returnPartialResponses` (*type:* `boolean()`, *default:* `nil`) - Whether Dialogflow should return currently queued fulfillment response messages in streaming APIs. If a webhook is specified, it happens before Dialogflow invokes webhook. Warning: 1) This flag only affects streaming API. Responses are still queued and returned once in non-streaming API. 2) The flag can be enabled in any fulfillment but only the first 3 partial responses will be returned. You may only want to apply it to fulfillments that have slow webhooks.
  *   `setParameterActions` (*type:* `list(GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3beta1FulfillmentSetParameterAction.t)`, *default:* `nil`) - Set parameter values before executing the webhook.
  *   `tag` (*type:* `String.t`, *default:* `nil`) - The value of this field will be populated in the WebhookRequest `fulfillmentInfo.tag` field by Dialogflow when the associated webhook is called. The tag is typically used by the webhook service to identify which fulfillment is being called, but it could be used for other purposes. This field is required if `webhook` is specified.
  *   `webhook` (*type:* `String.t`, *default:* `nil`) - The webhook to call. Format: `projects//locations//agents//webhooks/`.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :advancedSettings =>
            GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3beta1AdvancedSettings.t() | nil,
          :conditionalCases =>
            list(
              GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3beta1FulfillmentConditionalCases.t()
            )
            | nil,
          :enableGenerativeFallback => boolean() | nil,
          :messages =>
            list(GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3beta1ResponseMessage.t())
            | nil,
          :returnPartialResponses => boolean() | nil,
          :setParameterActions =>
            list(
              GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3beta1FulfillmentSetParameterAction.t()
            )
            | nil,
          :tag => String.t() | nil,
          :webhook => String.t() | nil
        }

  field(:advancedSettings,
    as: GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3beta1AdvancedSettings
  )

  field(:conditionalCases,
    as: GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3beta1FulfillmentConditionalCases,
    type: :list
  )

  field(:enableGenerativeFallback)

  field(:messages,
    as: GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3beta1ResponseMessage,
    type: :list
  )

  field(:returnPartialResponses)

  field(:setParameterActions,
    as: GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3beta1FulfillmentSetParameterAction,
    type: :list
  )

  field(:tag)
  field(:webhook)
end

defimpl Poison.Decoder,
  for: GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3beta1Fulfillment do
  def decode(value, options) do
    GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3beta1Fulfillment.decode(value, options)
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3beta1Fulfillment do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end