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