class Google::Cloud::Dialogflow::CX::V3::TestCases::Client

Client for the TestCases service.

Service for managing {::Google::Cloud::Dialogflow::CX::V3::TestCase Test Cases} and {::Google::Cloud::Dialogflow::CX::V3::TestCaseResult Test Case Results}.

Attributes

operations_client[R]

Get the associated client for long-running operations.

@return [::Google::Cloud::Dialogflow::CX::V3::TestCases::Operations]

test_cases_stub[R]

@private

Public Class Methods

configure() { |configure| ... } click to toggle source

Configure the TestCases Client class.

See {::Google::Cloud::Dialogflow::CX::V3::TestCases::Client::Configuration} for a description of the configuration fields.

@example

# Modify the configuration for all TestCases clients
::Google::Cloud::Dialogflow::CX::V3::TestCases::Client.configure do |config|
  config.timeout = 10.0
end

@yield [config] Configure the Client client. @yieldparam config [Client::Configuration]

@return [Client::Configuration]

# File lib/google/cloud/dialogflow/cx/v3/test_cases/client.rb, line 58
def self.configure
  @configure ||= begin
    namespace = ["Google", "Cloud", "Dialogflow", "CX", "V3"]
    parent_config = while namespace.any?
                      parent_name = namespace.join "::"
                      parent_const = const_get parent_name
                      break parent_const.configure if parent_const.respond_to? :configure
                      namespace.pop
                    end
    default_config = Client::Configuration.new parent_config

    default_config.timeout = 60.0
    default_config.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config
  end
  yield @configure if block_given?
  @configure
end
new() { |config| ... } click to toggle source

Create a new TestCases client object.

@example

# Create a client using the default configuration
client = ::Google::Cloud::Dialogflow::CX::V3::TestCases::Client.new

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

@yield [config] Configure the TestCases client. @yieldparam config [Client::Configuration]

# File lib/google/cloud/dialogflow/cx/v3/test_cases/client.rb, line 116
def initialize
  # These require statements are intentionally placed here to initialize
  # the gRPC module only when it's required.
  # See https://github.com/googleapis/toolkit/issues/446
  require "gapic/grpc"
  require "google/cloud/dialogflow/cx/v3/test_case_services_pb"

  # Create the configuration object
  @config = Configuration.new Client.configure

  # Yield the configuration if needed
  yield @config if block_given?

  # Create credentials
  credentials = @config.credentials
  # Use self-signed JWT if the endpoint is unchanged from default,
  # but only if the default endpoint does not have a region prefix.
  enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
                           !@config.endpoint.split(".").first.include?("-")
  credentials ||= Credentials.default scope: @config.scope,
                                      enable_self_signed_jwt: enable_self_signed_jwt
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
    credentials = Credentials.new credentials, scope: @config.scope
  end
  @quota_project_id = @config.quota_project
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id

  @operations_client = Operations.new do |config|
    config.credentials = credentials
    config.endpoint = @config.endpoint
  end

  @test_cases_stub = ::Gapic::ServiceStub.new(
    ::Google::Cloud::Dialogflow::CX::V3::TestCases::Stub,
    credentials:  credentials,
    endpoint:     @config.endpoint,
    channel_args: @config.channel_args,
    interceptors: @config.interceptors
  )
end

Public Instance Methods

batch_delete_test_cases(request, options = nil) { |response, operation| ... } click to toggle source

Batch deletes test cases.

@overload batch_delete_test_cases(request, options = nil)

Pass arguments to `batch_delete_test_cases` via a request object, either of type
{::Google::Cloud::Dialogflow::CX::V3::BatchDeleteTestCasesRequest} or an equivalent Hash.

@param request [::Google::Cloud::Dialogflow::CX::V3::BatchDeleteTestCasesRequest, ::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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload batch_delete_test_cases(parent: nil, names: nil)

Pass arguments to `batch_delete_test_cases` 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).

@param parent [::String]
  Required. The agent to delete test cases from.
  Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
@param names [::Array<::String>]
  Required. Format of test case names: `projects/<Project ID>/locations/
  <Location ID>/agents/<AgentID>/testCases/<TestCase ID>`.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Protobuf::Empty] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Google::Protobuf::Empty]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/dialogflow/cx/v3/test_cases/client.rb, line 277
def batch_delete_test_cases request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::BatchDeleteTestCasesRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
  metadata = @config.rpcs.batch_delete_test_cases.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "parent" => request.parent
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.batch_delete_test_cases.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.batch_delete_test_cases.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         retry_policy: @config.retry_policy

  @test_cases_stub.call_rpc :batch_delete_test_cases, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end
batch_run_test_cases(request, options = nil) { |response, operation| ... } click to toggle source

Kicks off a batch run of test cases.

@overload batch_run_test_cases(request, options = nil)

Pass arguments to `batch_run_test_cases` via a request object, either of type
{::Google::Cloud::Dialogflow::CX::V3::BatchRunTestCasesRequest} or an equivalent Hash.

@param request [::Google::Cloud::Dialogflow::CX::V3::BatchRunTestCasesRequest, ::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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload batch_run_test_cases(parent: nil, environment: nil, test_cases: nil)

Pass arguments to `batch_run_test_cases` 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).

@param parent [::String]
  Required. Agent name. Format: `projects/<Project ID>/locations/<Location ID>/agents/
  <AgentID>`.
@param environment [::String]
  Optional. If not set, draft environment is assumed. Format: `projects/<Project
  ID>/locations/<Location ID>/agents/<Agent ID>/environments/<Environment
  ID>`.
@param test_cases [::Array<::String>]
  Required. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
  ID>/testCases/<TestCase ID>`.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::Operation] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Gapic::Operation]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/dialogflow/cx/v3/test_cases/client.rb, line 646
def batch_run_test_cases request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::BatchRunTestCasesRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
  metadata = @config.rpcs.batch_run_test_cases.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "parent" => request.parent
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.batch_run_test_cases.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.batch_run_test_cases.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         retry_policy: @config.retry_policy

  @test_cases_stub.call_rpc :batch_run_test_cases, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end
calculate_coverage(request, options = nil) { |response, operation| ... } click to toggle source

Calculates the test coverage for an agent.

@overload calculate_coverage(request, options = nil)

Pass arguments to `calculate_coverage` via a request object, either of type
{::Google::Cloud::Dialogflow::CX::V3::CalculateCoverageRequest} or an equivalent Hash.

@param request [::Google::Cloud::Dialogflow::CX::V3::CalculateCoverageRequest, ::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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload calculate_coverage(agent: nil, type: nil)

Pass arguments to `calculate_coverage` 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).

@param agent [::String]
  Required. The agent to calculate coverage for.
  Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
@param type [::Google::Cloud::Dialogflow::CX::V3::CalculateCoverageRequest::CoverageType]
  Required. The type of coverage requested.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::Dialogflow::CX::V3::CalculateCoverageResponse] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Google::Cloud::Dialogflow::CX::V3::CalculateCoverageResponse]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/dialogflow/cx/v3/test_cases/client.rb, line 718
def calculate_coverage request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::CalculateCoverageRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
  metadata = @config.rpcs.calculate_coverage.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "agent" => request.agent
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.calculate_coverage.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.calculate_coverage.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         retry_policy: @config.retry_policy

  @test_cases_stub.call_rpc :calculate_coverage, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end
configure() { |config| ... } click to toggle source

Configure the TestCases 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 {::Google::Cloud::Dialogflow::CX::V3::TestCases::Client::Configuration} for a description of the configuration fields.

@yield [config] Configure the Client client. @yieldparam config [Client::Configuration]

@return [Client::Configuration]

# File lib/google/cloud/dialogflow/cx/v3/test_cases/client.rb, line 95
def configure
  yield @config if block_given?
  @config
end
create_test_case(request, options = nil) { |response, operation| ... } click to toggle source

Creates a test case for the given agent.

@overload create_test_case(request, options = nil)

Pass arguments to `create_test_case` via a request object, either of type
{::Google::Cloud::Dialogflow::CX::V3::CreateTestCaseRequest} or an equivalent Hash.

@param request [::Google::Cloud::Dialogflow::CX::V3::CreateTestCaseRequest, ::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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload create_test_case(parent: nil, test_case: nil)

Pass arguments to `create_test_case` 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).

@param parent [::String]
  Required. The agent to create the test case for.
  Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
@param test_case [::Google::Cloud::Dialogflow::CX::V3::TestCase, ::Hash]
  Required. The test case to create.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::Dialogflow::CX::V3::TestCase] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Google::Cloud::Dialogflow::CX::V3::TestCase]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/dialogflow/cx/v3/test_cases/client.rb, line 418
def create_test_case request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::CreateTestCaseRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
  metadata = @config.rpcs.create_test_case.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "parent" => request.parent
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.create_test_case.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.create_test_case.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         retry_policy: @config.retry_policy

  @test_cases_stub.call_rpc :create_test_case, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end
export_test_cases(request, options = nil) { |response, operation| ... } click to toggle source

Exports the test cases under the agent to a Cloud Storage bucket or a local file. Filter can be applied to export a subset of test cases.

@overload export_test_cases(request, options = nil)

Pass arguments to `export_test_cases` via a request object, either of type
{::Google::Cloud::Dialogflow::CX::V3::ExportTestCasesRequest} or an equivalent Hash.

@param request [::Google::Cloud::Dialogflow::CX::V3::ExportTestCasesRequest, ::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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload export_test_cases(parent: nil, gcs_uri: nil, data_format: nil, filter: nil)

Pass arguments to `export_test_cases` 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).

@param parent [::String]
  Required. The agent where to export test cases from.
  Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
@param gcs_uri [::String]
  The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI to
  export the test cases to. The format of this URI must be
  `gs://<bucket-name>/<object-name>`. If unspecified, the serialized test
  cases is returned inline.
@param data_format [::Google::Cloud::Dialogflow::CX::V3::ExportTestCasesRequest::DataFormat]
  The data format of the exported test cases. If not specified, `BLOB` is
  assumed.
@param filter [::String]
  The filter expression used to filter exported test cases, see
  [API Filtering](https://aip.dev/160). The expression is case insensitive
  and supports the following syntax:

    name = <value> [OR name = <value>] ...

  For example:

  *   "name = t1 OR name = t2" matches the test case with the exact resource
      name "t1" or "t2".

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::Operation] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Gapic::Operation]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/dialogflow/cx/v3/test_cases/client.rb, line 885
def export_test_cases request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::ExportTestCasesRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
  metadata = @config.rpcs.export_test_cases.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "parent" => request.parent
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.export_test_cases.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.export_test_cases.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         retry_policy: @config.retry_policy

  @test_cases_stub.call_rpc :export_test_cases, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end
get_test_case(request, options = nil) { |response, operation| ... } click to toggle source

Gets a test case.

@overload get_test_case(request, options = nil)

Pass arguments to `get_test_case` via a request object, either of type
{::Google::Cloud::Dialogflow::CX::V3::GetTestCaseRequest} or an equivalent Hash.

@param request [::Google::Cloud::Dialogflow::CX::V3::GetTestCaseRequest, ::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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload get_test_case(name: nil)

Pass arguments to `get_test_case` 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).

@param name [::String]
  Required. The name of the testcase.
  Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
  ID>/testCases/<TestCase ID>`.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::Dialogflow::CX::V3::TestCase] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Google::Cloud::Dialogflow::CX::V3::TestCase]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/dialogflow/cx/v3/test_cases/client.rb, line 347
def get_test_case request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::GetTestCaseRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
  metadata = @config.rpcs.get_test_case.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "name" => request.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.get_test_case.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.get_test_case.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         retry_policy: @config.retry_policy

  @test_cases_stub.call_rpc :get_test_case, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end
get_test_case_result(request, options = nil) { |response, operation| ... } click to toggle source

Gets a test case result.

@overload get_test_case_result(request, options = nil)

Pass arguments to `get_test_case_result` via a request object, either of type
{::Google::Cloud::Dialogflow::CX::V3::GetTestCaseResultRequest} or an equivalent Hash.

@param request [::Google::Cloud::Dialogflow::CX::V3::GetTestCaseResultRequest, ::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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload get_test_case_result(name: nil)

Pass arguments to `get_test_case_result` 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).

@param name [::String]
  Required. The name of the testcase.
  Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
  ID>/testCases/<TestCase ID>/results/<TestCaseResult ID>`.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::Dialogflow::CX::V3::TestCaseResult] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Google::Cloud::Dialogflow::CX::V3::TestCaseResult]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/dialogflow/cx/v3/test_cases/client.rb, line 1058
def get_test_case_result request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::GetTestCaseResultRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
  metadata = @config.rpcs.get_test_case_result.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "name" => request.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.get_test_case_result.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.get_test_case_result.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         retry_policy: @config.retry_policy

  @test_cases_stub.call_rpc :get_test_case_result, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end
import_test_cases(request, options = nil) { |response, operation| ... } click to toggle source

Imports the test cases from a Cloud Storage bucket or a local file. It always creates new test cases and won't overwite any existing ones. The provided ID in the imported test case is neglected.

@overload import_test_cases(request, options = nil)

Pass arguments to `import_test_cases` via a request object, either of type
{::Google::Cloud::Dialogflow::CX::V3::ImportTestCasesRequest} or an equivalent Hash.

@param request [::Google::Cloud::Dialogflow::CX::V3::ImportTestCasesRequest, ::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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload import_test_cases(parent: nil, gcs_uri: nil, content: nil)

Pass arguments to `import_test_cases` 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).

@param parent [::String]
  Required. The agent to import test cases to.
  Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
@param gcs_uri [::String]
  The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI
  to import test cases from. The format of this URI must be
  `gs://<bucket-name>/<object-name>`.
@param content [::String]
  Uncompressed raw byte content for test cases.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::Operation] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Gapic::Operation]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/dialogflow/cx/v3/test_cases/client.rb, line 795
def import_test_cases request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::ImportTestCasesRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
  metadata = @config.rpcs.import_test_cases.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "parent" => request.parent
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.import_test_cases.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.import_test_cases.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         retry_policy: @config.retry_policy

  @test_cases_stub.call_rpc :import_test_cases, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end
list_test_case_results(request, options = nil) { |response, operation| ... } click to toggle source

Fetches a list of results for a given test case.

@overload list_test_case_results(request, options = nil)

Pass arguments to `list_test_case_results` via a request object, either of type
{::Google::Cloud::Dialogflow::CX::V3::ListTestCaseResultsRequest} or an equivalent Hash.

@param request [::Google::Cloud::Dialogflow::CX::V3::ListTestCaseResultsRequest, ::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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload list_test_case_results(parent: nil, page_size: nil, page_token: nil, filter: nil)

Pass arguments to `list_test_case_results` 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).

@param parent [::String]
  Required. The test case to list results for.
  Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/
  testCases/<TestCase ID>`. Specify a `-` as a wildcard for TestCase ID to
  list results across multiple test cases.
@param page_size [::Integer]
  The maximum number of items to return in a single page. By default 100 and
  at most 1000.
@param page_token [::String]
  The next_page_token value returned from a previous list request.
@param filter [::String]
  The filter expression used to filter test case results. See
  [API Filtering](https://aip.dev/160).

  The expression is case insensitive. Only 'AND' is supported for logical
  operators. The supported syntax is listed below in detail:

    <field> <operator> <value> [AND <field> <operator> <value>] ...
    [AND latest]

  The supported fields and operators are:
  field                 operator
  `environment`         `=`, `IN`  (Use value `draft` for draft environment)
  `test_time`           `>`, `<`

  `latest` only returns the latest test result in all results for each test
  case.

  Examples:
  *   "environment=draft AND latest" matches the latest test result for each
      test case in the draft environment.
  *   "environment IN (e1,e2)" matches any test case results with an
      environment resource name of either "e1" or "e2".
  *   "test_time > 1602540713" matches any test case results with test time
      later than a unix timestamp in seconds 1602540713.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::CX::V3::TestCaseResult>] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::CX::V3::TestCaseResult>]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/dialogflow/cx/v3/test_cases/client.rb, line 987
def list_test_case_results request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::ListTestCaseResultsRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
  metadata = @config.rpcs.list_test_case_results.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "parent" => request.parent
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.list_test_case_results.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.list_test_case_results.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         retry_policy: @config.retry_policy

  @test_cases_stub.call_rpc :list_test_case_results, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @test_cases_stub, :list_test_case_results, request, response, operation, options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end
list_test_cases(request, options = nil) { |response, operation| ... } click to toggle source

Fetches a list of test cases for a given agent.

@overload list_test_cases(request, options = nil)

Pass arguments to `list_test_cases` via a request object, either of type
{::Google::Cloud::Dialogflow::CX::V3::ListTestCasesRequest} or an equivalent Hash.

@param request [::Google::Cloud::Dialogflow::CX::V3::ListTestCasesRequest, ::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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload list_test_cases(parent: nil, page_size: nil, page_token: nil, view: nil)

Pass arguments to `list_test_cases` 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).

@param parent [::String]
  Required. The agent to list all pages for.
  Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
@param page_size [::Integer]
  The maximum number of items to return in a single page. By default 20.
  Note that when TestCaseView = FULL, the maximum page size allowed is 20.
  When TestCaseView = BASIC, the maximum page size allowed is 500.
@param page_token [::String]
  The next_page_token value returned from a previous list request.
@param view [::Google::Cloud::Dialogflow::CX::V3::ListTestCasesRequest::TestCaseView]
  Specifies whether response should include all fields or just the metadata.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::CX::V3::TestCase>] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::CX::V3::TestCase>]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/dialogflow/cx/v3/test_cases/client.rb, line 204
def list_test_cases request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::ListTestCasesRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
  metadata = @config.rpcs.list_test_cases.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "parent" => request.parent
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.list_test_cases.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.list_test_cases.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         retry_policy: @config.retry_policy

  @test_cases_stub.call_rpc :list_test_cases, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @test_cases_stub, :list_test_cases, request, response, operation, options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end
run_test_case(request, options = nil) { |response, operation| ... } click to toggle source

Kicks off a test case run. This method is a [long-running operation](cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields:

  • `metadata`: {::Google::Cloud::Dialogflow::CX::V3::RunTestCaseMetadata RunTestCaseMetadata}

  • `response`: {::Google::Cloud::Dialogflow::CX::V3::RunTestCaseResponse RunTestCaseResponse}

@overload run_test_case(request, options = nil)

Pass arguments to `run_test_case` via a request object, either of type
{::Google::Cloud::Dialogflow::CX::V3::RunTestCaseRequest} or an equivalent Hash.

@param request [::Google::Cloud::Dialogflow::CX::V3::RunTestCaseRequest, ::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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload run_test_case(name: nil, environment: nil)

Pass arguments to `run_test_case` 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).

@param name [::String]
  Required. Format of test case name to run: `projects/<Project ID>/locations/
  <Location ID>/agents/<AgentID>/testCases/<TestCase ID>`.
@param environment [::String]
  Optional. Environment name. If not set, draft environment is assumed.
  Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
  ID>/environments/<Environment ID>`.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::Operation] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Gapic::Operation]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/dialogflow/cx/v3/test_cases/client.rb, line 569
def run_test_case request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::RunTestCaseRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
  metadata = @config.rpcs.run_test_case.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "name" => request.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.run_test_case.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.run_test_case.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         retry_policy: @config.retry_policy

  @test_cases_stub.call_rpc :run_test_case, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end
update_test_case(request, options = nil) { |response, operation| ... } click to toggle source

Updates the specified test case.

@overload update_test_case(request, options = nil)

Pass arguments to `update_test_case` via a request object, either of type
{::Google::Cloud::Dialogflow::CX::V3::UpdateTestCaseRequest} or an equivalent Hash.

@param request [::Google::Cloud::Dialogflow::CX::V3::UpdateTestCaseRequest, ::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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload update_test_case(test_case: nil, update_mask: nil)

Pass arguments to `update_test_case` 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).

@param test_case [::Google::Cloud::Dialogflow::CX::V3::TestCase, ::Hash]
  Required. The test case to update.
@param update_mask [::Google::Protobuf::FieldMask, ::Hash]
  Required. The mask to specify which fields should be updated. The
  {::Google::Cloud::Dialogflow::CX::V3::TestCase#creation_time `creationTime`} and
  {::Google::Cloud::Dialogflow::CX::V3::TestCase#last_test_result `lastTestResult`} cannot be updated.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::Dialogflow::CX::V3::TestCase] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Google::Cloud::Dialogflow::CX::V3::TestCase]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/dialogflow/cx/v3/test_cases/client.rb, line 490
def update_test_case request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::UpdateTestCaseRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
  metadata = @config.rpcs.update_test_case.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "test_case.name" => request.test_case.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.update_test_case.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.update_test_case.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         retry_policy: @config.retry_policy

  @test_cases_stub.call_rpc :update_test_case, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end