google-cloud-dialogflow-v2 0.6.2 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.md +188 -190
  3. data/README.md +70 -2
  4. data/lib/google/cloud/dialogflow/v2.rb +13 -2
  5. data/lib/google/cloud/dialogflow/v2/agent_services_pb.rb +25 -40
  6. data/lib/google/cloud/dialogflow/v2/agents.rb +1 -28
  7. data/lib/google/cloud/dialogflow/v2/agents/client.rb +41 -100
  8. data/lib/google/cloud/dialogflow/v2/agents/operations.rb +96 -11
  9. data/lib/google/cloud/dialogflow/v2/agents/paths.rb +42 -3
  10. data/lib/google/cloud/dialogflow/v2/answer_record_pb.rb +100 -0
  11. data/lib/google/cloud/dialogflow/v2/answer_record_services_pb.rb +48 -0
  12. data/lib/google/cloud/dialogflow/v2/answer_records.rb +49 -0
  13. data/lib/google/cloud/dialogflow/v2/answer_records/client.rb +478 -0
  14. data/lib/google/cloud/dialogflow/v2/answer_records/credentials.rb +52 -0
  15. data/lib/google/cloud/dialogflow/v2/answer_records/paths.rb +105 -0
  16. data/lib/google/cloud/dialogflow/v2/audio_config_pb.rb +7 -0
  17. data/lib/google/cloud/dialogflow/v2/context_services_pb.rb +8 -25
  18. data/lib/google/cloud/dialogflow/v2/contexts.rb +1 -18
  19. data/lib/google/cloud/dialogflow/v2/contexts/client.rb +24 -63
  20. data/lib/google/cloud/dialogflow/v2/contexts/paths.rb +74 -2
  21. data/lib/google/cloud/dialogflow/v2/conversation_event_pb.rb +39 -0
  22. data/lib/google/cloud/dialogflow/v2/conversation_pb.rb +89 -0
  23. data/lib/google/cloud/dialogflow/v2/conversation_profile_pb.rb +182 -0
  24. data/lib/google/cloud/dialogflow/v2/conversation_profile_services_pb.rb +61 -0
  25. data/lib/google/cloud/dialogflow/v2/conversation_profiles.rb +49 -0
  26. data/lib/google/cloud/dialogflow/v2/conversation_profiles/client.rb +699 -0
  27. data/lib/google/cloud/dialogflow/v2/conversation_profiles/credentials.rb +52 -0
  28. data/lib/google/cloud/dialogflow/v2/conversation_profiles/paths.rb +246 -0
  29. data/lib/google/cloud/dialogflow/v2/conversation_services_pb.rb +75 -0
  30. data/lib/google/cloud/dialogflow/v2/conversations.rb +49 -0
  31. data/lib/google/cloud/dialogflow/v2/conversations/client.rb +757 -0
  32. data/lib/google/cloud/dialogflow/v2/conversations/credentials.rb +52 -0
  33. data/lib/google/cloud/dialogflow/v2/conversations/paths.rb +146 -0
  34. data/lib/google/cloud/dialogflow/v2/document_pb.rb +99 -0
  35. data/lib/google/cloud/dialogflow/v2/document_services_pb.rb +73 -0
  36. data/lib/google/cloud/dialogflow/v2/documents.rb +50 -0
  37. data/lib/google/cloud/dialogflow/v2/documents/client.rb +810 -0
  38. data/lib/google/cloud/dialogflow/v2/documents/credentials.rb +52 -0
  39. data/lib/google/cloud/dialogflow/v2/documents/operations.rb +655 -0
  40. data/lib/google/cloud/dialogflow/v2/documents/paths.rb +119 -0
  41. data/lib/google/cloud/dialogflow/v2/entity_type_services_pb.rb +12 -39
  42. data/lib/google/cloud/dialogflow/v2/entity_types.rb +1 -28
  43. data/lib/google/cloud/dialogflow/v2/entity_types/client.rb +28 -91
  44. data/lib/google/cloud/dialogflow/v2/entity_types/operations.rb +96 -11
  45. data/lib/google/cloud/dialogflow/v2/entity_types/paths.rb +58 -12
  46. data/lib/google/cloud/dialogflow/v2/environment_pb.rb +50 -1
  47. data/lib/google/cloud/dialogflow/v2/environment_services_pb.rb +24 -3
  48. data/lib/google/cloud/dialogflow/v2/environments.rb +1 -1
  49. data/lib/google/cloud/dialogflow/v2/environments/client.rb +430 -14
  50. data/lib/google/cloud/dialogflow/v2/environments/paths.rb +104 -5
  51. data/lib/google/cloud/dialogflow/v2/fulfillment_pb.rb +59 -0
  52. data/lib/google/cloud/dialogflow/v2/fulfillment_services_pb.rb +47 -0
  53. data/lib/google/cloud/dialogflow/v2/fulfillments.rb +49 -0
  54. data/lib/google/cloud/dialogflow/v2/fulfillments/client.rb +460 -0
  55. data/lib/google/cloud/dialogflow/v2/fulfillments/credentials.rb +52 -0
  56. data/lib/google/cloud/dialogflow/v2/fulfillments/paths.rb +69 -0
  57. data/lib/google/cloud/dialogflow/v2/gcs_pb.rb +20 -0
  58. data/lib/google/cloud/dialogflow/v2/human_agent_assistant_event_pb.rb +26 -0
  59. data/lib/google/cloud/dialogflow/v2/intent_pb.rb +2 -0
  60. data/lib/google/cloud/dialogflow/v2/intent_services_pb.rb +9 -40
  61. data/lib/google/cloud/dialogflow/v2/intents.rb +1 -32
  62. data/lib/google/cloud/dialogflow/v2/intents/client.rb +34 -81
  63. data/lib/google/cloud/dialogflow/v2/intents/operations.rb +96 -11
  64. data/lib/google/cloud/dialogflow/v2/intents/paths.rb +97 -13
  65. data/lib/google/cloud/dialogflow/v2/knowledge_base_pb.rb +60 -0
  66. data/lib/google/cloud/dialogflow/v2/knowledge_base_services_pb.rb +53 -0
  67. data/lib/google/cloud/dialogflow/v2/knowledge_bases.rb +49 -0
  68. data/lib/google/cloud/dialogflow/v2/knowledge_bases/client.rb +696 -0
  69. data/lib/google/cloud/dialogflow/v2/knowledge_bases/credentials.rb +52 -0
  70. data/lib/google/cloud/dialogflow/v2/knowledge_bases/paths.rb +105 -0
  71. data/lib/google/cloud/dialogflow/v2/participant_pb.rb +172 -0
  72. data/lib/google/cloud/dialogflow/v2/participant_services_pb.rb +64 -0
  73. data/lib/google/cloud/dialogflow/v2/participants.rb +49 -0
  74. data/lib/google/cloud/dialogflow/v2/participants/client.rb +894 -0
  75. data/lib/google/cloud/dialogflow/v2/participants/credentials.rb +52 -0
  76. data/lib/google/cloud/dialogflow/v2/participants/paths.rb +334 -0
  77. data/lib/google/cloud/dialogflow/v2/session_entity_type_services_pb.rb +7 -23
  78. data/lib/google/cloud/dialogflow/v2/session_entity_types.rb +1 -17
  79. data/lib/google/cloud/dialogflow/v2/session_entity_types/client.rb +23 -53
  80. data/lib/google/cloud/dialogflow/v2/session_entity_types/paths.rb +74 -2
  81. data/lib/google/cloud/dialogflow/v2/session_pb.rb +1 -0
  82. data/lib/google/cloud/dialogflow/v2/session_services_pb.rb +15 -7
  83. data/lib/google/cloud/dialogflow/v2/sessions.rb +4 -4
  84. data/lib/google/cloud/dialogflow/v2/sessions/client.rb +51 -15
  85. data/lib/google/cloud/dialogflow/v2/sessions/paths.rb +113 -3
  86. data/lib/google/cloud/dialogflow/v2/version.rb +1 -1
  87. data/lib/google/cloud/dialogflow/v2/version_pb.rb +69 -0
  88. data/lib/google/cloud/dialogflow/v2/version_services_pb.rb +59 -0
  89. data/lib/google/cloud/dialogflow/v2/versions.rb +49 -0
  90. data/lib/google/cloud/dialogflow/v2/versions/client.rb +709 -0
  91. data/lib/google/cloud/dialogflow/v2/versions/credentials.rb +52 -0
  92. data/lib/google/cloud/dialogflow/v2/versions/paths.rb +110 -0
  93. data/proto_docs/google/api/field_behavior.rb +6 -0
  94. data/proto_docs/google/api/resource.rb +50 -14
  95. data/proto_docs/google/cloud/dialogflow/v2/agent.rb +9 -1
  96. data/proto_docs/google/cloud/dialogflow/v2/answer_record.rb +252 -0
  97. data/proto_docs/google/cloud/dialogflow/v2/audio_config.rb +25 -0
  98. data/proto_docs/google/cloud/dialogflow/v2/context.rb +17 -2
  99. data/proto_docs/google/cloud/dialogflow/v2/conversation.rb +253 -0
  100. data/proto_docs/google/cloud/dialogflow/v2/conversation_event.rb +83 -0
  101. data/proto_docs/google/cloud/dialogflow/v2/conversation_profile.rb +522 -0
  102. data/proto_docs/google/cloud/dialogflow/v2/document.rb +267 -0
  103. data/proto_docs/google/cloud/dialogflow/v2/entity_type.rb +12 -3
  104. data/proto_docs/google/cloud/dialogflow/v2/environment.rb +187 -5
  105. data/proto_docs/google/cloud/dialogflow/v2/fulfillment.rb +144 -0
  106. data/proto_docs/google/cloud/dialogflow/v2/human_agent_assistant_event.rb +45 -0
  107. data/proto_docs/google/cloud/dialogflow/v2/intent.rb +29 -4
  108. data/proto_docs/google/cloud/dialogflow/v2/knowledge_base.rb +139 -0
  109. data/proto_docs/google/cloud/dialogflow/v2/participant.rb +503 -0
  110. data/proto_docs/google/cloud/dialogflow/v2/session.rb +52 -7
  111. data/proto_docs/google/cloud/dialogflow/v2/session_entity_type.rb +7 -6
  112. data/proto_docs/google/cloud/dialogflow/v2/validation_result.rb +1 -1
  113. data/proto_docs/google/cloud/dialogflow/v2/version.rb +176 -0
  114. data/proto_docs/google/cloud/dialogflow/v2/webhook.rb +2 -2
  115. data/proto_docs/google/longrunning/operations.rb +17 -3
  116. data/proto_docs/google/protobuf/any.rb +5 -2
  117. data/proto_docs/google/protobuf/timestamp.rb +10 -1
  118. data/proto_docs/google/type/latlng.rb +2 -2
  119. metadata +73 -9
@@ -0,0 +1,52 @@
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 "googleauth"
20
+
21
+ module Google
22
+ module Cloud
23
+ module Dialogflow
24
+ module V2
25
+ module ConversationProfiles
26
+ # Credentials for the ConversationProfiles API.
27
+ class Credentials < ::Google::Auth::Credentials
28
+ self.scope = [
29
+ "https://www.googleapis.com/auth/cloud-platform",
30
+ "https://www.googleapis.com/auth/dialogflow"
31
+ ]
32
+ self.env_vars = [
33
+ "DIALOGFLOW_CREDENTIALS",
34
+ "DIALOGFLOW_KEYFILE",
35
+ "GOOGLE_CLOUD_CREDENTIALS",
36
+ "GOOGLE_CLOUD_KEYFILE",
37
+ "GCLOUD_KEYFILE",
38
+ "DIALOGFLOW_CREDENTIALS_JSON",
39
+ "DIALOGFLOW_KEYFILE_JSON",
40
+ "GOOGLE_CLOUD_CREDENTIALS_JSON",
41
+ "GOOGLE_CLOUD_KEYFILE_JSON",
42
+ "GCLOUD_KEYFILE_JSON"
43
+ ]
44
+ self.paths = [
45
+ "~/.config/google_cloud/application_default_credentials.json"
46
+ ]
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,246 @@
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
+
20
+ module Google
21
+ module Cloud
22
+ module Dialogflow
23
+ module V2
24
+ module ConversationProfiles
25
+ # Path helper methods for the ConversationProfiles API.
26
+ module Paths
27
+ ##
28
+ # Create a fully-qualified Agent resource string.
29
+ #
30
+ # @overload agent_path(project:)
31
+ # The resource will be in the following format:
32
+ #
33
+ # `projects/{project}/agent`
34
+ #
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]
44
+ #
45
+ # @return [::String]
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)
61
+ end
62
+
63
+ ##
64
+ # Create a fully-qualified ConversationModel resource string.
65
+ #
66
+ # The resource will be in the following format:
67
+ #
68
+ # `projects/{project}/locations/{location}/conversationModels/{conversation_model}`
69
+ #
70
+ # @param project [String]
71
+ # @param location [String]
72
+ # @param conversation_model [String]
73
+ #
74
+ # @return [::String]
75
+ def conversation_model_path project:, location:, conversation_model:
76
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
77
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
78
+
79
+ "projects/#{project}/locations/#{location}/conversationModels/#{conversation_model}"
80
+ end
81
+
82
+ ##
83
+ # Create a fully-qualified ConversationProfile resource string.
84
+ #
85
+ # @overload conversation_profile_path(project:, conversation_profile:)
86
+ # The resource will be in the following format:
87
+ #
88
+ # `projects/{project}/conversationProfiles/{conversation_profile}`
89
+ #
90
+ # @param project [String]
91
+ # @param conversation_profile [String]
92
+ #
93
+ # @overload conversation_profile_path(project:, location:, conversation_profile:)
94
+ # The resource will be in the following format:
95
+ #
96
+ # `projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}`
97
+ #
98
+ # @param project [String]
99
+ # @param location [String]
100
+ # @param conversation_profile [String]
101
+ #
102
+ # @return [::String]
103
+ def conversation_profile_path **args
104
+ resources = {
105
+ "conversation_profile:project" => (proc do |project:, conversation_profile:|
106
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
107
+
108
+ "projects/#{project}/conversationProfiles/#{conversation_profile}"
109
+ end),
110
+ "conversation_profile:location:project" => (proc do |project:, location:, conversation_profile:|
111
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
112
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
113
+
114
+ "projects/#{project}/locations/#{location}/conversationProfiles/#{conversation_profile}"
115
+ end)
116
+ }
117
+
118
+ resource = resources[args.keys.sort.join(":")]
119
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
120
+ resource.call(**args)
121
+ end
122
+
123
+ ##
124
+ # Create a fully-qualified Document resource string.
125
+ #
126
+ # @overload document_path(project:, knowledge_base:, document:)
127
+ # The resource will be in the following format:
128
+ #
129
+ # `projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}`
130
+ #
131
+ # @param project [String]
132
+ # @param knowledge_base [String]
133
+ # @param document [String]
134
+ #
135
+ # @overload document_path(project:, location:, knowledge_base:, document:)
136
+ # The resource will be in the following format:
137
+ #
138
+ # `projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}`
139
+ #
140
+ # @param project [String]
141
+ # @param location [String]
142
+ # @param knowledge_base [String]
143
+ # @param document [String]
144
+ #
145
+ # @return [::String]
146
+ def document_path **args
147
+ resources = {
148
+ "document:knowledge_base:project" => (proc do |project:, knowledge_base:, document:|
149
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
150
+ raise ::ArgumentError, "knowledge_base cannot contain /" if knowledge_base.to_s.include? "/"
151
+
152
+ "projects/#{project}/knowledgeBases/#{knowledge_base}/documents/#{document}"
153
+ end),
154
+ "document:knowledge_base:location:project" => (proc do |project:, location:, knowledge_base:, document:|
155
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
156
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
157
+ raise ::ArgumentError, "knowledge_base cannot contain /" if knowledge_base.to_s.include? "/"
158
+
159
+ "projects/#{project}/locations/#{location}/knowledgeBases/#{knowledge_base}/documents/#{document}"
160
+ end)
161
+ }
162
+
163
+ resource = resources[args.keys.sort.join(":")]
164
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
165
+ resource.call(**args)
166
+ end
167
+
168
+ ##
169
+ # Create a fully-qualified KnowledgeBase resource string.
170
+ #
171
+ # @overload knowledge_base_path(project:, knowledge_base:)
172
+ # The resource will be in the following format:
173
+ #
174
+ # `projects/{project}/knowledgeBases/{knowledge_base}`
175
+ #
176
+ # @param project [String]
177
+ # @param knowledge_base [String]
178
+ #
179
+ # @overload knowledge_base_path(project:, location:, knowledge_base:)
180
+ # The resource will be in the following format:
181
+ #
182
+ # `projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}`
183
+ #
184
+ # @param project [String]
185
+ # @param location [String]
186
+ # @param knowledge_base [String]
187
+ #
188
+ # @return [::String]
189
+ def knowledge_base_path **args
190
+ resources = {
191
+ "knowledge_base:project" => (proc do |project:, knowledge_base:|
192
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
193
+
194
+ "projects/#{project}/knowledgeBases/#{knowledge_base}"
195
+ end),
196
+ "knowledge_base:location:project" => (proc do |project:, location:, knowledge_base:|
197
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
198
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
199
+
200
+ "projects/#{project}/locations/#{location}/knowledgeBases/#{knowledge_base}"
201
+ end)
202
+ }
203
+
204
+ resource = resources[args.keys.sort.join(":")]
205
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
206
+ resource.call(**args)
207
+ end
208
+
209
+ ##
210
+ # Create a fully-qualified Location resource string.
211
+ #
212
+ # The resource will be in the following format:
213
+ #
214
+ # `projects/{project}/locations/{location}`
215
+ #
216
+ # @param project [String]
217
+ # @param location [String]
218
+ #
219
+ # @return [::String]
220
+ def location_path project:, location:
221
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
222
+
223
+ "projects/#{project}/locations/#{location}"
224
+ end
225
+
226
+ ##
227
+ # Create a fully-qualified Project resource string.
228
+ #
229
+ # The resource will be in the following format:
230
+ #
231
+ # `projects/{project}`
232
+ #
233
+ # @param project [String]
234
+ #
235
+ # @return [::String]
236
+ def project_path project:
237
+ "projects/#{project}"
238
+ end
239
+
240
+ extend self
241
+ end
242
+ end
243
+ end
244
+ end
245
+ end
246
+ end
@@ -0,0 +1,75 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: google/cloud/dialogflow/v2/conversation.proto for package 'google.cloud.dialogflow.v2'
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/v2/conversation_pb'
21
+
22
+ module Google
23
+ module Cloud
24
+ module Dialogflow
25
+ module V2
26
+ module Conversations
27
+ # Service for managing [Conversations][google.cloud.dialogflow.v2.Conversation].
28
+ class Service
29
+
30
+ include ::GRPC::GenericService
31
+
32
+ self.marshal_class_method = :encode
33
+ self.unmarshal_class_method = :decode
34
+ self.service_name = 'google.cloud.dialogflow.v2.Conversations'
35
+
36
+ # Creates a new conversation. Conversations are auto-completed after 24
37
+ # hours.
38
+ #
39
+ # Conversation Lifecycle:
40
+ # There are two stages during a conversation: Automated Agent Stage and
41
+ # Assist Stage.
42
+ #
43
+ # For Automated Agent Stage, there will be a dialogflow agent responding to
44
+ # user queries.
45
+ #
46
+ # For Assist Stage, there's no dialogflow agent responding to user queries.
47
+ # But we will provide suggestions which are generated from conversation.
48
+ #
49
+ # If [Conversation.conversation_profile][google.cloud.dialogflow.v2.Conversation.conversation_profile] is configured for a dialogflow
50
+ # agent, conversation will start from `Automated Agent Stage`, otherwise, it
51
+ # will start from `Assist Stage`. And during `Automated Agent Stage`, once an
52
+ # [Intent][google.cloud.dialogflow.v2.Intent] with [Intent.live_agent_handoff][google.cloud.dialogflow.v2.Intent.live_agent_handoff] is triggered, conversation
53
+ # will transfer to Assist Stage.
54
+ rpc :CreateConversation, ::Google::Cloud::Dialogflow::V2::CreateConversationRequest, ::Google::Cloud::Dialogflow::V2::Conversation
55
+ # Returns the list of all conversations in the specified project.
56
+ rpc :ListConversations, ::Google::Cloud::Dialogflow::V2::ListConversationsRequest, ::Google::Cloud::Dialogflow::V2::ListConversationsResponse
57
+ # Retrieves the specific conversation.
58
+ rpc :GetConversation, ::Google::Cloud::Dialogflow::V2::GetConversationRequest, ::Google::Cloud::Dialogflow::V2::Conversation
59
+ # Completes the specified conversation. Finished conversations are purged
60
+ # from the database after 30 days.
61
+ rpc :CompleteConversation, ::Google::Cloud::Dialogflow::V2::CompleteConversationRequest, ::Google::Cloud::Dialogflow::V2::Conversation
62
+ # Lists messages that belong to a given conversation.
63
+ # `messages` are ordered by `create_time` in descending order. To fetch
64
+ # updates without duplication, send request with filter
65
+ # `create_time_epoch_microseconds >
66
+ # [first item's create_time of previous request]` and empty page_token.
67
+ rpc :ListMessages, ::Google::Cloud::Dialogflow::V2::ListMessagesRequest, ::Google::Cloud::Dialogflow::V2::ListMessagesResponse
68
+ end
69
+
70
+ Stub = Service.rpc_stub_class
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,49 @@
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 "gapic/common"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/dialogflow/v2/version"
24
+
25
+ require "google/cloud/dialogflow/v2/conversations/credentials"
26
+ require "google/cloud/dialogflow/v2/conversations/paths"
27
+ require "google/cloud/dialogflow/v2/conversations/client"
28
+
29
+ module Google
30
+ module Cloud
31
+ module Dialogflow
32
+ module V2
33
+ ##
34
+ # Service for managing {::Google::Cloud::Dialogflow::V2::Conversation Conversations}.
35
+ #
36
+ # To load this service and instantiate a client:
37
+ #
38
+ # require "google/cloud/dialogflow/v2/conversations"
39
+ # client = ::Google::Cloud::Dialogflow::V2::Conversations::Client.new
40
+ #
41
+ module Conversations
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+
48
+ helper_path = ::File.join __dir__, "conversations", "helpers.rb"
49
+ require "google/cloud/dialogflow/v2/conversations/helpers" if ::File.file? helper_path
@@ -0,0 +1,757 @@
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/v2/conversation_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Dialogflow
25
+ module V2
26
+ module Conversations
27
+ ##
28
+ # Client for the Conversations service.
29
+ #
30
+ # Service for managing {::Google::Cloud::Dialogflow::V2::Conversation Conversations}.
31
+ #
32
+ class Client
33
+ include Paths
34
+
35
+ # @private
36
+ attr_reader :conversations_stub
37
+
38
+ ##
39
+ # Configure the Conversations Client class.
40
+ #
41
+ # See {::Google::Cloud::Dialogflow::V2::Conversations::Client::Configuration}
42
+ # for a description of the configuration fields.
43
+ #
44
+ # ## Example
45
+ #
46
+ # To modify the configuration for all Conversations clients:
47
+ #
48
+ # ::Google::Cloud::Dialogflow::V2::Conversations::Client.configure do |config|
49
+ # config.timeout = 10.0
50
+ # end
51
+ #
52
+ # @yield [config] Configure the Client client.
53
+ # @yieldparam config [Client::Configuration]
54
+ #
55
+ # @return [Client::Configuration]
56
+ #
57
+ def self.configure
58
+ @configure ||= begin
59
+ namespace = ["Google", "Cloud", "Dialogflow", "V2"]
60
+ parent_config = while namespace.any?
61
+ parent_name = namespace.join "::"
62
+ parent_const = const_get parent_name
63
+ break parent_const.configure if parent_const.respond_to? :configure
64
+ namespace.pop
65
+ end
66
+ default_config = Client::Configuration.new parent_config
67
+
68
+ default_config.timeout = 60.0
69
+ default_config.retry_policy = {
70
+ initial_delay: 0.1,
71
+ max_delay: 60.0,
72
+ multiplier: 1.3,
73
+ retry_codes: [14]
74
+ }
75
+
76
+ default_config
77
+ end
78
+ yield @configure if block_given?
79
+ @configure
80
+ end
81
+
82
+ ##
83
+ # Configure the Conversations Client instance.
84
+ #
85
+ # The configuration is set to the derived mode, meaning that values can be changed,
86
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
87
+ # should be made on {Client.configure}.
88
+ #
89
+ # See {::Google::Cloud::Dialogflow::V2::Conversations::Client::Configuration}
90
+ # for a description of the configuration fields.
91
+ #
92
+ # @yield [config] Configure the Client client.
93
+ # @yieldparam config [Client::Configuration]
94
+ #
95
+ # @return [Client::Configuration]
96
+ #
97
+ def configure
98
+ yield @config if block_given?
99
+ @config
100
+ end
101
+
102
+ ##
103
+ # Create a new Conversations client object.
104
+ #
105
+ # ## Examples
106
+ #
107
+ # To create a new Conversations client with the default
108
+ # configuration:
109
+ #
110
+ # client = ::Google::Cloud::Dialogflow::V2::Conversations::Client.new
111
+ #
112
+ # To create a new Conversations client with a custom
113
+ # configuration:
114
+ #
115
+ # client = ::Google::Cloud::Dialogflow::V2::Conversations::Client.new do |config|
116
+ # config.timeout = 10.0
117
+ # end
118
+ #
119
+ # @yield [config] Configure the Conversations client.
120
+ # @yieldparam config [Client::Configuration]
121
+ #
122
+ def initialize
123
+ # These require statements are intentionally placed here to initialize
124
+ # the gRPC module only when it's required.
125
+ # See https://github.com/googleapis/toolkit/issues/446
126
+ require "gapic/grpc"
127
+ require "google/cloud/dialogflow/v2/conversation_services_pb"
128
+
129
+ # Create the configuration object
130
+ @config = Configuration.new Client.configure
131
+
132
+ # Yield the configuration if needed
133
+ yield @config if block_given?
134
+
135
+ # Create credentials
136
+ credentials = @config.credentials
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
144
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
145
+ credentials = Credentials.new credentials, scope: @config.scope
146
+ end
147
+ @quota_project_id = @config.quota_project
148
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
149
+
150
+ @conversations_stub = ::Gapic::ServiceStub.new(
151
+ ::Google::Cloud::Dialogflow::V2::Conversations::Stub,
152
+ credentials: credentials,
153
+ endpoint: @config.endpoint,
154
+ channel_args: @config.channel_args,
155
+ interceptors: @config.interceptors
156
+ )
157
+ end
158
+
159
+ # Service calls
160
+
161
+ ##
162
+ # Creates a new conversation. Conversations are auto-completed after 24
163
+ # hours.
164
+ #
165
+ # Conversation Lifecycle:
166
+ # There are two stages during a conversation: Automated Agent Stage and
167
+ # Assist Stage.
168
+ #
169
+ # For Automated Agent Stage, there will be a dialogflow agent responding to
170
+ # user queries.
171
+ #
172
+ # For Assist Stage, there's no dialogflow agent responding to user queries.
173
+ # But we will provide suggestions which are generated from conversation.
174
+ #
175
+ # If {::Google::Cloud::Dialogflow::V2::Conversation#conversation_profile Conversation.conversation_profile} is configured for a dialogflow
176
+ # agent, conversation will start from `Automated Agent Stage`, otherwise, it
177
+ # will start from `Assist Stage`. And during `Automated Agent Stage`, once an
178
+ # {::Google::Cloud::Dialogflow::V2::Intent Intent} with {::Google::Cloud::Dialogflow::V2::Intent#live_agent_handoff Intent.live_agent_handoff} is triggered, conversation
179
+ # will transfer to Assist Stage.
180
+ #
181
+ # @overload create_conversation(request, options = nil)
182
+ # Pass arguments to `create_conversation` via a request object, either of type
183
+ # {::Google::Cloud::Dialogflow::V2::CreateConversationRequest} or an equivalent Hash.
184
+ #
185
+ # @param request [::Google::Cloud::Dialogflow::V2::CreateConversationRequest, ::Hash]
186
+ # A request object representing the call parameters. Required. To specify no
187
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
188
+ # @param options [::Gapic::CallOptions, ::Hash]
189
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
190
+ #
191
+ # @overload create_conversation(parent: nil, conversation: nil, conversation_id: nil)
192
+ # Pass arguments to `create_conversation` via keyword arguments. Note that at
193
+ # least one keyword argument is required. To specify no parameters, or to keep all
194
+ # the default parameter values, pass an empty Hash as a request object (see above).
195
+ #
196
+ # @param parent [::String]
197
+ # Required. Resource identifier of the project creating the conversation.
198
+ # Format: `projects/<Project ID>/locations/<Location ID>`.
199
+ # @param conversation [::Google::Cloud::Dialogflow::V2::Conversation, ::Hash]
200
+ # Required. The conversation to create.
201
+ # @param conversation_id [::String]
202
+ # Optional. Identifier of the conversation. Generally it's auto generated by Google.
203
+ # Only set it if you cannot wait for the response to return a
204
+ # auto-generated one to you.
205
+ #
206
+ # The conversation ID must be compliant with the regression fomula
207
+ # "[a-zA-Z][a-zA-Z0-9_-]*" with the characters length in range of [3,64].
208
+ # If the field is provided, the caller is resposible for
209
+ # 1. the uniqueness of the ID, otherwise the request will be rejected.
210
+ # 2. the consistency for whether to use custom ID or not under a project to
211
+ # better ensure uniqueness.
212
+ #
213
+ # @yield [response, operation] Access the result along with the RPC operation
214
+ # @yieldparam response [::Google::Cloud::Dialogflow::V2::Conversation]
215
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
216
+ #
217
+ # @return [::Google::Cloud::Dialogflow::V2::Conversation]
218
+ #
219
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
220
+ #
221
+ def create_conversation request, options = nil
222
+ raise ::ArgumentError, "request must be provided" if request.nil?
223
+
224
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::CreateConversationRequest
225
+
226
+ # Converts hash and nil to an options object
227
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
228
+
229
+ # Customize the options with defaults
230
+ metadata = @config.rpcs.create_conversation.metadata.to_h
231
+
232
+ # Set x-goog-api-client and x-goog-user-project headers
233
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
234
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
235
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
236
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
237
+
238
+ header_params = {
239
+ "parent" => request.parent
240
+ }
241
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
242
+ metadata[:"x-goog-request-params"] ||= request_params_header
243
+
244
+ options.apply_defaults timeout: @config.rpcs.create_conversation.timeout,
245
+ metadata: metadata,
246
+ retry_policy: @config.rpcs.create_conversation.retry_policy
247
+ options.apply_defaults metadata: @config.metadata,
248
+ retry_policy: @config.retry_policy
249
+
250
+ @conversations_stub.call_rpc :create_conversation, 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
+ # Returns the list of all conversations in the specified project.
260
+ #
261
+ # @overload list_conversations(request, options = nil)
262
+ # Pass arguments to `list_conversations` via a request object, either of type
263
+ # {::Google::Cloud::Dialogflow::V2::ListConversationsRequest} or an equivalent Hash.
264
+ #
265
+ # @param request [::Google::Cloud::Dialogflow::V2::ListConversationsRequest, ::Hash]
266
+ # A request object representing the call parameters. Required. To specify no
267
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
268
+ # @param options [::Gapic::CallOptions, ::Hash]
269
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
270
+ #
271
+ # @overload list_conversations(parent: nil, page_size: nil, page_token: nil, filter: nil)
272
+ # Pass arguments to `list_conversations` via keyword arguments. Note that at
273
+ # least one keyword argument is required. To specify no parameters, or to keep all
274
+ # the default parameter values, pass an empty Hash as a request object (see above).
275
+ #
276
+ # @param parent [::String]
277
+ # Required. The project from which to list all conversation.
278
+ # Format: `projects/<Project ID>/locations/<Location ID>`.
279
+ # @param page_size [::Integer]
280
+ # Optional. The maximum number of items to return in a single page. By
281
+ # default 100 and at most 1000.
282
+ # @param page_token [::String]
283
+ # Optional. The next_page_token value returned from a previous list request.
284
+ # @param filter [::String]
285
+ # A filter expression that filters conversations listed in the response. In
286
+ # general, the expression must specify the field name, a comparison operator,
287
+ # and the value to use for filtering:
288
+ # <ul>
289
+ # <li>The value must be a string, a number, or a boolean.</li>
290
+ # <li>The comparison operator must be either `=`,`!=`, `>`, or `<`.</li>
291
+ # <li>To filter on multiple expressions, separate the
292
+ # expressions with `AND` or `OR` (omitting both implies `AND`).</li>
293
+ # <li>For clarity, expressions can be enclosed in parentheses.</li>
294
+ # </ul>
295
+ # Only `lifecycle_state` can be filtered on in this way. For example,
296
+ # the following expression only returns `COMPLETED` conversations:
297
+ #
298
+ # `lifecycle_state = "COMPLETED"`
299
+ #
300
+ # For more information about filtering, see
301
+ # [API Filtering](https://aip.dev/160).
302
+ #
303
+ # @yield [response, operation] Access the result along with the RPC operation
304
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Conversation>]
305
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
306
+ #
307
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Conversation>]
308
+ #
309
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
310
+ #
311
+ def list_conversations request, options = nil
312
+ raise ::ArgumentError, "request must be provided" if request.nil?
313
+
314
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::ListConversationsRequest
315
+
316
+ # Converts hash and nil to an options object
317
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
318
+
319
+ # Customize the options with defaults
320
+ metadata = @config.rpcs.list_conversations.metadata.to_h
321
+
322
+ # Set x-goog-api-client and x-goog-user-project headers
323
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
324
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
325
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
326
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
327
+
328
+ header_params = {
329
+ "parent" => request.parent
330
+ }
331
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
332
+ metadata[:"x-goog-request-params"] ||= request_params_header
333
+
334
+ options.apply_defaults timeout: @config.rpcs.list_conversations.timeout,
335
+ metadata: metadata,
336
+ retry_policy: @config.rpcs.list_conversations.retry_policy
337
+ options.apply_defaults metadata: @config.metadata,
338
+ retry_policy: @config.retry_policy
339
+
340
+ @conversations_stub.call_rpc :list_conversations, request, options: options do |response, operation|
341
+ response = ::Gapic::PagedEnumerable.new @conversations_stub, :list_conversations, request, response, operation, options
342
+ yield response, operation if block_given?
343
+ return response
344
+ end
345
+ rescue ::GRPC::BadStatus => e
346
+ raise ::Google::Cloud::Error.from_error(e)
347
+ end
348
+
349
+ ##
350
+ # Retrieves the specific conversation.
351
+ #
352
+ # @overload get_conversation(request, options = nil)
353
+ # Pass arguments to `get_conversation` via a request object, either of type
354
+ # {::Google::Cloud::Dialogflow::V2::GetConversationRequest} or an equivalent Hash.
355
+ #
356
+ # @param request [::Google::Cloud::Dialogflow::V2::GetConversationRequest, ::Hash]
357
+ # A request object representing the call parameters. Required. To specify no
358
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
359
+ # @param options [::Gapic::CallOptions, ::Hash]
360
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
361
+ #
362
+ # @overload get_conversation(name: nil)
363
+ # Pass arguments to `get_conversation` via keyword arguments. Note that at
364
+ # least one keyword argument is required. To specify no parameters, or to keep all
365
+ # the default parameter values, pass an empty Hash as a request object (see above).
366
+ #
367
+ # @param name [::String]
368
+ # Required. The name of the conversation. Format:
369
+ # `projects/<Project ID>/locations/<Location ID>/conversations/<Conversation
370
+ # ID>`.
371
+ #
372
+ # @yield [response, operation] Access the result along with the RPC operation
373
+ # @yieldparam response [::Google::Cloud::Dialogflow::V2::Conversation]
374
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
375
+ #
376
+ # @return [::Google::Cloud::Dialogflow::V2::Conversation]
377
+ #
378
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
379
+ #
380
+ def get_conversation request, options = nil
381
+ raise ::ArgumentError, "request must be provided" if request.nil?
382
+
383
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::GetConversationRequest
384
+
385
+ # Converts hash and nil to an options object
386
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
387
+
388
+ # Customize the options with defaults
389
+ metadata = @config.rpcs.get_conversation.metadata.to_h
390
+
391
+ # Set x-goog-api-client and x-goog-user-project headers
392
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
393
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
394
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
395
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
396
+
397
+ header_params = {
398
+ "name" => request.name
399
+ }
400
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
401
+ metadata[:"x-goog-request-params"] ||= request_params_header
402
+
403
+ options.apply_defaults timeout: @config.rpcs.get_conversation.timeout,
404
+ metadata: metadata,
405
+ retry_policy: @config.rpcs.get_conversation.retry_policy
406
+ options.apply_defaults metadata: @config.metadata,
407
+ retry_policy: @config.retry_policy
408
+
409
+ @conversations_stub.call_rpc :get_conversation, request, options: options do |response, operation|
410
+ yield response, operation if block_given?
411
+ return response
412
+ end
413
+ rescue ::GRPC::BadStatus => e
414
+ raise ::Google::Cloud::Error.from_error(e)
415
+ end
416
+
417
+ ##
418
+ # Completes the specified conversation. Finished conversations are purged
419
+ # from the database after 30 days.
420
+ #
421
+ # @overload complete_conversation(request, options = nil)
422
+ # Pass arguments to `complete_conversation` via a request object, either of type
423
+ # {::Google::Cloud::Dialogflow::V2::CompleteConversationRequest} or an equivalent Hash.
424
+ #
425
+ # @param request [::Google::Cloud::Dialogflow::V2::CompleteConversationRequest, ::Hash]
426
+ # A request object representing the call parameters. Required. To specify no
427
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
428
+ # @param options [::Gapic::CallOptions, ::Hash]
429
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
430
+ #
431
+ # @overload complete_conversation(name: nil)
432
+ # Pass arguments to `complete_conversation` via keyword arguments. Note that at
433
+ # least one keyword argument is required. To specify no parameters, or to keep all
434
+ # the default parameter values, pass an empty Hash as a request object (see above).
435
+ #
436
+ # @param name [::String]
437
+ # Required. Resource identifier of the conversation to close.
438
+ # Format: `projects/<Project ID>/locations/<Location
439
+ # ID>/conversations/<Conversation ID>`.
440
+ #
441
+ # @yield [response, operation] Access the result along with the RPC operation
442
+ # @yieldparam response [::Google::Cloud::Dialogflow::V2::Conversation]
443
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
444
+ #
445
+ # @return [::Google::Cloud::Dialogflow::V2::Conversation]
446
+ #
447
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
448
+ #
449
+ def complete_conversation request, options = nil
450
+ raise ::ArgumentError, "request must be provided" if request.nil?
451
+
452
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::CompleteConversationRequest
453
+
454
+ # Converts hash and nil to an options object
455
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
456
+
457
+ # Customize the options with defaults
458
+ metadata = @config.rpcs.complete_conversation.metadata.to_h
459
+
460
+ # Set x-goog-api-client and x-goog-user-project headers
461
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
462
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
463
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
464
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
465
+
466
+ header_params = {
467
+ "name" => request.name
468
+ }
469
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
470
+ metadata[:"x-goog-request-params"] ||= request_params_header
471
+
472
+ options.apply_defaults timeout: @config.rpcs.complete_conversation.timeout,
473
+ metadata: metadata,
474
+ retry_policy: @config.rpcs.complete_conversation.retry_policy
475
+ options.apply_defaults metadata: @config.metadata,
476
+ retry_policy: @config.retry_policy
477
+
478
+ @conversations_stub.call_rpc :complete_conversation, request, options: options do |response, operation|
479
+ yield response, operation if block_given?
480
+ return response
481
+ end
482
+ rescue ::GRPC::BadStatus => e
483
+ raise ::Google::Cloud::Error.from_error(e)
484
+ end
485
+
486
+ ##
487
+ # Lists messages that belong to a given conversation.
488
+ # `messages` are ordered by `create_time` in descending order. To fetch
489
+ # updates without duplication, send request with filter
490
+ # `create_time_epoch_microseconds >
491
+ # [first item's create_time of previous request]` and empty page_token.
492
+ #
493
+ # @overload list_messages(request, options = nil)
494
+ # Pass arguments to `list_messages` via a request object, either of type
495
+ # {::Google::Cloud::Dialogflow::V2::ListMessagesRequest} or an equivalent Hash.
496
+ #
497
+ # @param request [::Google::Cloud::Dialogflow::V2::ListMessagesRequest, ::Hash]
498
+ # A request object representing the call parameters. Required. To specify no
499
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
500
+ # @param options [::Gapic::CallOptions, ::Hash]
501
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
502
+ #
503
+ # @overload list_messages(parent: nil, filter: nil, page_size: nil, page_token: nil)
504
+ # Pass arguments to `list_messages` via keyword arguments. Note that at
505
+ # least one keyword argument is required. To specify no parameters, or to keep all
506
+ # the default parameter values, pass an empty Hash as a request object (see above).
507
+ #
508
+ # @param parent [::String]
509
+ # Required. The name of the conversation to list messages for.
510
+ # Format: `projects/<Project ID>/locations/<Location
511
+ # ID>/conversations/<Conversation ID>`
512
+ # @param filter [::String]
513
+ # Optional. Filter on message fields. Currently predicates on `create_time`
514
+ # and `create_time_epoch_microseconds` are supported. `create_time` only
515
+ # support milliseconds accuracy. E.g.,
516
+ # `create_time_epoch_microseconds > 1551790877964485` or
517
+ # `create_time > 2017-01-15T01:30:15.01Z`.
518
+ #
519
+ # For more information about filtering, see
520
+ # [API Filtering](https://aip.dev/160).
521
+ # @param page_size [::Integer]
522
+ # Optional. The maximum number of items to return in a single page. By
523
+ # default 100 and at most 1000.
524
+ # @param page_token [::String]
525
+ # Optional. The next_page_token value returned from a previous list request.
526
+ #
527
+ # @yield [response, operation] Access the result along with the RPC operation
528
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Message>]
529
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
530
+ #
531
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Message>]
532
+ #
533
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
534
+ #
535
+ def list_messages request, options = nil
536
+ raise ::ArgumentError, "request must be provided" if request.nil?
537
+
538
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::ListMessagesRequest
539
+
540
+ # Converts hash and nil to an options object
541
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
542
+
543
+ # Customize the options with defaults
544
+ metadata = @config.rpcs.list_messages.metadata.to_h
545
+
546
+ # Set x-goog-api-client and x-goog-user-project headers
547
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
548
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
549
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
550
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
551
+
552
+ header_params = {
553
+ "parent" => request.parent
554
+ }
555
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
556
+ metadata[:"x-goog-request-params"] ||= request_params_header
557
+
558
+ options.apply_defaults timeout: @config.rpcs.list_messages.timeout,
559
+ metadata: metadata,
560
+ retry_policy: @config.rpcs.list_messages.retry_policy
561
+ options.apply_defaults metadata: @config.metadata,
562
+ retry_policy: @config.retry_policy
563
+
564
+ @conversations_stub.call_rpc :list_messages, request, options: options do |response, operation|
565
+ response = ::Gapic::PagedEnumerable.new @conversations_stub, :list_messages, request, response, operation, options
566
+ yield response, operation if block_given?
567
+ return response
568
+ end
569
+ rescue ::GRPC::BadStatus => e
570
+ raise ::Google::Cloud::Error.from_error(e)
571
+ end
572
+
573
+ ##
574
+ # Configuration class for the Conversations API.
575
+ #
576
+ # This class represents the configuration for Conversations,
577
+ # providing control over timeouts, retry behavior, logging, transport
578
+ # parameters, and other low-level controls. Certain parameters can also be
579
+ # applied individually to specific RPCs. See
580
+ # {::Google::Cloud::Dialogflow::V2::Conversations::Client::Configuration::Rpcs}
581
+ # for a list of RPCs that can be configured independently.
582
+ #
583
+ # Configuration can be applied globally to all clients, or to a single client
584
+ # on construction.
585
+ #
586
+ # # Examples
587
+ #
588
+ # To modify the global config, setting the timeout for create_conversation
589
+ # to 20 seconds, and all remaining timeouts to 10 seconds:
590
+ #
591
+ # ::Google::Cloud::Dialogflow::V2::Conversations::Client.configure do |config|
592
+ # config.timeout = 10.0
593
+ # config.rpcs.create_conversation.timeout = 20.0
594
+ # end
595
+ #
596
+ # To apply the above configuration only to a new client:
597
+ #
598
+ # client = ::Google::Cloud::Dialogflow::V2::Conversations::Client.new do |config|
599
+ # config.timeout = 10.0
600
+ # config.rpcs.create_conversation.timeout = 20.0
601
+ # end
602
+ #
603
+ # @!attribute [rw] endpoint
604
+ # The hostname or hostname:port of the service endpoint.
605
+ # Defaults to `"dialogflow.googleapis.com"`.
606
+ # @return [::String]
607
+ # @!attribute [rw] credentials
608
+ # Credentials to send with calls. You may provide any of the following types:
609
+ # * (`String`) The path to a service account key file in JSON format
610
+ # * (`Hash`) A service account key as a Hash
611
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
612
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
613
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
614
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
615
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
616
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
617
+ # * (`nil`) indicating no credentials
618
+ # @return [::Object]
619
+ # @!attribute [rw] scope
620
+ # The OAuth scopes
621
+ # @return [::Array<::String>]
622
+ # @!attribute [rw] lib_name
623
+ # The library name as recorded in instrumentation and logging
624
+ # @return [::String]
625
+ # @!attribute [rw] lib_version
626
+ # The library version as recorded in instrumentation and logging
627
+ # @return [::String]
628
+ # @!attribute [rw] channel_args
629
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
630
+ # `GRPC::Core::Channel` object is provided as the credential.
631
+ # @return [::Hash]
632
+ # @!attribute [rw] interceptors
633
+ # An array of interceptors that are run before calls are executed.
634
+ # @return [::Array<::GRPC::ClientInterceptor>]
635
+ # @!attribute [rw] timeout
636
+ # The call timeout in seconds.
637
+ # @return [::Numeric]
638
+ # @!attribute [rw] metadata
639
+ # Additional gRPC headers to be sent with the call.
640
+ # @return [::Hash{::Symbol=>::String}]
641
+ # @!attribute [rw] retry_policy
642
+ # The retry policy. The value is a hash with the following keys:
643
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
644
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
645
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
646
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
647
+ # trigger a retry.
648
+ # @return [::Hash]
649
+ # @!attribute [rw] quota_project
650
+ # A separate project against which to charge quota.
651
+ # @return [::String]
652
+ #
653
+ class Configuration
654
+ extend ::Gapic::Config
655
+
656
+ config_attr :endpoint, "dialogflow.googleapis.com", ::String
657
+ config_attr :credentials, nil do |value|
658
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
659
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
660
+ allowed.any? { |klass| klass === value }
661
+ end
662
+ config_attr :scope, nil, ::String, ::Array, nil
663
+ config_attr :lib_name, nil, ::String, nil
664
+ config_attr :lib_version, nil, ::String, nil
665
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
666
+ config_attr :interceptors, nil, ::Array, nil
667
+ config_attr :timeout, nil, ::Numeric, nil
668
+ config_attr :metadata, nil, ::Hash, nil
669
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
670
+ config_attr :quota_project, nil, ::String, nil
671
+
672
+ # @private
673
+ def initialize parent_config = nil
674
+ @parent_config = parent_config unless parent_config.nil?
675
+
676
+ yield self if block_given?
677
+ end
678
+
679
+ ##
680
+ # Configurations for individual RPCs
681
+ # @return [Rpcs]
682
+ #
683
+ def rpcs
684
+ @rpcs ||= begin
685
+ parent_rpcs = nil
686
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
687
+ Rpcs.new parent_rpcs
688
+ end
689
+ end
690
+
691
+ ##
692
+ # Configuration RPC class for the Conversations API.
693
+ #
694
+ # Includes fields providing the configuration for each RPC in this service.
695
+ # Each configuration object is of type `Gapic::Config::Method` and includes
696
+ # the following configuration fields:
697
+ #
698
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
699
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
700
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
701
+ # include the following keys:
702
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
703
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
704
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
705
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
706
+ # trigger a retry.
707
+ #
708
+ class Rpcs
709
+ ##
710
+ # RPC-specific configuration for `create_conversation`
711
+ # @return [::Gapic::Config::Method]
712
+ #
713
+ attr_reader :create_conversation
714
+ ##
715
+ # RPC-specific configuration for `list_conversations`
716
+ # @return [::Gapic::Config::Method]
717
+ #
718
+ attr_reader :list_conversations
719
+ ##
720
+ # RPC-specific configuration for `get_conversation`
721
+ # @return [::Gapic::Config::Method]
722
+ #
723
+ attr_reader :get_conversation
724
+ ##
725
+ # RPC-specific configuration for `complete_conversation`
726
+ # @return [::Gapic::Config::Method]
727
+ #
728
+ attr_reader :complete_conversation
729
+ ##
730
+ # RPC-specific configuration for `list_messages`
731
+ # @return [::Gapic::Config::Method]
732
+ #
733
+ attr_reader :list_messages
734
+
735
+ # @private
736
+ def initialize parent_rpcs = nil
737
+ create_conversation_config = parent_rpcs.create_conversation if parent_rpcs.respond_to? :create_conversation
738
+ @create_conversation = ::Gapic::Config::Method.new create_conversation_config
739
+ list_conversations_config = parent_rpcs.list_conversations if parent_rpcs.respond_to? :list_conversations
740
+ @list_conversations = ::Gapic::Config::Method.new list_conversations_config
741
+ get_conversation_config = parent_rpcs.get_conversation if parent_rpcs.respond_to? :get_conversation
742
+ @get_conversation = ::Gapic::Config::Method.new get_conversation_config
743
+ complete_conversation_config = parent_rpcs.complete_conversation if parent_rpcs.respond_to? :complete_conversation
744
+ @complete_conversation = ::Gapic::Config::Method.new complete_conversation_config
745
+ list_messages_config = parent_rpcs.list_messages if parent_rpcs.respond_to? :list_messages
746
+ @list_messages = ::Gapic::Config::Method.new list_messages_config
747
+
748
+ yield self if block_given?
749
+ end
750
+ end
751
+ end
752
+ end
753
+ end
754
+ end
755
+ end
756
+ end
757
+ end