Dialogflow CX V3 API - Class Google::Cloud::Dialogflow::CX::V3::Intents::Client (v0.7.1)

Reference documentation and code samples for the Dialogflow CX V3 API class Google::Cloud::Dialogflow::CX::V3::Intents::Client.

Client for the Intents service.

Service for managing Intents.

Inherits

  • Object

Methods

.configure

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

Configure the Intents 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 Intents clients
::Google::Cloud::Dialogflow::CX::V3::Intents::Client.configure do |config|
  config.timeout = 10.0
end

#configure

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

Configure the Intents 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_intent

def create_intent(request, options = nil) -> ::Google::Cloud::Dialogflow::CX::V3::Intent
def create_intent(parent: nil, intent: nil, language_code: nil) -> ::Google::Cloud::Dialogflow::CX::V3::Intent

Creates an intent in the specified agent.

Note: You should always train a flow prior to sending it queries. See the training documentation.

Overloads
def create_intent(request, options = nil) -> ::Google::Cloud::Dialogflow::CX::V3::Intent
Pass arguments to create_intent via a request object, either of type CreateIntentRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::CX::V3::CreateIntentRequest, ::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_intent(parent: nil, intent: nil, language_code: nil) -> ::Google::Cloud::Dialogflow::CX::V3::Intent
Pass arguments to create_intent 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 agent to create an intent for. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.
  • intent (::Google::Cloud::Dialogflow::CX::V3::Intent, ::Hash) — Required. The intent to create.
  • language_code (::String) — The language of the following fields in intent:

    • Intent.training_phrases.parts.text

    If not specified, the agent's default language is used. Many languages are supported. Note: languages must be enabled in the agent before they can be used.

Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::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::Intents::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dialogflow::CX::V3::CreateIntentRequest.new

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

# The returned object is of type Google::Cloud::Dialogflow::CX::V3::Intent.
p result

#delete_intent

def delete_intent(request, options = nil) -> ::Google::Protobuf::Empty
def delete_intent(name: nil) -> ::Google::Protobuf::Empty

Deletes the specified intent.

Note: You should always train a flow prior to sending it queries. See the training documentation.

Overloads
def delete_intent(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_intent via a request object, either of type DeleteIntentRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::CX::V3::DeleteIntentRequest, ::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 delete_intent(name: nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_intent 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 intent to delete. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/intents/<Intent ID>.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::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::Intents::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dialogflow::CX::V3::DeleteIntentRequest.new

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

# The returned object is of type Google::Protobuf::Empty.
p result

#get_intent

def get_intent(request, options = nil) -> ::Google::Cloud::Dialogflow::CX::V3::Intent
def get_intent(name: nil, language_code: nil) -> ::Google::Cloud::Dialogflow::CX::V3::Intent

Retrieves the specified intent.

Overloads
def get_intent(request, options = nil) -> ::Google::Cloud::Dialogflow::CX::V3::Intent
Pass arguments to get_intent via a request object, either of type GetIntentRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::CX::V3::GetIntentRequest, ::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_intent(name: nil, language_code: nil) -> ::Google::Cloud::Dialogflow::CX::V3::Intent
Pass arguments to get_intent 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
  • name (::String) — Required. The name of the intent. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/intents/<Intent ID>.
  • language_code (::String) — The language to retrieve the intent for. The following fields are language dependent:

    • Intent.training_phrases.parts.text

    If not specified, the agent's default language is used. Many languages are supported. Note: languages must be enabled in the agent before they can be used.

Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::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::Intents::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dialogflow::CX::V3::GetIntentRequest.new

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

# The returned object is of type Google::Cloud::Dialogflow::CX::V3::Intent.
p result

#initialize

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

Create a new Intents client object.

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

# Create a client using a custom configuration
client = ::Google::Cloud::Dialogflow::CX::V3::Intents::Client.new do |config|
  config.timeout = 10.0
end

#list_intents

def list_intents(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::CX::V3::Intent>
def list_intents(parent: nil, language_code: nil, intent_view: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::CX::V3::Intent>

Returns the list of all intents in the specified agent.

Overloads
def list_intents(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::CX::V3::Intent>
Pass arguments to list_intents via a request object, either of type ListIntentsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::CX::V3::ListIntentsRequest, ::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_intents(parent: nil, language_code: nil, intent_view: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::CX::V3::Intent>
Pass arguments to list_intents 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 agent to list all intents for. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.
  • language_code (::String) — The language to list intents for. The following fields are language dependent:

    • Intent.training_phrases.parts.text

    If not specified, the agent's default language is used. Many languages are supported. Note: languages must be enabled in the agent before they can be used.

  • intent_view (::Google::Cloud::Dialogflow::CX::V3::IntentView) — The resource view to apply to the returned intent.
  • page_size (::Integer) — The maximum number of items to return in a single page. By default 100 and at most 1000.
  • page_token (::String) — The next_page_token value returned from a previous list request.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Returns
Raises
  • (::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::Intents::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dialogflow::CX::V3::ListIntentsRequest.new

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

# The returned object is of type Gapic::PagedEnumerable. You can
# iterate over all elements by calling #each, and the enumerable
# will lazily make API calls to fetch subsequent pages. Other
# methods are also available for managing paging directly.
result.each do |response|
  # Each element is of type ::Google::Cloud::Dialogflow::CX::V3::Intent.
  p response
end

#update_intent

def update_intent(request, options = nil) -> ::Google::Cloud::Dialogflow::CX::V3::Intent
def update_intent(intent: nil, language_code: nil, update_mask: nil) -> ::Google::Cloud::Dialogflow::CX::V3::Intent

Updates the specified intent.

Note: You should always train a flow prior to sending it queries. See the training documentation.

Overloads
def update_intent(request, options = nil) -> ::Google::Cloud::Dialogflow::CX::V3::Intent
Pass arguments to update_intent via a request object, either of type UpdateIntentRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::CX::V3::UpdateIntentRequest, ::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_intent(intent: nil, language_code: nil, update_mask: nil) -> ::Google::Cloud::Dialogflow::CX::V3::Intent
Pass arguments to update_intent 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
  • intent (::Google::Cloud::Dialogflow::CX::V3::Intent, ::Hash) — Required. The intent to update.
  • language_code (::String) — The language of the following fields in intent:

    • Intent.training_phrases.parts.text

    If not specified, the agent's default language is used. Many languages are supported. Note: languages must be enabled in the agent before they can be used.

  • update_mask (::Google::Protobuf::FieldMask, ::Hash) — The mask to control which fields get updated. If the mask is not present, all fields will be updated.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::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::Intents::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dialogflow::CX::V3::UpdateIntentRequest.new

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

# The returned object is of type Google::Cloud::Dialogflow::CX::V3::Intent.
p result