google-cloud-speech-v1p1beta1 0.10.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -41,13 +41,12 @@ module Google
41
41
  # See {::Google::Cloud::Speech::V1p1beta1::Adaptation::Client::Configuration}
42
42
  # for a description of the configuration fields.
43
43
  #
44
- # ## Example
44
+ # @example
45
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
46
+ # # Modify the configuration for all Adaptation clients
47
+ # ::Google::Cloud::Speech::V1p1beta1::Adaptation::Client.configure do |config|
48
+ # config.timeout = 10.0
49
+ # end
51
50
  #
52
51
  # @yield [config] Configure the Client client.
53
52
  # @yieldparam config [Client::Configuration]
@@ -94,19 +93,15 @@ module Google
94
93
  ##
95
94
  # Create a new Adaptation client object.
96
95
  #
97
- # ## Examples
98
- #
99
- # To create a new Adaptation client with the default
100
- # configuration:
96
+ # @example
101
97
  #
102
- # client = ::Google::Cloud::Speech::V1p1beta1::Adaptation::Client.new
98
+ # # Create a client using the default configuration
99
+ # client = ::Google::Cloud::Speech::V1p1beta1::Adaptation::Client.new
103
100
  #
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
101
+ # # Create a client using a custom configuration
102
+ # client = ::Google::Cloud::Speech::V1p1beta1::Adaptation::Client.new do |config|
103
+ # config.timeout = 10.0
104
+ # end
110
105
  #
111
106
  # @yield [config] Configure the Adaptation client.
112
107
  # @yieldparam config [Client::Configuration]
@@ -126,10 +121,9 @@ module Google
126
121
 
127
122
  # Create credentials
128
123
  credentials = @config.credentials
129
- # Use self-signed JWT if the scope and endpoint are unchanged from default,
124
+ # Use self-signed JWT if the endpoint is unchanged from default,
130
125
  # 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 &&
126
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
133
127
  !@config.endpoint.split(".").first.include?("-")
134
128
  credentials ||= Credentials.default scope: @config.scope,
135
129
  enable_self_signed_jwt: enable_self_signed_jwt
@@ -171,9 +165,15 @@ module Google
171
165
  # the default parameter values, pass an empty Hash as a request object (see above).
172
166
  #
173
167
  # @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
168
+ # Required. The parent resource where this phrase set will be created. Format:
169
+ #
170
+ # `projects/{project}/locations/{location}/phraseSets`
171
+ #
172
+ # Speech-to-Text supports three locations: `global`, `us` (US North America),
173
+ # and `eu` (Europe). If you are calling the `speech.googleapis.com`
174
+ # endpoint, use the `global` location. To specify a region, use a
175
+ # [regional endpoint](/speech-to-text/docs/endpoints) with matching `us` or
176
+ # `eu` location value.
177
177
  # @param phrase_set_id [::String]
178
178
  # Required. The ID to use for the phrase set, which will become the final
179
179
  # component of the phrase set's resource name.
@@ -191,6 +191,21 @@ module Google
191
191
  #
192
192
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
193
193
  #
194
+ # @example Basic example
195
+ # require "google/cloud/speech/v1p1beta1"
196
+ #
197
+ # # Create a client object. The client can be reused for multiple calls.
198
+ # client = Google::Cloud::Speech::V1p1beta1::Adaptation::Client.new
199
+ #
200
+ # # Create a request. To set request fields, pass in keyword arguments.
201
+ # request = Google::Cloud::Speech::V1p1beta1::CreatePhraseSetRequest.new
202
+ #
203
+ # # Call the create_phrase_set method.
204
+ # result = client.create_phrase_set request
205
+ #
206
+ # # The returned object is of type Google::Cloud::Speech::V1p1beta1::PhraseSet.
207
+ # p result
208
+ #
194
209
  def create_phrase_set request, options = nil
195
210
  raise ::ArgumentError, "request must be provided" if request.nil?
196
211
 
@@ -208,16 +223,20 @@ module Google
208
223
  gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
209
224
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
210
225
 
211
- header_params = {
212
- "parent" => request.parent
213
- }
226
+ header_params = {}
227
+ if request.parent
228
+ header_params["parent"] = request.parent
229
+ end
230
+
214
231
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
215
232
  metadata[:"x-goog-request-params"] ||= request_params_header
216
233
 
217
234
  options.apply_defaults timeout: @config.rpcs.create_phrase_set.timeout,
218
235
  metadata: metadata,
219
236
  retry_policy: @config.rpcs.create_phrase_set.retry_policy
220
- options.apply_defaults metadata: @config.metadata,
237
+
238
+ options.apply_defaults timeout: @config.timeout,
239
+ metadata: @config.metadata,
221
240
  retry_policy: @config.retry_policy
222
241
 
223
242
  @adaptation_stub.call_rpc :create_phrase_set, request, options: options do |response, operation|
@@ -247,9 +266,15 @@ module Google
247
266
  # the default parameter values, pass an empty Hash as a request object (see above).
248
267
  #
249
268
  # @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}
269
+ # Required. The name of the phrase set to retrieve. Format:
270
+ #
271
+ # `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
272
+ #
273
+ # Speech-to-Text supports three locations: `global`, `us` (US North America),
274
+ # and `eu` (Europe). If you are calling the `speech.googleapis.com`
275
+ # endpoint, use the `global` location. To specify a region, use a
276
+ # [regional endpoint](/speech-to-text/docs/endpoints) with matching `us` or
277
+ # `eu` location value.
253
278
  #
254
279
  # @yield [response, operation] Access the result along with the RPC operation
255
280
  # @yieldparam response [::Google::Cloud::Speech::V1p1beta1::PhraseSet]
@@ -259,6 +284,21 @@ module Google
259
284
  #
260
285
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
261
286
  #
287
+ # @example Basic example
288
+ # require "google/cloud/speech/v1p1beta1"
289
+ #
290
+ # # Create a client object. The client can be reused for multiple calls.
291
+ # client = Google::Cloud::Speech::V1p1beta1::Adaptation::Client.new
292
+ #
293
+ # # Create a request. To set request fields, pass in keyword arguments.
294
+ # request = Google::Cloud::Speech::V1p1beta1::GetPhraseSetRequest.new
295
+ #
296
+ # # Call the get_phrase_set method.
297
+ # result = client.get_phrase_set request
298
+ #
299
+ # # The returned object is of type Google::Cloud::Speech::V1p1beta1::PhraseSet.
300
+ # p result
301
+ #
262
302
  def get_phrase_set request, options = nil
263
303
  raise ::ArgumentError, "request must be provided" if request.nil?
264
304
 
@@ -276,16 +316,20 @@ module Google
276
316
  gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
277
317
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
278
318
 
279
- header_params = {
280
- "name" => request.name
281
- }
319
+ header_params = {}
320
+ if request.name
321
+ header_params["name"] = request.name
322
+ end
323
+
282
324
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
283
325
  metadata[:"x-goog-request-params"] ||= request_params_header
284
326
 
285
327
  options.apply_defaults timeout: @config.rpcs.get_phrase_set.timeout,
286
328
  metadata: metadata,
287
329
  retry_policy: @config.rpcs.get_phrase_set.retry_policy
288
- options.apply_defaults metadata: @config.metadata,
330
+
331
+ options.apply_defaults timeout: @config.timeout,
332
+ metadata: @config.metadata,
289
333
  retry_policy: @config.retry_policy
290
334
 
291
335
  @adaptation_stub.call_rpc :get_phrase_set, request, options: options do |response, operation|
@@ -315,9 +359,15 @@ module Google
315
359
  # the default parameter values, pass an empty Hash as a request object (see above).
316
360
  #
317
361
  # @param parent [::String]
318
- # Required. The parent, which owns this collection of phrase set.
319
- # Format:
320
- # projects/\\{project}/locations/\\{location}
362
+ # Required. The parent, which owns this collection of phrase set. Format:
363
+ #
364
+ # `projects/{project}/locations/{location}`
365
+ #
366
+ # Speech-to-Text supports three locations: `global`, `us` (US North America),
367
+ # and `eu` (Europe). If you are calling the `speech.googleapis.com`
368
+ # endpoint, use the `global` location. To specify a region, use a
369
+ # [regional endpoint](/speech-to-text/docs/endpoints) with matching `us` or
370
+ # `eu` location value.
321
371
  # @param page_size [::Integer]
322
372
  # The maximum number of phrase sets to return. The service may return
323
373
  # fewer than this value. If unspecified, at most 50 phrase sets will be
@@ -338,6 +388,27 @@ module Google
338
388
  #
339
389
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
340
390
  #
391
+ # @example Basic example
392
+ # require "google/cloud/speech/v1p1beta1"
393
+ #
394
+ # # Create a client object. The client can be reused for multiple calls.
395
+ # client = Google::Cloud::Speech::V1p1beta1::Adaptation::Client.new
396
+ #
397
+ # # Create a request. To set request fields, pass in keyword arguments.
398
+ # request = Google::Cloud::Speech::V1p1beta1::ListPhraseSetRequest.new
399
+ #
400
+ # # Call the list_phrase_set method.
401
+ # result = client.list_phrase_set request
402
+ #
403
+ # # The returned object is of type Gapic::PagedEnumerable. You can
404
+ # # iterate over all elements by calling #each, and the enumerable
405
+ # # will lazily make API calls to fetch subsequent pages. Other
406
+ # # methods are also available for managing paging directly.
407
+ # result.each do |response|
408
+ # # Each element is of type ::Google::Cloud::Speech::V1p1beta1::PhraseSet.
409
+ # p response
410
+ # end
411
+ #
341
412
  def list_phrase_set request, options = nil
342
413
  raise ::ArgumentError, "request must be provided" if request.nil?
343
414
 
@@ -355,16 +426,20 @@ module Google
355
426
  gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
356
427
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
357
428
 
358
- header_params = {
359
- "parent" => request.parent
360
- }
429
+ header_params = {}
430
+ if request.parent
431
+ header_params["parent"] = request.parent
432
+ end
433
+
361
434
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
362
435
  metadata[:"x-goog-request-params"] ||= request_params_header
363
436
 
364
437
  options.apply_defaults timeout: @config.rpcs.list_phrase_set.timeout,
365
438
  metadata: metadata,
366
439
  retry_policy: @config.rpcs.list_phrase_set.retry_policy
367
- options.apply_defaults metadata: @config.metadata,
440
+
441
+ options.apply_defaults timeout: @config.timeout,
442
+ metadata: @config.metadata,
368
443
  retry_policy: @config.retry_policy
369
444
 
370
445
  @adaptation_stub.call_rpc :list_phrase_set, request, options: options do |response, operation|
@@ -399,7 +474,14 @@ module Google
399
474
  #
400
475
  # The phrase set's `name` field is used to identify the set to be
401
476
  # updated. Format:
402
- # \\{api_version}/projects/\\{project}/locations/\\{location}/phraseSets/\\{phrase_set}
477
+ #
478
+ # `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
479
+ #
480
+ # Speech-to-Text supports three locations: `global`, `us` (US North America),
481
+ # and `eu` (Europe). If you are calling the `speech.googleapis.com`
482
+ # endpoint, use the `global` location. To specify a region, use a
483
+ # [regional endpoint](/speech-to-text/docs/endpoints) with matching `us` or
484
+ # `eu` location value.
403
485
  # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
404
486
  # The list of fields to be updated.
405
487
  #
@@ -411,6 +493,21 @@ module Google
411
493
  #
412
494
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
413
495
  #
496
+ # @example Basic example
497
+ # require "google/cloud/speech/v1p1beta1"
498
+ #
499
+ # # Create a client object. The client can be reused for multiple calls.
500
+ # client = Google::Cloud::Speech::V1p1beta1::Adaptation::Client.new
501
+ #
502
+ # # Create a request. To set request fields, pass in keyword arguments.
503
+ # request = Google::Cloud::Speech::V1p1beta1::UpdatePhraseSetRequest.new
504
+ #
505
+ # # Call the update_phrase_set method.
506
+ # result = client.update_phrase_set request
507
+ #
508
+ # # The returned object is of type Google::Cloud::Speech::V1p1beta1::PhraseSet.
509
+ # p result
510
+ #
414
511
  def update_phrase_set request, options = nil
415
512
  raise ::ArgumentError, "request must be provided" if request.nil?
416
513
 
@@ -428,16 +525,20 @@ module Google
428
525
  gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
429
526
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
430
527
 
431
- header_params = {
432
- "phrase_set.name" => request.phrase_set.name
433
- }
528
+ header_params = {}
529
+ if request.phrase_set&.name
530
+ header_params["phrase_set.name"] = request.phrase_set.name
531
+ end
532
+
434
533
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
435
534
  metadata[:"x-goog-request-params"] ||= request_params_header
436
535
 
437
536
  options.apply_defaults timeout: @config.rpcs.update_phrase_set.timeout,
438
537
  metadata: metadata,
439
538
  retry_policy: @config.rpcs.update_phrase_set.retry_policy
440
- options.apply_defaults metadata: @config.metadata,
539
+
540
+ options.apply_defaults timeout: @config.timeout,
541
+ metadata: @config.metadata,
441
542
  retry_policy: @config.retry_policy
442
543
 
443
544
  @adaptation_stub.call_rpc :update_phrase_set, request, options: options do |response, operation|
@@ -467,9 +568,9 @@ module Google
467
568
  # the default parameter values, pass an empty Hash as a request object (see above).
468
569
  #
469
570
  # @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}
571
+ # Required. The name of the phrase set to delete. Format:
572
+ #
573
+ # `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
473
574
  #
474
575
  # @yield [response, operation] Access the result along with the RPC operation
475
576
  # @yieldparam response [::Google::Protobuf::Empty]
@@ -479,6 +580,21 @@ module Google
479
580
  #
480
581
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
481
582
  #
583
+ # @example Basic example
584
+ # require "google/cloud/speech/v1p1beta1"
585
+ #
586
+ # # Create a client object. The client can be reused for multiple calls.
587
+ # client = Google::Cloud::Speech::V1p1beta1::Adaptation::Client.new
588
+ #
589
+ # # Create a request. To set request fields, pass in keyword arguments.
590
+ # request = Google::Cloud::Speech::V1p1beta1::DeletePhraseSetRequest.new
591
+ #
592
+ # # Call the delete_phrase_set method.
593
+ # result = client.delete_phrase_set request
594
+ #
595
+ # # The returned object is of type Google::Protobuf::Empty.
596
+ # p result
597
+ #
482
598
  def delete_phrase_set request, options = nil
483
599
  raise ::ArgumentError, "request must be provided" if request.nil?
484
600
 
@@ -496,16 +612,20 @@ module Google
496
612
  gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
497
613
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
498
614
 
499
- header_params = {
500
- "name" => request.name
501
- }
615
+ header_params = {}
616
+ if request.name
617
+ header_params["name"] = request.name
618
+ end
619
+
502
620
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
503
621
  metadata[:"x-goog-request-params"] ||= request_params_header
504
622
 
505
623
  options.apply_defaults timeout: @config.rpcs.delete_phrase_set.timeout,
506
624
  metadata: metadata,
507
625
  retry_policy: @config.rpcs.delete_phrase_set.retry_policy
508
- options.apply_defaults metadata: @config.metadata,
626
+
627
+ options.apply_defaults timeout: @config.timeout,
628
+ metadata: @config.metadata,
509
629
  retry_policy: @config.retry_policy
510
630
 
511
631
  @adaptation_stub.call_rpc :delete_phrase_set, request, options: options do |response, operation|
@@ -535,9 +655,15 @@ module Google
535
655
  # the default parameter values, pass an empty Hash as a request object (see above).
536
656
  #
537
657
  # @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
658
+ # Required. The parent resource where this custom class will be created. Format:
659
+ #
660
+ # `projects/{project}/locations/{location}/customClasses`
661
+ #
662
+ # Speech-to-Text supports three locations: `global`, `us` (US North America),
663
+ # and `eu` (Europe). If you are calling the `speech.googleapis.com`
664
+ # endpoint, use the `global` location. To specify a region, use a
665
+ # [regional endpoint](/speech-to-text/docs/endpoints) with matching `us` or
666
+ # `eu` location value.
541
667
  # @param custom_class_id [::String]
542
668
  # Required. The ID to use for the custom class, which will become the final
543
669
  # component of the custom class' resource name.
@@ -555,6 +681,21 @@ module Google
555
681
  #
556
682
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
557
683
  #
684
+ # @example Basic example
685
+ # require "google/cloud/speech/v1p1beta1"
686
+ #
687
+ # # Create a client object. The client can be reused for multiple calls.
688
+ # client = Google::Cloud::Speech::V1p1beta1::Adaptation::Client.new
689
+ #
690
+ # # Create a request. To set request fields, pass in keyword arguments.
691
+ # request = Google::Cloud::Speech::V1p1beta1::CreateCustomClassRequest.new
692
+ #
693
+ # # Call the create_custom_class method.
694
+ # result = client.create_custom_class request
695
+ #
696
+ # # The returned object is of type Google::Cloud::Speech::V1p1beta1::CustomClass.
697
+ # p result
698
+ #
558
699
  def create_custom_class request, options = nil
559
700
  raise ::ArgumentError, "request must be provided" if request.nil?
560
701
 
@@ -572,16 +713,20 @@ module Google
572
713
  gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
573
714
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
574
715
 
575
- header_params = {
576
- "parent" => request.parent
577
- }
716
+ header_params = {}
717
+ if request.parent
718
+ header_params["parent"] = request.parent
719
+ end
720
+
578
721
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
579
722
  metadata[:"x-goog-request-params"] ||= request_params_header
580
723
 
581
724
  options.apply_defaults timeout: @config.rpcs.create_custom_class.timeout,
582
725
  metadata: metadata,
583
726
  retry_policy: @config.rpcs.create_custom_class.retry_policy
584
- options.apply_defaults metadata: @config.metadata,
727
+
728
+ options.apply_defaults timeout: @config.timeout,
729
+ metadata: @config.metadata,
585
730
  retry_policy: @config.retry_policy
586
731
 
587
732
  @adaptation_stub.call_rpc :create_custom_class, request, options: options do |response, operation|
@@ -611,9 +756,9 @@ module Google
611
756
  # the default parameter values, pass an empty Hash as a request object (see above).
612
757
  #
613
758
  # @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}
759
+ # Required. The name of the custom class to retrieve. Format:
760
+ #
761
+ # `projects/{project}/locations/{location}/customClasses/{custom_class}`
617
762
  #
618
763
  # @yield [response, operation] Access the result along with the RPC operation
619
764
  # @yieldparam response [::Google::Cloud::Speech::V1p1beta1::CustomClass]
@@ -623,6 +768,21 @@ module Google
623
768
  #
624
769
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
625
770
  #
771
+ # @example Basic example
772
+ # require "google/cloud/speech/v1p1beta1"
773
+ #
774
+ # # Create a client object. The client can be reused for multiple calls.
775
+ # client = Google::Cloud::Speech::V1p1beta1::Adaptation::Client.new
776
+ #
777
+ # # Create a request. To set request fields, pass in keyword arguments.
778
+ # request = Google::Cloud::Speech::V1p1beta1::GetCustomClassRequest.new
779
+ #
780
+ # # Call the get_custom_class method.
781
+ # result = client.get_custom_class request
782
+ #
783
+ # # The returned object is of type Google::Cloud::Speech::V1p1beta1::CustomClass.
784
+ # p result
785
+ #
626
786
  def get_custom_class request, options = nil
627
787
  raise ::ArgumentError, "request must be provided" if request.nil?
628
788
 
@@ -640,16 +800,20 @@ module Google
640
800
  gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
641
801
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
642
802
 
643
- header_params = {
644
- "name" => request.name
645
- }
803
+ header_params = {}
804
+ if request.name
805
+ header_params["name"] = request.name
806
+ end
807
+
646
808
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
647
809
  metadata[:"x-goog-request-params"] ||= request_params_header
648
810
 
649
811
  options.apply_defaults timeout: @config.rpcs.get_custom_class.timeout,
650
812
  metadata: metadata,
651
813
  retry_policy: @config.rpcs.get_custom_class.retry_policy
652
- options.apply_defaults metadata: @config.metadata,
814
+
815
+ options.apply_defaults timeout: @config.timeout,
816
+ metadata: @config.metadata,
653
817
  retry_policy: @config.retry_policy
654
818
 
655
819
  @adaptation_stub.call_rpc :get_custom_class, request, options: options do |response, operation|
@@ -679,9 +843,15 @@ module Google
679
843
  # the default parameter values, pass an empty Hash as a request object (see above).
680
844
  #
681
845
  # @param parent [::String]
682
- # Required. The parent, which owns this collection of custom classes.
683
- # Format:
684
- # \\{api_version}/projects/\\{project}/locations/\\{location}/customClasses
846
+ # Required. The parent, which owns this collection of custom classes. Format:
847
+ #
848
+ # `projects/{project}/locations/{location}/customClasses`
849
+ #
850
+ # Speech-to-Text supports three locations: `global`, `us` (US North America),
851
+ # and `eu` (Europe). If you are calling the `speech.googleapis.com`
852
+ # endpoint, use the `global` location. To specify a region, use a
853
+ # [regional endpoint](/speech-to-text/docs/endpoints) with matching `us` or
854
+ # `eu` location value.
685
855
  # @param page_size [::Integer]
686
856
  # The maximum number of custom classes to return. The service may return
687
857
  # fewer than this value. If unspecified, at most 50 custom classes will be
@@ -702,6 +872,27 @@ module Google
702
872
  #
703
873
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
704
874
  #
875
+ # @example Basic example
876
+ # require "google/cloud/speech/v1p1beta1"
877
+ #
878
+ # # Create a client object. The client can be reused for multiple calls.
879
+ # client = Google::Cloud::Speech::V1p1beta1::Adaptation::Client.new
880
+ #
881
+ # # Create a request. To set request fields, pass in keyword arguments.
882
+ # request = Google::Cloud::Speech::V1p1beta1::ListCustomClassesRequest.new
883
+ #
884
+ # # Call the list_custom_classes method.
885
+ # result = client.list_custom_classes request
886
+ #
887
+ # # The returned object is of type Gapic::PagedEnumerable. You can
888
+ # # iterate over all elements by calling #each, and the enumerable
889
+ # # will lazily make API calls to fetch subsequent pages. Other
890
+ # # methods are also available for managing paging directly.
891
+ # result.each do |response|
892
+ # # Each element is of type ::Google::Cloud::Speech::V1p1beta1::CustomClass.
893
+ # p response
894
+ # end
895
+ #
705
896
  def list_custom_classes request, options = nil
706
897
  raise ::ArgumentError, "request must be provided" if request.nil?
707
898
 
@@ -719,16 +910,20 @@ module Google
719
910
  gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
720
911
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
721
912
 
722
- header_params = {
723
- "parent" => request.parent
724
- }
913
+ header_params = {}
914
+ if request.parent
915
+ header_params["parent"] = request.parent
916
+ end
917
+
725
918
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
726
919
  metadata[:"x-goog-request-params"] ||= request_params_header
727
920
 
728
921
  options.apply_defaults timeout: @config.rpcs.list_custom_classes.timeout,
729
922
  metadata: metadata,
730
923
  retry_policy: @config.rpcs.list_custom_classes.retry_policy
731
- options.apply_defaults metadata: @config.metadata,
924
+
925
+ options.apply_defaults timeout: @config.timeout,
926
+ metadata: @config.metadata,
732
927
  retry_policy: @config.retry_policy
733
928
 
734
929
  @adaptation_stub.call_rpc :list_custom_classes, request, options: options do |response, operation|
@@ -763,7 +958,14 @@ module Google
763
958
  #
764
959
  # The custom class's `name` field is used to identify the custom class to be
765
960
  # updated. Format:
766
- # \\{api_version}/projects/\\{project}/locations/\\{location}/customClasses/\\{custom_class}
961
+ #
962
+ # `projects/{project}/locations/{location}/customClasses/{custom_class}`
963
+ #
964
+ # Speech-to-Text supports three locations: `global`, `us` (US North America),
965
+ # and `eu` (Europe). If you are calling the `speech.googleapis.com`
966
+ # endpoint, use the `global` location. To specify a region, use a
967
+ # [regional endpoint](/speech-to-text/docs/endpoints) with matching `us` or
968
+ # `eu` location value.
767
969
  # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
768
970
  # The list of fields to be updated.
769
971
  #
@@ -775,6 +977,21 @@ module Google
775
977
  #
776
978
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
777
979
  #
980
+ # @example Basic example
981
+ # require "google/cloud/speech/v1p1beta1"
982
+ #
983
+ # # Create a client object. The client can be reused for multiple calls.
984
+ # client = Google::Cloud::Speech::V1p1beta1::Adaptation::Client.new
985
+ #
986
+ # # Create a request. To set request fields, pass in keyword arguments.
987
+ # request = Google::Cloud::Speech::V1p1beta1::UpdateCustomClassRequest.new
988
+ #
989
+ # # Call the update_custom_class method.
990
+ # result = client.update_custom_class request
991
+ #
992
+ # # The returned object is of type Google::Cloud::Speech::V1p1beta1::CustomClass.
993
+ # p result
994
+ #
778
995
  def update_custom_class request, options = nil
779
996
  raise ::ArgumentError, "request must be provided" if request.nil?
780
997
 
@@ -792,16 +1009,20 @@ module Google
792
1009
  gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
793
1010
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
794
1011
 
795
- header_params = {
796
- "custom_class.name" => request.custom_class.name
797
- }
1012
+ header_params = {}
1013
+ if request.custom_class&.name
1014
+ header_params["custom_class.name"] = request.custom_class.name
1015
+ end
1016
+
798
1017
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
799
1018
  metadata[:"x-goog-request-params"] ||= request_params_header
800
1019
 
801
1020
  options.apply_defaults timeout: @config.rpcs.update_custom_class.timeout,
802
1021
  metadata: metadata,
803
1022
  retry_policy: @config.rpcs.update_custom_class.retry_policy
804
- options.apply_defaults metadata: @config.metadata,
1023
+
1024
+ options.apply_defaults timeout: @config.timeout,
1025
+ metadata: @config.metadata,
805
1026
  retry_policy: @config.retry_policy
806
1027
 
807
1028
  @adaptation_stub.call_rpc :update_custom_class, request, options: options do |response, operation|
@@ -831,9 +1052,15 @@ module Google
831
1052
  # the default parameter values, pass an empty Hash as a request object (see above).
832
1053
  #
833
1054
  # @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}
1055
+ # Required. The name of the custom class to delete. Format:
1056
+ #
1057
+ # `projects/{project}/locations/{location}/customClasses/{custom_class}`
1058
+ #
1059
+ # Speech-to-Text supports three locations: `global`, `us` (US North America),
1060
+ # and `eu` (Europe). If you are calling the `speech.googleapis.com`
1061
+ # endpoint, use the `global` location. To specify a region, use a
1062
+ # [regional endpoint](/speech-to-text/docs/endpoints) with matching `us` or
1063
+ # `eu` location value.
837
1064
  #
838
1065
  # @yield [response, operation] Access the result along with the RPC operation
839
1066
  # @yieldparam response [::Google::Protobuf::Empty]
@@ -843,6 +1070,21 @@ module Google
843
1070
  #
844
1071
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
845
1072
  #
1073
+ # @example Basic example
1074
+ # require "google/cloud/speech/v1p1beta1"
1075
+ #
1076
+ # # Create a client object. The client can be reused for multiple calls.
1077
+ # client = Google::Cloud::Speech::V1p1beta1::Adaptation::Client.new
1078
+ #
1079
+ # # Create a request. To set request fields, pass in keyword arguments.
1080
+ # request = Google::Cloud::Speech::V1p1beta1::DeleteCustomClassRequest.new
1081
+ #
1082
+ # # Call the delete_custom_class method.
1083
+ # result = client.delete_custom_class request
1084
+ #
1085
+ # # The returned object is of type Google::Protobuf::Empty.
1086
+ # p result
1087
+ #
846
1088
  def delete_custom_class request, options = nil
847
1089
  raise ::ArgumentError, "request must be provided" if request.nil?
848
1090
 
@@ -860,16 +1102,20 @@ module Google
860
1102
  gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
861
1103
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
862
1104
 
863
- header_params = {
864
- "name" => request.name
865
- }
1105
+ header_params = {}
1106
+ if request.name
1107
+ header_params["name"] = request.name
1108
+ end
1109
+
866
1110
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
867
1111
  metadata[:"x-goog-request-params"] ||= request_params_header
868
1112
 
869
1113
  options.apply_defaults timeout: @config.rpcs.delete_custom_class.timeout,
870
1114
  metadata: metadata,
871
1115
  retry_policy: @config.rpcs.delete_custom_class.retry_policy
872
- options.apply_defaults metadata: @config.metadata,
1116
+
1117
+ options.apply_defaults timeout: @config.timeout,
1118
+ metadata: @config.metadata,
873
1119
  retry_policy: @config.retry_policy
874
1120
 
875
1121
  @adaptation_stub.call_rpc :delete_custom_class, request, options: options do |response, operation|
@@ -893,22 +1139,21 @@ module Google
893
1139
  # Configuration can be applied globally to all clients, or to a single client
894
1140
  # on construction.
895
1141
  #
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
1142
+ # @example
1143
+ #
1144
+ # # Modify the global config, setting the timeout for
1145
+ # # create_phrase_set to 20 seconds,
1146
+ # # and all remaining timeouts to 10 seconds.
1147
+ # ::Google::Cloud::Speech::V1p1beta1::Adaptation::Client.configure do |config|
1148
+ # config.timeout = 10.0
1149
+ # config.rpcs.create_phrase_set.timeout = 20.0
1150
+ # end
1151
+ #
1152
+ # # Apply the above configuration only to a new client.
1153
+ # client = ::Google::Cloud::Speech::V1p1beta1::Adaptation::Client.new do |config|
1154
+ # config.timeout = 10.0
1155
+ # config.rpcs.create_phrase_set.timeout = 20.0
1156
+ # end
912
1157
  #
913
1158
  # @!attribute [rw] endpoint
914
1159
  # The hostname or hostname:port of the service endpoint.