Reference documentation and code samples for the Dialogflow V2 API class Google::Cloud::Dialogflow::V2::Intents::Rest::Client.
REST 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.
- (config) — Configure the Client client.
- config (Client::Configuration)
# Modify the configuration for all Intents clients ::Google::Cloud::Dialogflow::V2::Intents::Rest::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:
metadata
: An empty Struct messageresponse
: An Empty message
Note: You should always train an agent prior to sending it queries. See the training documentation.
def batch_delete_intents(request, options = nil) -> ::Gapic::Operation
batch_delete_intents
via a request object, either of type
BatchDeleteIntentsRequest or an equivalent Hash.
- 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
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).
-
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.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Operation)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the REST call is aborted.
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::Rest::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 it to # check the status of an operation, cancel it, or wait for results. # Here is how to wait for a response. result.wait_until_done! timeout: 60 if result.response? p result.response else puts "No response received." 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:
metadata
: An empty Struct messageresponse
: BatchUpdateIntentsResponse
Note: You should always train an agent prior to sending it queries. See the training documentation.
def batch_update_intents(request, options = nil) -> ::Gapic::Operation
batch_update_intents
via a request object, either of type
BatchUpdateIntentsRequest or an equivalent Hash.
- 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
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).
-
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.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Operation)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the REST call is aborted.
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::Rest::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 it to # check the status of an operation, cancel it, or wait for results. # Here is how to wait for a response. result.wait_until_done! timeout: 60 if result.response? p result.response else puts "No response received." 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.
- (config) — Configure the Client client.
- config (Client::Configuration)
#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.
def create_intent(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::Intent
create_intent
via a request object, either of type
CreateIntentRequest or an equivalent Hash.
- 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
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).
-
parent (::String) — Required. The agent to create a intent for.
Format:
projects/<Project ID>/agent
. - intent (::Google::Cloud::Dialogflow::V2::Intent, ::Hash) — Required. The intent to 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.
- intent_view (::Google::Cloud::Dialogflow::V2::IntentView) — Optional. The resource view to apply to the returned intent.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::Dialogflow::V2::Intent)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
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::Rest::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.
def delete_intent(request, options = nil) -> ::Google::Protobuf::Empty
delete_intent
via a request object, either of type
DeleteIntentRequest or an equivalent Hash.
- 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
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).
-
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>
.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Protobuf::Empty)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
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::Rest::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.
def get_intent(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::Intent
get_intent
via a request object, either of type
GetIntentRequest or an equivalent Hash.
- 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
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).
-
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.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::Dialogflow::V2::Intent)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
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::Rest::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 REST client object.
- (config) — Configure the Intents client.
- config (Client::Configuration)
- (Client) — a new instance of Client
# Create a client using the default configuration client = ::Google::Cloud::Dialogflow::V2::Intents::Rest::Client.new # Create a client using a custom configuration client = ::Google::Cloud::Dialogflow::V2::Intents::Rest::Client.new do |config| config.timeout = 10.0 end
#list_intents
def list_intents(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Intent>
def list_intents(parent: nil, language_code: nil, intent_view: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Intent>
Returns the list of all intents in the specified agent.
def list_intents(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Intent>
list_intents
via a request object, either of type
ListIntentsRequest or an equivalent Hash.
- 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::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Intent>
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).
-
parent (::String) — Required. The agent to list all intents from.
Format:
projects/<Project ID>/agent
orprojects/<Project ID>/locations/<Location ID>/agent
.Alternatively, you can specify the environment to list intents for. Format:
projects/<Project ID>/agent/environments/<Environment ID>
orprojects/<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.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Intent>)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Intent>)
- (::Google::Cloud::Error) — if the REST call is aborted.
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::Rest::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 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::Intent. p item end
#location_client
def location_client() -> Google::Cloud::Location::Locations::Rest::Client
Get the associated client for mix-in of the Locations.
- (Google::Cloud::Location::Locations::Rest::Client)
#operations_client
def operations_client() -> ::Google::Cloud::Dialogflow::V2::Intents::Rest::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.
def update_intent(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::Intent
update_intent
via a request object, either of type
UpdateIntentRequest or an equivalent Hash.
- 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
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).
- intent (::Google::Cloud::Dialogflow::V2::Intent, ::Hash) — Required. The intent to update.
- 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.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::Dialogflow::V2::Intent)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
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::Rest::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