Dialogflow V2 API - Class Google::Cloud::Dialogflow::V2::Intents::Client (v0.17.1)

Reference documentation and code samples for the Dialogflow V2 API class Google::Cloud::Dialogflow::V2::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::V2::Intents::Client.configure do |config|
  config.timeout = 10.0
end

#batch_delete_intents

def batch_delete_intents(request, options = nil) -> ::Gapic::Operation
def batch_delete_intents(parent: nil, intents: nil) -> ::Gapic::Operation

Deletes intents in the specified agent.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

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

Overloads
def batch_delete_intents(request, options = nil) -> ::Gapic::Operation
Pass arguments to batch_delete_intents via a request object, either of type BatchDeleteIntentsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::BatchDeleteIntentsRequest, ::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 batch_delete_intents(parent: nil, intents: nil) -> ::Gapic::Operation
Pass arguments to batch_delete_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 name of the agent to delete all entities types for. Format: projects/<Project ID>/agent.
  • intents (::Array<::Google::Cloud::Dialogflow::V2::Intent, ::Hash>) — Required. The collection of intents to delete. Only intent name must be filled in.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC 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::Intents::Client.new

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

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

# The returned object is of type Gapic::Operation. You can use this
# object to check the status of an operation, cancel it, or wait
# for results. Here is how to block until completion:
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "Error!"
end

#batch_update_intents

def batch_update_intents(request, options = nil) -> ::Gapic::Operation
def batch_update_intents(parent: nil, intent_batch_uri: nil, intent_batch_inline: nil, language_code: nil, update_mask: nil, intent_view: nil) -> ::Gapic::Operation

Updates/Creates multiple intents in the specified agent.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

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

Overloads
def batch_update_intents(request, options = nil) -> ::Gapic::Operation
Pass arguments to batch_update_intents via a request object, either of type BatchUpdateIntentsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::BatchUpdateIntentsRequest, ::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 batch_update_intents(parent: nil, intent_batch_uri: nil, intent_batch_inline: nil, language_code: nil, update_mask: nil, intent_view: nil) -> ::Gapic::Operation
Pass arguments to batch_update_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 name of the agent to update or create intents in. Format: projects/<Project ID>/agent.
  • intent_batch_uri (::String) — The URI to a Google Cloud Storage file containing intents to update or create. The file format can either be a serialized proto (of IntentBatch type) or JSON object. Note: The URI must start with "gs://".
  • intent_batch_inline (::Google::Cloud::Dialogflow::V2::IntentBatch, ::Hash) — The collection of intents to update or create.
  • language_code (::String) — Optional. The language used to access language-specific data. If not specified, the agent's default language is used. For more information, see Multilingual intent and entity data.
  • update_mask (::Google::Protobuf::FieldMask, ::Hash) — Optional. The mask to control which fields get updated.
  • intent_view (::Google::Cloud::Dialogflow::V2::IntentView) — Optional. The resource view to apply to the returned intent.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC 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::Intents::Client.new

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

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

# The returned object is of type Gapic::Operation. You can use this
# object to check the status of an operation, cancel it, or wait
# for results. Here is how to block until completion:
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "Error!"
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::V2::Intent
def create_intent(parent: nil, intent: nil, language_code: nil, intent_view: nil) -> ::Google::Cloud::Dialogflow::V2::Intent

Creates an intent in the specified agent.

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

Overloads
def create_intent(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::Intent
Pass arguments to create_intent via a request object, either of type CreateIntentRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::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, intent_view: nil) -> ::Google::Cloud::Dialogflow::V2::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
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/v2"

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

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

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

# The returned object is of type Google::Cloud::Dialogflow::V2::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 and its direct or indirect followup intents.

Note: You should always train an agent 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::V2::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. If this intent has direct or indirect followup intents, we also delete them. Format: projects/<Project ID>/agent/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/v2"

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

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dialogflow::V2::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::V2::Intent
def get_intent(name: nil, language_code: nil, intent_view: nil) -> ::Google::Cloud::Dialogflow::V2::Intent

Retrieves the specified intent.

Overloads
def get_intent(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::Intent
Pass arguments to get_intent via a request object, either of type GetIntentRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::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, intent_view: nil) -> ::Google::Cloud::Dialogflow::V2::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>/agent/intents/<Intent ID>.
  • language_code (::String) — Optional. The language used to access language-specific data. If not specified, the agent's default language is used. For more information, see Multilingual intent and entity data.
  • intent_view (::Google::Cloud::Dialogflow::V2::IntentView) — Optional. The resource view to apply to the returned intent.
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/v2"

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

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

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

# The returned object is of type Google::Cloud::Dialogflow::V2::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::V2::Intents::Client.new

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

#list_intents

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

Returns the list of all intents in the specified agent.

Overloads
def list_intents(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Intent>
Pass arguments to list_intents via a request object, either of type ListIntentsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::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::V2::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 from. Format: projects/<Project ID>/agent or projects/<Project ID>/locations/<Location ID>/agent.

    Alternatively, you can specify the environment to list intents for. Format: projects/<Project ID>/agent/environments/<Environment ID> or projects/<Project ID>/locations/<Location ID>/agent/environments/<Environment ID>. Note: training phrases of the intents will not be returned for non-draft environment.

  • language_code (::String) — Optional. The language used to access language-specific data. If not specified, the agent's default language is used. For more information, see Multilingual intent and entity data.
  • intent_view (::Google::Cloud::Dialogflow::V2::IntentView) — Optional. The resource view to apply to the returned intent.
  • 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
  • (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/v2"

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

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dialogflow::V2::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::V2::Intent.
  p response
end

#location_client

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

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

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

#operations_client

def operations_client() -> ::Google::Cloud::Dialogflow::V2::Intents::Operations

Get the associated client for long-running operations.

#update_intent

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

Updates the specified intent.

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

Overloads
def update_intent(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::Intent
Pass arguments to update_intent via a request object, either of type UpdateIntentRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::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, intent_view: nil) -> ::Google::Cloud::Dialogflow::V2::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
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/v2"

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

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

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

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