google-cloud-dialogflow-v2 0.6.4 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.md +188 -190
  3. data/README.md +66 -2
  4. data/lib/google/cloud/dialogflow/v2.rb +13 -2
  5. data/lib/google/cloud/dialogflow/v2/agent_services_pb.rb +26 -15
  6. data/lib/google/cloud/dialogflow/v2/agents/client.rb +40 -23
  7. data/lib/google/cloud/dialogflow/v2/agents/operations.rb +96 -11
  8. data/lib/google/cloud/dialogflow/v2/agents/paths.rb +42 -3
  9. data/lib/google/cloud/dialogflow/v2/answer_record_pb.rb +100 -0
  10. data/lib/google/cloud/dialogflow/v2/answer_record_services_pb.rb +48 -0
  11. data/lib/google/cloud/dialogflow/v2/answer_records.rb +49 -0
  12. data/lib/google/cloud/dialogflow/v2/answer_records/client.rb +478 -0
  13. data/lib/google/cloud/dialogflow/v2/answer_records/credentials.rb +52 -0
  14. data/lib/google/cloud/dialogflow/v2/answer_records/paths.rb +105 -0
  15. data/lib/google/cloud/dialogflow/v2/audio_config_pb.rb +7 -0
  16. data/lib/google/cloud/dialogflow/v2/context_services_pb.rb +8 -25
  17. data/lib/google/cloud/dialogflow/v2/contexts.rb +1 -18
  18. data/lib/google/cloud/dialogflow/v2/contexts/client.rb +22 -33
  19. data/lib/google/cloud/dialogflow/v2/contexts/paths.rb +74 -2
  20. data/lib/google/cloud/dialogflow/v2/conversation_event_pb.rb +39 -0
  21. data/lib/google/cloud/dialogflow/v2/conversation_pb.rb +89 -0
  22. data/lib/google/cloud/dialogflow/v2/conversation_profile_pb.rb +182 -0
  23. data/lib/google/cloud/dialogflow/v2/conversation_profile_services_pb.rb +61 -0
  24. data/lib/google/cloud/dialogflow/v2/conversation_profiles.rb +49 -0
  25. data/lib/google/cloud/dialogflow/v2/conversation_profiles/client.rb +699 -0
  26. data/lib/google/cloud/dialogflow/v2/conversation_profiles/credentials.rb +52 -0
  27. data/lib/google/cloud/dialogflow/v2/conversation_profiles/paths.rb +246 -0
  28. data/lib/google/cloud/dialogflow/v2/conversation_services_pb.rb +75 -0
  29. data/lib/google/cloud/dialogflow/v2/conversations.rb +49 -0
  30. data/lib/google/cloud/dialogflow/v2/conversations/client.rb +757 -0
  31. data/lib/google/cloud/dialogflow/v2/conversations/credentials.rb +52 -0
  32. data/lib/google/cloud/dialogflow/v2/conversations/paths.rb +146 -0
  33. data/lib/google/cloud/dialogflow/v2/document_pb.rb +99 -0
  34. data/lib/google/cloud/dialogflow/v2/document_services_pb.rb +73 -0
  35. data/lib/google/cloud/dialogflow/v2/documents.rb +50 -0
  36. data/lib/google/cloud/dialogflow/v2/documents/client.rb +810 -0
  37. data/lib/google/cloud/dialogflow/v2/documents/credentials.rb +52 -0
  38. data/lib/google/cloud/dialogflow/v2/documents/operations.rb +655 -0
  39. data/lib/google/cloud/dialogflow/v2/documents/paths.rb +119 -0
  40. data/lib/google/cloud/dialogflow/v2/entity_type_services_pb.rb +40 -46
  41. data/lib/google/cloud/dialogflow/v2/entity_types.rb +1 -28
  42. data/lib/google/cloud/dialogflow/v2/entity_types/client.rb +54 -54
  43. data/lib/google/cloud/dialogflow/v2/entity_types/operations.rb +96 -11
  44. data/lib/google/cloud/dialogflow/v2/entity_types/paths.rb +58 -12
  45. data/lib/google/cloud/dialogflow/v2/environment_pb.rb +50 -1
  46. data/lib/google/cloud/dialogflow/v2/environment_services_pb.rb +24 -3
  47. data/lib/google/cloud/dialogflow/v2/environments.rb +1 -1
  48. data/lib/google/cloud/dialogflow/v2/environments/client.rb +428 -12
  49. data/lib/google/cloud/dialogflow/v2/environments/paths.rb +145 -5
  50. data/lib/google/cloud/dialogflow/v2/fulfillment_pb.rb +59 -0
  51. data/lib/google/cloud/dialogflow/v2/fulfillment_services_pb.rb +47 -0
  52. data/lib/google/cloud/dialogflow/v2/fulfillments.rb +49 -0
  53. data/lib/google/cloud/dialogflow/v2/fulfillments/client.rb +460 -0
  54. data/lib/google/cloud/dialogflow/v2/fulfillments/credentials.rb +52 -0
  55. data/lib/google/cloud/dialogflow/v2/fulfillments/paths.rb +69 -0
  56. data/lib/google/cloud/dialogflow/v2/gcs_pb.rb +20 -0
  57. data/lib/google/cloud/dialogflow/v2/human_agent_assistant_event_pb.rb +26 -0
  58. data/lib/google/cloud/dialogflow/v2/intent_pb.rb +2 -0
  59. data/lib/google/cloud/dialogflow/v2/intent_services_pb.rb +29 -42
  60. data/lib/google/cloud/dialogflow/v2/intents.rb +1 -32
  61. data/lib/google/cloud/dialogflow/v2/intents/client.rb +52 -51
  62. data/lib/google/cloud/dialogflow/v2/intents/operations.rb +96 -11
  63. data/lib/google/cloud/dialogflow/v2/intents/paths.rb +97 -13
  64. data/lib/google/cloud/dialogflow/v2/knowledge_base_pb.rb +60 -0
  65. data/lib/google/cloud/dialogflow/v2/knowledge_base_services_pb.rb +53 -0
  66. data/lib/google/cloud/dialogflow/v2/knowledge_bases.rb +49 -0
  67. data/lib/google/cloud/dialogflow/v2/knowledge_bases/client.rb +696 -0
  68. data/lib/google/cloud/dialogflow/v2/knowledge_bases/credentials.rb +52 -0
  69. data/lib/google/cloud/dialogflow/v2/knowledge_bases/paths.rb +105 -0
  70. data/lib/google/cloud/dialogflow/v2/participant_pb.rb +181 -0
  71. data/lib/google/cloud/dialogflow/v2/participant_services_pb.rb +64 -0
  72. data/lib/google/cloud/dialogflow/v2/participants.rb +49 -0
  73. data/lib/google/cloud/dialogflow/v2/participants/client.rb +894 -0
  74. data/lib/google/cloud/dialogflow/v2/participants/credentials.rb +52 -0
  75. data/lib/google/cloud/dialogflow/v2/participants/paths.rb +334 -0
  76. data/lib/google/cloud/dialogflow/v2/session_entity_type_services_pb.rb +7 -23
  77. data/lib/google/cloud/dialogflow/v2/session_entity_types.rb +1 -17
  78. data/lib/google/cloud/dialogflow/v2/session_entity_types/client.rb +21 -31
  79. data/lib/google/cloud/dialogflow/v2/session_entity_types/paths.rb +74 -2
  80. data/lib/google/cloud/dialogflow/v2/session_pb.rb +2 -0
  81. data/lib/google/cloud/dialogflow/v2/session_services_pb.rb +15 -7
  82. data/lib/google/cloud/dialogflow/v2/sessions.rb +4 -4
  83. data/lib/google/cloud/dialogflow/v2/sessions/client.rb +43 -21
  84. data/lib/google/cloud/dialogflow/v2/sessions/paths.rb +113 -3
  85. data/lib/google/cloud/dialogflow/v2/version.rb +1 -1
  86. data/lib/google/cloud/dialogflow/v2/version_pb.rb +69 -0
  87. data/lib/google/cloud/dialogflow/v2/version_services_pb.rb +59 -0
  88. data/lib/google/cloud/dialogflow/v2/versions.rb +49 -0
  89. data/lib/google/cloud/dialogflow/v2/versions/client.rb +709 -0
  90. data/lib/google/cloud/dialogflow/v2/versions/credentials.rb +52 -0
  91. data/lib/google/cloud/dialogflow/v2/versions/paths.rb +110 -0
  92. data/proto_docs/google/api/field_behavior.rb +6 -0
  93. data/proto_docs/google/api/resource.rb +50 -14
  94. data/proto_docs/google/cloud/dialogflow/v2/agent.rb +1 -2
  95. data/proto_docs/google/cloud/dialogflow/v2/answer_record.rb +252 -0
  96. data/proto_docs/google/cloud/dialogflow/v2/audio_config.rb +25 -0
  97. data/proto_docs/google/cloud/dialogflow/v2/context.rb +17 -2
  98. data/proto_docs/google/cloud/dialogflow/v2/conversation.rb +253 -0
  99. data/proto_docs/google/cloud/dialogflow/v2/conversation_event.rb +83 -0
  100. data/proto_docs/google/cloud/dialogflow/v2/conversation_profile.rb +522 -0
  101. data/proto_docs/google/cloud/dialogflow/v2/document.rb +267 -0
  102. data/proto_docs/google/cloud/dialogflow/v2/entity_type.rb +12 -3
  103. data/proto_docs/google/cloud/dialogflow/v2/environment.rb +188 -6
  104. data/proto_docs/google/cloud/dialogflow/v2/fulfillment.rb +144 -0
  105. data/proto_docs/google/cloud/dialogflow/v2/human_agent_assistant_event.rb +45 -0
  106. data/proto_docs/google/cloud/dialogflow/v2/intent.rb +29 -4
  107. data/proto_docs/google/cloud/dialogflow/v2/knowledge_base.rb +139 -0
  108. data/proto_docs/google/cloud/dialogflow/v2/participant.rb +525 -0
  109. data/proto_docs/google/cloud/dialogflow/v2/session.rb +56 -7
  110. data/proto_docs/google/cloud/dialogflow/v2/session_entity_type.rb +7 -6
  111. data/proto_docs/google/cloud/dialogflow/v2/validation_result.rb +1 -1
  112. data/proto_docs/google/cloud/dialogflow/v2/version.rb +176 -0
  113. data/proto_docs/google/cloud/dialogflow/v2/webhook.rb +2 -2
  114. data/proto_docs/google/longrunning/operations.rb +17 -3
  115. data/proto_docs/google/protobuf/any.rb +5 -2
  116. data/proto_docs/google/protobuf/timestamp.rb +10 -1
  117. data/proto_docs/google/type/latlng.rb +2 -2
  118. metadata +81 -11
@@ -103,8 +103,13 @@ module Google
103
103
  # Lists operations that match the specified filter in the request. If the
104
104
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
105
105
  #
106
- # NOTE: the `name` binding below allows API services to override the binding
107
- # to use different resource name schemes, such as `users/*/operations`.
106
+ # NOTE: the `name` binding allows API services to override the binding
107
+ # to use different resource name schemes, such as `users/*/operations`. To
108
+ # override the binding, API services can add a binding such as
109
+ # `"/v1/{name=users/*}/operations"` to their service configuration.
110
+ # For backwards compatibility, the default name includes the operations
111
+ # collection id, however overriding users must ensure the name binding
112
+ # is the parent resource, without the operations collection id.
108
113
  #
109
114
  # @overload list_operations(request, options = nil)
110
115
  # Pass arguments to `list_operations` via a request object, either of type
@@ -122,7 +127,7 @@ module Google
122
127
  # the default parameter values, pass an empty Hash as a request object (see above).
123
128
  #
124
129
  # @param name [::String]
125
- # The name of the operation collection.
130
+ # The name of the operation's parent resource.
126
131
  # @param filter [::String]
127
132
  # The standard list filter.
128
133
  # @param page_size [::Integer]
@@ -390,6 +395,79 @@ module Google
390
395
  raise ::Google::Cloud::Error.from_error(e)
391
396
  end
392
397
 
398
+ ##
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
402
+ # specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
403
+ # timeout is used. If the server does not support this method, it returns
404
+ # `google.rpc.Code.UNIMPLEMENTED`.
405
+ # Note that this method is on a best-effort basis. It may return the latest
406
+ # state before the specified timeout (including immediately), meaning even an
407
+ # immediate response is no guarantee that the operation is done.
408
+ #
409
+ # @overload wait_operation(request, options = nil)
410
+ # Pass arguments to `wait_operation` via a request object, either of type
411
+ # {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash.
412
+ #
413
+ # @param request [::Google::Longrunning::WaitOperationRequest, ::Hash]
414
+ # A request object representing the call parameters. Required. To specify no
415
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
416
+ # @param options [::Gapic::CallOptions, ::Hash]
417
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
418
+ #
419
+ # @overload wait_operation(name: nil, timeout: nil)
420
+ # Pass arguments to `wait_operation` via keyword arguments. Note that at
421
+ # least one keyword argument is required. To specify no parameters, or to keep all
422
+ # the default parameter values, pass an empty Hash as a request object (see above).
423
+ #
424
+ # @param name [::String]
425
+ # The name of the operation resource to wait on.
426
+ # @param timeout [::Google::Protobuf::Duration, ::Hash]
427
+ # The maximum duration to wait before timing out. If left blank, the wait
428
+ # will be at most the time permitted by the underlying HTTP/RPC protocol.
429
+ # If RPC context deadline is also specified, the shorter one will be used.
430
+ #
431
+ # @yield [response, operation] Access the result along with the RPC operation
432
+ # @yieldparam response [::Gapic::Operation]
433
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
434
+ #
435
+ # @return [::Gapic::Operation]
436
+ #
437
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
438
+ #
439
+ def wait_operation request, options = nil
440
+ raise ::ArgumentError, "request must be provided" if request.nil?
441
+
442
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest
443
+
444
+ # Converts hash and nil to an options object
445
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
446
+
447
+ # Customize the options with defaults
448
+ metadata = @config.rpcs.wait_operation.metadata.to_h
449
+
450
+ # Set x-goog-api-client and x-goog-user-project headers
451
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
452
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
453
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
454
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
455
+
456
+ options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
457
+ metadata: metadata,
458
+ retry_policy: @config.rpcs.wait_operation.retry_policy
459
+ options.apply_defaults metadata: @config.metadata,
460
+ retry_policy: @config.retry_policy
461
+
462
+ @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
463
+ response = ::Gapic::Operation.new response, @operations_client, options: options
464
+ yield response, operation if block_given?
465
+ return response
466
+ end
467
+ rescue ::GRPC::BadStatus => e
468
+ raise ::Google::Cloud::Error.from_error(e)
469
+ end
470
+
393
471
  ##
394
472
  # Configuration class for the Operations API.
395
473
  #
@@ -475,14 +553,14 @@ module Google
475
553
 
476
554
  config_attr :endpoint, "dialogflow.googleapis.com", ::String
477
555
  config_attr :credentials, nil do |value|
478
- allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
556
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
479
557
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
480
558
  allowed.any? { |klass| klass === value }
481
559
  end
482
560
  config_attr :scope, nil, ::String, ::Array, nil
483
561
  config_attr :lib_name, nil, ::String, nil
484
562
  config_attr :lib_version, nil, ::String, nil
485
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
563
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
486
564
  config_attr :interceptors, nil, ::Array, nil
487
565
  config_attr :timeout, nil, ::Numeric, nil
488
566
  config_attr :metadata, nil, ::Hash, nil
@@ -503,7 +581,7 @@ module Google
503
581
  def rpcs
504
582
  @rpcs ||= begin
505
583
  parent_rpcs = nil
506
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
584
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
507
585
  Rpcs.new parent_rpcs
508
586
  end
509
587
  end
@@ -515,7 +593,7 @@ module Google
515
593
  # Each configuration object is of type `Gapic::Config::Method` and includes
516
594
  # the following configuration fields:
517
595
  #
518
- # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
596
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
519
597
  # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
520
598
  # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
521
599
  # include the following keys:
@@ -546,17 +624,24 @@ module Google
546
624
  # @return [::Gapic::Config::Method]
547
625
  #
548
626
  attr_reader :cancel_operation
627
+ ##
628
+ # RPC-specific configuration for `wait_operation`
629
+ # @return [::Gapic::Config::Method]
630
+ #
631
+ attr_reader :wait_operation
549
632
 
550
633
  # @private
551
634
  def initialize parent_rpcs = nil
552
- list_operations_config = parent_rpcs&.list_operations if parent_rpcs&.respond_to? :list_operations
635
+ list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations
553
636
  @list_operations = ::Gapic::Config::Method.new list_operations_config
554
- get_operation_config = parent_rpcs&.get_operation if parent_rpcs&.respond_to? :get_operation
637
+ get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation
555
638
  @get_operation = ::Gapic::Config::Method.new get_operation_config
556
- delete_operation_config = parent_rpcs&.delete_operation if parent_rpcs&.respond_to? :delete_operation
639
+ delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation
557
640
  @delete_operation = ::Gapic::Config::Method.new delete_operation_config
558
- cancel_operation_config = parent_rpcs&.cancel_operation if parent_rpcs&.respond_to? :cancel_operation
641
+ cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation
559
642
  @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config
643
+ wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation
644
+ @wait_operation = ::Gapic::Config::Method.new wait_operation_config
560
645
 
561
646
  yield self if block_given?
562
647
  end
@@ -27,32 +27,78 @@ module Google
27
27
  ##
28
28
  # Create a fully-qualified Agent resource string.
29
29
  #
30
- # The resource will be in the following format:
30
+ # @overload agent_path(project:)
31
+ # The resource will be in the following format:
31
32
  #
32
- # `projects/{project}/agent`
33
+ # `projects/{project}/agent`
33
34
  #
34
- # @param project [String]
35
+ # @param project [String]
36
+ #
37
+ # @overload agent_path(project:, location:)
38
+ # The resource will be in the following format:
39
+ #
40
+ # `projects/{project}/locations/{location}/agent`
41
+ #
42
+ # @param project [String]
43
+ # @param location [String]
35
44
  #
36
45
  # @return [::String]
37
- def agent_path project:
38
- "projects/#{project}/agent"
46
+ def agent_path **args
47
+ resources = {
48
+ "project" => (proc do |project:|
49
+ "projects/#{project}/agent"
50
+ end),
51
+ "location:project" => (proc do |project:, location:|
52
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
53
+
54
+ "projects/#{project}/locations/#{location}/agent"
55
+ end)
56
+ }
57
+
58
+ resource = resources[args.keys.sort.join(":")]
59
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
60
+ resource.call(**args)
39
61
  end
40
62
 
41
63
  ##
42
64
  # Create a fully-qualified EntityType resource string.
43
65
  #
44
- # The resource will be in the following format:
66
+ # @overload entity_type_path(project:, entity_type:)
67
+ # The resource will be in the following format:
45
68
  #
46
- # `projects/{project}/agent/entityTypes/{entity_type}`
69
+ # `projects/{project}/agent/entityTypes/{entity_type}`
47
70
  #
48
- # @param project [String]
49
- # @param entity_type [String]
71
+ # @param project [String]
72
+ # @param entity_type [String]
73
+ #
74
+ # @overload entity_type_path(project:, location:, entity_type:)
75
+ # The resource will be in the following format:
76
+ #
77
+ # `projects/{project}/locations/{location}/agent/entityTypes/{entity_type}`
78
+ #
79
+ # @param project [String]
80
+ # @param location [String]
81
+ # @param entity_type [String]
50
82
  #
51
83
  # @return [::String]
52
- def entity_type_path project:, entity_type:
53
- raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
84
+ def entity_type_path **args
85
+ resources = {
86
+ "entity_type:project" => (proc do |project:, entity_type:|
87
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
88
+
89
+ "projects/#{project}/agent/entityTypes/#{entity_type}"
90
+ end),
91
+ "entity_type:location:project" => (proc do |project:, location:, entity_type:|
92
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
93
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
94
+
95
+ "projects/#{project}/locations/#{location}/agent/entityTypes/#{entity_type}"
96
+ end)
97
+ }
54
98
 
55
- "projects/#{project}/agent/entityTypes/#{entity_type}"
99
+ resource = resources[args.keys.sort.join(":")]
100
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
101
+ resource.call(**args)
56
102
  end
57
103
 
58
104
  extend self
@@ -4,12 +4,14 @@
4
4
  require 'google/protobuf'
5
5
 
6
6
  require 'google/api/annotations_pb'
7
+ require 'google/api/client_pb'
7
8
  require 'google/api/field_behavior_pb'
8
9
  require 'google/api/resource_pb'
10
+ require 'google/cloud/dialogflow/v2/audio_config_pb'
11
+ require 'google/cloud/dialogflow/v2/fulfillment_pb'
9
12
  require 'google/protobuf/empty_pb'
10
13
  require 'google/protobuf/field_mask_pb'
11
14
  require 'google/protobuf/timestamp_pb'
12
- require 'google/api/client_pb'
13
15
  Google::Protobuf::DescriptorPool.generated_pool.build do
14
16
  add_file("google/cloud/dialogflow/v2/environment.proto", :syntax => :proto3) do
15
17
  add_message "google.cloud.dialogflow.v2.Environment" do
@@ -18,6 +20,8 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
18
20
  optional :agent_version, :string, 3
19
21
  optional :state, :enum, 4, "google.cloud.dialogflow.v2.Environment.State"
20
22
  optional :update_time, :message, 5, "google.protobuf.Timestamp"
23
+ optional :text_to_speech_settings, :message, 7, "google.cloud.dialogflow.v2.TextToSpeechSettings"
24
+ optional :fulfillment, :message, 8, "google.cloud.dialogflow.v2.Fulfillment"
21
25
  end
22
26
  add_enum "google.cloud.dialogflow.v2.Environment.State" do
23
27
  value :STATE_UNSPECIFIED, 0
@@ -25,6 +29,12 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
25
29
  value :LOADING, 2
26
30
  value :RUNNING, 3
27
31
  end
32
+ add_message "google.cloud.dialogflow.v2.TextToSpeechSettings" do
33
+ optional :enable_text_to_speech, :bool, 1
34
+ optional :output_audio_encoding, :enum, 2, "google.cloud.dialogflow.v2.OutputAudioEncoding"
35
+ optional :sample_rate_hertz, :int32, 3
36
+ map :synthesize_speech_configs, :string, :message, 4, "google.cloud.dialogflow.v2.SynthesizeSpeechConfig"
37
+ end
28
38
  add_message "google.cloud.dialogflow.v2.ListEnvironmentsRequest" do
29
39
  optional :parent, :string, 1
30
40
  optional :page_size, :int32, 2
@@ -34,6 +44,37 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
34
44
  repeated :environments, :message, 1, "google.cloud.dialogflow.v2.Environment"
35
45
  optional :next_page_token, :string, 2
36
46
  end
47
+ add_message "google.cloud.dialogflow.v2.GetEnvironmentRequest" do
48
+ optional :name, :string, 1
49
+ end
50
+ add_message "google.cloud.dialogflow.v2.CreateEnvironmentRequest" do
51
+ optional :parent, :string, 1
52
+ optional :environment, :message, 2, "google.cloud.dialogflow.v2.Environment"
53
+ optional :environment_id, :string, 3
54
+ end
55
+ add_message "google.cloud.dialogflow.v2.UpdateEnvironmentRequest" do
56
+ optional :environment, :message, 1, "google.cloud.dialogflow.v2.Environment"
57
+ optional :update_mask, :message, 2, "google.protobuf.FieldMask"
58
+ optional :allow_load_to_draft_and_discard_changes, :bool, 3
59
+ end
60
+ add_message "google.cloud.dialogflow.v2.DeleteEnvironmentRequest" do
61
+ optional :name, :string, 1
62
+ end
63
+ add_message "google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest" do
64
+ optional :parent, :string, 1
65
+ optional :page_size, :int32, 2
66
+ optional :page_token, :string, 3
67
+ end
68
+ add_message "google.cloud.dialogflow.v2.EnvironmentHistory" do
69
+ optional :parent, :string, 1
70
+ repeated :entries, :message, 2, "google.cloud.dialogflow.v2.EnvironmentHistory.Entry"
71
+ optional :next_page_token, :string, 3
72
+ end
73
+ add_message "google.cloud.dialogflow.v2.EnvironmentHistory.Entry" do
74
+ optional :agent_version, :string, 1
75
+ optional :description, :string, 2
76
+ optional :create_time, :message, 3, "google.protobuf.Timestamp"
77
+ end
37
78
  end
38
79
  end
39
80
 
@@ -43,8 +84,16 @@ module Google
43
84
  module V2
44
85
  Environment = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Environment").msgclass
45
86
  Environment::State = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Environment.State").enummodule
87
+ TextToSpeechSettings = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.TextToSpeechSettings").msgclass
46
88
  ListEnvironmentsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.ListEnvironmentsRequest").msgclass
47
89
  ListEnvironmentsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.ListEnvironmentsResponse").msgclass
90
+ GetEnvironmentRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.GetEnvironmentRequest").msgclass
91
+ CreateEnvironmentRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.CreateEnvironmentRequest").msgclass
92
+ UpdateEnvironmentRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.UpdateEnvironmentRequest").msgclass
93
+ DeleteEnvironmentRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.DeleteEnvironmentRequest").msgclass
94
+ GetEnvironmentHistoryRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest").msgclass
95
+ EnvironmentHistory = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.EnvironmentHistory").msgclass
96
+ EnvironmentHistory::Entry = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.EnvironmentHistory.Entry").msgclass
48
97
  end
49
98
  end
50
99
  end
@@ -24,17 +24,38 @@ module Google
24
24
  module Dialogflow
25
25
  module V2
26
26
  module Environments
27
- # Manages agent environments.
27
+ # Service for managing [Environments][google.cloud.dialogflow.v2.Environment].
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
34
34
  self.service_name = 'google.cloud.dialogflow.v2.Environments'
35
35
 
36
36
  # Returns the list of all non-draft environments of the specified agent.
37
- rpc :ListEnvironments, ListEnvironmentsRequest, ListEnvironmentsResponse
37
+ rpc :ListEnvironments, ::Google::Cloud::Dialogflow::V2::ListEnvironmentsRequest, ::Google::Cloud::Dialogflow::V2::ListEnvironmentsResponse
38
+ # Retrieves the specified agent environment.
39
+ rpc :GetEnvironment, ::Google::Cloud::Dialogflow::V2::GetEnvironmentRequest, ::Google::Cloud::Dialogflow::V2::Environment
40
+ # Creates an agent environment.
41
+ rpc :CreateEnvironment, ::Google::Cloud::Dialogflow::V2::CreateEnvironmentRequest, ::Google::Cloud::Dialogflow::V2::Environment
42
+ # Updates the specified agent environment.
43
+ #
44
+ # This method allows you to deploy new agent versions into the environment.
45
+ # When an environment is pointed to a new agent version by setting
46
+ # `environment.agent_version`, the environment is temporarily set to the
47
+ # `LOADING` state. During that time, the environment keeps on serving the
48
+ # previous version of the agent. After the new agent version is done loading,
49
+ # the environment is set back to the `RUNNING` state.
50
+ # You can use "-" as Environment ID in environment name to update version
51
+ # in "draft" environment. WARNING: this will negate all recent changes to
52
+ # draft and can't be undone. You may want to save the draft to a version
53
+ # before calling this function.
54
+ rpc :UpdateEnvironment, ::Google::Cloud::Dialogflow::V2::UpdateEnvironmentRequest, ::Google::Cloud::Dialogflow::V2::Environment
55
+ # Deletes the specified agent environment.
56
+ rpc :DeleteEnvironment, ::Google::Cloud::Dialogflow::V2::DeleteEnvironmentRequest, ::Google::Protobuf::Empty
57
+ # Gets the history of the specified environment.
58
+ rpc :GetEnvironmentHistory, ::Google::Cloud::Dialogflow::V2::GetEnvironmentHistoryRequest, ::Google::Cloud::Dialogflow::V2::EnvironmentHistory
38
59
  end
39
60
 
40
61
  Stub = Service.rpc_stub_class
@@ -31,7 +31,7 @@ module Google
31
31
  module Dialogflow
32
32
  module V2
33
33
  ##
34
- # Manages agent environments.
34
+ # Service for managing {::Google::Cloud::Dialogflow::V2::Environment Environments}.
35
35
  #
36
36
  # To load this service and instantiate a client:
37
37
  #
@@ -27,7 +27,7 @@ module Google
27
27
  ##
28
28
  # Client for the Environments service.
29
29
  #
30
- # Manages agent environments.
30
+ # Service for managing {::Google::Cloud::Dialogflow::V2::Environment Environments}.
31
31
  #
32
32
  class Client
33
33
  include Paths
@@ -60,7 +60,7 @@ module Google
60
60
  parent_config = while namespace.any?
61
61
  parent_name = namespace.join "::"
62
62
  parent_const = const_get parent_name
63
- break parent_const.configure if parent_const&.respond_to? :configure
63
+ break parent_const.configure if parent_const.respond_to? :configure
64
64
  namespace.pop
65
65
  end
66
66
  default_config = Client::Configuration.new parent_config
@@ -68,9 +68,9 @@ module Google
68
68
  default_config.timeout = 60.0
69
69
  default_config.retry_policy = {
70
70
  initial_delay: 0.1,
71
- max_delay: 60.0,
72
- multiplier: 1.3,
73
- retry_codes: ["UNAVAILABLE"]
71
+ max_delay: 60.0,
72
+ multiplier: 1.3,
73
+ retry_codes: [14]
74
74
  }
75
75
 
76
76
  default_config
@@ -134,7 +134,13 @@ module Google
134
134
 
135
135
  # Create credentials
136
136
  credentials = @config.credentials
137
- credentials ||= Credentials.default scope: @config.scope
137
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
138
+ # 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 &&
141
+ !@config.endpoint.split(".").first.include?("-")
142
+ credentials ||= Credentials.default scope: @config.scope,
143
+ enable_self_signed_jwt: enable_self_signed_jwt
138
144
  if credentials.is_a?(String) || credentials.is_a?(Hash)
139
145
  credentials = Credentials.new credentials, scope: @config.scope
140
146
  end
@@ -172,7 +178,9 @@ module Google
172
178
  #
173
179
  # @param parent [::String]
174
180
  # Required. The agent to list all environments from.
175
- # Format: `projects/<Project ID>/agent`.
181
+ # Format:
182
+ # - `projects/<Project ID>/agent`
183
+ # - `projects/<Project ID>/locations/<Location ID>/agent`
176
184
  # @param page_size [::Integer]
177
185
  # Optional. The maximum number of items to return in a single page. By default 100 and
178
186
  # at most 1000.
@@ -225,6 +233,379 @@ module Google
225
233
  raise ::Google::Cloud::Error.from_error(e)
226
234
  end
227
235
 
236
+ ##
237
+ # Retrieves the specified agent environment.
238
+ #
239
+ # @overload get_environment(request, options = nil)
240
+ # Pass arguments to `get_environment` via a request object, either of type
241
+ # {::Google::Cloud::Dialogflow::V2::GetEnvironmentRequest} or an equivalent Hash.
242
+ #
243
+ # @param request [::Google::Cloud::Dialogflow::V2::GetEnvironmentRequest, ::Hash]
244
+ # A request object representing the call parameters. Required. To specify no
245
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
246
+ # @param options [::Gapic::CallOptions, ::Hash]
247
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
248
+ #
249
+ # @overload get_environment(name: nil)
250
+ # Pass arguments to `get_environment` via keyword arguments. Note that at
251
+ # least one keyword argument is required. To specify no parameters, or to keep all
252
+ # the default parameter values, pass an empty Hash as a request object (see above).
253
+ #
254
+ # @param name [::String]
255
+ # Required. The name of the environment.
256
+ # Supported formats:
257
+ # - `projects/<Project ID>/agent/environments/<Environment ID>`
258
+ # - `projects/<Project ID>/locations/<Location
259
+ # ID>/agent/environments/<Environment ID>`
260
+ #
261
+ # @yield [response, operation] Access the result along with the RPC operation
262
+ # @yieldparam response [::Google::Cloud::Dialogflow::V2::Environment]
263
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
264
+ #
265
+ # @return [::Google::Cloud::Dialogflow::V2::Environment]
266
+ #
267
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
268
+ #
269
+ def get_environment request, options = nil
270
+ raise ::ArgumentError, "request must be provided" if request.nil?
271
+
272
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::GetEnvironmentRequest
273
+
274
+ # Converts hash and nil to an options object
275
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
276
+
277
+ # Customize the options with defaults
278
+ metadata = @config.rpcs.get_environment.metadata.to_h
279
+
280
+ # Set x-goog-api-client and x-goog-user-project headers
281
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
282
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
283
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
284
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
285
+
286
+ header_params = {
287
+ "name" => request.name
288
+ }
289
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
290
+ metadata[:"x-goog-request-params"] ||= request_params_header
291
+
292
+ options.apply_defaults timeout: @config.rpcs.get_environment.timeout,
293
+ metadata: metadata,
294
+ retry_policy: @config.rpcs.get_environment.retry_policy
295
+ options.apply_defaults metadata: @config.metadata,
296
+ retry_policy: @config.retry_policy
297
+
298
+ @environments_stub.call_rpc :get_environment, request, options: options do |response, operation|
299
+ yield response, operation if block_given?
300
+ return response
301
+ end
302
+ rescue ::GRPC::BadStatus => e
303
+ raise ::Google::Cloud::Error.from_error(e)
304
+ end
305
+
306
+ ##
307
+ # Creates an agent environment.
308
+ #
309
+ # @overload create_environment(request, options = nil)
310
+ # Pass arguments to `create_environment` via a request object, either of type
311
+ # {::Google::Cloud::Dialogflow::V2::CreateEnvironmentRequest} or an equivalent Hash.
312
+ #
313
+ # @param request [::Google::Cloud::Dialogflow::V2::CreateEnvironmentRequest, ::Hash]
314
+ # A request object representing the call parameters. Required. To specify no
315
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
316
+ # @param options [::Gapic::CallOptions, ::Hash]
317
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
318
+ #
319
+ # @overload create_environment(parent: nil, environment: nil, environment_id: nil)
320
+ # Pass arguments to `create_environment` via keyword arguments. Note that at
321
+ # least one keyword argument is required. To specify no parameters, or to keep all
322
+ # the default parameter values, pass an empty Hash as a request object (see above).
323
+ #
324
+ # @param parent [::String]
325
+ # Required. The agent to create an environment for.
326
+ # Supported formats:
327
+ # - `projects/<Project ID>/agent`
328
+ # - `projects/<Project ID>/locations/<Location ID>/agent`
329
+ # @param environment [::Google::Cloud::Dialogflow::V2::Environment, ::Hash]
330
+ # Required. The environment to create.
331
+ # @param environment_id [::String]
332
+ # Required. The unique id of the new environment.
333
+ #
334
+ # @yield [response, operation] Access the result along with the RPC operation
335
+ # @yieldparam response [::Google::Cloud::Dialogflow::V2::Environment]
336
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
337
+ #
338
+ # @return [::Google::Cloud::Dialogflow::V2::Environment]
339
+ #
340
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
341
+ #
342
+ def create_environment request, options = nil
343
+ raise ::ArgumentError, "request must be provided" if request.nil?
344
+
345
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::CreateEnvironmentRequest
346
+
347
+ # Converts hash and nil to an options object
348
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
349
+
350
+ # Customize the options with defaults
351
+ metadata = @config.rpcs.create_environment.metadata.to_h
352
+
353
+ # Set x-goog-api-client and x-goog-user-project headers
354
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
355
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
356
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
357
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
358
+
359
+ header_params = {
360
+ "parent" => request.parent
361
+ }
362
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
363
+ metadata[:"x-goog-request-params"] ||= request_params_header
364
+
365
+ options.apply_defaults timeout: @config.rpcs.create_environment.timeout,
366
+ metadata: metadata,
367
+ retry_policy: @config.rpcs.create_environment.retry_policy
368
+ options.apply_defaults metadata: @config.metadata,
369
+ retry_policy: @config.retry_policy
370
+
371
+ @environments_stub.call_rpc :create_environment, request, options: options do |response, operation|
372
+ yield response, operation if block_given?
373
+ return response
374
+ end
375
+ rescue ::GRPC::BadStatus => e
376
+ raise ::Google::Cloud::Error.from_error(e)
377
+ end
378
+
379
+ ##
380
+ # Updates the specified agent environment.
381
+ #
382
+ # This method allows you to deploy new agent versions into the environment.
383
+ # When an environment is pointed to a new agent version by setting
384
+ # `environment.agent_version`, the environment is temporarily set to the
385
+ # `LOADING` state. During that time, the environment keeps on serving the
386
+ # previous version of the agent. After the new agent version is done loading,
387
+ # the environment is set back to the `RUNNING` state.
388
+ # You can use "-" as Environment ID in environment name to update version
389
+ # in "draft" environment. WARNING: this will negate all recent changes to
390
+ # draft and can't be undone. You may want to save the draft to a version
391
+ # before calling this function.
392
+ #
393
+ # @overload update_environment(request, options = nil)
394
+ # Pass arguments to `update_environment` via a request object, either of type
395
+ # {::Google::Cloud::Dialogflow::V2::UpdateEnvironmentRequest} or an equivalent Hash.
396
+ #
397
+ # @param request [::Google::Cloud::Dialogflow::V2::UpdateEnvironmentRequest, ::Hash]
398
+ # A request object representing the call parameters. Required. To specify no
399
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
400
+ # @param options [::Gapic::CallOptions, ::Hash]
401
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
402
+ #
403
+ # @overload update_environment(environment: nil, update_mask: nil, allow_load_to_draft_and_discard_changes: nil)
404
+ # Pass arguments to `update_environment` via keyword arguments. Note that at
405
+ # least one keyword argument is required. To specify no parameters, or to keep all
406
+ # the default parameter values, pass an empty Hash as a request object (see above).
407
+ #
408
+ # @param environment [::Google::Cloud::Dialogflow::V2::Environment, ::Hash]
409
+ # Required. The environment to update.
410
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
411
+ # Required. The mask to control which fields get updated.
412
+ # @param allow_load_to_draft_and_discard_changes [::Boolean]
413
+ # Optional. This field is used to prevent accidental overwrite of the draft
414
+ # environment, which is an operation that cannot be undone. To confirm that
415
+ # the caller desires this overwrite, this field must be explicitly set to
416
+ # true when updating the draft environment (environment ID = `-`).
417
+ #
418
+ # @yield [response, operation] Access the result along with the RPC operation
419
+ # @yieldparam response [::Google::Cloud::Dialogflow::V2::Environment]
420
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
421
+ #
422
+ # @return [::Google::Cloud::Dialogflow::V2::Environment]
423
+ #
424
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
425
+ #
426
+ def update_environment request, options = nil
427
+ raise ::ArgumentError, "request must be provided" if request.nil?
428
+
429
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::UpdateEnvironmentRequest
430
+
431
+ # Converts hash and nil to an options object
432
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
433
+
434
+ # Customize the options with defaults
435
+ metadata = @config.rpcs.update_environment.metadata.to_h
436
+
437
+ # Set x-goog-api-client and x-goog-user-project headers
438
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
439
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
440
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
441
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
442
+
443
+ header_params = {
444
+ "environment.name" => request.environment.name
445
+ }
446
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
447
+ metadata[:"x-goog-request-params"] ||= request_params_header
448
+
449
+ options.apply_defaults timeout: @config.rpcs.update_environment.timeout,
450
+ metadata: metadata,
451
+ retry_policy: @config.rpcs.update_environment.retry_policy
452
+ options.apply_defaults metadata: @config.metadata,
453
+ retry_policy: @config.retry_policy
454
+
455
+ @environments_stub.call_rpc :update_environment, request, options: options do |response, operation|
456
+ yield response, operation if block_given?
457
+ return response
458
+ end
459
+ rescue ::GRPC::BadStatus => e
460
+ raise ::Google::Cloud::Error.from_error(e)
461
+ end
462
+
463
+ ##
464
+ # Deletes the specified agent environment.
465
+ #
466
+ # @overload delete_environment(request, options = nil)
467
+ # Pass arguments to `delete_environment` via a request object, either of type
468
+ # {::Google::Cloud::Dialogflow::V2::DeleteEnvironmentRequest} or an equivalent Hash.
469
+ #
470
+ # @param request [::Google::Cloud::Dialogflow::V2::DeleteEnvironmentRequest, ::Hash]
471
+ # A request object representing the call parameters. Required. To specify no
472
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
473
+ # @param options [::Gapic::CallOptions, ::Hash]
474
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
475
+ #
476
+ # @overload delete_environment(name: nil)
477
+ # Pass arguments to `delete_environment` via keyword arguments. Note that at
478
+ # least one keyword argument is required. To specify no parameters, or to keep all
479
+ # the default parameter values, pass an empty Hash as a request object (see above).
480
+ #
481
+ # @param name [::String]
482
+ # Required. The name of the environment to delete.
483
+ # / Format:
484
+ # - `projects/<Project ID>/agent/environments/<Environment ID>`
485
+ # - `projects/<Project ID>/locations/<Location
486
+ # ID>/agent/environments/<Environment ID>`
487
+ #
488
+ # @yield [response, operation] Access the result along with the RPC operation
489
+ # @yieldparam response [::Google::Protobuf::Empty]
490
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
491
+ #
492
+ # @return [::Google::Protobuf::Empty]
493
+ #
494
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
495
+ #
496
+ def delete_environment request, options = nil
497
+ raise ::ArgumentError, "request must be provided" if request.nil?
498
+
499
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::DeleteEnvironmentRequest
500
+
501
+ # Converts hash and nil to an options object
502
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
503
+
504
+ # Customize the options with defaults
505
+ metadata = @config.rpcs.delete_environment.metadata.to_h
506
+
507
+ # Set x-goog-api-client and x-goog-user-project headers
508
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
509
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
510
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
511
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
512
+
513
+ header_params = {
514
+ "name" => request.name
515
+ }
516
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
517
+ metadata[:"x-goog-request-params"] ||= request_params_header
518
+
519
+ options.apply_defaults timeout: @config.rpcs.delete_environment.timeout,
520
+ metadata: metadata,
521
+ retry_policy: @config.rpcs.delete_environment.retry_policy
522
+ options.apply_defaults metadata: @config.metadata,
523
+ retry_policy: @config.retry_policy
524
+
525
+ @environments_stub.call_rpc :delete_environment, request, options: options do |response, operation|
526
+ yield response, operation if block_given?
527
+ return response
528
+ end
529
+ rescue ::GRPC::BadStatus => e
530
+ raise ::Google::Cloud::Error.from_error(e)
531
+ end
532
+
533
+ ##
534
+ # Gets the history of the specified environment.
535
+ #
536
+ # @overload get_environment_history(request, options = nil)
537
+ # Pass arguments to `get_environment_history` via a request object, either of type
538
+ # {::Google::Cloud::Dialogflow::V2::GetEnvironmentHistoryRequest} or an equivalent Hash.
539
+ #
540
+ # @param request [::Google::Cloud::Dialogflow::V2::GetEnvironmentHistoryRequest, ::Hash]
541
+ # A request object representing the call parameters. Required. To specify no
542
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
543
+ # @param options [::Gapic::CallOptions, ::Hash]
544
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
545
+ #
546
+ # @overload get_environment_history(parent: nil, page_size: nil, page_token: nil)
547
+ # Pass arguments to `get_environment_history` via keyword arguments. Note that at
548
+ # least one keyword argument is required. To specify no parameters, or to keep all
549
+ # the default parameter values, pass an empty Hash as a request object (see above).
550
+ #
551
+ # @param parent [::String]
552
+ # Required. The name of the environment to retrieve history for.
553
+ # Supported formats:
554
+ # - `projects/<Project ID>/agent/environments/<Environment ID>`
555
+ # - `projects/<Project ID>/locations/<Location
556
+ # ID>/agent/environments/<Environment ID>`
557
+ # @param page_size [::Integer]
558
+ # Optional. The maximum number of items to return in a single page. By default 100 and
559
+ # at most 1000.
560
+ # @param page_token [::String]
561
+ # Optional. The next_page_token value returned from a previous list request.
562
+ #
563
+ # @yield [response, operation] Access the result along with the RPC operation
564
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::V2::EnvironmentHistory::Entry>]
565
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
566
+ #
567
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::V2::EnvironmentHistory::Entry>]
568
+ #
569
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
570
+ #
571
+ def get_environment_history request, options = nil
572
+ raise ::ArgumentError, "request must be provided" if request.nil?
573
+
574
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::GetEnvironmentHistoryRequest
575
+
576
+ # Converts hash and nil to an options object
577
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
578
+
579
+ # Customize the options with defaults
580
+ metadata = @config.rpcs.get_environment_history.metadata.to_h
581
+
582
+ # Set x-goog-api-client and x-goog-user-project headers
583
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
584
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
585
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
586
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
587
+
588
+ header_params = {
589
+ "parent" => request.parent
590
+ }
591
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
592
+ metadata[:"x-goog-request-params"] ||= request_params_header
593
+
594
+ options.apply_defaults timeout: @config.rpcs.get_environment_history.timeout,
595
+ metadata: metadata,
596
+ retry_policy: @config.rpcs.get_environment_history.retry_policy
597
+ options.apply_defaults metadata: @config.metadata,
598
+ retry_policy: @config.retry_policy
599
+
600
+ @environments_stub.call_rpc :get_environment_history, request, options: options do |response, operation|
601
+ response = ::Gapic::PagedEnumerable.new @environments_stub, :get_environment_history, request, response, operation, options
602
+ yield response, operation if block_given?
603
+ return response
604
+ end
605
+ rescue ::GRPC::BadStatus => e
606
+ raise ::Google::Cloud::Error.from_error(e)
607
+ end
608
+
228
609
  ##
229
610
  # Configuration class for the Environments API.
230
611
  #
@@ -310,14 +691,14 @@ module Google
310
691
 
311
692
  config_attr :endpoint, "dialogflow.googleapis.com", ::String
312
693
  config_attr :credentials, nil do |value|
313
- allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
694
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
314
695
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
315
696
  allowed.any? { |klass| klass === value }
316
697
  end
317
698
  config_attr :scope, nil, ::String, ::Array, nil
318
699
  config_attr :lib_name, nil, ::String, nil
319
700
  config_attr :lib_version, nil, ::String, nil
320
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
701
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
321
702
  config_attr :interceptors, nil, ::Array, nil
322
703
  config_attr :timeout, nil, ::Numeric, nil
323
704
  config_attr :metadata, nil, ::Hash, nil
@@ -338,7 +719,7 @@ module Google
338
719
  def rpcs
339
720
  @rpcs ||= begin
340
721
  parent_rpcs = nil
341
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
722
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
342
723
  Rpcs.new parent_rpcs
343
724
  end
344
725
  end
@@ -350,7 +731,7 @@ module Google
350
731
  # Each configuration object is of type `Gapic::Config::Method` and includes
351
732
  # the following configuration fields:
352
733
  #
353
- # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
734
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
354
735
  # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
355
736
  # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
356
737
  # include the following keys:
@@ -366,11 +747,46 @@ module Google
366
747
  # @return [::Gapic::Config::Method]
367
748
  #
368
749
  attr_reader :list_environments
750
+ ##
751
+ # RPC-specific configuration for `get_environment`
752
+ # @return [::Gapic::Config::Method]
753
+ #
754
+ attr_reader :get_environment
755
+ ##
756
+ # RPC-specific configuration for `create_environment`
757
+ # @return [::Gapic::Config::Method]
758
+ #
759
+ attr_reader :create_environment
760
+ ##
761
+ # RPC-specific configuration for `update_environment`
762
+ # @return [::Gapic::Config::Method]
763
+ #
764
+ attr_reader :update_environment
765
+ ##
766
+ # RPC-specific configuration for `delete_environment`
767
+ # @return [::Gapic::Config::Method]
768
+ #
769
+ attr_reader :delete_environment
770
+ ##
771
+ # RPC-specific configuration for `get_environment_history`
772
+ # @return [::Gapic::Config::Method]
773
+ #
774
+ attr_reader :get_environment_history
369
775
 
370
776
  # @private
371
777
  def initialize parent_rpcs = nil
372
- list_environments_config = parent_rpcs&.list_environments if parent_rpcs&.respond_to? :list_environments
778
+ list_environments_config = parent_rpcs.list_environments if parent_rpcs.respond_to? :list_environments
373
779
  @list_environments = ::Gapic::Config::Method.new list_environments_config
780
+ get_environment_config = parent_rpcs.get_environment if parent_rpcs.respond_to? :get_environment
781
+ @get_environment = ::Gapic::Config::Method.new get_environment_config
782
+ create_environment_config = parent_rpcs.create_environment if parent_rpcs.respond_to? :create_environment
783
+ @create_environment = ::Gapic::Config::Method.new create_environment_config
784
+ update_environment_config = parent_rpcs.update_environment if parent_rpcs.respond_to? :update_environment
785
+ @update_environment = ::Gapic::Config::Method.new update_environment_config
786
+ delete_environment_config = parent_rpcs.delete_environment if parent_rpcs.respond_to? :delete_environment
787
+ @delete_environment = ::Gapic::Config::Method.new delete_environment_config
788
+ get_environment_history_config = parent_rpcs.get_environment_history if parent_rpcs.respond_to? :get_environment_history
789
+ @get_environment_history = ::Gapic::Config::Method.new get_environment_history_config
374
790
 
375
791
  yield self if block_given?
376
792
  end