Class: Google::Cloud::Speech::V2::Speech::Rest::Client

Inherits:
Object
  • Object
show all
Includes:
Paths
Defined in:
lib/google/cloud/speech/v2/speech/rest/client.rb

Overview

REST client for the Speech service.

Enables speech transcription and resource management.

Defined Under Namespace

Classes: Configuration

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Paths

#config_path, #crypto_key_path, #crypto_key_version_path, #custom_class_path, #location_path, #phrase_set_path, #recognizer_path

Constructor Details

#initialize {|config| ... } ⇒ Client

Create a new Speech REST client object.

Examples:


# Create a client using the default configuration
client = ::Google::Cloud::Speech::V2::Speech::Rest::Client.new

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

Yields:

  • (config)

    Configure the Speech client.

Yield Parameters:



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/google/cloud/speech/v2/speech/rest/client.rb', line 117

def initialize
  # 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 = ::Google::Cloud::Speech::V2::Speech::Rest::Operations.new do |config|
    config.credentials = credentials
    config.quota_project = @quota_project_id
    config.endpoint = @config.endpoint
  end

  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
    config.credentials = credentials
    config.quota_project = @quota_project_id
    config.endpoint = @config.endpoint
    config.bindings_override = @config.bindings_override
  end

  @speech_stub = ::Google::Cloud::Speech::V2::Speech::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
end

Instance Attribute Details

#location_clientGoogle::Cloud::Location::Locations::Rest::Client (readonly)

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

Returns:

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


167
168
169
# File 'lib/google/cloud/speech/v2/speech/rest/client.rb', line 167

def location_client
  @location_client
end

#operations_client::Google::Cloud::Speech::V2::Speech::Rest::Operations (readonly)

Get the associated client for long-running operations.



160
161
162
# File 'lib/google/cloud/speech/v2/speech/rest/client.rb', line 160

def operations_client
  @operations_client
end

Class Method Details

.configure {|config| ... } ⇒ Client::Configuration

Configure the Speech Client class.

See Configuration for a description of the configuration fields.

Examples:


# Modify the configuration for all Speech clients
::Google::Cloud::Speech::V2::Speech::Rest::Client.configure do |config|
  config.timeout = 10.0
end

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:

Returns:



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/google/cloud/speech/v2/speech/rest/client.rb', line 59

def self.configure
  @configure ||= begin
    namespace = ["Google", "Cloud", "Speech", "V2"]
    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 = 5000.0
    default_config.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config
  end
  yield @configure if block_given?
  @configure
end

Instance Method Details

#batch_recognize(request, options = nil) ⇒ ::Gapic::Operation #batch_recognize(recognizer: nil, config: nil, config_mask: nil, files: nil, recognition_output_config: nil) ⇒ ::Gapic::Operation

Performs batch asynchronous speech recognition: send a request with N audio files and receive a long running operation that can be polled to see when the transcriptions are finished.

Overloads:

  • #batch_recognize(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to batch_recognize via a request object, either of type BatchRecognizeRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Speech::V2::BatchRecognizeRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #batch_recognize(recognizer: nil, config: nil, config_mask: nil, files: nil, recognition_output_config: nil) ⇒ ::Gapic::Operation

    Pass arguments to batch_recognize 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:

    • recognizer (::String) (defaults to: nil)

      Required. Resource name of the recognizer to be used for ASR.

    • config (::Google::Cloud::Speech::V2::RecognitionConfig, ::Hash) (defaults to: nil)

      Features and audio metadata to use for the Automatic Speech Recognition. This field in combination with the config_mask field can be used to override parts of the default_recognition_config of the Recognizer resource.

    • config_mask (::Google::Protobuf::FieldMask, ::Hash) (defaults to: nil)

      The list of fields in config that override the values in the default_recognition_config of the recognizer during this recognition request. If no mask is provided, all given fields in config override the values in the recognizer for this recognition request. If a mask is provided, only the fields listed in the mask override the config in the recognizer for this recognition request. If a wildcard (*) is provided, config completely overrides and replaces the config in the recognizer for this recognition request.

    • files (::Array<::Google::Cloud::Speech::V2::BatchRecognizeFileMetadata, ::Hash>) (defaults to: nil)

      Audio files with file metadata for ASR. The maximum number of files allowed to be specified is 5.

    • recognition_output_config (::Google::Cloud::Speech::V2::RecognitionOutputConfig, ::Hash) (defaults to: nil)

      Configuration options for where to output the transcripts of each file.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
# File 'lib/google/cloud/speech/v2/speech/rest/client.rb', line 762

def batch_recognize request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V2::BatchRecognizeRequest

  # 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
   = @config.rpcs.batch_recognize..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Speech::V2::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @speech_stub.batch_recognize request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#configure {|config| ... } ⇒ Client::Configuration

Configure the Speech 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 configure.

See Configuration for a description of the configuration fields.

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:

Returns:



96
97
98
99
# File 'lib/google/cloud/speech/v2/speech/rest/client.rb', line 96

def configure
  yield @config if block_given?
  @config
end

#create_custom_class(request, options = nil) ⇒ ::Gapic::Operation #create_custom_class(custom_class: nil, validate_only: nil, custom_class_id: nil, parent: nil) ⇒ ::Gapic::Operation

Creates a CustomClass.

Overloads:

  • #create_custom_class(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to create_custom_class via a request object, either of type CreateCustomClassRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Speech::V2::CreateCustomClassRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #create_custom_class(custom_class: nil, validate_only: nil, custom_class_id: nil, parent: nil) ⇒ ::Gapic::Operation

    Pass arguments to create_custom_class 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:

    • custom_class (::Google::Cloud::Speech::V2::CustomClass, ::Hash) (defaults to: nil)

      Required. The CustomClass to create.

    • validate_only (::Boolean) (defaults to: nil)

      If set, validate the request and preview the CustomClass, but do not actually create it.

    • custom_class_id (::String) (defaults to: nil)

      The ID to use for the CustomClass, which will become the final component of the CustomClass's resource name.

      This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.

    • parent (::String) (defaults to: nil)

      Required. The project and location where this CustomClass will be created. The expected format is projects/{project}/locations/{location}.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
# File 'lib/google/cloud/speech/v2/speech/rest/client.rb', line 968

def create_custom_class request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V2::CreateCustomClassRequest

  # 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
   = @config.rpcs.create_custom_class..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Speech::V2::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @speech_stub.create_custom_class request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#create_phrase_set(request, options = nil) ⇒ ::Gapic::Operation #create_phrase_set(phrase_set: nil, validate_only: nil, phrase_set_id: nil, parent: nil) ⇒ ::Gapic::Operation

Creates a PhraseSet.

Overloads:

  • #create_phrase_set(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to create_phrase_set via a request object, either of type CreatePhraseSetRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Speech::V2::CreatePhraseSetRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #create_phrase_set(phrase_set: nil, validate_only: nil, phrase_set_id: nil, parent: nil) ⇒ ::Gapic::Operation

    Pass arguments to create_phrase_set 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:

    • phrase_set (::Google::Cloud::Speech::V2::PhraseSet, ::Hash) (defaults to: nil)

      Required. The PhraseSet to create.

    • validate_only (::Boolean) (defaults to: nil)

      If set, validate the request and preview the PhraseSet, but do not actually create it.

    • phrase_set_id (::String) (defaults to: nil)

      The ID to use for the PhraseSet, which will become the final component of the PhraseSet's resource name.

      This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.

    • parent (::String) (defaults to: nil)

      Required. The project and location where this PhraseSet will be created. The expected format is projects/{project}/locations/{location}.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
# File 'lib/google/cloud/speech/v2/speech/rest/client.rb', line 1406

def create_phrase_set request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V2::CreatePhraseSetRequest

  # 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
   = @config.rpcs.create_phrase_set..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Speech::V2::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @speech_stub.create_phrase_set request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#create_recognizer(request, options = nil) ⇒ ::Gapic::Operation #create_recognizer(recognizer: nil, validate_only: nil, recognizer_id: nil, parent: nil) ⇒ ::Gapic::Operation

Creates a Recognizer.

Overloads:

  • #create_recognizer(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to create_recognizer via a request object, either of type CreateRecognizerRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Speech::V2::CreateRecognizerRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #create_recognizer(recognizer: nil, validate_only: nil, recognizer_id: nil, parent: nil) ⇒ ::Gapic::Operation

    Pass arguments to create_recognizer 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:

    • recognizer (::Google::Cloud::Speech::V2::Recognizer, ::Hash) (defaults to: nil)

      Required. The Recognizer to create.

    • validate_only (::Boolean) (defaults to: nil)

      If set, validate the request and preview the Recognizer, but do not actually create it.

    • recognizer_id (::String) (defaults to: nil)

      The ID to use for the Recognizer, which will become the final component of the Recognizer's resource name.

      This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.

    • parent (::String) (defaults to: nil)

      Required. The project and location where this Recognizer will be created. The expected format is projects/{project}/locations/{location}.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
# File 'lib/google/cloud/speech/v2/speech/rest/client.rb', line 210

def create_recognizer request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V2::CreateRecognizerRequest

  # 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
   = @config.rpcs.create_recognizer..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Speech::V2::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @speech_stub.create_recognizer request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#delete_custom_class(request, options = nil) ⇒ ::Gapic::Operation #delete_custom_class(name: nil, validate_only: nil, allow_missing: nil, etag: nil) ⇒ ::Gapic::Operation

Deletes the CustomClass.

Overloads:

  • #delete_custom_class(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to delete_custom_class via a request object, either of type DeleteCustomClassRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Speech::V2::DeleteCustomClassRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #delete_custom_class(name: nil, validate_only: nil, allow_missing: nil, etag: nil) ⇒ ::Gapic::Operation

    Pass arguments to delete_custom_class via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The name of the CustomClass to delete. Format: projects/{project}/locations/{location}/customClasses/{custom_class}

    • validate_only (::Boolean) (defaults to: nil)

      If set, validate the request and preview the deleted CustomClass, but do not actually delete it.

    • allow_missing (::Boolean) (defaults to: nil)

      If set to true, and the CustomClass is not found, the request will succeed and be a no-op (no Operation is recorded in this case).

    • etag (::String) (defaults to: nil)

      This checksum is computed by the server based on the value of other fields. This may be sent on update, undelete, and delete requests to ensure the client has an up-to-date value before proceeding.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
# File 'lib/google/cloud/speech/v2/speech/rest/client.rb', line 1259

def delete_custom_class request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V2::DeleteCustomClassRequest

  # 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
   = @config.rpcs.delete_custom_class..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Speech::V2::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @speech_stub.delete_custom_class request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#delete_phrase_set(request, options = nil) ⇒ ::Gapic::Operation #delete_phrase_set(name: nil, validate_only: nil, allow_missing: nil, etag: nil) ⇒ ::Gapic::Operation

Deletes the PhraseSet.

Overloads:

  • #delete_phrase_set(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to delete_phrase_set via a request object, either of type DeletePhraseSetRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Speech::V2::DeletePhraseSetRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #delete_phrase_set(name: nil, validate_only: nil, allow_missing: nil, etag: nil) ⇒ ::Gapic::Operation

    Pass arguments to delete_phrase_set via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The name of the PhraseSet to delete. Format: projects/{project}/locations/{location}/phraseSets/{phrase_set}

    • validate_only (::Boolean) (defaults to: nil)

      If set, validate the request and preview the deleted PhraseSet, but do not actually delete it.

    • allow_missing (::Boolean) (defaults to: nil)

      If set to true, and the PhraseSet is not found, the request will succeed and be a no-op (no Operation is recorded in this case).

    • etag (::String) (defaults to: nil)

      This checksum is computed by the server based on the value of other fields. This may be sent on update, undelete, and delete requests to ensure the client has an up-to-date value before proceeding.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
# File 'lib/google/cloud/speech/v2/speech/rest/client.rb', line 1694

def delete_phrase_set request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V2::DeletePhraseSetRequest

  # 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
   = @config.rpcs.delete_phrase_set..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Speech::V2::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @speech_stub.delete_phrase_set request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#delete_recognizer(request, options = nil) ⇒ ::Gapic::Operation #delete_recognizer(name: nil, validate_only: nil, allow_missing: nil, etag: nil) ⇒ ::Gapic::Operation

Deletes the Recognizer.

Overloads:

  • #delete_recognizer(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to delete_recognizer via a request object, either of type DeleteRecognizerRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Speech::V2::DeleteRecognizerRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #delete_recognizer(name: nil, validate_only: nil, allow_missing: nil, etag: nil) ⇒ ::Gapic::Operation

    Pass arguments to delete_recognizer via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The name of the Recognizer to delete. Format: projects/{project}/locations/{location}/recognizers/{recognizer}

    • validate_only (::Boolean) (defaults to: nil)

      If set, validate the request and preview the deleted Recognizer, but do not actually delete it.

    • allow_missing (::Boolean) (defaults to: nil)

      If set to true, and the Recognizer is not found, the request will succeed and be a no-op (no Operation is recorded in this case).

    • etag (::String) (defaults to: nil)

      This checksum is computed by the server based on the value of other fields. This may be sent on update, undelete, and delete requests to ensure the client has an up-to-date value before proceeding.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
# File 'lib/google/cloud/speech/v2/speech/rest/client.rb', line 500

def delete_recognizer request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V2::DeleteRecognizerRequest

  # 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
   = @config.rpcs.delete_recognizer..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Speech::V2::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @speech_stub.delete_recognizer request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_config(request, options = nil) ⇒ ::Google::Cloud::Speech::V2::Config #get_config(name: nil) ⇒ ::Google::Cloud::Speech::V2::Config

Returns the requested Config.

Overloads:

  • #get_config(request, options = nil) ⇒ ::Google::Cloud::Speech::V2::Config

    Pass arguments to get_config via a request object, either of type GetConfigRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Speech::V2::GetConfigRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #get_config(name: nil) ⇒ ::Google::Cloud::Speech::V2::Config

    Pass arguments to get_config via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The name of the config to retrieve. There is exactly one config resource per project per location. The expected format is projects/{project}/locations/{location}/config.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
# File 'lib/google/cloud/speech/v2/speech/rest/client.rb', line 827

def get_config request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V2::GetConfigRequest

  # 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
   = @config.rpcs.get_config..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Speech::V2::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @speech_stub.get_config request, options do |result, operation|
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_custom_class(request, options = nil) ⇒ ::Google::Cloud::Speech::V2::CustomClass #get_custom_class(name: nil) ⇒ ::Google::Cloud::Speech::V2::CustomClass

Returns the requested CustomClass.

Overloads:

  • #get_custom_class(request, options = nil) ⇒ ::Google::Cloud::Speech::V2::CustomClass

    Pass arguments to get_custom_class via a request object, either of type GetCustomClassRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Speech::V2::GetCustomClassRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #get_custom_class(name: nil) ⇒ ::Google::Cloud::Speech::V2::CustomClass

    Pass arguments to get_custom_class via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The name of the CustomClass to retrieve. The expected format is projects/{project}/locations/{location}/customClasses/{custom_class}.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
# File 'lib/google/cloud/speech/v2/speech/rest/client.rb', line 1112

def get_custom_class request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V2::GetCustomClassRequest

  # 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
   = @config.rpcs.get_custom_class..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Speech::V2::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @speech_stub.get_custom_class request, options do |result, operation|
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_phrase_set(request, options = nil) ⇒ ::Google::Cloud::Speech::V2::PhraseSet #get_phrase_set(name: nil) ⇒ ::Google::Cloud::Speech::V2::PhraseSet

Returns the requested PhraseSet.

Overloads:

  • #get_phrase_set(request, options = nil) ⇒ ::Google::Cloud::Speech::V2::PhraseSet

    Pass arguments to get_phrase_set via a request object, either of type GetPhraseSetRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Speech::V2::GetPhraseSetRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #get_phrase_set(name: nil) ⇒ ::Google::Cloud::Speech::V2::PhraseSet

    Pass arguments to get_phrase_set via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The name of the PhraseSet to retrieve. The expected format is projects/{project}/locations/{location}/phraseSets/{phrase_set}.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
# File 'lib/google/cloud/speech/v2/speech/rest/client.rb', line 1549

def get_phrase_set request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V2::GetPhraseSetRequest

  # 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
   = @config.rpcs.get_phrase_set..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Speech::V2::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @speech_stub.get_phrase_set request, options do |result, operation|
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_recognizer(request, options = nil) ⇒ ::Google::Cloud::Speech::V2::Recognizer #get_recognizer(name: nil) ⇒ ::Google::Cloud::Speech::V2::Recognizer

Returns the requested Recognizer. Fails with [NOT_FOUND][google.rpc.Code.NOT_FOUND] if the requested Recognizer doesn't exist.

Overloads:

  • #get_recognizer(request, options = nil) ⇒ ::Google::Cloud::Speech::V2::Recognizer

    Pass arguments to get_recognizer via a request object, either of type GetRecognizerRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Speech::V2::GetRecognizerRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #get_recognizer(name: nil) ⇒ ::Google::Cloud::Speech::V2::Recognizer

    Pass arguments to get_recognizer via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The name of the Recognizer to retrieve. The expected format is projects/{project}/locations/{location}/recognizers/{recognizer}.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
# File 'lib/google/cloud/speech/v2/speech/rest/client.rb', line 355

def get_recognizer request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V2::GetRecognizerRequest

  # 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
   = @config.rpcs.get_recognizer..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Speech::V2::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @speech_stub.get_recognizer request, options do |result, operation|
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_custom_classes(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Speech::V2::CustomClass> #list_custom_classes(parent: nil, page_size: nil, page_token: nil, show_deleted: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Speech::V2::CustomClass>

Lists CustomClasses.

Overloads:

  • #list_custom_classes(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Speech::V2::CustomClass>

    Pass arguments to list_custom_classes via a request object, either of type ListCustomClassesRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Speech::V2::ListCustomClassesRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #list_custom_classes(parent: nil, page_size: nil, page_token: nil, show_deleted: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Speech::V2::CustomClass>

    Pass arguments to list_custom_classes 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) (defaults to: nil)

      Required. The project and location of CustomClass resources to list. The expected format is projects/{project}/locations/{location}.

    • page_size (::Integer) (defaults to: nil)

      Number of results per requests. A valid page_size ranges from 0 to 20 inclusive. If the page_size is zero or unspecified, a page size of 5 will be chosen. If the page size exceeds 20, it will be coerced down to 20. Note that a call might return fewer results than the requested page size.

    • page_token (::String) (defaults to: nil)

      A page token, received from a previous ListCustomClasses call. Provide this to retrieve the subsequent page.

      When paginating, all other parameters provided to ListCustomClasses must match the call that provided the page token.

    • show_deleted (::Boolean) (defaults to: nil)

      Whether, or not, to show resources that have been deleted.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
# File 'lib/google/cloud/speech/v2/speech/rest/client.rb', line 1047

def list_custom_classes request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V2::ListCustomClassesRequest

  # 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
   = @config.rpcs.list_custom_classes..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Speech::V2::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @speech_stub.list_custom_classes request, options do |result, operation|
    result = ::Gapic::Rest::PagedEnumerable.new @speech_stub, :list_custom_classes, "custom_classes", request, result, options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_phrase_sets(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Speech::V2::PhraseSet> #list_phrase_sets(parent: nil, page_size: nil, page_token: nil, show_deleted: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Speech::V2::PhraseSet>

Lists PhraseSets.

Overloads:

  • #list_phrase_sets(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Speech::V2::PhraseSet>

    Pass arguments to list_phrase_sets via a request object, either of type ListPhraseSetsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Speech::V2::ListPhraseSetsRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #list_phrase_sets(parent: nil, page_size: nil, page_token: nil, show_deleted: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Speech::V2::PhraseSet>

    Pass arguments to list_phrase_sets 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) (defaults to: nil)

      Required. The project and location of PhraseSet resources to list. The expected format is projects/{project}/locations/{location}.

    • page_size (::Integer) (defaults to: nil)

      The maximum number of PhraseSets to return. The service may return fewer than this value. If unspecified, at most 20 PhraseSets will be returned. The maximum value is 20; values above 20 will be coerced to 20.

    • page_token (::String) (defaults to: nil)

      A page token, received from a previous ListPhraseSets call. Provide this to retrieve the subsequent page.

      When paginating, all other parameters provided to ListPhraseSets must match the call that provided the page token.

    • show_deleted (::Boolean) (defaults to: nil)

      Whether, or not, to show resources that have been deleted.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
# File 'lib/google/cloud/speech/v2/speech/rest/client.rb', line 1484

def list_phrase_sets request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V2::ListPhraseSetsRequest

  # 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
   = @config.rpcs.list_phrase_sets..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Speech::V2::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @speech_stub.list_phrase_sets request, options do |result, operation|
    result = ::Gapic::Rest::PagedEnumerable.new @speech_stub, :list_phrase_sets, "phrase_sets", request, result, options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_recognizers(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Speech::V2::Recognizer> #list_recognizers(parent: nil, page_size: nil, page_token: nil, show_deleted: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Speech::V2::Recognizer>

Lists Recognizers.

Overloads:

  • #list_recognizers(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Speech::V2::Recognizer>

    Pass arguments to list_recognizers via a request object, either of type ListRecognizersRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Speech::V2::ListRecognizersRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #list_recognizers(parent: nil, page_size: nil, page_token: nil, show_deleted: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Speech::V2::Recognizer>

    Pass arguments to list_recognizers 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) (defaults to: nil)

      Required. The project and location of Recognizers to list. The expected format is projects/{project}/locations/{location}.

    • page_size (::Integer) (defaults to: nil)

      The maximum number of Recognizers to return. The service may return fewer than this value. If unspecified, at most 20 Recognizers will be returned. The maximum value is 20; values above 20 will be coerced to 20.

    • page_token (::String) (defaults to: nil)

      A page token, received from a previous ListRecognizers call. Provide this to retrieve the subsequent page.

      When paginating, all other parameters provided to ListRecognizers must match the call that provided the page token.

    • show_deleted (::Boolean) (defaults to: nil)

      Whether, or not, to show resources that have been deleted.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
# File 'lib/google/cloud/speech/v2/speech/rest/client.rb', line 288

def list_recognizers request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V2::ListRecognizersRequest

  # 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
   = @config.rpcs.list_recognizers..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Speech::V2::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @speech_stub.list_recognizers request, options do |result, operation|
    result = ::Gapic::Rest::PagedEnumerable.new @speech_stub, :list_recognizers, "recognizers", request, result, options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#recognize(request, options = nil) ⇒ ::Google::Cloud::Speech::V2::RecognizeResponse #recognize(recognizer: nil, config: nil, config_mask: nil, content: nil, uri: nil) ⇒ ::Google::Cloud::Speech::V2::RecognizeResponse

Performs synchronous Speech recognition: receive results after all audio has been sent and processed.

Overloads:

  • #recognize(request, options = nil) ⇒ ::Google::Cloud::Speech::V2::RecognizeResponse

    Pass arguments to recognize via a request object, either of type RecognizeRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Speech::V2::RecognizeRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #recognize(recognizer: nil, config: nil, config_mask: nil, content: nil, uri: nil) ⇒ ::Google::Cloud::Speech::V2::RecognizeResponse

    Pass arguments to recognize 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:

    • recognizer (::String) (defaults to: nil)

      Required. The name of the Recognizer to use during recognition. The expected format is projects/{project}/locations/{location}/recognizers/{recognizer}.

    • config (::Google::Cloud::Speech::V2::RecognitionConfig, ::Hash) (defaults to: nil)

      Features and audio metadata to use for the Automatic Speech Recognition. This field in combination with the config_mask field can be used to override parts of the default_recognition_config of the Recognizer resource.

    • config_mask (::Google::Protobuf::FieldMask, ::Hash) (defaults to: nil)

      The list of fields in config that override the values in the default_recognition_config of the recognizer during this recognition request. If no mask is provided, all non-default valued fields in config override the values in the recognizer for this recognition request. If a mask is provided, only the fields listed in the mask override the config in the recognizer for this recognition request. If a wildcard (*) is provided, config completely overrides and replaces the config in the recognizer for this recognition request.

    • content (::String) (defaults to: nil)

      The audio data bytes encoded as specified in RecognitionConfig. As with all bytes fields, proto buffers use a pure binary representation, whereas JSON representations use base64.

    • uri (::String) (defaults to: nil)

      URI that points to a file that contains audio data bytes as specified in RecognitionConfig. The file must not be compressed (for example, gzip). Currently, only Google Cloud Storage URIs are supported, which must be specified in the following format: gs://bucket_name/object_name (other URI formats return [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information, see Request URIs.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
# File 'lib/google/cloud/speech/v2/speech/rest/client.rb', line 672

def recognize request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V2::RecognizeRequest

  # 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
   = @config.rpcs.recognize..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Speech::V2::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @speech_stub.recognize request, options do |result, operation|
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#undelete_custom_class(request, options = nil) ⇒ ::Gapic::Operation #undelete_custom_class(name: nil, validate_only: nil, etag: nil) ⇒ ::Gapic::Operation

Undeletes the CustomClass.

Overloads:

  • #undelete_custom_class(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to undelete_custom_class via a request object, either of type UndeleteCustomClassRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Speech::V2::UndeleteCustomClassRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #undelete_custom_class(name: nil, validate_only: nil, etag: nil) ⇒ ::Gapic::Operation

    Pass arguments to undelete_custom_class via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The name of the CustomClass to undelete. Format: projects/{project}/locations/{location}/customClasses/{custom_class}

    • validate_only (::Boolean) (defaults to: nil)

      If set, validate the request and preview the undeleted CustomClass, but do not actually undelete it.

    • etag (::String) (defaults to: nil)

      This checksum is computed by the server based on the value of other fields. This may be sent on update, undelete, and delete requests to ensure the client has an up-to-date value before proceeding.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
# File 'lib/google/cloud/speech/v2/speech/rest/client.rb', line 1331

def undelete_custom_class request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V2::UndeleteCustomClassRequest

  # 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
   = @config.rpcs.undelete_custom_class..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Speech::V2::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @speech_stub.undelete_custom_class request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#undelete_phrase_set(request, options = nil) ⇒ ::Gapic::Operation #undelete_phrase_set(name: nil, validate_only: nil, etag: nil) ⇒ ::Gapic::Operation

Undeletes the PhraseSet.

Overloads:

  • #undelete_phrase_set(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to undelete_phrase_set via a request object, either of type UndeletePhraseSetRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Speech::V2::UndeletePhraseSetRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #undelete_phrase_set(name: nil, validate_only: nil, etag: nil) ⇒ ::Gapic::Operation

    Pass arguments to undelete_phrase_set via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The name of the PhraseSet to undelete. Format: projects/{project}/locations/{location}/phraseSets/{phrase_set}

    • validate_only (::Boolean) (defaults to: nil)

      If set, validate the request and preview the undeleted PhraseSet, but do not actually undelete it.

    • etag (::String) (defaults to: nil)

      This checksum is computed by the server based on the value of other fields. This may be sent on update, undelete, and delete requests to ensure the client has an up-to-date value before proceeding.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
# File 'lib/google/cloud/speech/v2/speech/rest/client.rb', line 1765

def undelete_phrase_set request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V2::UndeletePhraseSetRequest

  # 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
   = @config.rpcs.undelete_phrase_set..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Speech::V2::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @speech_stub.undelete_phrase_set request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#undelete_recognizer(request, options = nil) ⇒ ::Gapic::Operation #undelete_recognizer(name: nil, validate_only: nil, etag: nil) ⇒ ::Gapic::Operation

Undeletes the Recognizer.

Overloads:

  • #undelete_recognizer(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to undelete_recognizer via a request object, either of type UndeleteRecognizerRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Speech::V2::UndeleteRecognizerRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #undelete_recognizer(name: nil, validate_only: nil, etag: nil) ⇒ ::Gapic::Operation

    Pass arguments to undelete_recognizer via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The name of the Recognizer to undelete. Format: projects/{project}/locations/{location}/recognizers/{recognizer}

    • validate_only (::Boolean) (defaults to: nil)

      If set, validate the request and preview the undeleted Recognizer, but do not actually undelete it.

    • etag (::String) (defaults to: nil)

      This checksum is computed by the server based on the value of other fields. This may be sent on update, undelete, and delete requests to ensure the client has an up-to-date value before proceeding.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
# File 'lib/google/cloud/speech/v2/speech/rest/client.rb', line 571

def undelete_recognizer request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V2::UndeleteRecognizerRequest

  # 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
   = @config.rpcs.undelete_recognizer..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Speech::V2::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @speech_stub.undelete_recognizer request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#update_config(request, options = nil) ⇒ ::Google::Cloud::Speech::V2::Config #update_config(config: nil, update_mask: nil) ⇒ ::Google::Cloud::Speech::V2::Config

Updates the Config.

Overloads:

  • #update_config(request, options = nil) ⇒ ::Google::Cloud::Speech::V2::Config

    Pass arguments to update_config via a request object, either of type UpdateConfigRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Speech::V2::UpdateConfigRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #update_config(config: nil, update_mask: nil) ⇒ ::Google::Cloud::Speech::V2::Config

    Pass arguments to update_config 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:

    • config (::Google::Cloud::Speech::V2::Config, ::Hash) (defaults to: nil)

      Required. The config to update.

      The config's name field is used to identify the config to be updated. The expected format is projects/{project}/locations/{location}/config.

    • update_mask (::Google::Protobuf::FieldMask, ::Hash) (defaults to: nil)

      The list of fields to be updated.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
# File 'lib/google/cloud/speech/v2/speech/rest/client.rb', line 894

def update_config request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V2::UpdateConfigRequest

  # 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
   = @config.rpcs.update_config..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Speech::V2::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @speech_stub.update_config request, options do |result, operation|
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#update_custom_class(request, options = nil) ⇒ ::Gapic::Operation #update_custom_class(custom_class: nil, update_mask: nil, validate_only: nil) ⇒ ::Gapic::Operation

Updates the CustomClass.

Overloads:

  • #update_custom_class(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to update_custom_class via a request object, either of type UpdateCustomClassRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Speech::V2::UpdateCustomClassRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #update_custom_class(custom_class: nil, update_mask: nil, validate_only: nil) ⇒ ::Gapic::Operation

    Pass arguments to update_custom_class 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:

    • custom_class (::Google::Cloud::Speech::V2::CustomClass, ::Hash) (defaults to: nil)

      Required. The CustomClass to update.

      The CustomClass's name field is used to identify the CustomClass to update. Format: projects/{project}/locations/{location}/customClasses/{custom_class}.

    • update_mask (::Google::Protobuf::FieldMask, ::Hash) (defaults to: nil)

      The list of fields to be updated. If empty, all fields are considered for update.

    • validate_only (::Boolean) (defaults to: nil)

      If set, validate the request and preview the updated CustomClass, but do not actually update it.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
# File 'lib/google/cloud/speech/v2/speech/rest/client.rb', line 1184

def update_custom_class request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V2::UpdateCustomClassRequest

  # 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
   = @config.rpcs.update_custom_class..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Speech::V2::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @speech_stub.update_custom_class request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#update_phrase_set(request, options = nil) ⇒ ::Gapic::Operation #update_phrase_set(phrase_set: nil, update_mask: nil, validate_only: nil) ⇒ ::Gapic::Operation

Updates the PhraseSet.

Overloads:

  • #update_phrase_set(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to update_phrase_set via a request object, either of type UpdatePhraseSetRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Speech::V2::UpdatePhraseSetRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #update_phrase_set(phrase_set: nil, update_mask: nil, validate_only: nil) ⇒ ::Gapic::Operation

    Pass arguments to update_phrase_set 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:

    • phrase_set (::Google::Cloud::Speech::V2::PhraseSet, ::Hash) (defaults to: nil)

      Required. The PhraseSet to update.

      The PhraseSet's name field is used to identify the PhraseSet to update. Format: projects/{project}/locations/{location}/phraseSets/{phrase_set}.

    • update_mask (::Google::Protobuf::FieldMask, ::Hash) (defaults to: nil)

      The list of fields to update. If empty, all non-default valued fields are considered for update. Use * to update the entire PhraseSet resource.

    • validate_only (::Boolean) (defaults to: nil)

      If set, validate the request and preview the updated PhraseSet, but do not actually update it.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
# File 'lib/google/cloud/speech/v2/speech/rest/client.rb', line 1620

def update_phrase_set request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V2::UpdatePhraseSetRequest

  # 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
   = @config.rpcs.update_phrase_set..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Speech::V2::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @speech_stub.update_phrase_set request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#update_recognizer(request, options = nil) ⇒ ::Gapic::Operation #update_recognizer(recognizer: nil, update_mask: nil, validate_only: nil) ⇒ ::Gapic::Operation

Updates the Recognizer.

Overloads:

  • #update_recognizer(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to update_recognizer via a request object, either of type UpdateRecognizerRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Speech::V2::UpdateRecognizerRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #update_recognizer(recognizer: nil, update_mask: nil, validate_only: nil) ⇒ ::Gapic::Operation

    Pass arguments to update_recognizer 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:

    • recognizer (::Google::Cloud::Speech::V2::Recognizer, ::Hash) (defaults to: nil)

      Required. The Recognizer to update.

      The Recognizer's name field is used to identify the Recognizer to update. Format: projects/{project}/locations/{location}/recognizers/{recognizer}.

    • update_mask (::Google::Protobuf::FieldMask, ::Hash) (defaults to: nil)

      The list of fields to update. If empty, all non-default valued fields are considered for update. Use * to update the entire Recognizer resource.

    • validate_only (::Boolean) (defaults to: nil)

      If set, validate the request and preview the updated Recognizer, but do not actually update it.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
# File 'lib/google/cloud/speech/v2/speech/rest/client.rb', line 426

def update_recognizer request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V2::UpdateRecognizerRequest

  # 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
   = @config.rpcs.update_recognizer..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Speech::V2::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @speech_stub.update_recognizer request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end