google-cloud-dialogflow-v2 0.9.0 → 0.11.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +8 -8
  3. data/README.md +1 -1
  4. data/lib/google/cloud/dialogflow/v2/agent_services_pb.rb +17 -6
  5. data/lib/google/cloud/dialogflow/v2/agents/client.rb +74 -55
  6. data/lib/google/cloud/dialogflow/v2/agents/operations.rb +34 -25
  7. data/lib/google/cloud/dialogflow/v2/answer_record_services_pb.rb +1 -1
  8. data/lib/google/cloud/dialogflow/v2/answer_records/client.rb +37 -43
  9. data/lib/google/cloud/dialogflow/v2/context_services_pb.rb +1 -1
  10. data/lib/google/cloud/dialogflow/v2/contexts/client.rb +49 -47
  11. data/lib/google/cloud/dialogflow/v2/conversation_profile_services_pb.rb +1 -1
  12. data/lib/google/cloud/dialogflow/v2/conversation_profiles/client.rb +46 -46
  13. data/lib/google/cloud/dialogflow/v2/conversation_services_pb.rb +1 -1
  14. data/lib/google/cloud/dialogflow/v2/conversations/client.rb +46 -46
  15. data/lib/google/cloud/dialogflow/v2/document_services_pb.rb +1 -1
  16. data/lib/google/cloud/dialogflow/v2/documents/client.rb +49 -47
  17. data/lib/google/cloud/dialogflow/v2/documents/operations.rb +34 -25
  18. data/lib/google/cloud/dialogflow/v2/entity_type_services_pb.rb +29 -8
  19. data/lib/google/cloud/dialogflow/v2/entity_types/client.rb +89 -58
  20. data/lib/google/cloud/dialogflow/v2/entity_types/operations.rb +34 -25
  21. data/lib/google/cloud/dialogflow/v2/environment_services_pb.rb +7 -7
  22. data/lib/google/cloud/dialogflow/v2/environments/client.rb +69 -56
  23. data/lib/google/cloud/dialogflow/v2/environments/paths.rb +41 -0
  24. data/lib/google/cloud/dialogflow/v2/fulfillment_services_pb.rb +1 -1
  25. data/lib/google/cloud/dialogflow/v2/fulfillments/client.rb +37 -43
  26. data/lib/google/cloud/dialogflow/v2/intent_services_pb.rb +21 -3
  27. data/lib/google/cloud/dialogflow/v2/intents/client.rb +72 -50
  28. data/lib/google/cloud/dialogflow/v2/intents/operations.rb +34 -25
  29. data/lib/google/cloud/dialogflow/v2/knowledge_base_services_pb.rb +1 -1
  30. data/lib/google/cloud/dialogflow/v2/knowledge_bases/client.rb +46 -46
  31. data/lib/google/cloud/dialogflow/v2/participant_services_pb.rb +1 -1
  32. data/lib/google/cloud/dialogflow/v2/participants/client.rb +53 -52
  33. data/lib/google/cloud/dialogflow/v2/session_entity_type_services_pb.rb +1 -1
  34. data/lib/google/cloud/dialogflow/v2/session_entity_types/client.rb +46 -46
  35. data/lib/google/cloud/dialogflow/v2/session_pb.rb +1 -0
  36. data/lib/google/cloud/dialogflow/v2/session_services_pb.rb +1 -1
  37. data/lib/google/cloud/dialogflow/v2/sessions/client.rb +38 -47
  38. data/lib/google/cloud/dialogflow/v2/version.rb +1 -1
  39. data/lib/google/cloud/dialogflow/v2/version_services_pb.rb +1 -1
  40. data/lib/google/cloud/dialogflow/v2/versions/client.rb +51 -46
  41. data/proto_docs/google/api/field_behavior.rb +7 -1
  42. data/proto_docs/google/cloud/dialogflow/v2/environment.rb +21 -3
  43. data/proto_docs/google/cloud/dialogflow/v2/intent.rb +4 -3
  44. data/proto_docs/google/cloud/dialogflow/v2/session.rb +3 -0
  45. data/proto_docs/google/cloud/dialogflow/v2/validation_result.rb +1 -1
  46. data/proto_docs/google/cloud/dialogflow/v2/version.rb +6 -0
  47. metadata +4 -4
@@ -27,7 +27,7 @@ module Google
27
27
  # Service for managing [Intents][google.cloud.dialogflow.v2.Intent].
28
28
  class Service
29
29
 
30
- include ::GRPC::GenericService
30
+ include GRPC::GenericService
31
31
 
32
32
  self.marshal_class_method = :encode
33
33
  self.unmarshal_class_method = :decode
@@ -38,18 +38,36 @@ module Google
38
38
  # Retrieves the specified intent.
39
39
  rpc :GetIntent, ::Google::Cloud::Dialogflow::V2::GetIntentRequest, ::Google::Cloud::Dialogflow::V2::Intent
40
40
  # Creates an intent in the specified agent.
41
+ #
42
+ # Note: You should always train an agent prior to sending it queries. See the
43
+ # [training
44
+ # documentation](https://cloud.google.com/dialogflow/es/docs/training).
41
45
  rpc :CreateIntent, ::Google::Cloud::Dialogflow::V2::CreateIntentRequest, ::Google::Cloud::Dialogflow::V2::Intent
42
46
  # Updates the specified intent.
47
+ #
48
+ # Note: You should always train an agent prior to sending it queries. See the
49
+ # [training
50
+ # documentation](https://cloud.google.com/dialogflow/es/docs/training).
43
51
  rpc :UpdateIntent, ::Google::Cloud::Dialogflow::V2::UpdateIntentRequest, ::Google::Cloud::Dialogflow::V2::Intent
44
52
  # Deletes the specified intent and its direct or indirect followup intents.
53
+ #
54
+ # Note: You should always train an agent prior to sending it queries. See the
55
+ # [training
56
+ # documentation](https://cloud.google.com/dialogflow/es/docs/training).
45
57
  rpc :DeleteIntent, ::Google::Cloud::Dialogflow::V2::DeleteIntentRequest, ::Google::Protobuf::Empty
46
58
  # Updates/Creates multiple intents in the specified agent.
47
59
  #
48
- # Operation <response: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2.BatchUpdateIntentsResponse]>
60
+ #
61
+ # Note: You should always train an agent prior to sending it queries. See the
62
+ # [training
63
+ # documentation](https://cloud.google.com/dialogflow/es/docs/training).
49
64
  rpc :BatchUpdateIntents, ::Google::Cloud::Dialogflow::V2::BatchUpdateIntentsRequest, ::Google::Longrunning::Operation
50
65
  # Deletes intents in the specified agent.
51
66
  #
52
- # Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
67
+ #
68
+ # Note: You should always train an agent prior to sending it queries. See the
69
+ # [training
70
+ # documentation](https://cloud.google.com/dialogflow/es/docs/training).
53
71
  rpc :BatchDeleteIntents, ::Google::Cloud::Dialogflow::V2::BatchDeleteIntentsRequest, ::Google::Longrunning::Operation
54
72
  end
55
73
 
@@ -41,13 +41,12 @@ module Google
41
41
  # See {::Google::Cloud::Dialogflow::V2::Intents::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 Intents clients:
47
- #
48
- # ::Google::Cloud::Dialogflow::V2::Intents::Client.configure do |config|
49
- # config.timeout = 10.0
50
- # end
46
+ # # Modify the configuration for all Intents clients
47
+ # ::Google::Cloud::Dialogflow::V2::Intents::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]
@@ -67,10 +66,7 @@ module Google
67
66
 
68
67
  default_config.timeout = 60.0
69
68
  default_config.retry_policy = {
70
- initial_delay: 0.1,
71
- max_delay: 60.0,
72
- multiplier: 1.3,
73
- retry_codes: [14]
69
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
74
70
  }
75
71
 
76
72
  default_config
@@ -102,19 +98,15 @@ module Google
102
98
  ##
103
99
  # Create a new Intents client object.
104
100
  #
105
- # ## Examples
106
- #
107
- # To create a new Intents client with the default
108
- # configuration:
109
- #
110
- # client = ::Google::Cloud::Dialogflow::V2::Intents::Client.new
101
+ # @example
111
102
  #
112
- # To create a new Intents client with a custom
113
- # configuration:
103
+ # # Create a client using the default configuration
104
+ # client = ::Google::Cloud::Dialogflow::V2::Intents::Client.new
114
105
  #
115
- # client = ::Google::Cloud::Dialogflow::V2::Intents::Client.new do |config|
116
- # config.timeout = 10.0
117
- # end
106
+ # # Create a client using a custom configuration
107
+ # client = ::Google::Cloud::Dialogflow::V2::Intents::Client.new do |config|
108
+ # config.timeout = 10.0
109
+ # end
118
110
  #
119
111
  # @yield [config] Configure the Intents client.
120
112
  # @yieldparam config [Client::Configuration]
@@ -134,14 +126,13 @@ module Google
134
126
 
135
127
  # Create credentials
136
128
  credentials = @config.credentials
137
- # Use self-signed JWT if the scope and endpoint are unchanged from default,
129
+ # Use self-signed JWT if the endpoint is unchanged from default,
138
130
  # but only if the default endpoint does not have a region prefix.
139
- enable_self_signed_jwt = @config.scope == Client.configure.scope &&
140
- @config.endpoint == Client.configure.endpoint &&
131
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
141
132
  !@config.endpoint.split(".").first.include?("-")
142
133
  credentials ||= Credentials.default scope: @config.scope,
143
134
  enable_self_signed_jwt: enable_self_signed_jwt
144
- if credentials.is_a?(String) || credentials.is_a?(Hash)
135
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
145
136
  credentials = Credentials.new credentials, scope: @config.scope
146
137
  end
147
138
  @quota_project_id = @config.quota_project
@@ -247,7 +238,9 @@ module Google
247
238
  options.apply_defaults timeout: @config.rpcs.list_intents.timeout,
248
239
  metadata: metadata,
249
240
  retry_policy: @config.rpcs.list_intents.retry_policy
250
- options.apply_defaults metadata: @config.metadata,
241
+
242
+ options.apply_defaults timeout: @config.timeout,
243
+ metadata: @config.metadata,
251
244
  retry_policy: @config.retry_policy
252
245
 
253
246
  @intents_stub.call_rpc :list_intents, request, options: options do |response, operation|
@@ -323,7 +316,9 @@ module Google
323
316
  options.apply_defaults timeout: @config.rpcs.get_intent.timeout,
324
317
  metadata: metadata,
325
318
  retry_policy: @config.rpcs.get_intent.retry_policy
326
- options.apply_defaults metadata: @config.metadata,
319
+
320
+ options.apply_defaults timeout: @config.timeout,
321
+ metadata: @config.metadata,
327
322
  retry_policy: @config.retry_policy
328
323
 
329
324
  @intents_stub.call_rpc :get_intent, request, options: options do |response, operation|
@@ -337,6 +332,10 @@ module Google
337
332
  ##
338
333
  # Creates an intent in the specified agent.
339
334
  #
335
+ # Note: You should always train an agent prior to sending it queries. See the
336
+ # [training
337
+ # documentation](https://cloud.google.com/dialogflow/es/docs/training).
338
+ #
340
339
  # @overload create_intent(request, options = nil)
341
340
  # Pass arguments to `create_intent` via a request object, either of type
342
341
  # {::Google::Cloud::Dialogflow::V2::CreateIntentRequest} or an equivalent Hash.
@@ -400,7 +399,9 @@ module Google
400
399
  options.apply_defaults timeout: @config.rpcs.create_intent.timeout,
401
400
  metadata: metadata,
402
401
  retry_policy: @config.rpcs.create_intent.retry_policy
403
- options.apply_defaults metadata: @config.metadata,
402
+
403
+ options.apply_defaults timeout: @config.timeout,
404
+ metadata: @config.metadata,
404
405
  retry_policy: @config.retry_policy
405
406
 
406
407
  @intents_stub.call_rpc :create_intent, request, options: options do |response, operation|
@@ -414,6 +415,10 @@ module Google
414
415
  ##
415
416
  # Updates the specified intent.
416
417
  #
418
+ # Note: You should always train an agent prior to sending it queries. See the
419
+ # [training
420
+ # documentation](https://cloud.google.com/dialogflow/es/docs/training).
421
+ #
417
422
  # @overload update_intent(request, options = nil)
418
423
  # Pass arguments to `update_intent` via a request object, either of type
419
424
  # {::Google::Cloud::Dialogflow::V2::UpdateIntentRequest} or an equivalent Hash.
@@ -476,7 +481,9 @@ module Google
476
481
  options.apply_defaults timeout: @config.rpcs.update_intent.timeout,
477
482
  metadata: metadata,
478
483
  retry_policy: @config.rpcs.update_intent.retry_policy
479
- options.apply_defaults metadata: @config.metadata,
484
+
485
+ options.apply_defaults timeout: @config.timeout,
486
+ metadata: @config.metadata,
480
487
  retry_policy: @config.retry_policy
481
488
 
482
489
  @intents_stub.call_rpc :update_intent, request, options: options do |response, operation|
@@ -490,6 +497,10 @@ module Google
490
497
  ##
491
498
  # Deletes the specified intent and its direct or indirect followup intents.
492
499
  #
500
+ # Note: You should always train an agent prior to sending it queries. See the
501
+ # [training
502
+ # documentation](https://cloud.google.com/dialogflow/es/docs/training).
503
+ #
493
504
  # @overload delete_intent(request, options = nil)
494
505
  # Pass arguments to `delete_intent` via a request object, either of type
495
506
  # {::Google::Cloud::Dialogflow::V2::DeleteIntentRequest} or an equivalent Hash.
@@ -544,7 +555,9 @@ module Google
544
555
  options.apply_defaults timeout: @config.rpcs.delete_intent.timeout,
545
556
  metadata: metadata,
546
557
  retry_policy: @config.rpcs.delete_intent.retry_policy
547
- options.apply_defaults metadata: @config.metadata,
558
+
559
+ options.apply_defaults timeout: @config.timeout,
560
+ metadata: @config.metadata,
548
561
  retry_policy: @config.retry_policy
549
562
 
550
563
  @intents_stub.call_rpc :delete_intent, request, options: options do |response, operation|
@@ -558,7 +571,10 @@ module Google
558
571
  ##
559
572
  # Updates/Creates multiple intents in the specified agent.
560
573
  #
561
- # Operation <response: {::Google::Cloud::Dialogflow::V2::BatchUpdateIntentsResponse BatchUpdateIntentsResponse}>
574
+ #
575
+ # Note: You should always train an agent prior to sending it queries. See the
576
+ # [training
577
+ # documentation](https://cloud.google.com/dialogflow/es/docs/training).
562
578
  #
563
579
  # @overload batch_update_intents(request, options = nil)
564
580
  # Pass arguments to `batch_update_intents` via a request object, either of type
@@ -629,7 +645,9 @@ module Google
629
645
  options.apply_defaults timeout: @config.rpcs.batch_update_intents.timeout,
630
646
  metadata: metadata,
631
647
  retry_policy: @config.rpcs.batch_update_intents.retry_policy
632
- options.apply_defaults metadata: @config.metadata,
648
+
649
+ options.apply_defaults timeout: @config.timeout,
650
+ metadata: @config.metadata,
633
651
  retry_policy: @config.retry_policy
634
652
 
635
653
  @intents_stub.call_rpc :batch_update_intents, request, options: options do |response, operation|
@@ -644,7 +662,10 @@ module Google
644
662
  ##
645
663
  # Deletes intents in the specified agent.
646
664
  #
647
- # Operation <response: {::Google::Protobuf::Empty google.protobuf.Empty}>
665
+ #
666
+ # Note: You should always train an agent prior to sending it queries. See the
667
+ # [training
668
+ # documentation](https://cloud.google.com/dialogflow/es/docs/training).
648
669
  #
649
670
  # @overload batch_delete_intents(request, options = nil)
650
671
  # Pass arguments to `batch_delete_intents` via a request object, either of type
@@ -702,7 +723,9 @@ module Google
702
723
  options.apply_defaults timeout: @config.rpcs.batch_delete_intents.timeout,
703
724
  metadata: metadata,
704
725
  retry_policy: @config.rpcs.batch_delete_intents.retry_policy
705
- options.apply_defaults metadata: @config.metadata,
726
+
727
+ options.apply_defaults timeout: @config.timeout,
728
+ metadata: @config.metadata,
706
729
  retry_policy: @config.retry_policy
707
730
 
708
731
  @intents_stub.call_rpc :batch_delete_intents, request, options: options do |response, operation|
@@ -727,22 +750,21 @@ module Google
727
750
  # Configuration can be applied globally to all clients, or to a single client
728
751
  # on construction.
729
752
  #
730
- # # Examples
731
- #
732
- # To modify the global config, setting the timeout for list_intents
733
- # to 20 seconds, and all remaining timeouts to 10 seconds:
734
- #
735
- # ::Google::Cloud::Dialogflow::V2::Intents::Client.configure do |config|
736
- # config.timeout = 10.0
737
- # config.rpcs.list_intents.timeout = 20.0
738
- # end
739
- #
740
- # To apply the above configuration only to a new client:
741
- #
742
- # client = ::Google::Cloud::Dialogflow::V2::Intents::Client.new do |config|
743
- # config.timeout = 10.0
744
- # config.rpcs.list_intents.timeout = 20.0
745
- # end
753
+ # @example
754
+ #
755
+ # # Modify the global config, setting the timeout for
756
+ # # list_intents to 20 seconds,
757
+ # # and all remaining timeouts to 10 seconds.
758
+ # ::Google::Cloud::Dialogflow::V2::Intents::Client.configure do |config|
759
+ # config.timeout = 10.0
760
+ # config.rpcs.list_intents.timeout = 20.0
761
+ # end
762
+ #
763
+ # # Apply the above configuration only to a new client.
764
+ # client = ::Google::Cloud::Dialogflow::V2::Intents::Client.new do |config|
765
+ # config.timeout = 10.0
766
+ # config.rpcs.list_intents.timeout = 20.0
767
+ # end
746
768
  #
747
769
  # @!attribute [rw] endpoint
748
770
  # The hostname or hostname:port of the service endpoint.
@@ -82,7 +82,7 @@ module Google
82
82
  # Create credentials
83
83
  credentials = @config.credentials
84
84
  credentials ||= Credentials.default scope: @config.scope
85
- if credentials.is_a?(String) || credentials.is_a?(Hash)
85
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
86
86
  credentials = Credentials.new credentials, scope: @config.scope
87
87
  end
88
88
  @quota_project_id = @config.quota_project
@@ -169,7 +169,9 @@ module Google
169
169
  options.apply_defaults timeout: @config.rpcs.list_operations.timeout,
170
170
  metadata: metadata,
171
171
  retry_policy: @config.rpcs.list_operations.retry_policy
172
- options.apply_defaults metadata: @config.metadata,
172
+
173
+ options.apply_defaults timeout: @config.timeout,
174
+ metadata: @config.metadata,
173
175
  retry_policy: @config.retry_policy
174
176
 
175
177
  @operations_stub.call_rpc :list_operations, request, options: options do |response, operation|
@@ -239,7 +241,9 @@ module Google
239
241
  options.apply_defaults timeout: @config.rpcs.get_operation.timeout,
240
242
  metadata: metadata,
241
243
  retry_policy: @config.rpcs.get_operation.retry_policy
242
- options.apply_defaults metadata: @config.metadata,
244
+
245
+ options.apply_defaults timeout: @config.timeout,
246
+ metadata: @config.metadata,
243
247
  retry_policy: @config.retry_policy
244
248
 
245
249
  @operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
@@ -309,7 +313,9 @@ module Google
309
313
  options.apply_defaults timeout: @config.rpcs.delete_operation.timeout,
310
314
  metadata: metadata,
311
315
  retry_policy: @config.rpcs.delete_operation.retry_policy
312
- options.apply_defaults metadata: @config.metadata,
316
+
317
+ options.apply_defaults timeout: @config.timeout,
318
+ metadata: @config.metadata,
313
319
  retry_policy: @config.retry_policy
314
320
 
315
321
  @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
@@ -384,7 +390,9 @@ module Google
384
390
  options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout,
385
391
  metadata: metadata,
386
392
  retry_policy: @config.rpcs.cancel_operation.retry_policy
387
- options.apply_defaults metadata: @config.metadata,
393
+
394
+ options.apply_defaults timeout: @config.timeout,
395
+ metadata: @config.metadata,
388
396
  retry_policy: @config.retry_policy
389
397
 
390
398
  @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
@@ -396,9 +404,9 @@ module Google
396
404
  end
397
405
 
398
406
  ##
399
- # Waits for the specified long-running operation until it is done or reaches
400
- # at most a specified timeout, returning the latest state. If the operation
401
- # is already done, the latest state is immediately returned. If the timeout
407
+ # Waits until the specified long-running operation is done or reaches at most
408
+ # a specified timeout, returning the latest state. If the operation is
409
+ # already done, the latest state is immediately returned. If the timeout
402
410
  # specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
403
411
  # timeout is used. If the server does not support this method, it returns
404
412
  # `google.rpc.Code.UNIMPLEMENTED`.
@@ -456,7 +464,9 @@ module Google
456
464
  options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
457
465
  metadata: metadata,
458
466
  retry_policy: @config.rpcs.wait_operation.retry_policy
459
- options.apply_defaults metadata: @config.metadata,
467
+
468
+ options.apply_defaults timeout: @config.timeout,
469
+ metadata: @config.metadata,
460
470
  retry_policy: @config.retry_policy
461
471
 
462
472
  @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
@@ -481,22 +491,21 @@ module Google
481
491
  # Configuration can be applied globally to all clients, or to a single client
482
492
  # on construction.
483
493
  #
484
- # # Examples
485
- #
486
- # To modify the global config, setting the timeout for list_operations
487
- # to 20 seconds, and all remaining timeouts to 10 seconds:
488
- #
489
- # ::Google::Longrunning::Operations::Client.configure do |config|
490
- # config.timeout = 10.0
491
- # config.rpcs.list_operations.timeout = 20.0
492
- # end
493
- #
494
- # To apply the above configuration only to a new client:
495
- #
496
- # client = ::Google::Longrunning::Operations::Client.new do |config|
497
- # config.timeout = 10.0
498
- # config.rpcs.list_operations.timeout = 20.0
499
- # end
494
+ # @example
495
+ #
496
+ # # Modify the global config, setting the timeout for
497
+ # # list_operations to 20 seconds,
498
+ # # and all remaining timeouts to 10 seconds.
499
+ # ::Google::Longrunning::Operations::Client.configure do |config|
500
+ # config.timeout = 10.0
501
+ # config.rpcs.list_operations.timeout = 20.0
502
+ # end
503
+ #
504
+ # # Apply the above configuration only to a new client.
505
+ # client = ::Google::Longrunning::Operations::Client.new do |config|
506
+ # config.timeout = 10.0
507
+ # config.rpcs.list_operations.timeout = 20.0
508
+ # end
500
509
  #
501
510
  # @!attribute [rw] endpoint
502
511
  # The hostname or hostname:port of the service endpoint.
@@ -27,7 +27,7 @@ module Google
27
27
  # Service for managing [KnowledgeBases][google.cloud.dialogflow.v2.KnowledgeBase].
28
28
  class Service
29
29
 
30
- include ::GRPC::GenericService
30
+ include GRPC::GenericService
31
31
 
32
32
  self.marshal_class_method = :encode
33
33
  self.unmarshal_class_method = :decode
@@ -41,13 +41,12 @@ module Google
41
41
  # See {::Google::Cloud::Dialogflow::V2::KnowledgeBases::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 KnowledgeBases clients:
47
- #
48
- # ::Google::Cloud::Dialogflow::V2::KnowledgeBases::Client.configure do |config|
49
- # config.timeout = 10.0
50
- # end
46
+ # # Modify the configuration for all KnowledgeBases clients
47
+ # ::Google::Cloud::Dialogflow::V2::KnowledgeBases::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]
@@ -67,10 +66,7 @@ module Google
67
66
 
68
67
  default_config.timeout = 60.0
69
68
  default_config.retry_policy = {
70
- initial_delay: 0.1,
71
- max_delay: 60.0,
72
- multiplier: 1.3,
73
- retry_codes: [14]
69
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
74
70
  }
75
71
 
76
72
  default_config
@@ -102,19 +98,15 @@ module Google
102
98
  ##
103
99
  # Create a new KnowledgeBases client object.
104
100
  #
105
- # ## Examples
106
- #
107
- # To create a new KnowledgeBases client with the default
108
- # configuration:
109
- #
110
- # client = ::Google::Cloud::Dialogflow::V2::KnowledgeBases::Client.new
101
+ # @example
111
102
  #
112
- # To create a new KnowledgeBases client with a custom
113
- # configuration:
103
+ # # Create a client using the default configuration
104
+ # client = ::Google::Cloud::Dialogflow::V2::KnowledgeBases::Client.new
114
105
  #
115
- # client = ::Google::Cloud::Dialogflow::V2::KnowledgeBases::Client.new do |config|
116
- # config.timeout = 10.0
117
- # end
106
+ # # Create a client using a custom configuration
107
+ # client = ::Google::Cloud::Dialogflow::V2::KnowledgeBases::Client.new do |config|
108
+ # config.timeout = 10.0
109
+ # end
118
110
  #
119
111
  # @yield [config] Configure the KnowledgeBases client.
120
112
  # @yieldparam config [Client::Configuration]
@@ -134,14 +126,13 @@ module Google
134
126
 
135
127
  # Create credentials
136
128
  credentials = @config.credentials
137
- # Use self-signed JWT if the scope and endpoint are unchanged from default,
129
+ # Use self-signed JWT if the endpoint is unchanged from default,
138
130
  # but only if the default endpoint does not have a region prefix.
139
- enable_self_signed_jwt = @config.scope == Client.configure.scope &&
140
- @config.endpoint == Client.configure.endpoint &&
131
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
141
132
  !@config.endpoint.split(".").first.include?("-")
142
133
  credentials ||= Credentials.default scope: @config.scope,
143
134
  enable_self_signed_jwt: enable_self_signed_jwt
144
- if credentials.is_a?(String) || credentials.is_a?(Hash)
135
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
145
136
  credentials = Credentials.new credentials, scope: @config.scope
146
137
  end
147
138
  @quota_project_id = @config.quota_project
@@ -219,7 +210,9 @@ module Google
219
210
  options.apply_defaults timeout: @config.rpcs.list_knowledge_bases.timeout,
220
211
  metadata: metadata,
221
212
  retry_policy: @config.rpcs.list_knowledge_bases.retry_policy
222
- options.apply_defaults metadata: @config.metadata,
213
+
214
+ options.apply_defaults timeout: @config.timeout,
215
+ metadata: @config.metadata,
223
216
  retry_policy: @config.retry_policy
224
217
 
225
218
  @knowledge_bases_stub.call_rpc :list_knowledge_bases, request, options: options do |response, operation|
@@ -288,7 +281,9 @@ module Google
288
281
  options.apply_defaults timeout: @config.rpcs.get_knowledge_base.timeout,
289
282
  metadata: metadata,
290
283
  retry_policy: @config.rpcs.get_knowledge_base.retry_policy
291
- options.apply_defaults metadata: @config.metadata,
284
+
285
+ options.apply_defaults timeout: @config.timeout,
286
+ metadata: @config.metadata,
292
287
  retry_policy: @config.retry_policy
293
288
 
294
289
  @knowledge_bases_stub.call_rpc :get_knowledge_base, request, options: options do |response, operation|
@@ -357,7 +352,9 @@ module Google
357
352
  options.apply_defaults timeout: @config.rpcs.create_knowledge_base.timeout,
358
353
  metadata: metadata,
359
354
  retry_policy: @config.rpcs.create_knowledge_base.retry_policy
360
- options.apply_defaults metadata: @config.metadata,
355
+
356
+ options.apply_defaults timeout: @config.timeout,
357
+ metadata: @config.metadata,
361
358
  retry_policy: @config.retry_policy
362
359
 
363
360
  @knowledge_bases_stub.call_rpc :create_knowledge_base, request, options: options do |response, operation|
@@ -428,7 +425,9 @@ module Google
428
425
  options.apply_defaults timeout: @config.rpcs.delete_knowledge_base.timeout,
429
426
  metadata: metadata,
430
427
  retry_policy: @config.rpcs.delete_knowledge_base.retry_policy
431
- options.apply_defaults metadata: @config.metadata,
428
+
429
+ options.apply_defaults timeout: @config.timeout,
430
+ metadata: @config.metadata,
432
431
  retry_policy: @config.retry_policy
433
432
 
434
433
  @knowledge_bases_stub.call_rpc :delete_knowledge_base, request, options: options do |response, operation|
@@ -498,7 +497,9 @@ module Google
498
497
  options.apply_defaults timeout: @config.rpcs.update_knowledge_base.timeout,
499
498
  metadata: metadata,
500
499
  retry_policy: @config.rpcs.update_knowledge_base.retry_policy
501
- options.apply_defaults metadata: @config.metadata,
500
+
501
+ options.apply_defaults timeout: @config.timeout,
502
+ metadata: @config.metadata,
502
503
  retry_policy: @config.retry_policy
503
504
 
504
505
  @knowledge_bases_stub.call_rpc :update_knowledge_base, request, options: options do |response, operation|
@@ -522,22 +523,21 @@ module Google
522
523
  # Configuration can be applied globally to all clients, or to a single client
523
524
  # on construction.
524
525
  #
525
- # # Examples
526
- #
527
- # To modify the global config, setting the timeout for list_knowledge_bases
528
- # to 20 seconds, and all remaining timeouts to 10 seconds:
529
- #
530
- # ::Google::Cloud::Dialogflow::V2::KnowledgeBases::Client.configure do |config|
531
- # config.timeout = 10.0
532
- # config.rpcs.list_knowledge_bases.timeout = 20.0
533
- # end
534
- #
535
- # To apply the above configuration only to a new client:
536
- #
537
- # client = ::Google::Cloud::Dialogflow::V2::KnowledgeBases::Client.new do |config|
538
- # config.timeout = 10.0
539
- # config.rpcs.list_knowledge_bases.timeout = 20.0
540
- # end
526
+ # @example
527
+ #
528
+ # # Modify the global config, setting the timeout for
529
+ # # list_knowledge_bases to 20 seconds,
530
+ # # and all remaining timeouts to 10 seconds.
531
+ # ::Google::Cloud::Dialogflow::V2::KnowledgeBases::Client.configure do |config|
532
+ # config.timeout = 10.0
533
+ # config.rpcs.list_knowledge_bases.timeout = 20.0
534
+ # end
535
+ #
536
+ # # Apply the above configuration only to a new client.
537
+ # client = ::Google::Cloud::Dialogflow::V2::KnowledgeBases::Client.new do |config|
538
+ # config.timeout = 10.0
539
+ # config.rpcs.list_knowledge_bases.timeout = 20.0
540
+ # end
541
541
  #
542
542
  # @!attribute [rw] endpoint
543
543
  # The hostname or hostname:port of the service endpoint.