Dialogflow CX V3 API - Class Google::Cloud::Dialogflow::CX::V3::Examples::Client (v1.11.0)

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

Client for the Examples service.

Service for managing Examples.

Inherits

  • Object

Methods

.configure

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

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

#configure

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

Configure the Examples 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_example

def create_example(request, options = nil) -> ::Google::Cloud::Dialogflow::CX::V3::Example
def create_example(parent: nil, example: nil) -> ::Google::Cloud::Dialogflow::CX::V3::Example

Creates an example in the specified playbook.

Overloads
def create_example(request, options = nil) -> ::Google::Cloud::Dialogflow::CX::V3::Example
Pass arguments to create_example via a request object, either of type CreateExampleRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::CX::V3::CreateExampleRequest, ::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_example(parent: nil, example: nil) -> ::Google::Cloud::Dialogflow::CX::V3::Example
Pass arguments to create_example 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 playbook to create an example for. Format: projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/playbooks/<PlaybookID>.
  • example (::Google::Cloud::Dialogflow::CX::V3::Example, ::Hash) — Required. The example to create.
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::Examples::Client.new

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

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

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

#delete_example

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

Deletes the specified example.

Overloads
def delete_example(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_example via a request object, either of type DeleteExampleRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::CX::V3::DeleteExampleRequest, ::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_example(name: nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_example 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 example to delete. Format: projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/playbooks/<PlaybookID>/examples/<ExampleID>.
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::Examples::Client.new

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

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

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

#get_example

def get_example(request, options = nil) -> ::Google::Cloud::Dialogflow::CX::V3::Example
def get_example(name: nil) -> ::Google::Cloud::Dialogflow::CX::V3::Example

Retrieves the specified example.

Overloads
def get_example(request, options = nil) -> ::Google::Cloud::Dialogflow::CX::V3::Example
Pass arguments to get_example via a request object, either of type GetExampleRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::CX::V3::GetExampleRequest, ::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_example(name: nil) -> ::Google::Cloud::Dialogflow::CX::V3::Example
Pass arguments to get_example 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 example. Format: projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/playbooks/<PlaybookID>/examples/<ExampleID>.
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::Examples::Client.new

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

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

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

#initialize

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

Create a new Examples client object.

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

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

#list_examples

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

Returns a list of examples in the specified playbook.

Overloads
def list_examples(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::CX::V3::Example>
Pass arguments to list_examples via a request object, either of type ListExamplesRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::CX::V3::ListExamplesRequest, ::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_examples(parent: nil, page_size: nil, page_token: nil, language_code: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::CX::V3::Example>
Pass arguments to list_examples 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 playbook to list the examples from. Format: projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/playbooks/<PlaybookID>.
  • 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][ListExampleResponse.next_page_token] value returned from a previous list request.
  • language_code (::String) — Optional. The language to list examples for. If not specified, list all examples under the playbook. 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
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::Examples::Client.new

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

# Call the list_examples method.
result = client.list_examples 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::CX::V3::Example.
  p item
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)

#logger

def logger() -> Logger

The logger used for request/response debug logging.

Returns
  • (Logger)

#universe_domain

def universe_domain() -> String

The effective universe domain

Returns
  • (String)

#update_example

def update_example(request, options = nil) -> ::Google::Cloud::Dialogflow::CX::V3::Example
def update_example(example: nil, update_mask: nil) -> ::Google::Cloud::Dialogflow::CX::V3::Example

Update the specified example.

Overloads
def update_example(request, options = nil) -> ::Google::Cloud::Dialogflow::CX::V3::Example
Pass arguments to update_example via a request object, either of type UpdateExampleRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::CX::V3::UpdateExampleRequest, ::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_example(example: nil, update_mask: nil) -> ::Google::Cloud::Dialogflow::CX::V3::Example
Pass arguments to update_example 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/cx/v3"

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

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

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

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