google-cloud-speech-v1p1beta1 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6590a69cb7eaa25baef7d7c0bd3e5b09050f7adc12ffe09a82ae73000183dca4
4
- data.tar.gz: 6bb3ef14c493cbaef365b6d7bc91231d2c93746f69760f64f2e5bfd222a814a7
3
+ metadata.gz: bb2c20feb0fcea4269317875af66b9b916f64ba514c9e9cacf3308edb1335050
4
+ data.tar.gz: d550c0466ce5f9601c4ae18dc69dc831d302822eb9033ddb32201e8d84e341ea
5
5
  SHA512:
6
- metadata.gz: 6b17f8d69510b0934d4bf71aa64c686a68dc516abc24dbc00d165b474367eb4d28baecf25652ea183b596115894c38813c6d490f938529101e11b0bdae8d6548
7
- data.tar.gz: 2b34c8afb313e22a2699e7327aab0c094af9001f23d5ce7dcce78d0cc9254c33a61f665349476ce7cd70f8f7add58dfb87d522940313522e00d1394b0fcdc470
6
+ metadata.gz: cdff08a4bb312a35413a4ca27090e407f95a45a2bff1afe8d9e9a788c3b8def303fc4d48bcb94bc693323d7fdfa8e38eabace70e1f3572cff8cd2b19139edc8a
7
+ data.tar.gz: 6f1502a8bf30159371eb6c4329687a1838af8666fa7313b77fb0b64c99d491009b7ec063a2ccbe64a052fca99b99a72de96641ca666e757676f946e70deaba41
@@ -17,6 +17,7 @@
17
17
  # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
18
 
19
19
  require "google/cloud/speech/v1p1beta1/speech"
20
+ require "google/cloud/speech/v1p1beta1/adaptation"
20
21
  require "google/cloud/speech/v1p1beta1/version"
21
22
 
22
23
  module Google
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "gapic/common"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/speech/v1p1beta1/version"
24
+
25
+ require "google/cloud/speech/v1p1beta1/adaptation/credentials"
26
+ require "google/cloud/speech/v1p1beta1/adaptation/paths"
27
+ require "google/cloud/speech/v1p1beta1/adaptation/client"
28
+
29
+ module Google
30
+ module Cloud
31
+ module Speech
32
+ module V1p1beta1
33
+ ##
34
+ # Service that implements Google Cloud Speech Adaptation API.
35
+ #
36
+ # To load this service and instantiate a client:
37
+ #
38
+ # require "google/cloud/speech/v1p1beta1/adaptation"
39
+ # client = ::Google::Cloud::Speech::V1p1beta1::Adaptation::Client.new
40
+ #
41
+ module Adaptation
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+
48
+ helper_path = ::File.join __dir__, "adaptation", "helpers.rb"
49
+ require "google/cloud/speech/v1p1beta1/adaptation/helpers" if ::File.file? helper_path
@@ -0,0 +1,1102 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/cloud/speech/v1p1beta1/cloud_speech_adaptation_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Speech
25
+ module V1p1beta1
26
+ module Adaptation
27
+ ##
28
+ # Client for the Adaptation service.
29
+ #
30
+ # Service that implements Google Cloud Speech Adaptation API.
31
+ #
32
+ class Client
33
+ include Paths
34
+
35
+ # @private
36
+ attr_reader :adaptation_stub
37
+
38
+ ##
39
+ # Configure the Adaptation Client class.
40
+ #
41
+ # See {::Google::Cloud::Speech::V1p1beta1::Adaptation::Client::Configuration}
42
+ # for a description of the configuration fields.
43
+ #
44
+ # ## Example
45
+ #
46
+ # To modify the configuration for all Adaptation clients:
47
+ #
48
+ # ::Google::Cloud::Speech::V1p1beta1::Adaptation::Client.configure do |config|
49
+ # config.timeout = 10.0
50
+ # end
51
+ #
52
+ # @yield [config] Configure the Client client.
53
+ # @yieldparam config [Client::Configuration]
54
+ #
55
+ # @return [Client::Configuration]
56
+ #
57
+ def self.configure
58
+ @configure ||= begin
59
+ namespace = ["Google", "Cloud", "Speech", "V1p1beta1"]
60
+ parent_config = while namespace.any?
61
+ parent_name = namespace.join "::"
62
+ parent_const = const_get parent_name
63
+ break parent_const.configure if parent_const&.respond_to? :configure
64
+ namespace.pop
65
+ end
66
+ default_config = Client::Configuration.new parent_config
67
+
68
+ default_config
69
+ end
70
+ yield @configure if block_given?
71
+ @configure
72
+ end
73
+
74
+ ##
75
+ # Configure the Adaptation Client instance.
76
+ #
77
+ # The configuration is set to the derived mode, meaning that values can be changed,
78
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
79
+ # should be made on {Client.configure}.
80
+ #
81
+ # See {::Google::Cloud::Speech::V1p1beta1::Adaptation::Client::Configuration}
82
+ # for a description of the configuration fields.
83
+ #
84
+ # @yield [config] Configure the Client client.
85
+ # @yieldparam config [Client::Configuration]
86
+ #
87
+ # @return [Client::Configuration]
88
+ #
89
+ def configure
90
+ yield @config if block_given?
91
+ @config
92
+ end
93
+
94
+ ##
95
+ # Create a new Adaptation client object.
96
+ #
97
+ # ## Examples
98
+ #
99
+ # To create a new Adaptation client with the default
100
+ # configuration:
101
+ #
102
+ # client = ::Google::Cloud::Speech::V1p1beta1::Adaptation::Client.new
103
+ #
104
+ # To create a new Adaptation client with a custom
105
+ # configuration:
106
+ #
107
+ # client = ::Google::Cloud::Speech::V1p1beta1::Adaptation::Client.new do |config|
108
+ # config.timeout = 10.0
109
+ # end
110
+ #
111
+ # @yield [config] Configure the Adaptation client.
112
+ # @yieldparam config [Client::Configuration]
113
+ #
114
+ def initialize
115
+ # These require statements are intentionally placed here to initialize
116
+ # the gRPC module only when it's required.
117
+ # See https://github.com/googleapis/toolkit/issues/446
118
+ require "gapic/grpc"
119
+ require "google/cloud/speech/v1p1beta1/cloud_speech_adaptation_services_pb"
120
+
121
+ # Create the configuration object
122
+ @config = Configuration.new Client.configure
123
+
124
+ # Yield the configuration if needed
125
+ yield @config if block_given?
126
+
127
+ # Create credentials
128
+ credentials = @config.credentials
129
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
130
+ # but only if the default endpoint does not have a region prefix.
131
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
132
+ @config.endpoint == Client.configure.endpoint &&
133
+ !@config.endpoint.split(".").first.include?("-")
134
+ credentials ||= Credentials.default scope: @config.scope,
135
+ enable_self_signed_jwt: enable_self_signed_jwt
136
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
137
+ credentials = Credentials.new credentials, scope: @config.scope
138
+ end
139
+ @quota_project_id = @config.quota_project
140
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
141
+
142
+ @adaptation_stub = ::Gapic::ServiceStub.new(
143
+ ::Google::Cloud::Speech::V1p1beta1::Adaptation::Stub,
144
+ credentials: credentials,
145
+ endpoint: @config.endpoint,
146
+ channel_args: @config.channel_args,
147
+ interceptors: @config.interceptors
148
+ )
149
+ end
150
+
151
+ # Service calls
152
+
153
+ ##
154
+ # Create a set of phrase hints. Each item in the set can be a single word or
155
+ # a multi-word phrase. The items in the PhraseSet are favored by the
156
+ # recognition model when you send a call that includes the PhraseSet.
157
+ #
158
+ # @overload create_phrase_set(request, options = nil)
159
+ # Pass arguments to `create_phrase_set` via a request object, either of type
160
+ # {::Google::Cloud::Speech::V1p1beta1::CreatePhraseSetRequest} or an equivalent Hash.
161
+ #
162
+ # @param request [::Google::Cloud::Speech::V1p1beta1::CreatePhraseSetRequest, ::Hash]
163
+ # A request object representing the call parameters. Required. To specify no
164
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
165
+ # @param options [::Gapic::CallOptions, ::Hash]
166
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
167
+ #
168
+ # @overload create_phrase_set(parent: nil, phrase_set_id: nil, phrase_set: nil)
169
+ # Pass arguments to `create_phrase_set` via keyword arguments. Note that at
170
+ # least one keyword argument is required. To specify no parameters, or to keep all
171
+ # the default parameter values, pass an empty Hash as a request object (see above).
172
+ #
173
+ # @param parent [::String]
174
+ # Required. The parent resource where this phrase set will be created.
175
+ # Format:
176
+ # \\{api_version}/projects/\\{project}/locations/\\{location}/phraseSets
177
+ # @param phrase_set_id [::String]
178
+ # The ID to use for the phrase set, which will become the final
179
+ # component of the phrase set's resource name.
180
+ #
181
+ # This value should be 4-63 characters, and valid characters
182
+ # are /[a-z][0-9]-/.
183
+ # @param phrase_set [::Google::Cloud::Speech::V1p1beta1::PhraseSet, ::Hash]
184
+ # Required. The phrase set to create.
185
+ #
186
+ # @yield [response, operation] Access the result along with the RPC operation
187
+ # @yieldparam response [::Google::Cloud::Speech::V1p1beta1::PhraseSet]
188
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
189
+ #
190
+ # @return [::Google::Cloud::Speech::V1p1beta1::PhraseSet]
191
+ #
192
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
193
+ #
194
+ def create_phrase_set request, options = nil
195
+ raise ::ArgumentError, "request must be provided" if request.nil?
196
+
197
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V1p1beta1::CreatePhraseSetRequest
198
+
199
+ # Converts hash and nil to an options object
200
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
201
+
202
+ # Customize the options with defaults
203
+ metadata = @config.rpcs.create_phrase_set.metadata.to_h
204
+
205
+ # Set x-goog-api-client and x-goog-user-project headers
206
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
207
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
208
+ gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
209
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
210
+
211
+ header_params = {
212
+ "parent" => request.parent
213
+ }
214
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
215
+ metadata[:"x-goog-request-params"] ||= request_params_header
216
+
217
+ options.apply_defaults timeout: @config.rpcs.create_phrase_set.timeout,
218
+ metadata: metadata,
219
+ retry_policy: @config.rpcs.create_phrase_set.retry_policy
220
+ options.apply_defaults metadata: @config.metadata,
221
+ retry_policy: @config.retry_policy
222
+
223
+ @adaptation_stub.call_rpc :create_phrase_set, request, options: options do |response, operation|
224
+ yield response, operation if block_given?
225
+ return response
226
+ end
227
+ rescue ::GRPC::BadStatus => e
228
+ raise ::Google::Cloud::Error.from_error(e)
229
+ end
230
+
231
+ ##
232
+ # Get a phrase set.
233
+ #
234
+ # @overload get_phrase_set(request, options = nil)
235
+ # Pass arguments to `get_phrase_set` via a request object, either of type
236
+ # {::Google::Cloud::Speech::V1p1beta1::GetPhraseSetRequest} or an equivalent Hash.
237
+ #
238
+ # @param request [::Google::Cloud::Speech::V1p1beta1::GetPhraseSetRequest, ::Hash]
239
+ # A request object representing the call parameters. Required. To specify no
240
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
241
+ # @param options [::Gapic::CallOptions, ::Hash]
242
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
243
+ #
244
+ # @overload get_phrase_set(name: nil)
245
+ # Pass arguments to `get_phrase_set` via keyword arguments. Note that at
246
+ # least one keyword argument is required. To specify no parameters, or to keep all
247
+ # the default parameter values, pass an empty Hash as a request object (see above).
248
+ #
249
+ # @param name [::String]
250
+ # Required. The name of the phrase set to retrieve.
251
+ # Format:
252
+ # \\{api_version}/projects/\\{project}/locations/\\{location}/phraseSets/\\{phrase_set}
253
+ #
254
+ # @yield [response, operation] Access the result along with the RPC operation
255
+ # @yieldparam response [::Google::Cloud::Speech::V1p1beta1::PhraseSet]
256
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
257
+ #
258
+ # @return [::Google::Cloud::Speech::V1p1beta1::PhraseSet]
259
+ #
260
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
261
+ #
262
+ def get_phrase_set request, options = nil
263
+ raise ::ArgumentError, "request must be provided" if request.nil?
264
+
265
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V1p1beta1::GetPhraseSetRequest
266
+
267
+ # Converts hash and nil to an options object
268
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
269
+
270
+ # Customize the options with defaults
271
+ metadata = @config.rpcs.get_phrase_set.metadata.to_h
272
+
273
+ # Set x-goog-api-client and x-goog-user-project headers
274
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
275
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
276
+ gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
277
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
278
+
279
+ header_params = {
280
+ "name" => request.name
281
+ }
282
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
283
+ metadata[:"x-goog-request-params"] ||= request_params_header
284
+
285
+ options.apply_defaults timeout: @config.rpcs.get_phrase_set.timeout,
286
+ metadata: metadata,
287
+ retry_policy: @config.rpcs.get_phrase_set.retry_policy
288
+ options.apply_defaults metadata: @config.metadata,
289
+ retry_policy: @config.retry_policy
290
+
291
+ @adaptation_stub.call_rpc :get_phrase_set, request, options: options do |response, operation|
292
+ yield response, operation if block_given?
293
+ return response
294
+ end
295
+ rescue ::GRPC::BadStatus => e
296
+ raise ::Google::Cloud::Error.from_error(e)
297
+ end
298
+
299
+ ##
300
+ # List phrase sets.
301
+ #
302
+ # @overload list_phrase_set(request, options = nil)
303
+ # Pass arguments to `list_phrase_set` via a request object, either of type
304
+ # {::Google::Cloud::Speech::V1p1beta1::ListPhraseSetRequest} or an equivalent Hash.
305
+ #
306
+ # @param request [::Google::Cloud::Speech::V1p1beta1::ListPhraseSetRequest, ::Hash]
307
+ # A request object representing the call parameters. Required. To specify no
308
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
309
+ # @param options [::Gapic::CallOptions, ::Hash]
310
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
311
+ #
312
+ # @overload list_phrase_set(parent: nil, page_size: nil, page_token: nil)
313
+ # Pass arguments to `list_phrase_set` via keyword arguments. Note that at
314
+ # least one keyword argument is required. To specify no parameters, or to keep all
315
+ # the default parameter values, pass an empty Hash as a request object (see above).
316
+ #
317
+ # @param parent [::String]
318
+ # Required. The parent, which owns this collection of phrase set.
319
+ # Format:
320
+ # projects/\\{project}/locations/\\{location}
321
+ # @param page_size [::Integer]
322
+ # The maximum number of phrase sets to return. The service may return
323
+ # fewer than this value. If unspecified, at most 50 phrase sets will be
324
+ # returned. The maximum value is 1000; values above 1000 will be coerced to
325
+ # 1000.
326
+ # @param page_token [::String]
327
+ # A page token, received from a previous `ListPhraseSet` call.
328
+ # Provide this to retrieve the subsequent page.
329
+ #
330
+ # When paginating, all other parameters provided to `ListPhraseSet` must
331
+ # match the call that provided the page token.
332
+ #
333
+ # @yield [response, operation] Access the result along with the RPC operation
334
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Speech::V1p1beta1::PhraseSet>]
335
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
336
+ #
337
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Speech::V1p1beta1::PhraseSet>]
338
+ #
339
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
340
+ #
341
+ def list_phrase_set request, options = nil
342
+ raise ::ArgumentError, "request must be provided" if request.nil?
343
+
344
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V1p1beta1::ListPhraseSetRequest
345
+
346
+ # Converts hash and nil to an options object
347
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
348
+
349
+ # Customize the options with defaults
350
+ metadata = @config.rpcs.list_phrase_set.metadata.to_h
351
+
352
+ # Set x-goog-api-client and x-goog-user-project headers
353
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
354
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
355
+ gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
356
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
357
+
358
+ header_params = {
359
+ "parent" => request.parent
360
+ }
361
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
362
+ metadata[:"x-goog-request-params"] ||= request_params_header
363
+
364
+ options.apply_defaults timeout: @config.rpcs.list_phrase_set.timeout,
365
+ metadata: metadata,
366
+ retry_policy: @config.rpcs.list_phrase_set.retry_policy
367
+ options.apply_defaults metadata: @config.metadata,
368
+ retry_policy: @config.retry_policy
369
+
370
+ @adaptation_stub.call_rpc :list_phrase_set, request, options: options do |response, operation|
371
+ response = ::Gapic::PagedEnumerable.new @adaptation_stub, :list_phrase_set, request, response, operation, options
372
+ yield response, operation if block_given?
373
+ return response
374
+ end
375
+ rescue ::GRPC::BadStatus => e
376
+ raise ::Google::Cloud::Error.from_error(e)
377
+ end
378
+
379
+ ##
380
+ # Update a phrase set.
381
+ #
382
+ # @overload update_phrase_set(request, options = nil)
383
+ # Pass arguments to `update_phrase_set` via a request object, either of type
384
+ # {::Google::Cloud::Speech::V1p1beta1::UpdatePhraseSetRequest} or an equivalent Hash.
385
+ #
386
+ # @param request [::Google::Cloud::Speech::V1p1beta1::UpdatePhraseSetRequest, ::Hash]
387
+ # A request object representing the call parameters. Required. To specify no
388
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
389
+ # @param options [::Gapic::CallOptions, ::Hash]
390
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
391
+ #
392
+ # @overload update_phrase_set(phrase_set: nil, update_mask: nil)
393
+ # Pass arguments to `update_phrase_set` via keyword arguments. Note that at
394
+ # least one keyword argument is required. To specify no parameters, or to keep all
395
+ # the default parameter values, pass an empty Hash as a request object (see above).
396
+ #
397
+ # @param phrase_set [::Google::Cloud::Speech::V1p1beta1::PhraseSet, ::Hash]
398
+ # Required. The phrase set to update.
399
+ #
400
+ # The phrase set's `name` field is used to identify the set to be
401
+ # updated. Format:
402
+ # \\{api_version}/projects/\\{project}/locations/\\{location}/phraseSets/\\{phrase_set}
403
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
404
+ # The list of fields to be updated.
405
+ #
406
+ # @yield [response, operation] Access the result along with the RPC operation
407
+ # @yieldparam response [::Google::Cloud::Speech::V1p1beta1::PhraseSet]
408
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
409
+ #
410
+ # @return [::Google::Cloud::Speech::V1p1beta1::PhraseSet]
411
+ #
412
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
413
+ #
414
+ def update_phrase_set request, options = nil
415
+ raise ::ArgumentError, "request must be provided" if request.nil?
416
+
417
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V1p1beta1::UpdatePhraseSetRequest
418
+
419
+ # Converts hash and nil to an options object
420
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
421
+
422
+ # Customize the options with defaults
423
+ metadata = @config.rpcs.update_phrase_set.metadata.to_h
424
+
425
+ # Set x-goog-api-client and x-goog-user-project headers
426
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
427
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
428
+ gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
429
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
430
+
431
+ header_params = {
432
+ "phrase_set.name" => request.phrase_set.name
433
+ }
434
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
435
+ metadata[:"x-goog-request-params"] ||= request_params_header
436
+
437
+ options.apply_defaults timeout: @config.rpcs.update_phrase_set.timeout,
438
+ metadata: metadata,
439
+ retry_policy: @config.rpcs.update_phrase_set.retry_policy
440
+ options.apply_defaults metadata: @config.metadata,
441
+ retry_policy: @config.retry_policy
442
+
443
+ @adaptation_stub.call_rpc :update_phrase_set, request, options: options do |response, operation|
444
+ yield response, operation if block_given?
445
+ return response
446
+ end
447
+ rescue ::GRPC::BadStatus => e
448
+ raise ::Google::Cloud::Error.from_error(e)
449
+ end
450
+
451
+ ##
452
+ # Delete a phrase set.
453
+ #
454
+ # @overload delete_phrase_set(request, options = nil)
455
+ # Pass arguments to `delete_phrase_set` via a request object, either of type
456
+ # {::Google::Cloud::Speech::V1p1beta1::DeletePhraseSetRequest} or an equivalent Hash.
457
+ #
458
+ # @param request [::Google::Cloud::Speech::V1p1beta1::DeletePhraseSetRequest, ::Hash]
459
+ # A request object representing the call parameters. Required. To specify no
460
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
461
+ # @param options [::Gapic::CallOptions, ::Hash]
462
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
463
+ #
464
+ # @overload delete_phrase_set(name: nil)
465
+ # Pass arguments to `delete_phrase_set` via keyword arguments. Note that at
466
+ # least one keyword argument is required. To specify no parameters, or to keep all
467
+ # the default parameter values, pass an empty Hash as a request object (see above).
468
+ #
469
+ # @param name [::String]
470
+ # Required. The name of the phrase set to delete.
471
+ # Format:
472
+ # \\{api_version}/projects/\\{project}/locations/\\{location}/phraseSets/\\{phrase_set}
473
+ #
474
+ # @yield [response, operation] Access the result along with the RPC operation
475
+ # @yieldparam response [::Google::Protobuf::Empty]
476
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
477
+ #
478
+ # @return [::Google::Protobuf::Empty]
479
+ #
480
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
481
+ #
482
+ def delete_phrase_set request, options = nil
483
+ raise ::ArgumentError, "request must be provided" if request.nil?
484
+
485
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V1p1beta1::DeletePhraseSetRequest
486
+
487
+ # Converts hash and nil to an options object
488
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
489
+
490
+ # Customize the options with defaults
491
+ metadata = @config.rpcs.delete_phrase_set.metadata.to_h
492
+
493
+ # Set x-goog-api-client and x-goog-user-project headers
494
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
495
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
496
+ gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
497
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
498
+
499
+ header_params = {
500
+ "name" => request.name
501
+ }
502
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
503
+ metadata[:"x-goog-request-params"] ||= request_params_header
504
+
505
+ options.apply_defaults timeout: @config.rpcs.delete_phrase_set.timeout,
506
+ metadata: metadata,
507
+ retry_policy: @config.rpcs.delete_phrase_set.retry_policy
508
+ options.apply_defaults metadata: @config.metadata,
509
+ retry_policy: @config.retry_policy
510
+
511
+ @adaptation_stub.call_rpc :delete_phrase_set, request, options: options do |response, operation|
512
+ yield response, operation if block_given?
513
+ return response
514
+ end
515
+ rescue ::GRPC::BadStatus => e
516
+ raise ::Google::Cloud::Error.from_error(e)
517
+ end
518
+
519
+ ##
520
+ # Create a custom class.
521
+ #
522
+ # @overload create_custom_class(request, options = nil)
523
+ # Pass arguments to `create_custom_class` via a request object, either of type
524
+ # {::Google::Cloud::Speech::V1p1beta1::CreateCustomClassRequest} or an equivalent Hash.
525
+ #
526
+ # @param request [::Google::Cloud::Speech::V1p1beta1::CreateCustomClassRequest, ::Hash]
527
+ # A request object representing the call parameters. Required. To specify no
528
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
529
+ # @param options [::Gapic::CallOptions, ::Hash]
530
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
531
+ #
532
+ # @overload create_custom_class(parent: nil, custom_class_id: nil, custom_class: nil)
533
+ # Pass arguments to `create_custom_class` via keyword arguments. Note that at
534
+ # least one keyword argument is required. To specify no parameters, or to keep all
535
+ # the default parameter values, pass an empty Hash as a request object (see above).
536
+ #
537
+ # @param parent [::String]
538
+ # Required. The parent resource where this custom class will be created.
539
+ # Format:
540
+ # \\{api_version}/projects/\\{project}/locations/\\{location}/customClasses
541
+ # @param custom_class_id [::String]
542
+ # The ID to use for the custom class, which will become the final
543
+ # component of the custom class' resource name.
544
+ #
545
+ # This value should be 4-63 characters, and valid characters
546
+ # are /[a-z][0-9]-/.
547
+ # @param custom_class [::Google::Cloud::Speech::V1p1beta1::CustomClass, ::Hash]
548
+ # Required. The custom class to create.
549
+ #
550
+ # @yield [response, operation] Access the result along with the RPC operation
551
+ # @yieldparam response [::Google::Cloud::Speech::V1p1beta1::CustomClass]
552
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
553
+ #
554
+ # @return [::Google::Cloud::Speech::V1p1beta1::CustomClass]
555
+ #
556
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
557
+ #
558
+ def create_custom_class request, options = nil
559
+ raise ::ArgumentError, "request must be provided" if request.nil?
560
+
561
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V1p1beta1::CreateCustomClassRequest
562
+
563
+ # Converts hash and nil to an options object
564
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
565
+
566
+ # Customize the options with defaults
567
+ metadata = @config.rpcs.create_custom_class.metadata.to_h
568
+
569
+ # Set x-goog-api-client and x-goog-user-project headers
570
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
571
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
572
+ gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
573
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
574
+
575
+ header_params = {
576
+ "parent" => request.parent
577
+ }
578
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
579
+ metadata[:"x-goog-request-params"] ||= request_params_header
580
+
581
+ options.apply_defaults timeout: @config.rpcs.create_custom_class.timeout,
582
+ metadata: metadata,
583
+ retry_policy: @config.rpcs.create_custom_class.retry_policy
584
+ options.apply_defaults metadata: @config.metadata,
585
+ retry_policy: @config.retry_policy
586
+
587
+ @adaptation_stub.call_rpc :create_custom_class, request, options: options do |response, operation|
588
+ yield response, operation if block_given?
589
+ return response
590
+ end
591
+ rescue ::GRPC::BadStatus => e
592
+ raise ::Google::Cloud::Error.from_error(e)
593
+ end
594
+
595
+ ##
596
+ # Get a custom class.
597
+ #
598
+ # @overload get_custom_class(request, options = nil)
599
+ # Pass arguments to `get_custom_class` via a request object, either of type
600
+ # {::Google::Cloud::Speech::V1p1beta1::GetCustomClassRequest} or an equivalent Hash.
601
+ #
602
+ # @param request [::Google::Cloud::Speech::V1p1beta1::GetCustomClassRequest, ::Hash]
603
+ # A request object representing the call parameters. Required. To specify no
604
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
605
+ # @param options [::Gapic::CallOptions, ::Hash]
606
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
607
+ #
608
+ # @overload get_custom_class(name: nil)
609
+ # Pass arguments to `get_custom_class` via keyword arguments. Note that at
610
+ # least one keyword argument is required. To specify no parameters, or to keep all
611
+ # the default parameter values, pass an empty Hash as a request object (see above).
612
+ #
613
+ # @param name [::String]
614
+ # Required. The name of the custom class to retrieve.
615
+ # Format:
616
+ # \\{api_version}/projects/\\{project}/locations/\\{location}/customClasses/\\{custom_class}
617
+ #
618
+ # @yield [response, operation] Access the result along with the RPC operation
619
+ # @yieldparam response [::Google::Cloud::Speech::V1p1beta1::CustomClass]
620
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
621
+ #
622
+ # @return [::Google::Cloud::Speech::V1p1beta1::CustomClass]
623
+ #
624
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
625
+ #
626
+ def get_custom_class request, options = nil
627
+ raise ::ArgumentError, "request must be provided" if request.nil?
628
+
629
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V1p1beta1::GetCustomClassRequest
630
+
631
+ # Converts hash and nil to an options object
632
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
633
+
634
+ # Customize the options with defaults
635
+ metadata = @config.rpcs.get_custom_class.metadata.to_h
636
+
637
+ # Set x-goog-api-client and x-goog-user-project headers
638
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
639
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
640
+ gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
641
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
642
+
643
+ header_params = {
644
+ "name" => request.name
645
+ }
646
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
647
+ metadata[:"x-goog-request-params"] ||= request_params_header
648
+
649
+ options.apply_defaults timeout: @config.rpcs.get_custom_class.timeout,
650
+ metadata: metadata,
651
+ retry_policy: @config.rpcs.get_custom_class.retry_policy
652
+ options.apply_defaults metadata: @config.metadata,
653
+ retry_policy: @config.retry_policy
654
+
655
+ @adaptation_stub.call_rpc :get_custom_class, request, options: options do |response, operation|
656
+ yield response, operation if block_given?
657
+ return response
658
+ end
659
+ rescue ::GRPC::BadStatus => e
660
+ raise ::Google::Cloud::Error.from_error(e)
661
+ end
662
+
663
+ ##
664
+ # List custom classes.
665
+ #
666
+ # @overload list_custom_classes(request, options = nil)
667
+ # Pass arguments to `list_custom_classes` via a request object, either of type
668
+ # {::Google::Cloud::Speech::V1p1beta1::ListCustomClassesRequest} or an equivalent Hash.
669
+ #
670
+ # @param request [::Google::Cloud::Speech::V1p1beta1::ListCustomClassesRequest, ::Hash]
671
+ # A request object representing the call parameters. Required. To specify no
672
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
673
+ # @param options [::Gapic::CallOptions, ::Hash]
674
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
675
+ #
676
+ # @overload list_custom_classes(parent: nil, page_size: nil, page_token: nil)
677
+ # Pass arguments to `list_custom_classes` via keyword arguments. Note that at
678
+ # least one keyword argument is required. To specify no parameters, or to keep all
679
+ # the default parameter values, pass an empty Hash as a request object (see above).
680
+ #
681
+ # @param parent [::String]
682
+ # Required. The parent, which owns this collection of custom classes.
683
+ # Format:
684
+ # \\{api_version}/projects/\\{project}/locations/\\{location}/customClasses
685
+ # @param page_size [::Integer]
686
+ # The maximum number of custom classes to return. The service may return
687
+ # fewer than this value. If unspecified, at most 50 custom classes will be
688
+ # returned. The maximum value is 1000; values above 1000 will be coerced to
689
+ # 1000.
690
+ # @param page_token [::String]
691
+ # A page token, received from a previous `ListCustomClass` call.
692
+ # Provide this to retrieve the subsequent page.
693
+ #
694
+ # When paginating, all other parameters provided to `ListCustomClass` must
695
+ # match the call that provided the page token.
696
+ #
697
+ # @yield [response, operation] Access the result along with the RPC operation
698
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Speech::V1p1beta1::CustomClass>]
699
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
700
+ #
701
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Speech::V1p1beta1::CustomClass>]
702
+ #
703
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
704
+ #
705
+ def list_custom_classes request, options = nil
706
+ raise ::ArgumentError, "request must be provided" if request.nil?
707
+
708
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V1p1beta1::ListCustomClassesRequest
709
+
710
+ # Converts hash and nil to an options object
711
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
712
+
713
+ # Customize the options with defaults
714
+ metadata = @config.rpcs.list_custom_classes.metadata.to_h
715
+
716
+ # Set x-goog-api-client and x-goog-user-project headers
717
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
718
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
719
+ gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
720
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
721
+
722
+ header_params = {
723
+ "parent" => request.parent
724
+ }
725
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
726
+ metadata[:"x-goog-request-params"] ||= request_params_header
727
+
728
+ options.apply_defaults timeout: @config.rpcs.list_custom_classes.timeout,
729
+ metadata: metadata,
730
+ retry_policy: @config.rpcs.list_custom_classes.retry_policy
731
+ options.apply_defaults metadata: @config.metadata,
732
+ retry_policy: @config.retry_policy
733
+
734
+ @adaptation_stub.call_rpc :list_custom_classes, request, options: options do |response, operation|
735
+ response = ::Gapic::PagedEnumerable.new @adaptation_stub, :list_custom_classes, request, response, operation, options
736
+ yield response, operation if block_given?
737
+ return response
738
+ end
739
+ rescue ::GRPC::BadStatus => e
740
+ raise ::Google::Cloud::Error.from_error(e)
741
+ end
742
+
743
+ ##
744
+ # Update a custom class.
745
+ #
746
+ # @overload update_custom_class(request, options = nil)
747
+ # Pass arguments to `update_custom_class` via a request object, either of type
748
+ # {::Google::Cloud::Speech::V1p1beta1::UpdateCustomClassRequest} or an equivalent Hash.
749
+ #
750
+ # @param request [::Google::Cloud::Speech::V1p1beta1::UpdateCustomClassRequest, ::Hash]
751
+ # A request object representing the call parameters. Required. To specify no
752
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
753
+ # @param options [::Gapic::CallOptions, ::Hash]
754
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
755
+ #
756
+ # @overload update_custom_class(custom_class: nil, update_mask: nil)
757
+ # Pass arguments to `update_custom_class` via keyword arguments. Note that at
758
+ # least one keyword argument is required. To specify no parameters, or to keep all
759
+ # the default parameter values, pass an empty Hash as a request object (see above).
760
+ #
761
+ # @param custom_class [::Google::Cloud::Speech::V1p1beta1::CustomClass, ::Hash]
762
+ # Required. The custom class to update.
763
+ #
764
+ # The custom class's `name` field is used to identify the custom class to be
765
+ # updated. Format:
766
+ # \\{api_version}/projects/\\{project}/locations/\\{location}/customClasses/\\{custom_class}
767
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
768
+ # The list of fields to be updated.
769
+ #
770
+ # @yield [response, operation] Access the result along with the RPC operation
771
+ # @yieldparam response [::Google::Cloud::Speech::V1p1beta1::CustomClass]
772
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
773
+ #
774
+ # @return [::Google::Cloud::Speech::V1p1beta1::CustomClass]
775
+ #
776
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
777
+ #
778
+ def update_custom_class request, options = nil
779
+ raise ::ArgumentError, "request must be provided" if request.nil?
780
+
781
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V1p1beta1::UpdateCustomClassRequest
782
+
783
+ # Converts hash and nil to an options object
784
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
785
+
786
+ # Customize the options with defaults
787
+ metadata = @config.rpcs.update_custom_class.metadata.to_h
788
+
789
+ # Set x-goog-api-client and x-goog-user-project headers
790
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
791
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
792
+ gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
793
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
794
+
795
+ header_params = {
796
+ "custom_class.name" => request.custom_class.name
797
+ }
798
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
799
+ metadata[:"x-goog-request-params"] ||= request_params_header
800
+
801
+ options.apply_defaults timeout: @config.rpcs.update_custom_class.timeout,
802
+ metadata: metadata,
803
+ retry_policy: @config.rpcs.update_custom_class.retry_policy
804
+ options.apply_defaults metadata: @config.metadata,
805
+ retry_policy: @config.retry_policy
806
+
807
+ @adaptation_stub.call_rpc :update_custom_class, request, options: options do |response, operation|
808
+ yield response, operation if block_given?
809
+ return response
810
+ end
811
+ rescue ::GRPC::BadStatus => e
812
+ raise ::Google::Cloud::Error.from_error(e)
813
+ end
814
+
815
+ ##
816
+ # Delete a custom class.
817
+ #
818
+ # @overload delete_custom_class(request, options = nil)
819
+ # Pass arguments to `delete_custom_class` via a request object, either of type
820
+ # {::Google::Cloud::Speech::V1p1beta1::DeleteCustomClassRequest} or an equivalent Hash.
821
+ #
822
+ # @param request [::Google::Cloud::Speech::V1p1beta1::DeleteCustomClassRequest, ::Hash]
823
+ # A request object representing the call parameters. Required. To specify no
824
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
825
+ # @param options [::Gapic::CallOptions, ::Hash]
826
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
827
+ #
828
+ # @overload delete_custom_class(name: nil)
829
+ # Pass arguments to `delete_custom_class` via keyword arguments. Note that at
830
+ # least one keyword argument is required. To specify no parameters, or to keep all
831
+ # the default parameter values, pass an empty Hash as a request object (see above).
832
+ #
833
+ # @param name [::String]
834
+ # Required. The name of the custom class to delete.
835
+ # Format:
836
+ # \\{api_version}/projects/\\{project}/locations/\\{location}/customClasses/\\{custom_class}
837
+ #
838
+ # @yield [response, operation] Access the result along with the RPC operation
839
+ # @yieldparam response [::Google::Protobuf::Empty]
840
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
841
+ #
842
+ # @return [::Google::Protobuf::Empty]
843
+ #
844
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
845
+ #
846
+ def delete_custom_class request, options = nil
847
+ raise ::ArgumentError, "request must be provided" if request.nil?
848
+
849
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V1p1beta1::DeleteCustomClassRequest
850
+
851
+ # Converts hash and nil to an options object
852
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
853
+
854
+ # Customize the options with defaults
855
+ metadata = @config.rpcs.delete_custom_class.metadata.to_h
856
+
857
+ # Set x-goog-api-client and x-goog-user-project headers
858
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
859
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
860
+ gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
861
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
862
+
863
+ header_params = {
864
+ "name" => request.name
865
+ }
866
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
867
+ metadata[:"x-goog-request-params"] ||= request_params_header
868
+
869
+ options.apply_defaults timeout: @config.rpcs.delete_custom_class.timeout,
870
+ metadata: metadata,
871
+ retry_policy: @config.rpcs.delete_custom_class.retry_policy
872
+ options.apply_defaults metadata: @config.metadata,
873
+ retry_policy: @config.retry_policy
874
+
875
+ @adaptation_stub.call_rpc :delete_custom_class, request, options: options do |response, operation|
876
+ yield response, operation if block_given?
877
+ return response
878
+ end
879
+ rescue ::GRPC::BadStatus => e
880
+ raise ::Google::Cloud::Error.from_error(e)
881
+ end
882
+
883
+ ##
884
+ # Configuration class for the Adaptation API.
885
+ #
886
+ # This class represents the configuration for Adaptation,
887
+ # providing control over timeouts, retry behavior, logging, transport
888
+ # parameters, and other low-level controls. Certain parameters can also be
889
+ # applied individually to specific RPCs. See
890
+ # {::Google::Cloud::Speech::V1p1beta1::Adaptation::Client::Configuration::Rpcs}
891
+ # for a list of RPCs that can be configured independently.
892
+ #
893
+ # Configuration can be applied globally to all clients, or to a single client
894
+ # on construction.
895
+ #
896
+ # # Examples
897
+ #
898
+ # To modify the global config, setting the timeout for create_phrase_set
899
+ # to 20 seconds, and all remaining timeouts to 10 seconds:
900
+ #
901
+ # ::Google::Cloud::Speech::V1p1beta1::Adaptation::Client.configure do |config|
902
+ # config.timeout = 10.0
903
+ # config.rpcs.create_phrase_set.timeout = 20.0
904
+ # end
905
+ #
906
+ # To apply the above configuration only to a new client:
907
+ #
908
+ # client = ::Google::Cloud::Speech::V1p1beta1::Adaptation::Client.new do |config|
909
+ # config.timeout = 10.0
910
+ # config.rpcs.create_phrase_set.timeout = 20.0
911
+ # end
912
+ #
913
+ # @!attribute [rw] endpoint
914
+ # The hostname or hostname:port of the service endpoint.
915
+ # Defaults to `"speech.googleapis.com"`.
916
+ # @return [::String]
917
+ # @!attribute [rw] credentials
918
+ # Credentials to send with calls. You may provide any of the following types:
919
+ # * (`String`) The path to a service account key file in JSON format
920
+ # * (`Hash`) A service account key as a Hash
921
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
922
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
923
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
924
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
925
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
926
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
927
+ # * (`nil`) indicating no credentials
928
+ # @return [::Object]
929
+ # @!attribute [rw] scope
930
+ # The OAuth scopes
931
+ # @return [::Array<::String>]
932
+ # @!attribute [rw] lib_name
933
+ # The library name as recorded in instrumentation and logging
934
+ # @return [::String]
935
+ # @!attribute [rw] lib_version
936
+ # The library version as recorded in instrumentation and logging
937
+ # @return [::String]
938
+ # @!attribute [rw] channel_args
939
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
940
+ # `GRPC::Core::Channel` object is provided as the credential.
941
+ # @return [::Hash]
942
+ # @!attribute [rw] interceptors
943
+ # An array of interceptors that are run before calls are executed.
944
+ # @return [::Array<::GRPC::ClientInterceptor>]
945
+ # @!attribute [rw] timeout
946
+ # The call timeout in seconds.
947
+ # @return [::Numeric]
948
+ # @!attribute [rw] metadata
949
+ # Additional gRPC headers to be sent with the call.
950
+ # @return [::Hash{::Symbol=>::String}]
951
+ # @!attribute [rw] retry_policy
952
+ # The retry policy. The value is a hash with the following keys:
953
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
954
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
955
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
956
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
957
+ # trigger a retry.
958
+ # @return [::Hash]
959
+ # @!attribute [rw] quota_project
960
+ # A separate project against which to charge quota.
961
+ # @return [::String]
962
+ #
963
+ class Configuration
964
+ extend ::Gapic::Config
965
+
966
+ config_attr :endpoint, "speech.googleapis.com", ::String
967
+ config_attr :credentials, nil do |value|
968
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
969
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
970
+ allowed.any? { |klass| klass === value }
971
+ end
972
+ config_attr :scope, nil, ::String, ::Array, nil
973
+ config_attr :lib_name, nil, ::String, nil
974
+ config_attr :lib_version, nil, ::String, nil
975
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
976
+ config_attr :interceptors, nil, ::Array, nil
977
+ config_attr :timeout, nil, ::Numeric, nil
978
+ config_attr :metadata, nil, ::Hash, nil
979
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
980
+ config_attr :quota_project, nil, ::String, nil
981
+
982
+ # @private
983
+ def initialize parent_config = nil
984
+ @parent_config = parent_config unless parent_config.nil?
985
+
986
+ yield self if block_given?
987
+ end
988
+
989
+ ##
990
+ # Configurations for individual RPCs
991
+ # @return [Rpcs]
992
+ #
993
+ def rpcs
994
+ @rpcs ||= begin
995
+ parent_rpcs = nil
996
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
997
+ Rpcs.new parent_rpcs
998
+ end
999
+ end
1000
+
1001
+ ##
1002
+ # Configuration RPC class for the Adaptation API.
1003
+ #
1004
+ # Includes fields providing the configuration for each RPC in this service.
1005
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1006
+ # the following configuration fields:
1007
+ #
1008
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1009
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
1010
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1011
+ # include the following keys:
1012
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1013
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1014
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1015
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1016
+ # trigger a retry.
1017
+ #
1018
+ class Rpcs
1019
+ ##
1020
+ # RPC-specific configuration for `create_phrase_set`
1021
+ # @return [::Gapic::Config::Method]
1022
+ #
1023
+ attr_reader :create_phrase_set
1024
+ ##
1025
+ # RPC-specific configuration for `get_phrase_set`
1026
+ # @return [::Gapic::Config::Method]
1027
+ #
1028
+ attr_reader :get_phrase_set
1029
+ ##
1030
+ # RPC-specific configuration for `list_phrase_set`
1031
+ # @return [::Gapic::Config::Method]
1032
+ #
1033
+ attr_reader :list_phrase_set
1034
+ ##
1035
+ # RPC-specific configuration for `update_phrase_set`
1036
+ # @return [::Gapic::Config::Method]
1037
+ #
1038
+ attr_reader :update_phrase_set
1039
+ ##
1040
+ # RPC-specific configuration for `delete_phrase_set`
1041
+ # @return [::Gapic::Config::Method]
1042
+ #
1043
+ attr_reader :delete_phrase_set
1044
+ ##
1045
+ # RPC-specific configuration for `create_custom_class`
1046
+ # @return [::Gapic::Config::Method]
1047
+ #
1048
+ attr_reader :create_custom_class
1049
+ ##
1050
+ # RPC-specific configuration for `get_custom_class`
1051
+ # @return [::Gapic::Config::Method]
1052
+ #
1053
+ attr_reader :get_custom_class
1054
+ ##
1055
+ # RPC-specific configuration for `list_custom_classes`
1056
+ # @return [::Gapic::Config::Method]
1057
+ #
1058
+ attr_reader :list_custom_classes
1059
+ ##
1060
+ # RPC-specific configuration for `update_custom_class`
1061
+ # @return [::Gapic::Config::Method]
1062
+ #
1063
+ attr_reader :update_custom_class
1064
+ ##
1065
+ # RPC-specific configuration for `delete_custom_class`
1066
+ # @return [::Gapic::Config::Method]
1067
+ #
1068
+ attr_reader :delete_custom_class
1069
+
1070
+ # @private
1071
+ def initialize parent_rpcs = nil
1072
+ create_phrase_set_config = parent_rpcs&.create_phrase_set if parent_rpcs&.respond_to? :create_phrase_set
1073
+ @create_phrase_set = ::Gapic::Config::Method.new create_phrase_set_config
1074
+ get_phrase_set_config = parent_rpcs&.get_phrase_set if parent_rpcs&.respond_to? :get_phrase_set
1075
+ @get_phrase_set = ::Gapic::Config::Method.new get_phrase_set_config
1076
+ list_phrase_set_config = parent_rpcs&.list_phrase_set if parent_rpcs&.respond_to? :list_phrase_set
1077
+ @list_phrase_set = ::Gapic::Config::Method.new list_phrase_set_config
1078
+ update_phrase_set_config = parent_rpcs&.update_phrase_set if parent_rpcs&.respond_to? :update_phrase_set
1079
+ @update_phrase_set = ::Gapic::Config::Method.new update_phrase_set_config
1080
+ delete_phrase_set_config = parent_rpcs&.delete_phrase_set if parent_rpcs&.respond_to? :delete_phrase_set
1081
+ @delete_phrase_set = ::Gapic::Config::Method.new delete_phrase_set_config
1082
+ create_custom_class_config = parent_rpcs&.create_custom_class if parent_rpcs&.respond_to? :create_custom_class
1083
+ @create_custom_class = ::Gapic::Config::Method.new create_custom_class_config
1084
+ get_custom_class_config = parent_rpcs&.get_custom_class if parent_rpcs&.respond_to? :get_custom_class
1085
+ @get_custom_class = ::Gapic::Config::Method.new get_custom_class_config
1086
+ list_custom_classes_config = parent_rpcs&.list_custom_classes if parent_rpcs&.respond_to? :list_custom_classes
1087
+ @list_custom_classes = ::Gapic::Config::Method.new list_custom_classes_config
1088
+ update_custom_class_config = parent_rpcs&.update_custom_class if parent_rpcs&.respond_to? :update_custom_class
1089
+ @update_custom_class = ::Gapic::Config::Method.new update_custom_class_config
1090
+ delete_custom_class_config = parent_rpcs&.delete_custom_class if parent_rpcs&.respond_to? :delete_custom_class
1091
+ @delete_custom_class = ::Gapic::Config::Method.new delete_custom_class_config
1092
+
1093
+ yield self if block_given?
1094
+ end
1095
+ end
1096
+ end
1097
+ end
1098
+ end
1099
+ end
1100
+ end
1101
+ end
1102
+ end