Dialogflow V2 API - Class Google::Cloud::Dialogflow::V2::Participants::Rest::Client (v0.29.0)

Reference documentation and code samples for the Dialogflow V2 API class Google::Cloud::Dialogflow::V2::Participants::Rest::Client.

REST client for the Participants service.

Service for managing Participants.

Inherits

  • Object

Methods

.configure

def self.configure() { |config| ... } -> Client::Configuration

Configure the Participants Client class.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all Participants clients
::Google::Cloud::Dialogflow::V2::Participants::Rest::Client.configure do |config|
  config.timeout = 10.0
end

#analyze_content

def analyze_content(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::AnalyzeContentResponse
def analyze_content(participant: nil, text_input: nil, event_input: nil, suggestion_input: nil, reply_audio_config: nil, query_params: nil, assist_query_params: nil, cx_parameters: nil, request_id: nil) -> ::Google::Cloud::Dialogflow::V2::AnalyzeContentResponse

Adds a text (chat, for example), or audio (phone recording, for example) message from a participant into the conversation.

Note: Always use agent versions for production traffic sent to virtual agents. See Versions and environments.

Overloads
def analyze_content(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::AnalyzeContentResponse
Pass arguments to analyze_content via a request object, either of type AnalyzeContentRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::AnalyzeContentRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def analyze_content(participant: nil, text_input: nil, event_input: nil, suggestion_input: nil, reply_audio_config: nil, query_params: nil, assist_query_params: nil, cx_parameters: nil, request_id: nil) -> ::Google::Cloud::Dialogflow::V2::AnalyzeContentResponse
Pass arguments to analyze_content 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).
Parameters
  • participant (::String) — Required. The name of the participant this text comes from. Format: projects/<Project ID>/locations/<Location ID>/conversations/<Conversation ID>/participants/<Participant ID>.
  • text_input (::Google::Cloud::Dialogflow::V2::TextInput, ::Hash) — The natural language text to be processed.
  • event_input (::Google::Cloud::Dialogflow::V2::EventInput, ::Hash) — An input event to send to Dialogflow.
  • suggestion_input (::Google::Cloud::Dialogflow::V2::SuggestionInput, ::Hash) — An input representing the selection of a suggestion.
  • reply_audio_config (::Google::Cloud::Dialogflow::V2::OutputAudioConfig, ::Hash) — Speech synthesis configuration. The speech synthesis settings for a virtual agent that may be configured for the associated conversation profile are not used when calling AnalyzeContent. If this configuration is not supplied, speech synthesis is disabled.
  • query_params (::Google::Cloud::Dialogflow::V2::QueryParameters, ::Hash) — Parameters for a Dialogflow virtual-agent query.
  • assist_query_params (::Google::Cloud::Dialogflow::V2::AssistQueryParameters, ::Hash) — Parameters for a human assist query.
  • cx_parameters (::Google::Protobuf::Struct, ::Hash) — Additional parameters to be put into Dialogflow CX session parameters. To remove a parameter from the session, clients should explicitly set the parameter value to null.

    Note: this field should only be used if you are connecting to a Dialogflow CX agent.

  • request_id (::String) — A unique identifier for this request. Restricted to 36 ASCII characters. A random UUID is recommended. This request is only idempotent if a request_id is provided.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/dialogflow/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dialogflow::V2::Participants::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dialogflow::V2::AnalyzeContentRequest.new

# Call the analyze_content method.
result = client.analyze_content request

# The returned object is of type Google::Cloud::Dialogflow::V2::AnalyzeContentResponse.
p result

#configure

def configure() { |config| ... } -> Client::Configuration

Configure the Participants Client instance.

The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#create_participant

def create_participant(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::Participant
def create_participant(parent: nil, participant: nil) -> ::Google::Cloud::Dialogflow::V2::Participant

Creates a new participant in a conversation.

Overloads
def create_participant(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::Participant
Pass arguments to create_participant via a request object, either of type CreateParticipantRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::CreateParticipantRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def create_participant(parent: nil, participant: nil) -> ::Google::Cloud::Dialogflow::V2::Participant
Pass arguments to create_participant 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).
Parameters
  • parent (::String) — Required. Resource identifier of the conversation adding the participant. Format: projects/<Project ID>/locations/<Location ID>/conversations/<Conversation ID>.
  • participant (::Google::Cloud::Dialogflow::V2::Participant, ::Hash) — Required. The participant to create.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/dialogflow/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dialogflow::V2::Participants::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dialogflow::V2::CreateParticipantRequest.new

# Call the create_participant method.
result = client.create_participant request

# The returned object is of type Google::Cloud::Dialogflow::V2::Participant.
p result

#get_participant

def get_participant(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::Participant
def get_participant(name: nil) -> ::Google::Cloud::Dialogflow::V2::Participant

Retrieves a conversation participant.

Overloads
def get_participant(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::Participant
Pass arguments to get_participant via a request object, either of type GetParticipantRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::GetParticipantRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def get_participant(name: nil) -> ::Google::Cloud::Dialogflow::V2::Participant
Pass arguments to get_participant 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).
Parameter
  • name (::String) — Required. The name of the participant. Format: projects/<Project ID>/locations/<Location ID>/conversations/<Conversation ID>/participants/<Participant ID>.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/dialogflow/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dialogflow::V2::Participants::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dialogflow::V2::GetParticipantRequest.new

# Call the get_participant method.
result = client.get_participant request

# The returned object is of type Google::Cloud::Dialogflow::V2::Participant.
p result

#initialize

def initialize() { |config| ... } -> Client

Create a new Participants REST client object.

Yields
  • (config) — Configure the Participants client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::Dialogflow::V2::Participants::Rest::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::Dialogflow::V2::Participants::Rest::Client.new do |config|
  config.timeout = 10.0
end

#list_participants

def list_participants(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Participant>
def list_participants(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Participant>

Returns the list of all participants in the specified conversation.

Overloads
def list_participants(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Participant>
Pass arguments to list_participants via a request object, either of type ListParticipantsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::ListParticipantsRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def list_participants(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Participant>
Pass arguments to list_participants 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).
Parameters
  • parent (::String) — Required. The conversation to list all participants from. Format: projects/<Project ID>/locations/<Location ID>/conversations/<Conversation ID>.
  • page_size (::Integer) — Optional. The maximum number of items to return in a single page. By default 100 and at most 1000.
  • page_token (::String) — Optional. The next_page_token value returned from a previous list request.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/dialogflow/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dialogflow::V2::Participants::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dialogflow::V2::ListParticipantsRequest.new

# Call the list_participants method.
result = client.list_participants request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::Dialogflow::V2::Participant.
  p item
end

#location_client

def location_client() -> Google::Cloud::Location::Locations::Rest::Client

Get the associated client for mix-in of the Locations.

Returns
  • (Google::Cloud::Location::Locations::Rest::Client)

#suggest_articles

def suggest_articles(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::SuggestArticlesResponse
def suggest_articles(parent: nil, latest_message: nil, context_size: nil, assist_query_params: nil) -> ::Google::Cloud::Dialogflow::V2::SuggestArticlesResponse

Gets suggested articles for a participant based on specific historical messages.

Overloads
def suggest_articles(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::SuggestArticlesResponse
Pass arguments to suggest_articles via a request object, either of type SuggestArticlesRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::SuggestArticlesRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def suggest_articles(parent: nil, latest_message: nil, context_size: nil, assist_query_params: nil) -> ::Google::Cloud::Dialogflow::V2::SuggestArticlesResponse
Pass arguments to suggest_articles 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).
Parameters
  • parent (::String) — Required. The name of the participant to fetch suggestion for. Format: projects/<Project ID>/locations/<Location ID>/conversations/<Conversation ID>/participants/<Participant ID>.
  • latest_message (::String) — Optional. The name of the latest conversation message to compile suggestion for. If empty, it will be the latest message of the conversation.

    Format: projects/<Project ID>/locations/<Location ID>/conversations/<Conversation ID>/messages/<Message ID>.

  • context_size (::Integer) — Optional. Max number of messages prior to and including latest_message to use as context when compiling the suggestion. By default 20 and at most 50.
  • assist_query_params (::Google::Cloud::Dialogflow::V2::AssistQueryParameters, ::Hash) — Parameters for a human assist query.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/dialogflow/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dialogflow::V2::Participants::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dialogflow::V2::SuggestArticlesRequest.new

# Call the suggest_articles method.
result = client.suggest_articles request

# The returned object is of type Google::Cloud::Dialogflow::V2::SuggestArticlesResponse.
p result

#suggest_faq_answers

def suggest_faq_answers(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::SuggestFaqAnswersResponse
def suggest_faq_answers(parent: nil, latest_message: nil, context_size: nil, assist_query_params: nil) -> ::Google::Cloud::Dialogflow::V2::SuggestFaqAnswersResponse

Gets suggested faq answers for a participant based on specific historical messages.

Overloads
def suggest_faq_answers(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::SuggestFaqAnswersResponse
Pass arguments to suggest_faq_answers via a request object, either of type SuggestFaqAnswersRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::SuggestFaqAnswersRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def suggest_faq_answers(parent: nil, latest_message: nil, context_size: nil, assist_query_params: nil) -> ::Google::Cloud::Dialogflow::V2::SuggestFaqAnswersResponse
Pass arguments to suggest_faq_answers 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).
Parameters
  • parent (::String) — Required. The name of the participant to fetch suggestion for. Format: projects/<Project ID>/locations/<Location ID>/conversations/<Conversation ID>/participants/<Participant ID>.
  • latest_message (::String) — Optional. The name of the latest conversation message to compile suggestion for. If empty, it will be the latest message of the conversation.

    Format: projects/<Project ID>/locations/<Location ID>/conversations/<Conversation ID>/messages/<Message ID>.

  • context_size (::Integer) — Optional. Max number of messages prior to and including [latest_message] to use as context when compiling the suggestion. By default 20 and at most 50.
  • assist_query_params (::Google::Cloud::Dialogflow::V2::AssistQueryParameters, ::Hash) — Parameters for a human assist query.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/dialogflow/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dialogflow::V2::Participants::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dialogflow::V2::SuggestFaqAnswersRequest.new

# Call the suggest_faq_answers method.
result = client.suggest_faq_answers request

# The returned object is of type Google::Cloud::Dialogflow::V2::SuggestFaqAnswersResponse.
p result

#suggest_smart_replies

def suggest_smart_replies(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::SuggestSmartRepliesResponse
def suggest_smart_replies(parent: nil, current_text_input: nil, latest_message: nil, context_size: nil) -> ::Google::Cloud::Dialogflow::V2::SuggestSmartRepliesResponse

Gets smart replies for a participant based on specific historical messages.

Overloads
def suggest_smart_replies(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::SuggestSmartRepliesResponse
Pass arguments to suggest_smart_replies via a request object, either of type SuggestSmartRepliesRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::SuggestSmartRepliesRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def suggest_smart_replies(parent: nil, current_text_input: nil, latest_message: nil, context_size: nil) -> ::Google::Cloud::Dialogflow::V2::SuggestSmartRepliesResponse
Pass arguments to suggest_smart_replies 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).
Parameters
  • parent (::String) — Required. The name of the participant to fetch suggestion for. Format: projects/<Project ID>/locations/<Location ID>/conversations/<Conversation ID>/participants/<Participant ID>.
  • current_text_input (::Google::Cloud::Dialogflow::V2::TextInput, ::Hash) — The current natural language text segment to compile suggestion for. This provides a way for user to get follow up smart reply suggestion after a smart reply selection, without sending a text message.
  • latest_message (::String) — The name of the latest conversation message to compile suggestion for. If empty, it will be the latest message of the conversation.

    Format: projects/<Project ID>/locations/<Location ID>/conversations/<Conversation ID>/messages/<Message ID>.

  • context_size (::Integer) — Max number of messages prior to and including [latest_message] to use as context when compiling the suggestion. By default 20 and at most 50.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/dialogflow/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dialogflow::V2::Participants::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dialogflow::V2::SuggestSmartRepliesRequest.new

# Call the suggest_smart_replies method.
result = client.suggest_smart_replies request

# The returned object is of type Google::Cloud::Dialogflow::V2::SuggestSmartRepliesResponse.
p result

#update_participant

def update_participant(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::Participant
def update_participant(participant: nil, update_mask: nil) -> ::Google::Cloud::Dialogflow::V2::Participant

Updates the specified participant.

Overloads
def update_participant(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::Participant
Pass arguments to update_participant via a request object, either of type UpdateParticipantRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::UpdateParticipantRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def update_participant(participant: nil, update_mask: nil) -> ::Google::Cloud::Dialogflow::V2::Participant
Pass arguments to update_participant 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).
Parameters
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/dialogflow/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dialogflow::V2::Participants::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dialogflow::V2::UpdateParticipantRequest.new

# Call the update_participant method.
result = client.update_participant request

# The returned object is of type Google::Cloud::Dialogflow::V2::Participant.
p result