Dialogflow V2 API - Class Google::Cloud::Dialogflow::V2::Versions::Client (v0.16.0)

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

Client for the Versions service.

Service for managing Versions.

Inherits

  • Object

Methods

.configure

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

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

#configure

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

Configure the Versions 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_version

def create_version(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::Version
def create_version(parent: nil, version: nil) -> ::Google::Cloud::Dialogflow::V2::Version

Creates an agent version.

The new version points to the agent instance in the "default" environment.

Overloads
def create_version(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::Version
Pass arguments to create_version via a request object, either of type CreateVersionRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::CreateVersionRequest, ::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_version(parent: nil, version: nil) -> ::Google::Cloud::Dialogflow::V2::Version
Pass arguments to create_version 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 a version for. Supported formats:

    • projects/<Project ID>/agent
    • projects/<Project ID>/locations/<Location ID>/agent
  • version (::Google::Cloud::Dialogflow::V2::Version, ::Hash) — Required. The version 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/v2"

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

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

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

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

#delete_version

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

Delete the specified agent version.

Overloads
def delete_version(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_version via a request object, either of type DeleteVersionRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::DeleteVersionRequest, ::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_version(name: nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_version 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 version to delete. Supported formats:

    • projects/<Project ID>/agent/versions/<Version ID>
    • projects/<Project ID>/locations/<Location ID>/agent/versions/<Version 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::Versions::Client.new

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

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

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

#get_version

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

Retrieves the specified agent version.

Overloads
def get_version(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::Version
Pass arguments to get_version via a request object, either of type GetVersionRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::GetVersionRequest, ::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_version(name: nil) -> ::Google::Cloud::Dialogflow::V2::Version
Pass arguments to get_version 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 version. Supported formats:

    • projects/<Project ID>/agent/versions/<Version ID>
    • projects/<Project ID>/locations/<Location ID>/agent/versions/<Version 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::Versions::Client.new

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

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

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

#initialize

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

Create a new Versions client object.

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

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

#list_versions

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

Returns the list of all versions of the specified agent.

Overloads
def list_versions(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Version>
Pass arguments to list_versions via a request object, either of type ListVersionsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::ListVersionsRequest, ::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_versions(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Version>
Pass arguments to list_versions 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 versions from. Supported formats:

    • projects/<Project ID>/agent
    • projects/<Project ID>/locations/<Location ID>/agent
  • 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::Versions::Client.new

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

# Call the list_versions method.
result = client.list_versions 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::Version.
  p response
end

#update_version

def update_version(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::Version
def update_version(version: nil, update_mask: nil) -> ::Google::Cloud::Dialogflow::V2::Version

Updates the specified agent version.

Note that this method does not allow you to update the state of the agent the given version points to. It allows you to update only mutable properties of the version resource.

Overloads
def update_version(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::Version
Pass arguments to update_version via a request object, either of type UpdateVersionRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dialogflow::V2::UpdateVersionRequest, ::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_version(version: nil, update_mask: nil) -> ::Google::Cloud::Dialogflow::V2::Version
Pass arguments to update_version 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
  • version (::Google::Cloud::Dialogflow::V2::Version, ::Hash) —

    Required. The version to update. Supported formats:

    • projects/<Project ID>/agent/versions/<Version ID>
    • projects/<Project ID>/locations/<Location ID>/agent/versions/<Version ID>
  • update_mask (::Google::Protobuf::FieldMask, ::Hash) — Required. The mask to control which fields get 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/v2"

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

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

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

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