google-cloud-dialogflow-cx-v3 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +169 -0
  4. data/LICENSE.md +201 -0
  5. data/README.md +139 -0
  6. data/lib/google/cloud/dialogflow/cx/v3/advanced_settings_pb.rb +32 -0
  7. data/lib/google/cloud/dialogflow/cx/v3/agent_pb.rb +122 -0
  8. data/lib/google/cloud/dialogflow/cx/v3/agent_services_pb.rb +82 -0
  9. data/lib/google/cloud/dialogflow/cx/v3/agents/client.rb +1051 -0
  10. data/lib/google/cloud/dialogflow/cx/v3/agents/credentials.rb +54 -0
  11. data/lib/google/cloud/dialogflow/cx/v3/agents/operations.rb +666 -0
  12. data/lib/google/cloud/dialogflow/cx/v3/agents/paths.rb +151 -0
  13. data/lib/google/cloud/dialogflow/cx/v3/agents.rb +52 -0
  14. data/lib/google/cloud/dialogflow/cx/v3/audio_config_pb.rb +94 -0
  15. data/lib/google/cloud/dialogflow/cx/v3/entity_type_pb.rb +92 -0
  16. data/lib/google/cloud/dialogflow/cx/v3/entity_type_services_pb.rb +67 -0
  17. data/lib/google/cloud/dialogflow/cx/v3/entity_types/client.rb +766 -0
  18. data/lib/google/cloud/dialogflow/cx/v3/entity_types/credentials.rb +54 -0
  19. data/lib/google/cloud/dialogflow/cx/v3/entity_types/paths.rb +75 -0
  20. data/lib/google/cloud/dialogflow/cx/v3/entity_types.rb +51 -0
  21. data/lib/google/cloud/dialogflow/cx/v3/environment_pb.rb +117 -0
  22. data/lib/google/cloud/dialogflow/cx/v3/environment_services_pb.rb +61 -0
  23. data/lib/google/cloud/dialogflow/cx/v3/environments/client.rb +950 -0
  24. data/lib/google/cloud/dialogflow/cx/v3/environments/credentials.rb +54 -0
  25. data/lib/google/cloud/dialogflow/cx/v3/environments/operations.rb +666 -0
  26. data/lib/google/cloud/dialogflow/cx/v3/environments/paths.rb +98 -0
  27. data/lib/google/cloud/dialogflow/cx/v3/environments.rb +52 -0
  28. data/lib/google/cloud/dialogflow/cx/v3/experiment_pb.rb +177 -0
  29. data/lib/google/cloud/dialogflow/cx/v3/experiment_services_pb.rb +61 -0
  30. data/lib/google/cloud/dialogflow/cx/v3/experiments/client.rb +851 -0
  31. data/lib/google/cloud/dialogflow/cx/v3/experiments/credentials.rb +54 -0
  32. data/lib/google/cloud/dialogflow/cx/v3/experiments/paths.rb +102 -0
  33. data/lib/google/cloud/dialogflow/cx/v3/experiments.rb +51 -0
  34. data/lib/google/cloud/dialogflow/cx/v3/flow_pb.rb +145 -0
  35. data/lib/google/cloud/dialogflow/cx/v3/flow_services_pb.rb +88 -0
  36. data/lib/google/cloud/dialogflow/cx/v3/flows/client.rb +1200 -0
  37. data/lib/google/cloud/dialogflow/cx/v3/flows/credentials.rb +54 -0
  38. data/lib/google/cloud/dialogflow/cx/v3/flows/operations.rb +666 -0
  39. data/lib/google/cloud/dialogflow/cx/v3/flows/paths.rb +184 -0
  40. data/lib/google/cloud/dialogflow/cx/v3/flows.rb +52 -0
  41. data/lib/google/cloud/dialogflow/cx/v3/fulfillment_pb.rb +55 -0
  42. data/lib/google/cloud/dialogflow/cx/v3/intent_pb.rb +97 -0
  43. data/lib/google/cloud/dialogflow/cx/v3/intent_services_pb.rb +67 -0
  44. data/lib/google/cloud/dialogflow/cx/v3/intents/client.rb +750 -0
  45. data/lib/google/cloud/dialogflow/cx/v3/intents/credentials.rb +54 -0
  46. data/lib/google/cloud/dialogflow/cx/v3/intents/paths.rb +96 -0
  47. data/lib/google/cloud/dialogflow/cx/v3/intents.rb +51 -0
  48. data/lib/google/cloud/dialogflow/cx/v3/page_pb.rb +113 -0
  49. data/lib/google/cloud/dialogflow/cx/v3/page_services_pb.rb +67 -0
  50. data/lib/google/cloud/dialogflow/cx/v3/pages/client.rb +805 -0
  51. data/lib/google/cloud/dialogflow/cx/v3/pages/credentials.rb +54 -0
  52. data/lib/google/cloud/dialogflow/cx/v3/pages/paths.rb +165 -0
  53. data/lib/google/cloud/dialogflow/cx/v3/pages.rb +51 -0
  54. data/lib/google/cloud/dialogflow/cx/v3/response_message_pb.rb +77 -0
  55. data/lib/google/cloud/dialogflow/cx/v3/security_settings_pb.rb +89 -0
  56. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/client.rb +696 -0
  57. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/credentials.rb +54 -0
  58. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/paths.rb +157 -0
  59. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service.rb +51 -0
  60. data/lib/google/cloud/dialogflow/cx/v3/security_settings_services_pb.rb +56 -0
  61. data/lib/google/cloud/dialogflow/cx/v3/session_entity_type_pb.rb +68 -0
  62. data/lib/google/cloud/dialogflow/cx/v3/session_entity_type_services_pb.rb +55 -0
  63. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/client.rb +715 -0
  64. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/credentials.rb +54 -0
  65. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/paths.rb +137 -0
  66. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types.rb +51 -0
  67. data/lib/google/cloud/dialogflow/cx/v3/session_pb.rb +209 -0
  68. data/lib/google/cloud/dialogflow/cx/v3/session_services_pb.rb +71 -0
  69. data/lib/google/cloud/dialogflow/cx/v3/sessions/client.rb +654 -0
  70. data/lib/google/cloud/dialogflow/cx/v3/sessions/credentials.rb +54 -0
  71. data/lib/google/cloud/dialogflow/cx/v3/sessions/paths.rb +225 -0
  72. data/lib/google/cloud/dialogflow/cx/v3/sessions.rb +53 -0
  73. data/lib/google/cloud/dialogflow/cx/v3/test_case_pb.rb +302 -0
  74. data/lib/google/cloud/dialogflow/cx/v3/test_case_services_pb.rb +73 -0
  75. data/lib/google/cloud/dialogflow/cx/v3/test_cases/client.rb +1324 -0
  76. data/lib/google/cloud/dialogflow/cx/v3/test_cases/credentials.rb +54 -0
  77. data/lib/google/cloud/dialogflow/cx/v3/test_cases/operations.rb +666 -0
  78. data/lib/google/cloud/dialogflow/cx/v3/test_cases/paths.rb +249 -0
  79. data/lib/google/cloud/dialogflow/cx/v3/test_cases.rb +53 -0
  80. data/lib/google/cloud/dialogflow/cx/v3/transition_route_group_pb.rb +67 -0
  81. data/lib/google/cloud/dialogflow/cx/v3/transition_route_group_services_pb.rb +67 -0
  82. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/client.rb +766 -0
  83. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/credentials.rb +54 -0
  84. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/paths.rb +144 -0
  85. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups.rb +51 -0
  86. data/lib/google/cloud/dialogflow/cx/v3/validation_message_pb.rb +59 -0
  87. data/lib/google/cloud/dialogflow/cx/v3/version.rb +30 -0
  88. data/lib/google/cloud/dialogflow/cx/v3/version_pb.rb +88 -0
  89. data/lib/google/cloud/dialogflow/cx/v3/version_services_pb.rb +57 -0
  90. data/lib/google/cloud/dialogflow/cx/v3/versions/client.rb +792 -0
  91. data/lib/google/cloud/dialogflow/cx/v3/versions/credentials.rb +54 -0
  92. data/lib/google/cloud/dialogflow/cx/v3/versions/operations.rb +666 -0
  93. data/lib/google/cloud/dialogflow/cx/v3/versions/paths.rb +79 -0
  94. data/lib/google/cloud/dialogflow/cx/v3/versions.rb +52 -0
  95. data/lib/google/cloud/dialogflow/cx/v3/webhook_pb.rb +172 -0
  96. data/lib/google/cloud/dialogflow/cx/v3/webhook_services_pb.rb +55 -0
  97. data/lib/google/cloud/dialogflow/cx/v3/webhooks/client.rb +704 -0
  98. data/lib/google/cloud/dialogflow/cx/v3/webhooks/credentials.rb +54 -0
  99. data/lib/google/cloud/dialogflow/cx/v3/webhooks/paths.rb +96 -0
  100. data/lib/google/cloud/dialogflow/cx/v3/webhooks.rb +51 -0
  101. data/lib/google/cloud/dialogflow/cx/v3.rb +53 -0
  102. data/lib/google-cloud-dialogflow-cx-v3.rb +21 -0
  103. data/proto_docs/README.md +4 -0
  104. data/proto_docs/google/api/field_behavior.rb +71 -0
  105. data/proto_docs/google/api/resource.rb +283 -0
  106. data/proto_docs/google/cloud/dialogflow/cx/v3/advanced_settings.rb +57 -0
  107. data/proto_docs/google/cloud/dialogflow/cx/v3/agent.rb +301 -0
  108. data/proto_docs/google/cloud/dialogflow/cx/v3/audio_config.rb +322 -0
  109. data/proto_docs/google/cloud/dialogflow/cx/v3/entity_type.rb +306 -0
  110. data/proto_docs/google/cloud/dialogflow/cx/v3/environment.rb +279 -0
  111. data/proto_docs/google/cloud/dialogflow/cx/v3/experiment.rb +438 -0
  112. data/proto_docs/google/cloud/dialogflow/cx/v3/flow.rb +438 -0
  113. data/proto_docs/google/cloud/dialogflow/cx/v3/fulfillment.rb +126 -0
  114. data/proto_docs/google/cloud/dialogflow/cx/v3/intent.rb +318 -0
  115. data/proto_docs/google/cloud/dialogflow/cx/v3/page.rb +478 -0
  116. data/proto_docs/google/cloud/dialogflow/cx/v3/response_message.rb +220 -0
  117. data/proto_docs/google/cloud/dialogflow/cx/v3/security_settings.rb +222 -0
  118. data/proto_docs/google/cloud/dialogflow/cx/v3/session.rb +798 -0
  119. data/proto_docs/google/cloud/dialogflow/cx/v3/session_entity_type.rb +184 -0
  120. data/proto_docs/google/cloud/dialogflow/cx/v3/test_case.rb +757 -0
  121. data/proto_docs/google/cloud/dialogflow/cx/v3/transition_route_group.rb +195 -0
  122. data/proto_docs/google/cloud/dialogflow/cx/v3/validation_message.rb +121 -0
  123. data/proto_docs/google/cloud/dialogflow/cx/v3/version.rb +182 -0
  124. data/proto_docs/google/cloud/dialogflow/cx/v3/webhook.rb +496 -0
  125. data/proto_docs/google/longrunning/operations.rb +164 -0
  126. data/proto_docs/google/protobuf/any.rb +141 -0
  127. data/proto_docs/google/protobuf/duration.rb +98 -0
  128. data/proto_docs/google/protobuf/empty.rb +36 -0
  129. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  130. data/proto_docs/google/protobuf/struct.rb +96 -0
  131. data/proto_docs/google/protobuf/timestamp.rb +129 -0
  132. data/proto_docs/google/rpc/status.rb +46 -0
  133. data/proto_docs/google/type/latlng.rb +38 -0
  134. metadata +326 -0
@@ -0,0 +1,71 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: google/cloud/dialogflow/cx/v3/session.proto for package 'Google.Cloud.Dialogflow.CX.V3'
3
+ # Original file comments:
4
+ # Copyright 2021 Google LLC
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require 'grpc'
20
+ require 'google/cloud/dialogflow/cx/v3/session_pb'
21
+
22
+ module Google
23
+ module Cloud
24
+ module Dialogflow
25
+ module CX
26
+ module V3
27
+ module Sessions
28
+ # A session represents an interaction with a user. You retrieve user input
29
+ # and pass it to the [DetectIntent][google.cloud.dialogflow.cx.v3.Sessions.DetectIntent] method to determine
30
+ # user intent and respond.
31
+ class Service
32
+
33
+ include GRPC::GenericService
34
+
35
+ self.marshal_class_method = :encode
36
+ self.unmarshal_class_method = :decode
37
+ self.service_name = 'google.cloud.dialogflow.cx.v3.Sessions'
38
+
39
+ # Processes a natural language query and returns structured, actionable data
40
+ # as a result. This method is not idempotent, because it may cause session
41
+ # entity types to be updated, which in turn might affect results of future
42
+ # queries.
43
+ #
44
+ # Note: Always use agent versions for production traffic.
45
+ # See [Versions and
46
+ # environments](https://cloud.google.com/dialogflow/cx/docs/concept/version).
47
+ rpc :DetectIntent, ::Google::Cloud::Dialogflow::CX::V3::DetectIntentRequest, ::Google::Cloud::Dialogflow::CX::V3::DetectIntentResponse
48
+ # Processes a natural language query in audio format in a streaming fashion
49
+ # and returns structured, actionable data as a result. This method is only
50
+ # available via the gRPC API (not REST).
51
+ #
52
+ # Note: Always use agent versions for production traffic.
53
+ # See [Versions and
54
+ # environments](https://cloud.google.com/dialogflow/cx/docs/concept/version).
55
+ rpc :StreamingDetectIntent, stream(::Google::Cloud::Dialogflow::CX::V3::StreamingDetectIntentRequest), stream(::Google::Cloud::Dialogflow::CX::V3::StreamingDetectIntentResponse)
56
+ # Returns preliminary intent match results, doesn't change the session
57
+ # status.
58
+ rpc :MatchIntent, ::Google::Cloud::Dialogflow::CX::V3::MatchIntentRequest, ::Google::Cloud::Dialogflow::CX::V3::MatchIntentResponse
59
+ # Fulfills a matched intent returned by [MatchIntent][google.cloud.dialogflow.cx.v3.Sessions.MatchIntent].
60
+ # Must be called after [MatchIntent][google.cloud.dialogflow.cx.v3.Sessions.MatchIntent], with input from
61
+ # [MatchIntentResponse][google.cloud.dialogflow.cx.v3.MatchIntentResponse]. Otherwise, the behavior is undefined.
62
+ rpc :FulfillIntent, ::Google::Cloud::Dialogflow::CX::V3::FulfillIntentRequest, ::Google::Cloud::Dialogflow::CX::V3::FulfillIntentResponse
63
+ end
64
+
65
+ Stub = Service.rpc_stub_class
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,654 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/cloud/dialogflow/cx/v3/session_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Dialogflow
25
+ module CX
26
+ module V3
27
+ module Sessions
28
+ ##
29
+ # Client for the Sessions service.
30
+ #
31
+ # A session represents an interaction with a user. You retrieve user input
32
+ # and pass it to the {::Google::Cloud::Dialogflow::CX::V3::Sessions::Client#detect_intent DetectIntent} method to determine
33
+ # user intent and respond.
34
+ #
35
+ class Client
36
+ include Paths
37
+
38
+ # @private
39
+ attr_reader :sessions_stub
40
+
41
+ ##
42
+ # Configure the Sessions Client class.
43
+ #
44
+ # See {::Google::Cloud::Dialogflow::CX::V3::Sessions::Client::Configuration}
45
+ # for a description of the configuration fields.
46
+ #
47
+ # @example
48
+ #
49
+ # # Modify the configuration for all Sessions clients
50
+ # ::Google::Cloud::Dialogflow::CX::V3::Sessions::Client.configure do |config|
51
+ # config.timeout = 10.0
52
+ # end
53
+ #
54
+ # @yield [config] Configure the Client client.
55
+ # @yieldparam config [Client::Configuration]
56
+ #
57
+ # @return [Client::Configuration]
58
+ #
59
+ def self.configure
60
+ @configure ||= begin
61
+ namespace = ["Google", "Cloud", "Dialogflow", "CX", "V3"]
62
+ parent_config = while namespace.any?
63
+ parent_name = namespace.join "::"
64
+ parent_const = const_get parent_name
65
+ break parent_const.configure if parent_const.respond_to? :configure
66
+ namespace.pop
67
+ end
68
+ default_config = Client::Configuration.new parent_config
69
+
70
+ default_config.timeout = 60.0
71
+ default_config.retry_policy = {
72
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
73
+ }
74
+
75
+ default_config.rpcs.detect_intent.timeout = 220.0
76
+ default_config.rpcs.detect_intent.retry_policy = {
77
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
78
+ }
79
+
80
+ default_config.rpcs.streaming_detect_intent.timeout = 220.0
81
+
82
+ default_config
83
+ end
84
+ yield @configure if block_given?
85
+ @configure
86
+ end
87
+
88
+ ##
89
+ # Configure the Sessions Client instance.
90
+ #
91
+ # The configuration is set to the derived mode, meaning that values can be changed,
92
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
93
+ # should be made on {Client.configure}.
94
+ #
95
+ # See {::Google::Cloud::Dialogflow::CX::V3::Sessions::Client::Configuration}
96
+ # for a description of the configuration fields.
97
+ #
98
+ # @yield [config] Configure the Client client.
99
+ # @yieldparam config [Client::Configuration]
100
+ #
101
+ # @return [Client::Configuration]
102
+ #
103
+ def configure
104
+ yield @config if block_given?
105
+ @config
106
+ end
107
+
108
+ ##
109
+ # Create a new Sessions client object.
110
+ #
111
+ # @example
112
+ #
113
+ # # Create a client using the default configuration
114
+ # client = ::Google::Cloud::Dialogflow::CX::V3::Sessions::Client.new
115
+ #
116
+ # # Create a client using a custom configuration
117
+ # client = ::Google::Cloud::Dialogflow::CX::V3::Sessions::Client.new do |config|
118
+ # config.timeout = 10.0
119
+ # end
120
+ #
121
+ # @yield [config] Configure the Sessions client.
122
+ # @yieldparam config [Client::Configuration]
123
+ #
124
+ def initialize
125
+ # These require statements are intentionally placed here to initialize
126
+ # the gRPC module only when it's required.
127
+ # See https://github.com/googleapis/toolkit/issues/446
128
+ require "gapic/grpc"
129
+ require "google/cloud/dialogflow/cx/v3/session_services_pb"
130
+
131
+ # Create the configuration object
132
+ @config = Configuration.new Client.configure
133
+
134
+ # Yield the configuration if needed
135
+ yield @config if block_given?
136
+
137
+ # Create credentials
138
+ credentials = @config.credentials
139
+ # Use self-signed JWT if the endpoint is unchanged from default,
140
+ # but only if the default endpoint does not have a region prefix.
141
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
142
+ !@config.endpoint.split(".").first.include?("-")
143
+ credentials ||= Credentials.default scope: @config.scope,
144
+ enable_self_signed_jwt: enable_self_signed_jwt
145
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
146
+ credentials = Credentials.new credentials, scope: @config.scope
147
+ end
148
+ @quota_project_id = @config.quota_project
149
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
150
+
151
+ @sessions_stub = ::Gapic::ServiceStub.new(
152
+ ::Google::Cloud::Dialogflow::CX::V3::Sessions::Stub,
153
+ credentials: credentials,
154
+ endpoint: @config.endpoint,
155
+ channel_args: @config.channel_args,
156
+ interceptors: @config.interceptors
157
+ )
158
+ end
159
+
160
+ # Service calls
161
+
162
+ ##
163
+ # Processes a natural language query and returns structured, actionable data
164
+ # as a result. This method is not idempotent, because it may cause session
165
+ # entity types to be updated, which in turn might affect results of future
166
+ # queries.
167
+ #
168
+ # Note: Always use agent versions for production traffic.
169
+ # See [Versions and
170
+ # environments](https://cloud.google.com/dialogflow/cx/docs/concept/version).
171
+ #
172
+ # @overload detect_intent(request, options = nil)
173
+ # Pass arguments to `detect_intent` via a request object, either of type
174
+ # {::Google::Cloud::Dialogflow::CX::V3::DetectIntentRequest} or an equivalent Hash.
175
+ #
176
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::DetectIntentRequest, ::Hash]
177
+ # A request object representing the call parameters. Required. To specify no
178
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
179
+ # @param options [::Gapic::CallOptions, ::Hash]
180
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
181
+ #
182
+ # @overload detect_intent(session: nil, query_params: nil, query_input: nil, output_audio_config: nil)
183
+ # Pass arguments to `detect_intent` via keyword arguments. Note that at
184
+ # least one keyword argument is required. To specify no parameters, or to keep all
185
+ # the default parameter values, pass an empty Hash as a request object (see above).
186
+ #
187
+ # @param session [::String]
188
+ # Required. The name of the session this query is sent to.
189
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
190
+ # ID>/sessions/<Session ID>` or `projects/<Project ID>/locations/<Location
191
+ # ID>/agents/<Agent ID>/environments/<Environment ID>/sessions/<Session ID>`.
192
+ # If `Environment ID` is not specified, we assume default 'draft'
193
+ # environment.
194
+ # It's up to the API caller to choose an appropriate `Session ID`. It can be
195
+ # a random number or some type of session identifiers (preferably hashed).
196
+ # The length of the `Session ID` must not exceed 36 characters.
197
+ #
198
+ # For more information, see the [sessions
199
+ # guide](https://cloud.google.com/dialogflow/cx/docs/concept/session).
200
+ #
201
+ # Note: Always use agent versions for production traffic.
202
+ # See [Versions and
203
+ # environments](https://cloud.google.com/dialogflow/cx/docs/concept/version).
204
+ # @param query_params [::Google::Cloud::Dialogflow::CX::V3::QueryParameters, ::Hash]
205
+ # The parameters of this query.
206
+ # @param query_input [::Google::Cloud::Dialogflow::CX::V3::QueryInput, ::Hash]
207
+ # Required. The input specification.
208
+ # @param output_audio_config [::Google::Cloud::Dialogflow::CX::V3::OutputAudioConfig, ::Hash]
209
+ # Instructs the speech synthesizer how to generate the output audio.
210
+ #
211
+ # @yield [response, operation] Access the result along with the RPC operation
212
+ # @yieldparam response [::Google::Cloud::Dialogflow::CX::V3::DetectIntentResponse]
213
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
214
+ #
215
+ # @return [::Google::Cloud::Dialogflow::CX::V3::DetectIntentResponse]
216
+ #
217
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
218
+ #
219
+ def detect_intent request, options = nil
220
+ raise ::ArgumentError, "request must be provided" if request.nil?
221
+
222
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::DetectIntentRequest
223
+
224
+ # Converts hash and nil to an options object
225
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
226
+
227
+ # Customize the options with defaults
228
+ metadata = @config.rpcs.detect_intent.metadata.to_h
229
+
230
+ # Set x-goog-api-client and x-goog-user-project headers
231
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
232
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
233
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION
234
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
235
+
236
+ header_params = {
237
+ "session" => request.session
238
+ }
239
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
240
+ metadata[:"x-goog-request-params"] ||= request_params_header
241
+
242
+ options.apply_defaults timeout: @config.rpcs.detect_intent.timeout,
243
+ metadata: metadata,
244
+ retry_policy: @config.rpcs.detect_intent.retry_policy
245
+
246
+ options.apply_defaults timeout: @config.timeout,
247
+ metadata: @config.metadata,
248
+ retry_policy: @config.retry_policy
249
+
250
+ @sessions_stub.call_rpc :detect_intent, request, options: options do |response, operation|
251
+ yield response, operation if block_given?
252
+ return response
253
+ end
254
+ rescue ::GRPC::BadStatus => e
255
+ raise ::Google::Cloud::Error.from_error(e)
256
+ end
257
+
258
+ ##
259
+ # Processes a natural language query in audio format in a streaming fashion
260
+ # and returns structured, actionable data as a result. This method is only
261
+ # available via the gRPC API (not REST).
262
+ #
263
+ # Note: Always use agent versions for production traffic.
264
+ # See [Versions and
265
+ # environments](https://cloud.google.com/dialogflow/cx/docs/concept/version).
266
+ #
267
+ # @param request [::Gapic::StreamInput, ::Enumerable<::Google::Cloud::Dialogflow::CX::V3::StreamingDetectIntentRequest, ::Hash>]
268
+ # An enumerable of {::Google::Cloud::Dialogflow::CX::V3::StreamingDetectIntentRequest} instances.
269
+ # @param options [::Gapic::CallOptions, ::Hash]
270
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
271
+ #
272
+ # @yield [response, operation] Access the result along with the RPC operation
273
+ # @yieldparam response [::Enumerable<::Google::Cloud::Dialogflow::CX::V3::StreamingDetectIntentResponse>]
274
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
275
+ #
276
+ # @return [::Enumerable<::Google::Cloud::Dialogflow::CX::V3::StreamingDetectIntentResponse>]
277
+ #
278
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
279
+ #
280
+ def streaming_detect_intent request, options = nil
281
+ unless request.is_a? ::Enumerable
282
+ raise ::ArgumentError, "request must be an Enumerable" unless request.respond_to? :to_enum
283
+ request = request.to_enum
284
+ end
285
+
286
+ request = request.lazy.map do |req|
287
+ ::Gapic::Protobuf.coerce req, to: ::Google::Cloud::Dialogflow::CX::V3::StreamingDetectIntentRequest
288
+ end
289
+
290
+ # Converts hash and nil to an options object
291
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
292
+
293
+ # Customize the options with defaults
294
+ metadata = @config.rpcs.streaming_detect_intent.metadata.to_h
295
+
296
+ # Set x-goog-api-client and x-goog-user-project headers
297
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
298
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
299
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION
300
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
301
+
302
+ options.apply_defaults timeout: @config.rpcs.streaming_detect_intent.timeout,
303
+ metadata: metadata,
304
+ retry_policy: @config.rpcs.streaming_detect_intent.retry_policy
305
+
306
+ options.apply_defaults timeout: @config.timeout,
307
+ metadata: @config.metadata,
308
+ retry_policy: @config.retry_policy
309
+
310
+ @sessions_stub.call_rpc :streaming_detect_intent, request, options: options do |response, operation|
311
+ yield response, operation if block_given?
312
+ return response
313
+ end
314
+ rescue ::GRPC::BadStatus => e
315
+ raise ::Google::Cloud::Error.from_error(e)
316
+ end
317
+
318
+ ##
319
+ # Returns preliminary intent match results, doesn't change the session
320
+ # status.
321
+ #
322
+ # @overload match_intent(request, options = nil)
323
+ # Pass arguments to `match_intent` via a request object, either of type
324
+ # {::Google::Cloud::Dialogflow::CX::V3::MatchIntentRequest} or an equivalent Hash.
325
+ #
326
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::MatchIntentRequest, ::Hash]
327
+ # A request object representing the call parameters. Required. To specify no
328
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
329
+ # @param options [::Gapic::CallOptions, ::Hash]
330
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
331
+ #
332
+ # @overload match_intent(session: nil, query_params: nil, query_input: nil)
333
+ # Pass arguments to `match_intent` via keyword arguments. Note that at
334
+ # least one keyword argument is required. To specify no parameters, or to keep all
335
+ # the default parameter values, pass an empty Hash as a request object (see above).
336
+ #
337
+ # @param session [::String]
338
+ # Required. The name of the session this query is sent to.
339
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
340
+ # ID>/sessions/<Session ID>` or `projects/<Project ID>/locations/<Location
341
+ # ID>/agents/<Agent ID>/environments/<Environment ID>/sessions/<Session ID>`.
342
+ # If `Environment ID` is not specified, we assume default 'draft'
343
+ # environment.
344
+ # It's up to the API caller to choose an appropriate `Session ID`. It can be
345
+ # a random number or some type of session identifiers (preferably hashed).
346
+ # The length of the `Session ID` must not exceed 36 characters.
347
+ #
348
+ # For more information, see the [sessions
349
+ # guide](https://cloud.google.com/dialogflow/cx/docs/concept/session).
350
+ # @param query_params [::Google::Cloud::Dialogflow::CX::V3::QueryParameters, ::Hash]
351
+ # The parameters of this query.
352
+ # @param query_input [::Google::Cloud::Dialogflow::CX::V3::QueryInput, ::Hash]
353
+ # Required. The input specification.
354
+ #
355
+ # @yield [response, operation] Access the result along with the RPC operation
356
+ # @yieldparam response [::Google::Cloud::Dialogflow::CX::V3::MatchIntentResponse]
357
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
358
+ #
359
+ # @return [::Google::Cloud::Dialogflow::CX::V3::MatchIntentResponse]
360
+ #
361
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
362
+ #
363
+ def match_intent request, options = nil
364
+ raise ::ArgumentError, "request must be provided" if request.nil?
365
+
366
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::MatchIntentRequest
367
+
368
+ # Converts hash and nil to an options object
369
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
370
+
371
+ # Customize the options with defaults
372
+ metadata = @config.rpcs.match_intent.metadata.to_h
373
+
374
+ # Set x-goog-api-client and x-goog-user-project headers
375
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
376
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
377
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION
378
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
379
+
380
+ header_params = {
381
+ "session" => request.session
382
+ }
383
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
384
+ metadata[:"x-goog-request-params"] ||= request_params_header
385
+
386
+ options.apply_defaults timeout: @config.rpcs.match_intent.timeout,
387
+ metadata: metadata,
388
+ retry_policy: @config.rpcs.match_intent.retry_policy
389
+
390
+ options.apply_defaults timeout: @config.timeout,
391
+ metadata: @config.metadata,
392
+ retry_policy: @config.retry_policy
393
+
394
+ @sessions_stub.call_rpc :match_intent, request, options: options do |response, operation|
395
+ yield response, operation if block_given?
396
+ return response
397
+ end
398
+ rescue ::GRPC::BadStatus => e
399
+ raise ::Google::Cloud::Error.from_error(e)
400
+ end
401
+
402
+ ##
403
+ # Fulfills a matched intent returned by {::Google::Cloud::Dialogflow::CX::V3::Sessions::Client#match_intent MatchIntent}.
404
+ # Must be called after {::Google::Cloud::Dialogflow::CX::V3::Sessions::Client#match_intent MatchIntent}, with input from
405
+ # {::Google::Cloud::Dialogflow::CX::V3::MatchIntentResponse MatchIntentResponse}. Otherwise, the behavior is undefined.
406
+ #
407
+ # @overload fulfill_intent(request, options = nil)
408
+ # Pass arguments to `fulfill_intent` via a request object, either of type
409
+ # {::Google::Cloud::Dialogflow::CX::V3::FulfillIntentRequest} or an equivalent Hash.
410
+ #
411
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::FulfillIntentRequest, ::Hash]
412
+ # A request object representing the call parameters. Required. To specify no
413
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
414
+ # @param options [::Gapic::CallOptions, ::Hash]
415
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
416
+ #
417
+ # @overload fulfill_intent(match_intent_request: nil, match: nil, output_audio_config: nil)
418
+ # Pass arguments to `fulfill_intent` via keyword arguments. Note that at
419
+ # least one keyword argument is required. To specify no parameters, or to keep all
420
+ # the default parameter values, pass an empty Hash as a request object (see above).
421
+ #
422
+ # @param match_intent_request [::Google::Cloud::Dialogflow::CX::V3::MatchIntentRequest, ::Hash]
423
+ # Must be same as the corresponding MatchIntent request, otherwise the
424
+ # behavior is undefined.
425
+ # @param match [::Google::Cloud::Dialogflow::CX::V3::Match, ::Hash]
426
+ # The matched intent/event to fulfill.
427
+ # @param output_audio_config [::Google::Cloud::Dialogflow::CX::V3::OutputAudioConfig, ::Hash]
428
+ # Instructs the speech synthesizer how to generate output audio.
429
+ #
430
+ # @yield [response, operation] Access the result along with the RPC operation
431
+ # @yieldparam response [::Google::Cloud::Dialogflow::CX::V3::FulfillIntentResponse]
432
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
433
+ #
434
+ # @return [::Google::Cloud::Dialogflow::CX::V3::FulfillIntentResponse]
435
+ #
436
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
437
+ #
438
+ def fulfill_intent request, options = nil
439
+ raise ::ArgumentError, "request must be provided" if request.nil?
440
+
441
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::FulfillIntentRequest
442
+
443
+ # Converts hash and nil to an options object
444
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
445
+
446
+ # Customize the options with defaults
447
+ metadata = @config.rpcs.fulfill_intent.metadata.to_h
448
+
449
+ # Set x-goog-api-client and x-goog-user-project headers
450
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
451
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
452
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION
453
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
454
+
455
+ header_params = {
456
+ "match_intent_request.session" => request.match_intent_request.session
457
+ }
458
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
459
+ metadata[:"x-goog-request-params"] ||= request_params_header
460
+
461
+ options.apply_defaults timeout: @config.rpcs.fulfill_intent.timeout,
462
+ metadata: metadata,
463
+ retry_policy: @config.rpcs.fulfill_intent.retry_policy
464
+
465
+ options.apply_defaults timeout: @config.timeout,
466
+ metadata: @config.metadata,
467
+ retry_policy: @config.retry_policy
468
+
469
+ @sessions_stub.call_rpc :fulfill_intent, request, options: options do |response, operation|
470
+ yield response, operation if block_given?
471
+ return response
472
+ end
473
+ rescue ::GRPC::BadStatus => e
474
+ raise ::Google::Cloud::Error.from_error(e)
475
+ end
476
+
477
+ ##
478
+ # Configuration class for the Sessions API.
479
+ #
480
+ # This class represents the configuration for Sessions,
481
+ # providing control over timeouts, retry behavior, logging, transport
482
+ # parameters, and other low-level controls. Certain parameters can also be
483
+ # applied individually to specific RPCs. See
484
+ # {::Google::Cloud::Dialogflow::CX::V3::Sessions::Client::Configuration::Rpcs}
485
+ # for a list of RPCs that can be configured independently.
486
+ #
487
+ # Configuration can be applied globally to all clients, or to a single client
488
+ # on construction.
489
+ #
490
+ # @example
491
+ #
492
+ # # Modify the global config, setting the timeout for
493
+ # # detect_intent to 20 seconds,
494
+ # # and all remaining timeouts to 10 seconds.
495
+ # ::Google::Cloud::Dialogflow::CX::V3::Sessions::Client.configure do |config|
496
+ # config.timeout = 10.0
497
+ # config.rpcs.detect_intent.timeout = 20.0
498
+ # end
499
+ #
500
+ # # Apply the above configuration only to a new client.
501
+ # client = ::Google::Cloud::Dialogflow::CX::V3::Sessions::Client.new do |config|
502
+ # config.timeout = 10.0
503
+ # config.rpcs.detect_intent.timeout = 20.0
504
+ # end
505
+ #
506
+ # @!attribute [rw] endpoint
507
+ # The hostname or hostname:port of the service endpoint.
508
+ # Defaults to `"dialogflow.googleapis.com"`.
509
+ # @return [::String]
510
+ # @!attribute [rw] credentials
511
+ # Credentials to send with calls. You may provide any of the following types:
512
+ # * (`String`) The path to a service account key file in JSON format
513
+ # * (`Hash`) A service account key as a Hash
514
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
515
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
516
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
517
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
518
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
519
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
520
+ # * (`nil`) indicating no credentials
521
+ # @return [::Object]
522
+ # @!attribute [rw] scope
523
+ # The OAuth scopes
524
+ # @return [::Array<::String>]
525
+ # @!attribute [rw] lib_name
526
+ # The library name as recorded in instrumentation and logging
527
+ # @return [::String]
528
+ # @!attribute [rw] lib_version
529
+ # The library version as recorded in instrumentation and logging
530
+ # @return [::String]
531
+ # @!attribute [rw] channel_args
532
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
533
+ # `GRPC::Core::Channel` object is provided as the credential.
534
+ # @return [::Hash]
535
+ # @!attribute [rw] interceptors
536
+ # An array of interceptors that are run before calls are executed.
537
+ # @return [::Array<::GRPC::ClientInterceptor>]
538
+ # @!attribute [rw] timeout
539
+ # The call timeout in seconds.
540
+ # @return [::Numeric]
541
+ # @!attribute [rw] metadata
542
+ # Additional gRPC headers to be sent with the call.
543
+ # @return [::Hash{::Symbol=>::String}]
544
+ # @!attribute [rw] retry_policy
545
+ # The retry policy. The value is a hash with the following keys:
546
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
547
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
548
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
549
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
550
+ # trigger a retry.
551
+ # @return [::Hash]
552
+ # @!attribute [rw] quota_project
553
+ # A separate project against which to charge quota.
554
+ # @return [::String]
555
+ #
556
+ class Configuration
557
+ extend ::Gapic::Config
558
+
559
+ config_attr :endpoint, "dialogflow.googleapis.com", ::String
560
+ config_attr :credentials, nil do |value|
561
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
562
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
563
+ allowed.any? { |klass| klass === value }
564
+ end
565
+ config_attr :scope, nil, ::String, ::Array, nil
566
+ config_attr :lib_name, nil, ::String, nil
567
+ config_attr :lib_version, nil, ::String, nil
568
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
569
+ config_attr :interceptors, nil, ::Array, nil
570
+ config_attr :timeout, nil, ::Numeric, nil
571
+ config_attr :metadata, nil, ::Hash, nil
572
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
573
+ config_attr :quota_project, nil, ::String, nil
574
+
575
+ # @private
576
+ def initialize parent_config = nil
577
+ @parent_config = parent_config unless parent_config.nil?
578
+
579
+ yield self if block_given?
580
+ end
581
+
582
+ ##
583
+ # Configurations for individual RPCs
584
+ # @return [Rpcs]
585
+ #
586
+ def rpcs
587
+ @rpcs ||= begin
588
+ parent_rpcs = nil
589
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
590
+ Rpcs.new parent_rpcs
591
+ end
592
+ end
593
+
594
+ ##
595
+ # Configuration RPC class for the Sessions API.
596
+ #
597
+ # Includes fields providing the configuration for each RPC in this service.
598
+ # Each configuration object is of type `Gapic::Config::Method` and includes
599
+ # the following configuration fields:
600
+ #
601
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
602
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
603
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
604
+ # include the following keys:
605
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
606
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
607
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
608
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
609
+ # trigger a retry.
610
+ #
611
+ class Rpcs
612
+ ##
613
+ # RPC-specific configuration for `detect_intent`
614
+ # @return [::Gapic::Config::Method]
615
+ #
616
+ attr_reader :detect_intent
617
+ ##
618
+ # RPC-specific configuration for `streaming_detect_intent`
619
+ # @return [::Gapic::Config::Method]
620
+ #
621
+ attr_reader :streaming_detect_intent
622
+ ##
623
+ # RPC-specific configuration for `match_intent`
624
+ # @return [::Gapic::Config::Method]
625
+ #
626
+ attr_reader :match_intent
627
+ ##
628
+ # RPC-specific configuration for `fulfill_intent`
629
+ # @return [::Gapic::Config::Method]
630
+ #
631
+ attr_reader :fulfill_intent
632
+
633
+ # @private
634
+ def initialize parent_rpcs = nil
635
+ detect_intent_config = parent_rpcs.detect_intent if parent_rpcs.respond_to? :detect_intent
636
+ @detect_intent = ::Gapic::Config::Method.new detect_intent_config
637
+ streaming_detect_intent_config = parent_rpcs.streaming_detect_intent if parent_rpcs.respond_to? :streaming_detect_intent
638
+ @streaming_detect_intent = ::Gapic::Config::Method.new streaming_detect_intent_config
639
+ match_intent_config = parent_rpcs.match_intent if parent_rpcs.respond_to? :match_intent
640
+ @match_intent = ::Gapic::Config::Method.new match_intent_config
641
+ fulfill_intent_config = parent_rpcs.fulfill_intent if parent_rpcs.respond_to? :fulfill_intent
642
+ @fulfill_intent = ::Gapic::Config::Method.new fulfill_intent_config
643
+
644
+ yield self if block_given?
645
+ end
646
+ end
647
+ end
648
+ end
649
+ end
650
+ end
651
+ end
652
+ end
653
+ end
654
+ end