google-cloud-dialogflow 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +8 -0
  3. data/LICENSE +201 -0
  4. data/README.md +32 -0
  5. data/lib/google/cloud/dialogflow.rb +452 -0
  6. data/lib/google/cloud/dialogflow/credentials.rb +30 -0
  7. data/lib/google/cloud/dialogflow/v2.rb +454 -0
  8. data/lib/google/cloud/dialogflow/v2/agent_pb.rb +87 -0
  9. data/lib/google/cloud/dialogflow/v2/agent_services_pb.rb +104 -0
  10. data/lib/google/cloud/dialogflow/v2/agents_client.rb +639 -0
  11. data/lib/google/cloud/dialogflow/v2/agents_client_config.json +56 -0
  12. data/lib/google/cloud/dialogflow/v2/context_pb.rb +59 -0
  13. data/lib/google/cloud/dialogflow/v2/context_services_pb.rb +71 -0
  14. data/lib/google/cloud/dialogflow/v2/contexts_client.rb +445 -0
  15. data/lib/google/cloud/dialogflow/v2/contexts_client_config.json +56 -0
  16. data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/agent.rb +223 -0
  17. data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/context.rb +115 -0
  18. data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/entity_type.rb +290 -0
  19. data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/intent.rb +714 -0
  20. data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/session.rb +451 -0
  21. data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/session_entity_type.rb +134 -0
  22. data/lib/google/cloud/dialogflow/v2/doc/google/protobuf/any.rb +124 -0
  23. data/lib/google/cloud/dialogflow/v2/doc/google/protobuf/field_mask.rb +223 -0
  24. data/lib/google/cloud/dialogflow/v2/doc/google/protobuf/struct.rb +73 -0
  25. data/lib/google/cloud/dialogflow/v2/doc/google/rpc/status.rb +83 -0
  26. data/lib/google/cloud/dialogflow/v2/doc/google/type/latlng.rb +64 -0
  27. data/lib/google/cloud/dialogflow/v2/doc/overview.rb +55 -0
  28. data/lib/google/cloud/dialogflow/v2/entity_type_pb.rb +120 -0
  29. data/lib/google/cloud/dialogflow/v2/entity_type_services_pb.rb +105 -0
  30. data/lib/google/cloud/dialogflow/v2/entity_types_client.rb +900 -0
  31. data/lib/google/cloud/dialogflow/v2/entity_types_client_config.json +76 -0
  32. data/lib/google/cloud/dialogflow/v2/intent_pb.rb +274 -0
  33. data/lib/google/cloud/dialogflow/v2/intent_services_pb.rb +91 -0
  34. data/lib/google/cloud/dialogflow/v2/intents_client.rb +684 -0
  35. data/lib/google/cloud/dialogflow/v2/intents_client_config.json +61 -0
  36. data/lib/google/cloud/dialogflow/v2/session_entity_type_pb.rb +61 -0
  37. data/lib/google/cloud/dialogflow/v2/session_entity_type_services_pb.rb +64 -0
  38. data/lib/google/cloud/dialogflow/v2/session_entity_types_client.rb +413 -0
  39. data/lib/google/cloud/dialogflow/v2/session_entity_types_client_config.json +51 -0
  40. data/lib/google/cloud/dialogflow/v2/session_pb.rb +127 -0
  41. data/lib/google/cloud/dialogflow/v2/session_services_pb.rb +55 -0
  42. data/lib/google/cloud/dialogflow/v2/sessions_client.rb +286 -0
  43. data/lib/google/cloud/dialogflow/v2/sessions_client_config.json +36 -0
  44. data/lib/google/cloud/dialogflow/v2/webhook_pb.rb +42 -0
  45. metadata +142 -0
@@ -0,0 +1,76 @@
1
+ {
2
+ "interfaces": {
3
+ "google.cloud.dialogflow.v2.EntityTypes": {
4
+ "retry_codes": {
5
+ "idempotent": [
6
+ "DEADLINE_EXCEEDED",
7
+ "UNAVAILABLE"
8
+ ],
9
+ "non_idempotent": []
10
+ },
11
+ "retry_params": {
12
+ "default": {
13
+ "initial_retry_delay_millis": 100,
14
+ "retry_delay_multiplier": 1.3,
15
+ "max_retry_delay_millis": 60000,
16
+ "initial_rpc_timeout_millis": 20000,
17
+ "rpc_timeout_multiplier": 1.0,
18
+ "max_rpc_timeout_millis": 20000,
19
+ "total_timeout_millis": 600000
20
+ }
21
+ },
22
+ "methods": {
23
+ "ListEntityTypes": {
24
+ "timeout_millis": 60000,
25
+ "retry_codes_name": "idempotent",
26
+ "retry_params_name": "default"
27
+ },
28
+ "GetEntityType": {
29
+ "timeout_millis": 60000,
30
+ "retry_codes_name": "idempotent",
31
+ "retry_params_name": "default"
32
+ },
33
+ "CreateEntityType": {
34
+ "timeout_millis": 60000,
35
+ "retry_codes_name": "non_idempotent",
36
+ "retry_params_name": "default"
37
+ },
38
+ "UpdateEntityType": {
39
+ "timeout_millis": 60000,
40
+ "retry_codes_name": "non_idempotent",
41
+ "retry_params_name": "default"
42
+ },
43
+ "DeleteEntityType": {
44
+ "timeout_millis": 60000,
45
+ "retry_codes_name": "idempotent",
46
+ "retry_params_name": "default"
47
+ },
48
+ "BatchUpdateEntityTypes": {
49
+ "timeout_millis": 60000,
50
+ "retry_codes_name": "non_idempotent",
51
+ "retry_params_name": "default"
52
+ },
53
+ "BatchDeleteEntityTypes": {
54
+ "timeout_millis": 60000,
55
+ "retry_codes_name": "idempotent",
56
+ "retry_params_name": "default"
57
+ },
58
+ "BatchCreateEntities": {
59
+ "timeout_millis": 60000,
60
+ "retry_codes_name": "non_idempotent",
61
+ "retry_params_name": "default"
62
+ },
63
+ "BatchUpdateEntities": {
64
+ "timeout_millis": 60000,
65
+ "retry_codes_name": "non_idempotent",
66
+ "retry_params_name": "default"
67
+ },
68
+ "BatchDeleteEntities": {
69
+ "timeout_millis": 60000,
70
+ "retry_codes_name": "idempotent",
71
+ "retry_params_name": "default"
72
+ }
73
+ }
74
+ }
75
+ }
76
+ }
@@ -0,0 +1,274 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: google/cloud/dialogflow/v2/intent.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ require 'google/api/annotations_pb'
7
+ require 'google/cloud/dialogflow/v2/context_pb'
8
+ require 'google/longrunning/operations_pb'
9
+ require 'google/protobuf/empty_pb'
10
+ require 'google/protobuf/field_mask_pb'
11
+ require 'google/protobuf/struct_pb'
12
+ Google::Protobuf::DescriptorPool.generated_pool.build do
13
+ add_message "google.cloud.dialogflow.v2.Intent" do
14
+ optional :name, :string, 1
15
+ optional :display_name, :string, 2
16
+ optional :webhook_state, :enum, 6, "google.cloud.dialogflow.v2.Intent.WebhookState"
17
+ optional :priority, :int32, 3
18
+ optional :is_fallback, :bool, 4
19
+ optional :ml_disabled, :bool, 19
20
+ repeated :input_context_names, :string, 7
21
+ repeated :events, :string, 8
22
+ repeated :training_phrases, :message, 9, "google.cloud.dialogflow.v2.Intent.TrainingPhrase"
23
+ optional :action, :string, 10
24
+ repeated :output_contexts, :message, 11, "google.cloud.dialogflow.v2.Context"
25
+ optional :reset_contexts, :bool, 12
26
+ repeated :parameters, :message, 13, "google.cloud.dialogflow.v2.Intent.Parameter"
27
+ repeated :messages, :message, 14, "google.cloud.dialogflow.v2.Intent.Message"
28
+ repeated :default_response_platforms, :enum, 15, "google.cloud.dialogflow.v2.Intent.Message.Platform"
29
+ optional :root_followup_intent_name, :string, 16
30
+ optional :parent_followup_intent_name, :string, 17
31
+ repeated :followup_intent_info, :message, 18, "google.cloud.dialogflow.v2.Intent.FollowupIntentInfo"
32
+ end
33
+ add_message "google.cloud.dialogflow.v2.Intent.TrainingPhrase" do
34
+ optional :name, :string, 1
35
+ optional :type, :enum, 2, "google.cloud.dialogflow.v2.Intent.TrainingPhrase.Type"
36
+ repeated :parts, :message, 3, "google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part"
37
+ optional :times_added_count, :int32, 4
38
+ end
39
+ add_message "google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part" do
40
+ optional :text, :string, 1
41
+ optional :entity_type, :string, 2
42
+ optional :alias, :string, 3
43
+ optional :user_defined, :bool, 4
44
+ end
45
+ add_enum "google.cloud.dialogflow.v2.Intent.TrainingPhrase.Type" do
46
+ value :TYPE_UNSPECIFIED, 0
47
+ value :EXAMPLE, 1
48
+ value :TEMPLATE, 2
49
+ end
50
+ add_message "google.cloud.dialogflow.v2.Intent.Parameter" do
51
+ optional :name, :string, 1
52
+ optional :display_name, :string, 2
53
+ optional :value, :string, 3
54
+ optional :default_value, :string, 4
55
+ optional :entity_type_display_name, :string, 5
56
+ optional :mandatory, :bool, 6
57
+ repeated :prompts, :string, 7
58
+ optional :is_list, :bool, 8
59
+ end
60
+ add_message "google.cloud.dialogflow.v2.Intent.Message" do
61
+ optional :platform, :enum, 6, "google.cloud.dialogflow.v2.Intent.Message.Platform"
62
+ oneof :message do
63
+ optional :text, :message, 1, "google.cloud.dialogflow.v2.Intent.Message.Text"
64
+ optional :image, :message, 2, "google.cloud.dialogflow.v2.Intent.Message.Image"
65
+ optional :quick_replies, :message, 3, "google.cloud.dialogflow.v2.Intent.Message.QuickReplies"
66
+ optional :card, :message, 4, "google.cloud.dialogflow.v2.Intent.Message.Card"
67
+ optional :payload, :message, 5, "google.protobuf.Struct"
68
+ optional :simple_responses, :message, 7, "google.cloud.dialogflow.v2.Intent.Message.SimpleResponses"
69
+ optional :basic_card, :message, 8, "google.cloud.dialogflow.v2.Intent.Message.BasicCard"
70
+ optional :suggestions, :message, 9, "google.cloud.dialogflow.v2.Intent.Message.Suggestions"
71
+ optional :link_out_suggestion, :message, 10, "google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion"
72
+ optional :list_select, :message, 11, "google.cloud.dialogflow.v2.Intent.Message.ListSelect"
73
+ optional :carousel_select, :message, 12, "google.cloud.dialogflow.v2.Intent.Message.CarouselSelect"
74
+ end
75
+ end
76
+ add_message "google.cloud.dialogflow.v2.Intent.Message.Text" do
77
+ repeated :text, :string, 1
78
+ end
79
+ add_message "google.cloud.dialogflow.v2.Intent.Message.Image" do
80
+ optional :image_uri, :string, 1
81
+ optional :accessibility_text, :string, 2
82
+ end
83
+ add_message "google.cloud.dialogflow.v2.Intent.Message.QuickReplies" do
84
+ optional :title, :string, 1
85
+ repeated :quick_replies, :string, 2
86
+ end
87
+ add_message "google.cloud.dialogflow.v2.Intent.Message.Card" do
88
+ optional :title, :string, 1
89
+ optional :subtitle, :string, 2
90
+ optional :image_uri, :string, 3
91
+ repeated :buttons, :message, 4, "google.cloud.dialogflow.v2.Intent.Message.Card.Button"
92
+ end
93
+ add_message "google.cloud.dialogflow.v2.Intent.Message.Card.Button" do
94
+ optional :text, :string, 1
95
+ optional :postback, :string, 2
96
+ end
97
+ add_message "google.cloud.dialogflow.v2.Intent.Message.SimpleResponse" do
98
+ optional :text_to_speech, :string, 1
99
+ optional :ssml, :string, 2
100
+ optional :display_text, :string, 3
101
+ end
102
+ add_message "google.cloud.dialogflow.v2.Intent.Message.SimpleResponses" do
103
+ repeated :simple_responses, :message, 1, "google.cloud.dialogflow.v2.Intent.Message.SimpleResponse"
104
+ end
105
+ add_message "google.cloud.dialogflow.v2.Intent.Message.BasicCard" do
106
+ optional :title, :string, 1
107
+ optional :subtitle, :string, 2
108
+ optional :formatted_text, :string, 3
109
+ optional :image, :message, 4, "google.cloud.dialogflow.v2.Intent.Message.Image"
110
+ repeated :buttons, :message, 5, "google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button"
111
+ end
112
+ add_message "google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button" do
113
+ optional :title, :string, 1
114
+ optional :open_uri_action, :message, 2, "google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction"
115
+ end
116
+ add_message "google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction" do
117
+ optional :uri, :string, 1
118
+ end
119
+ add_message "google.cloud.dialogflow.v2.Intent.Message.Suggestion" do
120
+ optional :title, :string, 1
121
+ end
122
+ add_message "google.cloud.dialogflow.v2.Intent.Message.Suggestions" do
123
+ repeated :suggestions, :message, 1, "google.cloud.dialogflow.v2.Intent.Message.Suggestion"
124
+ end
125
+ add_message "google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion" do
126
+ optional :destination_name, :string, 1
127
+ optional :uri, :string, 2
128
+ end
129
+ add_message "google.cloud.dialogflow.v2.Intent.Message.ListSelect" do
130
+ optional :title, :string, 1
131
+ repeated :items, :message, 2, "google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item"
132
+ end
133
+ add_message "google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item" do
134
+ optional :info, :message, 1, "google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo"
135
+ optional :title, :string, 2
136
+ optional :description, :string, 3
137
+ optional :image, :message, 4, "google.cloud.dialogflow.v2.Intent.Message.Image"
138
+ end
139
+ add_message "google.cloud.dialogflow.v2.Intent.Message.CarouselSelect" do
140
+ repeated :items, :message, 1, "google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item"
141
+ end
142
+ add_message "google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item" do
143
+ optional :info, :message, 1, "google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo"
144
+ optional :title, :string, 2
145
+ optional :description, :string, 3
146
+ optional :image, :message, 4, "google.cloud.dialogflow.v2.Intent.Message.Image"
147
+ end
148
+ add_message "google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo" do
149
+ optional :key, :string, 1
150
+ repeated :synonyms, :string, 2
151
+ end
152
+ add_enum "google.cloud.dialogflow.v2.Intent.Message.Platform" do
153
+ value :PLATFORM_UNSPECIFIED, 0
154
+ value :FACEBOOK, 1
155
+ value :SLACK, 2
156
+ value :TELEGRAM, 3
157
+ value :KIK, 4
158
+ value :SKYPE, 5
159
+ value :LINE, 6
160
+ value :VIBER, 7
161
+ value :ACTIONS_ON_GOOGLE, 8
162
+ end
163
+ add_message "google.cloud.dialogflow.v2.Intent.FollowupIntentInfo" do
164
+ optional :followup_intent_name, :string, 1
165
+ optional :parent_followup_intent_name, :string, 2
166
+ end
167
+ add_enum "google.cloud.dialogflow.v2.Intent.WebhookState" do
168
+ value :WEBHOOK_STATE_UNSPECIFIED, 0
169
+ value :WEBHOOK_STATE_ENABLED, 1
170
+ value :WEBHOOK_STATE_ENABLED_FOR_SLOT_FILLING, 2
171
+ end
172
+ add_message "google.cloud.dialogflow.v2.ListIntentsRequest" do
173
+ optional :parent, :string, 1
174
+ optional :language_code, :string, 2
175
+ optional :intent_view, :enum, 3, "google.cloud.dialogflow.v2.IntentView"
176
+ optional :page_size, :int32, 4
177
+ optional :page_token, :string, 5
178
+ end
179
+ add_message "google.cloud.dialogflow.v2.ListIntentsResponse" do
180
+ repeated :intents, :message, 1, "google.cloud.dialogflow.v2.Intent"
181
+ optional :next_page_token, :string, 2
182
+ end
183
+ add_message "google.cloud.dialogflow.v2.GetIntentRequest" do
184
+ optional :name, :string, 1
185
+ optional :language_code, :string, 2
186
+ optional :intent_view, :enum, 3, "google.cloud.dialogflow.v2.IntentView"
187
+ end
188
+ add_message "google.cloud.dialogflow.v2.CreateIntentRequest" do
189
+ optional :parent, :string, 1
190
+ optional :intent, :message, 2, "google.cloud.dialogflow.v2.Intent"
191
+ optional :language_code, :string, 3
192
+ optional :intent_view, :enum, 4, "google.cloud.dialogflow.v2.IntentView"
193
+ end
194
+ add_message "google.cloud.dialogflow.v2.UpdateIntentRequest" do
195
+ optional :intent, :message, 1, "google.cloud.dialogflow.v2.Intent"
196
+ optional :language_code, :string, 2
197
+ optional :update_mask, :message, 3, "google.protobuf.FieldMask"
198
+ optional :intent_view, :enum, 4, "google.cloud.dialogflow.v2.IntentView"
199
+ end
200
+ add_message "google.cloud.dialogflow.v2.DeleteIntentRequest" do
201
+ optional :name, :string, 1
202
+ end
203
+ add_message "google.cloud.dialogflow.v2.BatchUpdateIntentsRequest" do
204
+ optional :parent, :string, 1
205
+ optional :language_code, :string, 4
206
+ optional :update_mask, :message, 5, "google.protobuf.FieldMask"
207
+ optional :intent_view, :enum, 6, "google.cloud.dialogflow.v2.IntentView"
208
+ oneof :intent_batch do
209
+ optional :intent_batch_uri, :string, 2
210
+ optional :intent_batch_inline, :message, 3, "google.cloud.dialogflow.v2.IntentBatch"
211
+ end
212
+ end
213
+ add_message "google.cloud.dialogflow.v2.BatchUpdateIntentsResponse" do
214
+ repeated :intents, :message, 1, "google.cloud.dialogflow.v2.Intent"
215
+ end
216
+ add_message "google.cloud.dialogflow.v2.BatchDeleteIntentsRequest" do
217
+ optional :parent, :string, 1
218
+ repeated :intents, :message, 2, "google.cloud.dialogflow.v2.Intent"
219
+ end
220
+ add_message "google.cloud.dialogflow.v2.IntentBatch" do
221
+ repeated :intents, :message, 1, "google.cloud.dialogflow.v2.Intent"
222
+ end
223
+ add_enum "google.cloud.dialogflow.v2.IntentView" do
224
+ value :INTENT_VIEW_UNSPECIFIED, 0
225
+ value :INTENT_VIEW_FULL, 1
226
+ end
227
+ end
228
+
229
+ module Google
230
+ module Cloud
231
+ module Dialogflow
232
+ module V2
233
+ Intent = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Intent").msgclass
234
+ Intent::TrainingPhrase = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Intent.TrainingPhrase").msgclass
235
+ Intent::TrainingPhrase::Part = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part").msgclass
236
+ Intent::TrainingPhrase::Type = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Intent.TrainingPhrase.Type").enummodule
237
+ Intent::Parameter = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Intent.Parameter").msgclass
238
+ Intent::Message = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Intent.Message").msgclass
239
+ Intent::Message::Text = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Intent.Message.Text").msgclass
240
+ Intent::Message::Image = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Intent.Message.Image").msgclass
241
+ Intent::Message::QuickReplies = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Intent.Message.QuickReplies").msgclass
242
+ Intent::Message::Card = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Intent.Message.Card").msgclass
243
+ Intent::Message::Card::Button = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Intent.Message.Card.Button").msgclass
244
+ Intent::Message::SimpleResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Intent.Message.SimpleResponse").msgclass
245
+ Intent::Message::SimpleResponses = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Intent.Message.SimpleResponses").msgclass
246
+ Intent::Message::BasicCard = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Intent.Message.BasicCard").msgclass
247
+ Intent::Message::BasicCard::Button = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button").msgclass
248
+ Intent::Message::BasicCard::Button::OpenUriAction = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction").msgclass
249
+ Intent::Message::Suggestion = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Intent.Message.Suggestion").msgclass
250
+ Intent::Message::Suggestions = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Intent.Message.Suggestions").msgclass
251
+ Intent::Message::LinkOutSuggestion = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion").msgclass
252
+ Intent::Message::ListSelect = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Intent.Message.ListSelect").msgclass
253
+ Intent::Message::ListSelect::Item = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item").msgclass
254
+ Intent::Message::CarouselSelect = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Intent.Message.CarouselSelect").msgclass
255
+ Intent::Message::CarouselSelect::Item = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item").msgclass
256
+ Intent::Message::SelectItemInfo = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo").msgclass
257
+ Intent::Message::Platform = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Intent.Message.Platform").enummodule
258
+ Intent::FollowupIntentInfo = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Intent.FollowupIntentInfo").msgclass
259
+ Intent::WebhookState = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Intent.WebhookState").enummodule
260
+ ListIntentsRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.ListIntentsRequest").msgclass
261
+ ListIntentsResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.ListIntentsResponse").msgclass
262
+ GetIntentRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.GetIntentRequest").msgclass
263
+ CreateIntentRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.CreateIntentRequest").msgclass
264
+ UpdateIntentRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.UpdateIntentRequest").msgclass
265
+ DeleteIntentRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.DeleteIntentRequest").msgclass
266
+ BatchUpdateIntentsRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.BatchUpdateIntentsRequest").msgclass
267
+ BatchUpdateIntentsResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.BatchUpdateIntentsResponse").msgclass
268
+ BatchDeleteIntentsRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.BatchDeleteIntentsRequest").msgclass
269
+ IntentBatch = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.IntentBatch").msgclass
270
+ IntentView = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.IntentView").enummodule
271
+ end
272
+ end
273
+ end
274
+ end
@@ -0,0 +1,91 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: google/cloud/dialogflow/v2/intent.proto for package 'google.cloud.dialogflow.v2'
3
+ # Original file comments:
4
+ # Copyright 2018 Google Inc.
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/intent_pb'
21
+
22
+ module Google
23
+ module Cloud
24
+ module Dialogflow
25
+ module V2
26
+ module Intents
27
+ # An intent represents a mapping between input from a user and an action to
28
+ # be taken by your application. When you pass user input to the
29
+ # [DetectIntent][google.cloud.dialogflow.v2.Sessions.DetectIntent] (or
30
+ # [StreamingDetectIntent][google.cloud.dialogflow.v2.Sessions.StreamingDetectIntent]) method, the
31
+ # Dialogflow API analyzes the input and searches
32
+ # for a matching intent. If no match is found, the Dialogflow API returns a
33
+ # fallback intent (`is_fallback` = true).
34
+ #
35
+ # You can provide additional information for the Dialogflow API to use to
36
+ # match user input to an intent by adding the following to your intent.
37
+ #
38
+ # * **Contexts** - provide additional context for intent analysis. For
39
+ # example, if an intent is related to an object in your application that
40
+ # plays music, you can provide a context to determine when to match the
41
+ # intent if the user input is “turn it off”. You can include a context
42
+ # that matches the intent when there is previous user input of
43
+ # "play music", and not when there is previous user input of
44
+ # "turn on the light".
45
+ #
46
+ # * **Events** - allow for matching an intent by using an event name
47
+ # instead of user input. Your application can provide an event name and
48
+ # related parameters to the Dialogflow API to match an intent. For
49
+ # example, when your application starts, you can send a welcome event
50
+ # with a user name parameter to the Dialogflow API to match an intent with
51
+ # a personalized welcome message for the user.
52
+ #
53
+ # * **Training phrases** - provide examples of user input to train the
54
+ # Dialogflow API agent to better match intents.
55
+ #
56
+ # For more information about intents, see the
57
+ # [Dialogflow documentation](https://dialogflow.com/docs/intents).
58
+ class Service
59
+
60
+ include GRPC::GenericService
61
+
62
+ self.marshal_class_method = :encode
63
+ self.unmarshal_class_method = :decode
64
+ self.service_name = 'google.cloud.dialogflow.v2.Intents'
65
+
66
+ # Returns the list of all intents in the specified agent.
67
+ rpc :ListIntents, ListIntentsRequest, ListIntentsResponse
68
+ # Retrieves the specified intent.
69
+ rpc :GetIntent, GetIntentRequest, Intent
70
+ # Creates an intent in the specified agent.
71
+ rpc :CreateIntent, CreateIntentRequest, Intent
72
+ # Updates the specified intent.
73
+ rpc :UpdateIntent, UpdateIntentRequest, Intent
74
+ # Deletes the specified intent.
75
+ rpc :DeleteIntent, DeleteIntentRequest, Google::Protobuf::Empty
76
+ # Updates/Creates multiple intents in the specified agent.
77
+ #
78
+ # Operation <response: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2.BatchUpdateIntentsResponse]>
79
+ rpc :BatchUpdateIntents, BatchUpdateIntentsRequest, Google::Longrunning::Operation
80
+ # Deletes intents in the specified agent.
81
+ #
82
+ # Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
83
+ rpc :BatchDeleteIntents, BatchDeleteIntentsRequest, Google::Longrunning::Operation
84
+ end
85
+
86
+ Stub = Service.rpc_stub_class
87
+ end
88
+ end
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,684 @@
1
+ # Copyright 2018 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+ # EDITING INSTRUCTIONS
16
+ # This file was generated from the file
17
+ # https://github.com/googleapis/googleapis/blob/master/google/cloud/dialogflow/v2/intent.proto,
18
+ # and updates to that file get reflected here through a refresh process.
19
+ # For the short term, the refresh process will only be runnable by Google
20
+ # engineers.
21
+
22
+ require "json"
23
+ require "pathname"
24
+
25
+ require "google/gax"
26
+ require "google/gax/operation"
27
+ require "google/longrunning/operations_client"
28
+
29
+ require "google/cloud/dialogflow/v2/intent_pb"
30
+ require "google/cloud/dialogflow/credentials"
31
+
32
+ module Google
33
+ module Cloud
34
+ module Dialogflow
35
+ module V2
36
+ # An intent represents a mapping between input from a user and an action to
37
+ # be taken by your application. When you pass user input to the
38
+ # {Google::Cloud::Dialogflow::V2::Sessions::DetectIntent DetectIntent} (or
39
+ # {Google::Cloud::Dialogflow::V2::Sessions::StreamingDetectIntent StreamingDetectIntent}) method, the
40
+ # Dialogflow API analyzes the input and searches
41
+ # for a matching intent. If no match is found, the Dialogflow API returns a
42
+ # fallback intent (+is_fallback+ = true).
43
+ #
44
+ # You can provide additional information for the Dialogflow API to use to
45
+ # match user input to an intent by adding the following to your intent.
46
+ #
47
+ # * **Contexts** - provide additional context for intent analysis. For
48
+ # example, if an intent is related to an object in your application that
49
+ # plays music, you can provide a context to determine when to match the
50
+ # intent if the user input is “turn it off”. You can include a context
51
+ # that matches the intent when there is previous user input of
52
+ # "play music", and not when there is previous user input of
53
+ # "turn on the light".
54
+ #
55
+ # * **Events** - allow for matching an intent by using an event name
56
+ # instead of user input. Your application can provide an event name and
57
+ # related parameters to the Dialogflow API to match an intent. For
58
+ # example, when your application starts, you can send a welcome event
59
+ # with a user name parameter to the Dialogflow API to match an intent with
60
+ # a personalized welcome message for the user.
61
+ #
62
+ # * **Training phrases** - provide examples of user input to train the
63
+ # Dialogflow API agent to better match intents.
64
+ #
65
+ # For more information about intents, see the
66
+ # [Dialogflow documentation](https://dialogflow.com/docs/intents).
67
+ #
68
+ # @!attribute [r] intents_stub
69
+ # @return [Google::Cloud::Dialogflow::V2::Intents::Stub]
70
+ class IntentsClient
71
+ attr_reader :intents_stub
72
+
73
+ # The default address of the service.
74
+ SERVICE_ADDRESS = "dialogflow.googleapis.com".freeze
75
+
76
+ # The default port of the service.
77
+ DEFAULT_SERVICE_PORT = 443
78
+
79
+ DEFAULT_TIMEOUT = 30
80
+
81
+ PAGE_DESCRIPTORS = {
82
+ "list_intents" => Google::Gax::PageDescriptor.new(
83
+ "page_token",
84
+ "next_page_token",
85
+ "intents")
86
+ }.freeze
87
+
88
+ private_constant :PAGE_DESCRIPTORS
89
+
90
+ # The scopes needed to make gRPC calls to all of the methods defined in
91
+ # this service.
92
+ ALL_SCOPES = [
93
+ "https://www.googleapis.com/auth/cloud-platform"
94
+ ].freeze
95
+
96
+ class OperationsClient < Google::Longrunning::OperationsClient
97
+ self::SERVICE_ADDRESS = IntentsClient::SERVICE_ADDRESS
98
+ end
99
+
100
+ PROJECT_AGENT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
101
+ "projects/{project}/agent"
102
+ )
103
+
104
+ private_constant :PROJECT_AGENT_PATH_TEMPLATE
105
+
106
+ INTENT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
107
+ "projects/{project}/agent/intents/{intent}"
108
+ )
109
+
110
+ private_constant :INTENT_PATH_TEMPLATE
111
+
112
+ AGENT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
113
+ "projects/{project}/agents/{agent}"
114
+ )
115
+
116
+ private_constant :AGENT_PATH_TEMPLATE
117
+
118
+ # Returns a fully-qualified project_agent resource name string.
119
+ # @param project [String]
120
+ # @return [String]
121
+ def self.project_agent_path project
122
+ PROJECT_AGENT_PATH_TEMPLATE.render(
123
+ :"project" => project
124
+ )
125
+ end
126
+
127
+ # Returns a fully-qualified intent resource name string.
128
+ # @param project [String]
129
+ # @param intent [String]
130
+ # @return [String]
131
+ def self.intent_path project, intent
132
+ INTENT_PATH_TEMPLATE.render(
133
+ :"project" => project,
134
+ :"intent" => intent
135
+ )
136
+ end
137
+
138
+ # Returns a fully-qualified agent resource name string.
139
+ # @param project [String]
140
+ # @param agent [String]
141
+ # @return [String]
142
+ def self.agent_path project, agent
143
+ AGENT_PATH_TEMPLATE.render(
144
+ :"project" => project,
145
+ :"agent" => agent
146
+ )
147
+ end
148
+
149
+ # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
150
+ # Provides the means for authenticating requests made by the client. This parameter can
151
+ # be many types.
152
+ # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
153
+ # authenticating requests made by this client.
154
+ # A `String` will be treated as the path to the keyfile to be used for the construction of
155
+ # credentials for this client.
156
+ # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
157
+ # credentials for this client.
158
+ # A `GRPC::Core::Channel` will be used to make calls through.
159
+ # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
160
+ # should already be composed with a `GRPC::Core::CallCredentials` object.
161
+ # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
162
+ # metadata for requests, generally, to give OAuth credentials.
163
+ # @param scopes [Array<String>]
164
+ # The OAuth scopes for this service. This parameter is ignored if
165
+ # an updater_proc is supplied.
166
+ # @param client_config [Hash]
167
+ # A Hash for call options for each method. See
168
+ # Google::Gax#construct_settings for the structure of
169
+ # this data. Falls back to the default config if not specified
170
+ # or the specified config is missing data points.
171
+ # @param timeout [Numeric]
172
+ # The default timeout, in seconds, for calls made through this client.
173
+ def initialize \
174
+ credentials: nil,
175
+ scopes: ALL_SCOPES,
176
+ client_config: {},
177
+ timeout: DEFAULT_TIMEOUT,
178
+ lib_name: nil,
179
+ lib_version: ""
180
+ # These require statements are intentionally placed here to initialize
181
+ # the gRPC module only when it's required.
182
+ # See https://github.com/googleapis/toolkit/issues/446
183
+ require "google/gax/grpc"
184
+ require "google/cloud/dialogflow/v2/intent_services_pb"
185
+
186
+ credentials ||= Google::Cloud::Dialogflow::Credentials.default
187
+
188
+ @operations_client = OperationsClient.new(
189
+ credentials: credentials,
190
+ scopes: scopes,
191
+ client_config: client_config,
192
+ timeout: timeout,
193
+ lib_name: lib_name,
194
+ lib_version: lib_version,
195
+ )
196
+
197
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
198
+ updater_proc = Google::Cloud::Dialogflow::Credentials.new(credentials).updater_proc
199
+ end
200
+ if credentials.is_a?(GRPC::Core::Channel)
201
+ channel = credentials
202
+ end
203
+ if credentials.is_a?(GRPC::Core::ChannelCredentials)
204
+ chan_creds = credentials
205
+ end
206
+ if credentials.is_a?(Proc)
207
+ updater_proc = credentials
208
+ end
209
+ if credentials.is_a?(Google::Auth::Credentials)
210
+ updater_proc = credentials.updater_proc
211
+ end
212
+
213
+ package_version = Gem.loaded_specs['google-cloud-dialogflow'].version.version
214
+
215
+ google_api_client = "gl-ruby/#{RUBY_VERSION}"
216
+ google_api_client << " #{lib_name}/#{lib_version}" if lib_name
217
+ google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
218
+ google_api_client << " grpc/#{GRPC::VERSION}"
219
+ google_api_client.freeze
220
+
221
+ headers = { :"x-goog-api-client" => google_api_client }
222
+ client_config_file = Pathname.new(__dir__).join(
223
+ "intents_client_config.json"
224
+ )
225
+ defaults = client_config_file.open do |f|
226
+ Google::Gax.construct_settings(
227
+ "google.cloud.dialogflow.v2.Intents",
228
+ JSON.parse(f.read),
229
+ client_config,
230
+ Google::Gax::Grpc::STATUS_CODE_NAMES,
231
+ timeout,
232
+ page_descriptors: PAGE_DESCRIPTORS,
233
+ errors: Google::Gax::Grpc::API_ERRORS,
234
+ kwargs: headers
235
+ )
236
+ end
237
+
238
+ # Allow overriding the service path/port in subclasses.
239
+ service_path = self.class::SERVICE_ADDRESS
240
+ port = self.class::DEFAULT_SERVICE_PORT
241
+ @intents_stub = Google::Gax::Grpc.create_stub(
242
+ service_path,
243
+ port,
244
+ chan_creds: chan_creds,
245
+ channel: channel,
246
+ updater_proc: updater_proc,
247
+ scopes: scopes,
248
+ &Google::Cloud::Dialogflow::V2::Intents::Stub.method(:new)
249
+ )
250
+
251
+ @list_intents = Google::Gax.create_api_call(
252
+ @intents_stub.method(:list_intents),
253
+ defaults["list_intents"]
254
+ )
255
+ @get_intent = Google::Gax.create_api_call(
256
+ @intents_stub.method(:get_intent),
257
+ defaults["get_intent"]
258
+ )
259
+ @create_intent = Google::Gax.create_api_call(
260
+ @intents_stub.method(:create_intent),
261
+ defaults["create_intent"]
262
+ )
263
+ @update_intent = Google::Gax.create_api_call(
264
+ @intents_stub.method(:update_intent),
265
+ defaults["update_intent"]
266
+ )
267
+ @delete_intent = Google::Gax.create_api_call(
268
+ @intents_stub.method(:delete_intent),
269
+ defaults["delete_intent"]
270
+ )
271
+ @batch_update_intents = Google::Gax.create_api_call(
272
+ @intents_stub.method(:batch_update_intents),
273
+ defaults["batch_update_intents"]
274
+ )
275
+ @batch_delete_intents = Google::Gax.create_api_call(
276
+ @intents_stub.method(:batch_delete_intents),
277
+ defaults["batch_delete_intents"]
278
+ )
279
+ end
280
+
281
+ # Service calls
282
+
283
+ # Returns the list of all intents in the specified agent.
284
+ #
285
+ # @param parent [String]
286
+ # Required. The agent to list all intents from.
287
+ # Format: +projects/<Project ID>/agent+.
288
+ # @param language_code [String]
289
+ # Optional. The language to list training phrases, parameters and rich
290
+ # messages for. If not specified, the agent's default language is used.
291
+ # [More than a dozen
292
+ # languages](https://dialogflow.com/docs/reference/language) are supported.
293
+ # Note: languages must be enabled in the agent before they can be used.
294
+ # @param intent_view [Google::Cloud::Dialogflow::V2::IntentView]
295
+ # Optional. The resource view to apply to the returned intent.
296
+ # @param page_size [Integer]
297
+ # The maximum number of resources contained in the underlying API
298
+ # response. If page streaming is performed per-resource, this
299
+ # parameter does not affect the return value. If page streaming is
300
+ # performed per-page, this determines the maximum number of
301
+ # resources in a page.
302
+ # @param options [Google::Gax::CallOptions]
303
+ # Overrides the default settings for this call, e.g, timeout,
304
+ # retries, etc.
305
+ # @return [Google::Gax::PagedEnumerable<Google::Cloud::Dialogflow::V2::Intent>]
306
+ # An enumerable of Google::Cloud::Dialogflow::V2::Intent instances.
307
+ # See Google::Gax::PagedEnumerable documentation for other
308
+ # operations such as per-page iteration or access to the response
309
+ # object.
310
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
311
+ # @example
312
+ # require "google/cloud/dialogflow/v2"
313
+ #
314
+ # intents_client = Google::Cloud::Dialogflow::V2::Intents.new
315
+ # formatted_parent = Google::Cloud::Dialogflow::V2::IntentsClient.project_agent_path("[PROJECT]")
316
+ #
317
+ # # Iterate over all results.
318
+ # intents_client.list_intents(formatted_parent).each do |element|
319
+ # # Process element.
320
+ # end
321
+ #
322
+ # # Or iterate over results one page at a time.
323
+ # intents_client.list_intents(formatted_parent).each_page do |page|
324
+ # # Process each page at a time.
325
+ # page.each do |element|
326
+ # # Process element.
327
+ # end
328
+ # end
329
+
330
+ def list_intents \
331
+ parent,
332
+ language_code: nil,
333
+ intent_view: nil,
334
+ page_size: nil,
335
+ options: nil
336
+ req = {
337
+ parent: parent,
338
+ language_code: language_code,
339
+ intent_view: intent_view,
340
+ page_size: page_size
341
+ }.delete_if { |_, v| v.nil? }
342
+ req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::ListIntentsRequest)
343
+ @list_intents.call(req, options)
344
+ end
345
+
346
+ # Retrieves the specified intent.
347
+ #
348
+ # @param name [String]
349
+ # Required. The name of the intent.
350
+ # Format: +projects/<Project ID>/agent/intents/<Intent ID>+.
351
+ # @param language_code [String]
352
+ # Optional. The language to retrieve training phrases, parameters and rich
353
+ # messages for. If not specified, the agent's default language is used.
354
+ # [More than a dozen
355
+ # languages](https://dialogflow.com/docs/reference/language) are supported.
356
+ # Note: languages must be enabled in the agent, before they can be used.
357
+ # @param intent_view [Google::Cloud::Dialogflow::V2::IntentView]
358
+ # Optional. The resource view to apply to the returned intent.
359
+ # @param options [Google::Gax::CallOptions]
360
+ # Overrides the default settings for this call, e.g, timeout,
361
+ # retries, etc.
362
+ # @return [Google::Cloud::Dialogflow::V2::Intent]
363
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
364
+ # @example
365
+ # require "google/cloud/dialogflow/v2"
366
+ #
367
+ # intents_client = Google::Cloud::Dialogflow::V2::Intents.new
368
+ # formatted_name = Google::Cloud::Dialogflow::V2::IntentsClient.intent_path("[PROJECT]", "[INTENT]")
369
+ # response = intents_client.get_intent(formatted_name)
370
+
371
+ def get_intent \
372
+ name,
373
+ language_code: nil,
374
+ intent_view: nil,
375
+ options: nil
376
+ req = {
377
+ name: name,
378
+ language_code: language_code,
379
+ intent_view: intent_view
380
+ }.delete_if { |_, v| v.nil? }
381
+ req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::GetIntentRequest)
382
+ @get_intent.call(req, options)
383
+ end
384
+
385
+ # Creates an intent in the specified agent.
386
+ #
387
+ # @param parent [String]
388
+ # Required. The agent to create a intent for.
389
+ # Format: +projects/<Project ID>/agent+.
390
+ # @param intent [Google::Cloud::Dialogflow::V2::Intent | Hash]
391
+ # Required. The intent to create.
392
+ # A hash of the same form as `Google::Cloud::Dialogflow::V2::Intent`
393
+ # can also be provided.
394
+ # @param language_code [String]
395
+ # Optional. The language of training phrases, parameters and rich messages
396
+ # defined in +intent+. If not specified, the agent's default language is
397
+ # used. [More than a dozen
398
+ # languages](https://dialogflow.com/docs/reference/language) are supported.
399
+ # Note: languages must be enabled in the agent, before they can be used.
400
+ # @param intent_view [Google::Cloud::Dialogflow::V2::IntentView]
401
+ # Optional. The resource view to apply to the returned intent.
402
+ # @param options [Google::Gax::CallOptions]
403
+ # Overrides the default settings for this call, e.g, timeout,
404
+ # retries, etc.
405
+ # @return [Google::Cloud::Dialogflow::V2::Intent]
406
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
407
+ # @example
408
+ # require "google/cloud/dialogflow/v2"
409
+ #
410
+ # intents_client = Google::Cloud::Dialogflow::V2::Intents.new
411
+ # formatted_parent = Google::Cloud::Dialogflow::V2::IntentsClient.project_agent_path("[PROJECT]")
412
+ #
413
+ # # TODO: Initialize +intent+:
414
+ # intent = {}
415
+ # response = intents_client.create_intent(formatted_parent, intent)
416
+
417
+ def create_intent \
418
+ parent,
419
+ intent,
420
+ language_code: nil,
421
+ intent_view: nil,
422
+ options: nil
423
+ req = {
424
+ parent: parent,
425
+ intent: intent,
426
+ language_code: language_code,
427
+ intent_view: intent_view
428
+ }.delete_if { |_, v| v.nil? }
429
+ req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::CreateIntentRequest)
430
+ @create_intent.call(req, options)
431
+ end
432
+
433
+ # Updates the specified intent.
434
+ #
435
+ # @param intent [Google::Cloud::Dialogflow::V2::Intent | Hash]
436
+ # Required. The intent to update.
437
+ # Format: +projects/<Project ID>/agent/intents/<Intent ID>+.
438
+ # A hash of the same form as `Google::Cloud::Dialogflow::V2::Intent`
439
+ # can also be provided.
440
+ # @param language_code [String]
441
+ # Optional. The language of training phrases, parameters and rich messages
442
+ # defined in +intent+. If not specified, the agent's default language is
443
+ # used. [More than a dozen
444
+ # languages](https://dialogflow.com/docs/reference/language) are supported.
445
+ # Note: languages must be enabled in the agent, before they can be used.
446
+ # @param update_mask [Google::Protobuf::FieldMask | Hash]
447
+ # Optional. The mask to control which fields get updated.
448
+ # A hash of the same form as `Google::Protobuf::FieldMask`
449
+ # can also be provided.
450
+ # @param intent_view [Google::Cloud::Dialogflow::V2::IntentView]
451
+ # Optional. The resource view to apply to the returned intent.
452
+ # @param options [Google::Gax::CallOptions]
453
+ # Overrides the default settings for this call, e.g, timeout,
454
+ # retries, etc.
455
+ # @return [Google::Cloud::Dialogflow::V2::Intent]
456
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
457
+ # @example
458
+ # require "google/cloud/dialogflow/v2"
459
+ #
460
+ # intents_client = Google::Cloud::Dialogflow::V2::Intents.new
461
+ #
462
+ # # TODO: Initialize +intent+:
463
+ # intent = {}
464
+ #
465
+ # # TODO: Initialize +language_code+:
466
+ # language_code = ''
467
+ # response = intents_client.update_intent(intent, language_code)
468
+
469
+ def update_intent \
470
+ intent,
471
+ language_code,
472
+ update_mask: nil,
473
+ intent_view: nil,
474
+ options: nil
475
+ req = {
476
+ intent: intent,
477
+ language_code: language_code,
478
+ update_mask: update_mask,
479
+ intent_view: intent_view
480
+ }.delete_if { |_, v| v.nil? }
481
+ req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::UpdateIntentRequest)
482
+ @update_intent.call(req, options)
483
+ end
484
+
485
+ # Deletes the specified intent.
486
+ #
487
+ # @param name [String]
488
+ # Required. The name of the intent to delete.
489
+ # Format: +projects/<Project ID>/agent/intents/<Intent ID>+.
490
+ # @param options [Google::Gax::CallOptions]
491
+ # Overrides the default settings for this call, e.g, timeout,
492
+ # retries, etc.
493
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
494
+ # @example
495
+ # require "google/cloud/dialogflow/v2"
496
+ #
497
+ # intents_client = Google::Cloud::Dialogflow::V2::Intents.new
498
+ # formatted_name = Google::Cloud::Dialogflow::V2::IntentsClient.intent_path("[PROJECT]", "[INTENT]")
499
+ # intents_client.delete_intent(formatted_name)
500
+
501
+ def delete_intent \
502
+ name,
503
+ options: nil
504
+ req = {
505
+ name: name
506
+ }.delete_if { |_, v| v.nil? }
507
+ req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::DeleteIntentRequest)
508
+ @delete_intent.call(req, options)
509
+ nil
510
+ end
511
+
512
+ # Updates/Creates multiple intents in the specified agent.
513
+ #
514
+ # Operation <response: {Google::Cloud::Dialogflow::V2::BatchUpdateIntentsResponse BatchUpdateIntentsResponse}>
515
+ #
516
+ # @param parent [String]
517
+ # Required. The name of the agent to update or create intents in.
518
+ # Format: +projects/<Project ID>/agent+.
519
+ # @param language_code [String]
520
+ # Optional. The language of training phrases, parameters and rich messages
521
+ # defined in +intents+. If not specified, the agent's default language is
522
+ # used. [More than a dozen
523
+ # languages](https://dialogflow.com/docs/reference/language) are supported.
524
+ # Note: languages must be enabled in the agent, before they can be used.
525
+ # @param intent_batch_uri [String]
526
+ # The URI to a Google Cloud Storage file containing intents to update or
527
+ # create. The file format can either be a serialized proto (of IntentBatch
528
+ # type) or JSON object. Note: The URI must start with "gs://".
529
+ # @param intent_batch_inline [Google::Cloud::Dialogflow::V2::IntentBatch | Hash]
530
+ # The collection of intents to update or create.
531
+ # A hash of the same form as `Google::Cloud::Dialogflow::V2::IntentBatch`
532
+ # can also be provided.
533
+ # @param update_mask [Google::Protobuf::FieldMask | Hash]
534
+ # Optional. The mask to control which fields get updated.
535
+ # A hash of the same form as `Google::Protobuf::FieldMask`
536
+ # can also be provided.
537
+ # @param intent_view [Google::Cloud::Dialogflow::V2::IntentView]
538
+ # Optional. The resource view to apply to the returned intent.
539
+ # @param options [Google::Gax::CallOptions]
540
+ # Overrides the default settings for this call, e.g, timeout,
541
+ # retries, etc.
542
+ # @return [Google::Gax::Operation]
543
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
544
+ # @example
545
+ # require "google/cloud/dialogflow/v2"
546
+ #
547
+ # intents_client = Google::Cloud::Dialogflow::V2::Intents.new
548
+ # formatted_parent = Google::Cloud::Dialogflow::V2::IntentsClient.project_agent_path("[PROJECT]")
549
+ #
550
+ # # TODO: Initialize +language_code+:
551
+ # language_code = ''
552
+ #
553
+ # # Register a callback during the method call.
554
+ # operation = intents_client.batch_update_intents(formatted_parent, language_code) do |op|
555
+ # raise op.results.message if op.error?
556
+ # op_results = op.results
557
+ # # Process the results.
558
+ #
559
+ # metadata = op.metadata
560
+ # # Process the metadata.
561
+ # end
562
+ #
563
+ # # Or use the return value to register a callback.
564
+ # operation.on_done do |op|
565
+ # raise op.results.message if op.error?
566
+ # op_results = op.results
567
+ # # Process the results.
568
+ #
569
+ # metadata = op.metadata
570
+ # # Process the metadata.
571
+ # end
572
+ #
573
+ # # Manually reload the operation.
574
+ # operation.reload!
575
+ #
576
+ # # Or block until the operation completes, triggering callbacks on
577
+ # # completion.
578
+ # operation.wait_until_done!
579
+
580
+ def batch_update_intents \
581
+ parent,
582
+ language_code,
583
+ intent_batch_uri: nil,
584
+ intent_batch_inline: nil,
585
+ update_mask: nil,
586
+ intent_view: nil,
587
+ options: nil
588
+ req = {
589
+ parent: parent,
590
+ language_code: language_code,
591
+ intent_batch_uri: intent_batch_uri,
592
+ intent_batch_inline: intent_batch_inline,
593
+ update_mask: update_mask,
594
+ intent_view: intent_view
595
+ }.delete_if { |_, v| v.nil? }
596
+ req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::BatchUpdateIntentsRequest)
597
+ operation = Google::Gax::Operation.new(
598
+ @batch_update_intents.call(req, options),
599
+ @operations_client,
600
+ Google::Cloud::Dialogflow::V2::BatchUpdateIntentsResponse,
601
+ Google::Protobuf::Struct,
602
+ call_options: options
603
+ )
604
+ operation.on_done { |operation| yield(operation) } if block_given?
605
+ operation
606
+ end
607
+
608
+ # Deletes intents in the specified agent.
609
+ #
610
+ # Operation <response: {Google::Protobuf::Empty}>
611
+ #
612
+ # @param parent [String]
613
+ # Required. The name of the agent to delete all entities types for. Format:
614
+ # +projects/<Project ID>/agent+.
615
+ # @param intents [Array<Google::Cloud::Dialogflow::V2::Intent | Hash>]
616
+ # Required. The collection of intents to delete. Only intent +name+ must be
617
+ # filled in.
618
+ # A hash of the same form as `Google::Cloud::Dialogflow::V2::Intent`
619
+ # can also be provided.
620
+ # @param options [Google::Gax::CallOptions]
621
+ # Overrides the default settings for this call, e.g, timeout,
622
+ # retries, etc.
623
+ # @return [Google::Gax::Operation]
624
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
625
+ # @example
626
+ # require "google/cloud/dialogflow/v2"
627
+ #
628
+ # intents_client = Google::Cloud::Dialogflow::V2::Intents.new
629
+ # formatted_parent = Google::Cloud::Dialogflow::V2::IntentsClient.project_agent_path("[PROJECT]")
630
+ #
631
+ # # TODO: Initialize +intents+:
632
+ # intents = []
633
+ #
634
+ # # Register a callback during the method call.
635
+ # operation = intents_client.batch_delete_intents(formatted_parent, intents) do |op|
636
+ # raise op.results.message if op.error?
637
+ # op_results = op.results
638
+ # # Process the results.
639
+ #
640
+ # metadata = op.metadata
641
+ # # Process the metadata.
642
+ # end
643
+ #
644
+ # # Or use the return value to register a callback.
645
+ # operation.on_done do |op|
646
+ # raise op.results.message if op.error?
647
+ # op_results = op.results
648
+ # # Process the results.
649
+ #
650
+ # metadata = op.metadata
651
+ # # Process the metadata.
652
+ # end
653
+ #
654
+ # # Manually reload the operation.
655
+ # operation.reload!
656
+ #
657
+ # # Or block until the operation completes, triggering callbacks on
658
+ # # completion.
659
+ # operation.wait_until_done!
660
+
661
+ def batch_delete_intents \
662
+ parent,
663
+ intents,
664
+ options: nil
665
+ req = {
666
+ parent: parent,
667
+ intents: intents
668
+ }.delete_if { |_, v| v.nil? }
669
+ req = Google::Gax::to_proto(req, Google::Cloud::Dialogflow::V2::BatchDeleteIntentsRequest)
670
+ operation = Google::Gax::Operation.new(
671
+ @batch_delete_intents.call(req, options),
672
+ @operations_client,
673
+ Google::Protobuf::Empty,
674
+ Google::Protobuf::Struct,
675
+ call_options: options
676
+ )
677
+ operation.on_done { |operation| yield(operation) } if block_given?
678
+ operation
679
+ end
680
+ end
681
+ end
682
+ end
683
+ end
684
+ end