lib/google/cloud/dialogflow/cx/v3/sessions/client.rb in google-cloud-dialogflow-cx-v3-0.22.0 vs lib/google/cloud/dialogflow/cx/v3/sessions/client.rb in google-cloud-dialogflow-cx-v3-0.23.0
- old
+ new
@@ -570,10 +570,104 @@
rescue ::GRPC::BadStatus => e
raise ::Google::Cloud::Error.from_error(e)
end
##
+ # Updates the feedback received from the user for a single turn of the bot
+ # response.
+ #
+ # @overload submit_answer_feedback(request, options = nil)
+ # Pass arguments to `submit_answer_feedback` via a request object, either of type
+ # {::Google::Cloud::Dialogflow::CX::V3::SubmitAnswerFeedbackRequest} or an equivalent Hash.
+ #
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::SubmitAnswerFeedbackRequest, ::Hash]
+ # A request object representing the call parameters. Required. To specify no
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
+ # @param options [::Gapic::CallOptions, ::Hash]
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
+ #
+ # @overload submit_answer_feedback(session: nil, response_id: nil, answer_feedback: nil, update_mask: nil)
+ # Pass arguments to `submit_answer_feedback` via keyword arguments. Note that at
+ # least one keyword argument is required. To specify no parameters, or to keep all
+ # the default parameter values, pass an empty Hash as a request object (see above).
+ #
+ # @param session [::String]
+ # Required. The name of the session the feedback was sent to.
+ # @param response_id [::String]
+ # Required. ID of the response to update its feedback. This is the same as
+ # DetectIntentResponse.response_id.
+ # @param answer_feedback [::Google::Cloud::Dialogflow::CX::V3::AnswerFeedback, ::Hash]
+ # Required. Feedback provided for a bot answer.
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
+ # Optional. The mask to control which fields to update. If the mask is not
+ # present, all fields will be updated.
+ #
+ # @yield [response, operation] Access the result along with the RPC operation
+ # @yieldparam response [::Google::Cloud::Dialogflow::CX::V3::AnswerFeedback]
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
+ #
+ # @return [::Google::Cloud::Dialogflow::CX::V3::AnswerFeedback]
+ #
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
+ #
+ # @example Basic example
+ # require "google/cloud/dialogflow/cx/v3"
+ #
+ # # Create a client object. The client can be reused for multiple calls.
+ # client = Google::Cloud::Dialogflow::CX::V3::Sessions::Client.new
+ #
+ # # Create a request. To set request fields, pass in keyword arguments.
+ # request = Google::Cloud::Dialogflow::CX::V3::SubmitAnswerFeedbackRequest.new
+ #
+ # # Call the submit_answer_feedback method.
+ # result = client.submit_answer_feedback request
+ #
+ # # The returned object is of type Google::Cloud::Dialogflow::CX::V3::AnswerFeedback.
+ # p result
+ #
+ def submit_answer_feedback request, options = nil
+ raise ::ArgumentError, "request must be provided" if request.nil?
+
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::SubmitAnswerFeedbackRequest
+
+ # Converts hash and nil to an options object
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
+
+ # Customize the options with defaults
+ metadata = @config.rpcs.submit_answer_feedback.metadata.to_h
+
+ # Set x-goog-api-client and x-goog-user-project headers
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
+
+ header_params = {}
+ if request.session
+ header_params["session"] = request.session
+ end
+
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
+ metadata[:"x-goog-request-params"] ||= request_params_header
+
+ options.apply_defaults timeout: @config.rpcs.submit_answer_feedback.timeout,
+ metadata: metadata,
+ retry_policy: @config.rpcs.submit_answer_feedback.retry_policy
+
+ options.apply_defaults timeout: @config.timeout,
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
+
+ @sessions_stub.call_rpc :submit_answer_feedback, request, options: options do |response, operation|
+ yield response, operation if block_given?
+ return response
+ end
+ rescue ::GRPC::BadStatus => e
+ raise ::Google::Cloud::Error.from_error(e)
+ end
+
+ ##
# Configuration class for the Sessions API.
#
# This class represents the configuration for Sessions,
# providing control over timeouts, retry behavior, logging, transport
# parameters, and other low-level controls. Certain parameters can also be
@@ -734,10 +828,15 @@
##
# RPC-specific configuration for `fulfill_intent`
# @return [::Gapic::Config::Method]
#
attr_reader :fulfill_intent
+ ##
+ # RPC-specific configuration for `submit_answer_feedback`
+ # @return [::Gapic::Config::Method]
+ #
+ attr_reader :submit_answer_feedback
# @private
def initialize parent_rpcs = nil
detect_intent_config = parent_rpcs.detect_intent if parent_rpcs.respond_to? :detect_intent
@detect_intent = ::Gapic::Config::Method.new detect_intent_config
@@ -745,9 +844,11 @@
@streaming_detect_intent = ::Gapic::Config::Method.new streaming_detect_intent_config
match_intent_config = parent_rpcs.match_intent if parent_rpcs.respond_to? :match_intent
@match_intent = ::Gapic::Config::Method.new match_intent_config
fulfill_intent_config = parent_rpcs.fulfill_intent if parent_rpcs.respond_to? :fulfill_intent
@fulfill_intent = ::Gapic::Config::Method.new fulfill_intent_config
+ submit_answer_feedback_config = parent_rpcs.submit_answer_feedback if parent_rpcs.respond_to? :submit_answer_feedback
+ @submit_answer_feedback = ::Gapic::Config::Method.new submit_answer_feedback_config
yield self if block_given?
end
end
end