google-cloud-dialogflow-v2 0.13.0 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/google/cloud/dialogflow/v2/agents/client.rb +18 -0
  4. data/lib/google/cloud/dialogflow/v2/answer_record_pb.rb +0 -1
  5. data/lib/google/cloud/dialogflow/v2/audio_config_pb.rb +0 -2
  6. data/lib/google/cloud/dialogflow/v2/conversation_dataset_pb.rb +92 -0
  7. data/lib/google/cloud/dialogflow/v2/conversation_dataset_services_pb.rb +81 -0
  8. data/lib/google/cloud/dialogflow/v2/conversation_datasets/client.rb +849 -0
  9. data/lib/google/cloud/dialogflow/v2/conversation_datasets/credentials.rb +52 -0
  10. data/lib/google/cloud/dialogflow/v2/conversation_datasets/operations.rb +767 -0
  11. data/lib/google/cloud/dialogflow/v2/conversation_datasets/paths.rb +69 -0
  12. data/lib/google/cloud/dialogflow/v2/conversation_datasets.rb +53 -0
  13. data/lib/google/cloud/dialogflow/v2/conversation_event_pb.rb +0 -1
  14. data/lib/google/cloud/dialogflow/v2/conversation_model_pb.rb +205 -0
  15. data/lib/google/cloud/dialogflow/v2/conversation_model_services_pb.rb +98 -0
  16. data/lib/google/cloud/dialogflow/v2/conversation_models/client.rb +1257 -0
  17. data/lib/google/cloud/dialogflow/v2/conversation_models/credentials.rb +52 -0
  18. data/lib/google/cloud/dialogflow/v2/conversation_models/operations.rb +767 -0
  19. data/lib/google/cloud/dialogflow/v2/conversation_models/paths.rb +179 -0
  20. data/lib/google/cloud/dialogflow/v2/conversation_models.rb +50 -0
  21. data/lib/google/cloud/dialogflow/v2/conversation_pb.rb +0 -1
  22. data/lib/google/cloud/dialogflow/v2/conversation_profile_pb.rb +31 -1
  23. data/lib/google/cloud/dialogflow/v2/conversation_profile_services_pb.rb +27 -0
  24. data/lib/google/cloud/dialogflow/v2/conversation_profiles/client.rb +250 -0
  25. data/lib/google/cloud/dialogflow/v2/conversation_profiles/operations.rb +767 -0
  26. data/lib/google/cloud/dialogflow/v2/conversation_profiles/paths.rb +31 -9
  27. data/lib/google/cloud/dialogflow/v2/conversation_profiles.rb +1 -0
  28. data/lib/google/cloud/dialogflow/v2/document_pb.rb +38 -0
  29. data/lib/google/cloud/dialogflow/v2/document_services_pb.rb +11 -0
  30. data/lib/google/cloud/dialogflow/v2/documents/client.rb +123 -0
  31. data/lib/google/cloud/dialogflow/v2/gcs_pb.rb +4 -1
  32. data/lib/google/cloud/dialogflow/v2/human_agent_assistant_event_pb.rb +0 -1
  33. data/lib/google/cloud/dialogflow/v2/intent_pb.rb +0 -2
  34. data/lib/google/cloud/dialogflow/v2/participant_pb.rb +22 -3
  35. data/lib/google/cloud/dialogflow/v2/participant_services_pb.rb +3 -0
  36. data/lib/google/cloud/dialogflow/v2/participants/client.rb +113 -4
  37. data/lib/google/cloud/dialogflow/v2/session_pb.rb +0 -1
  38. data/lib/google/cloud/dialogflow/v2/validation_result_pb.rb +0 -1
  39. data/lib/google/cloud/dialogflow/v2/version.rb +1 -1
  40. data/lib/google/cloud/dialogflow/v2/webhook_pb.rb +0 -1
  41. data/lib/google/cloud/dialogflow/v2.rb +4 -0
  42. data/proto_docs/google/cloud/dialogflow/v2/agent.rb +18 -0
  43. data/proto_docs/google/cloud/dialogflow/v2/conversation_dataset.rb +211 -0
  44. data/proto_docs/google/cloud/dialogflow/v2/conversation_model.rb +522 -0
  45. data/proto_docs/google/cloud/dialogflow/v2/conversation_profile.rb +100 -2
  46. data/proto_docs/google/cloud/dialogflow/v2/document.rb +104 -0
  47. data/proto_docs/google/cloud/dialogflow/v2/gcs.rb +11 -0
  48. data/proto_docs/google/cloud/dialogflow/v2/participant.rb +88 -6
  49. data/proto_docs/google/cloud/dialogflow/v2/session.rb +5 -0
  50. metadata +20 -3
@@ -0,0 +1,179 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2022 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 ConversationModels
25
+ # Path helper methods for the ConversationModels API.
26
+ module Paths
27
+ ##
28
+ # Create a fully-qualified ConversationDataset resource string.
29
+ #
30
+ # The resource will be in the following format:
31
+ #
32
+ # `projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}`
33
+ #
34
+ # @param project [String]
35
+ # @param location [String]
36
+ # @param conversation_dataset [String]
37
+ #
38
+ # @return [::String]
39
+ def conversation_dataset_path project:, location:, conversation_dataset:
40
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
41
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
42
+
43
+ "projects/#{project}/locations/#{location}/conversationDatasets/#{conversation_dataset}"
44
+ end
45
+
46
+ ##
47
+ # Create a fully-qualified ConversationModel resource string.
48
+ #
49
+ # @overload conversation_model_path(project:, location:, conversation_model:)
50
+ # The resource will be in the following format:
51
+ #
52
+ # `projects/{project}/locations/{location}/conversationModels/{conversation_model}`
53
+ #
54
+ # @param project [String]
55
+ # @param location [String]
56
+ # @param conversation_model [String]
57
+ #
58
+ # @overload conversation_model_path(project:, conversation_model:)
59
+ # The resource will be in the following format:
60
+ #
61
+ # `projects/{project}/conversationModels/{conversation_model}`
62
+ #
63
+ # @param project [String]
64
+ # @param conversation_model [String]
65
+ #
66
+ # @return [::String]
67
+ def conversation_model_path **args
68
+ resources = {
69
+ "conversation_model:location:project" => (proc do |project:, location:, conversation_model:|
70
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
71
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
72
+
73
+ "projects/#{project}/locations/#{location}/conversationModels/#{conversation_model}"
74
+ end),
75
+ "conversation_model:project" => (proc do |project:, conversation_model:|
76
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
77
+
78
+ "projects/#{project}/conversationModels/#{conversation_model}"
79
+ end)
80
+ }
81
+
82
+ resource = resources[args.keys.sort.join(":")]
83
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
84
+ resource.call(**args)
85
+ end
86
+
87
+ ##
88
+ # Create a fully-qualified ConversationModelEvaluation resource string.
89
+ #
90
+ # @overload conversation_model_evaluation_path(project:, conversation_model:)
91
+ # The resource will be in the following format:
92
+ #
93
+ # `projects/{project}/conversationModels/{conversation_model}/evaluations/evaluation`
94
+ #
95
+ # @param project [String]
96
+ # @param conversation_model [String]
97
+ #
98
+ # @overload conversation_model_evaluation_path(project:, location:, conversation_model:)
99
+ # The resource will be in the following format:
100
+ #
101
+ # `projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/evaluation`
102
+ #
103
+ # @param project [String]
104
+ # @param location [String]
105
+ # @param conversation_model [String]
106
+ #
107
+ # @return [::String]
108
+ def conversation_model_evaluation_path **args
109
+ resources = {
110
+ "conversation_model:project" => (proc do |project:, conversation_model:|
111
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
112
+
113
+ "projects/#{project}/conversationModels/#{conversation_model}/evaluations/evaluation"
114
+ end),
115
+ "conversation_model:location:project" => (proc do |project:, location:, conversation_model:|
116
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
117
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
118
+
119
+ "projects/#{project}/locations/#{location}/conversationModels/#{conversation_model}/evaluations/evaluation"
120
+ end)
121
+ }
122
+
123
+ resource = resources[args.keys.sort.join(":")]
124
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
125
+ resource.call(**args)
126
+ end
127
+
128
+ ##
129
+ # Create a fully-qualified Document resource string.
130
+ #
131
+ # @overload document_path(project:, knowledge_base:, document:)
132
+ # The resource will be in the following format:
133
+ #
134
+ # `projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}`
135
+ #
136
+ # @param project [String]
137
+ # @param knowledge_base [String]
138
+ # @param document [String]
139
+ #
140
+ # @overload document_path(project:, location:, knowledge_base:, document:)
141
+ # The resource will be in the following format:
142
+ #
143
+ # `projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}`
144
+ #
145
+ # @param project [String]
146
+ # @param location [String]
147
+ # @param knowledge_base [String]
148
+ # @param document [String]
149
+ #
150
+ # @return [::String]
151
+ def document_path **args
152
+ resources = {
153
+ "document:knowledge_base:project" => (proc do |project:, knowledge_base:, document:|
154
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
155
+ raise ::ArgumentError, "knowledge_base cannot contain /" if knowledge_base.to_s.include? "/"
156
+
157
+ "projects/#{project}/knowledgeBases/#{knowledge_base}/documents/#{document}"
158
+ end),
159
+ "document:knowledge_base:location:project" => (proc do |project:, location:, knowledge_base:, document:|
160
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
161
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
162
+ raise ::ArgumentError, "knowledge_base cannot contain /" if knowledge_base.to_s.include? "/"
163
+
164
+ "projects/#{project}/locations/#{location}/knowledgeBases/#{knowledge_base}/documents/#{document}"
165
+ end)
166
+ }
167
+
168
+ resource = resources[args.keys.sort.join(":")]
169
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
170
+ resource.call(**args)
171
+ end
172
+
173
+ extend self
174
+ end
175
+ end
176
+ end
177
+ end
178
+ end
179
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2022 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/conversation_models/credentials"
26
+ require "google/cloud/dialogflow/v2/conversation_models/paths"
27
+ require "google/cloud/dialogflow/v2/conversation_models/operations"
28
+ require "google/cloud/dialogflow/v2/conversation_models/client"
29
+
30
+ module Google
31
+ module Cloud
32
+ module Dialogflow
33
+ module V2
34
+ ##
35
+ # Manages a collection of models for human agent assistant.
36
+ #
37
+ # To load this service and instantiate a client:
38
+ #
39
+ # require "google/cloud/dialogflow/v2/conversation_models"
40
+ # client = ::Google::Cloud::Dialogflow::V2::ConversationModels::Client.new
41
+ #
42
+ module ConversationModels
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+
49
+ helper_path = ::File.join __dir__, "conversation_models", "helpers.rb"
50
+ require "google/cloud/dialogflow/v2/conversation_models/helpers" if ::File.file? helper_path
@@ -6,7 +6,6 @@ require 'google/api/client_pb'
6
6
  require 'google/api/field_behavior_pb'
7
7
  require 'google/api/resource_pb'
8
8
  require 'google/cloud/dialogflow/v2/participant_pb'
9
- require 'google/protobuf/empty_pb'
10
9
  require 'google/protobuf/timestamp_pb'
11
10
  require 'google/protobuf'
12
11
 
@@ -8,7 +8,6 @@ require 'google/api/resource_pb'
8
8
  require 'google/cloud/dialogflow/v2/audio_config_pb'
9
9
  require 'google/cloud/dialogflow/v2/participant_pb'
10
10
  require 'google/longrunning/operations_pb'
11
- require 'google/protobuf/duration_pb'
12
11
  require 'google/protobuf/empty_pb'
13
12
  require 'google/protobuf/field_mask_pb'
14
13
  require 'google/protobuf/timestamp_pb'
@@ -74,6 +73,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
74
73
  optional :suggestion_trigger_settings, :message, 10, "google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionTriggerSettings"
75
74
  optional :query_config, :message, 6, "google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig"
76
75
  optional :conversation_model_config, :message, 7, "google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig"
76
+ optional :conversation_process_config, :message, 8, "google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationProcessConfig"
77
77
  end
78
78
  add_message "google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig" do
79
79
  repeated :feature_configs, :message, 2, "google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig"
@@ -106,6 +106,9 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
106
106
  add_message "google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig" do
107
107
  optional :model, :string, 1
108
108
  end
109
+ add_message "google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationProcessConfig" do
110
+ optional :recent_sentences_count, :int32, 2
111
+ end
109
112
  add_message "google.cloud.dialogflow.v2.HumanAgentAssistantConfig.MessageAnalysisConfig" do
110
113
  optional :enable_entity_extraction, :bool, 2
111
114
  optional :enable_sentiment_analysis, :bool, 3
@@ -146,6 +149,28 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
146
149
  value :FAQ, 2
147
150
  value :SMART_REPLY, 3
148
151
  end
152
+ add_message "google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest" do
153
+ optional :conversation_profile, :string, 1
154
+ optional :participant_role, :enum, 2, "google.cloud.dialogflow.v2.Participant.Role"
155
+ optional :suggestion_feature_config, :message, 3, "google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig"
156
+ end
157
+ add_message "google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest" do
158
+ optional :conversation_profile, :string, 1
159
+ optional :participant_role, :enum, 2, "google.cloud.dialogflow.v2.Participant.Role"
160
+ optional :suggestion_feature_type, :enum, 3, "google.cloud.dialogflow.v2.SuggestionFeature.Type"
161
+ end
162
+ add_message "google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata" do
163
+ optional :conversation_profile, :string, 1
164
+ optional :participant_role, :enum, 2, "google.cloud.dialogflow.v2.Participant.Role"
165
+ optional :suggestion_feature_type, :enum, 3, "google.cloud.dialogflow.v2.SuggestionFeature.Type"
166
+ optional :create_time, :message, 4, "google.protobuf.Timestamp"
167
+ end
168
+ add_message "google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata" do
169
+ optional :conversation_profile, :string, 1
170
+ optional :participant_role, :enum, 2, "google.cloud.dialogflow.v2.Participant.Role"
171
+ optional :suggestion_feature_type, :enum, 3, "google.cloud.dialogflow.v2.SuggestionFeature.Type"
172
+ optional :create_time, :message, 4, "google.protobuf.Timestamp"
173
+ end
149
174
  end
150
175
  end
151
176
 
@@ -171,6 +196,7 @@ module Google
171
196
  HumanAgentAssistantConfig::SuggestionQueryConfig::DialogflowQuerySource = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource").msgclass
172
197
  HumanAgentAssistantConfig::SuggestionQueryConfig::ContextFilterSettings = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings").msgclass
173
198
  HumanAgentAssistantConfig::ConversationModelConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig").msgclass
199
+ HumanAgentAssistantConfig::ConversationProcessConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationProcessConfig").msgclass
174
200
  HumanAgentAssistantConfig::MessageAnalysisConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.HumanAgentAssistantConfig.MessageAnalysisConfig").msgclass
175
201
  HumanAgentHandoffConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.HumanAgentHandoffConfig").msgclass
176
202
  HumanAgentHandoffConfig::LivePersonConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.HumanAgentHandoffConfig.LivePersonConfig").msgclass
@@ -180,6 +206,10 @@ module Google
180
206
  LoggingConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.LoggingConfig").msgclass
181
207
  SuggestionFeature = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.SuggestionFeature").msgclass
182
208
  SuggestionFeature::Type = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.SuggestionFeature.Type").enummodule
209
+ SetSuggestionFeatureConfigRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest").msgclass
210
+ ClearSuggestionFeatureConfigRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest").msgclass
211
+ SetSuggestionFeatureConfigOperationMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata").msgclass
212
+ ClearSuggestionFeatureConfigOperationMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata").msgclass
183
213
  end
184
214
  end
185
215
  end
@@ -51,6 +51,33 @@ module Google
51
51
  rpc :UpdateConversationProfile, ::Google::Cloud::Dialogflow::V2::UpdateConversationProfileRequest, ::Google::Cloud::Dialogflow::V2::ConversationProfile
52
52
  # Deletes the specified conversation profile.
53
53
  rpc :DeleteConversationProfile, ::Google::Cloud::Dialogflow::V2::DeleteConversationProfileRequest, ::Google::Protobuf::Empty
54
+ # Adds or updates a suggestion feature in a conversation profile.
55
+ # If the conversation profile contains the type of suggestion feature for
56
+ # the participant role, it will update it. Otherwise it will insert the
57
+ # suggestion feature.
58
+ #
59
+ # This method is a [long-running
60
+ # operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
61
+ # The returned `Operation` type has the following method-specific fields:
62
+ #
63
+ # - `metadata`: [SetSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata]
64
+ # - `response`: [ConversationProfile][google.cloud.dialogflow.v2.ConversationProfile]
65
+ #
66
+ # If a long running operation to add or update suggestion feature
67
+ # config for the same conversation profile, participant role and suggestion
68
+ # feature type exists, please cancel the existing long running operation
69
+ # before sending such request, otherwise the request will be rejected.
70
+ rpc :SetSuggestionFeatureConfig, ::Google::Cloud::Dialogflow::V2::SetSuggestionFeatureConfigRequest, ::Google::Longrunning::Operation
71
+ # Clears a suggestion feature from a conversation profile for the given
72
+ # participant role.
73
+ #
74
+ # This method is a [long-running
75
+ # operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
76
+ # The returned `Operation` type has the following method-specific fields:
77
+ #
78
+ # - `metadata`: [ClearSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata]
79
+ # - `response`: [ConversationProfile][google.cloud.dialogflow.v2.ConversationProfile]
80
+ rpc :ClearSuggestionFeatureConfig, ::Google::Cloud::Dialogflow::V2::ClearSuggestionFeatureConfigRequest, ::Google::Longrunning::Operation
54
81
  end
55
82
 
56
83
  Stub = Service.rpc_stub_class
@@ -138,6 +138,12 @@ module Google
138
138
  @quota_project_id = @config.quota_project
139
139
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
140
140
 
141
+ @operations_client = Operations.new do |config|
142
+ config.credentials = credentials
143
+ config.quota_project = @quota_project_id
144
+ config.endpoint = @config.endpoint
145
+ end
146
+
141
147
  @conversation_profiles_stub = ::Gapic::ServiceStub.new(
142
148
  ::Google::Cloud::Dialogflow::V2::ConversationProfiles::Stub,
143
149
  credentials: credentials,
@@ -147,6 +153,13 @@ module Google
147
153
  )
148
154
  end
149
155
 
156
+ ##
157
+ # Get the associated client for long-running operations.
158
+ #
159
+ # @return [::Google::Cloud::Dialogflow::V2::ConversationProfiles::Operations]
160
+ #
161
+ attr_reader :operations_client
162
+
150
163
  # Service calls
151
164
 
152
165
  ##
@@ -604,6 +617,229 @@ module Google
604
617
  raise ::Google::Cloud::Error.from_error(e)
605
618
  end
606
619
 
620
+ ##
621
+ # Adds or updates a suggestion feature in a conversation profile.
622
+ # If the conversation profile contains the type of suggestion feature for
623
+ # the participant role, it will update it. Otherwise it will insert the
624
+ # suggestion feature.
625
+ #
626
+ # This method is a [long-running
627
+ # operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
628
+ # The returned `Operation` type has the following method-specific fields:
629
+ #
630
+ # - `metadata`: {::Google::Cloud::Dialogflow::V2::SetSuggestionFeatureConfigOperationMetadata SetSuggestionFeatureConfigOperationMetadata}
631
+ # - `response`: {::Google::Cloud::Dialogflow::V2::ConversationProfile ConversationProfile}
632
+ #
633
+ # If a long running operation to add or update suggestion feature
634
+ # config for the same conversation profile, participant role and suggestion
635
+ # feature type exists, please cancel the existing long running operation
636
+ # before sending such request, otherwise the request will be rejected.
637
+ #
638
+ # @overload set_suggestion_feature_config(request, options = nil)
639
+ # Pass arguments to `set_suggestion_feature_config` via a request object, either of type
640
+ # {::Google::Cloud::Dialogflow::V2::SetSuggestionFeatureConfigRequest} or an equivalent Hash.
641
+ #
642
+ # @param request [::Google::Cloud::Dialogflow::V2::SetSuggestionFeatureConfigRequest, ::Hash]
643
+ # A request object representing the call parameters. Required. To specify no
644
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
645
+ # @param options [::Gapic::CallOptions, ::Hash]
646
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
647
+ #
648
+ # @overload set_suggestion_feature_config(conversation_profile: nil, participant_role: nil, suggestion_feature_config: nil)
649
+ # Pass arguments to `set_suggestion_feature_config` via keyword arguments. Note that at
650
+ # least one keyword argument is required. To specify no parameters, or to keep all
651
+ # the default parameter values, pass an empty Hash as a request object (see above).
652
+ #
653
+ # @param conversation_profile [::String]
654
+ # Required. The Conversation Profile to add or update the suggestion feature
655
+ # config. Format: `projects/<Project ID>/locations/<Location
656
+ # ID>/conversationProfiles/<Conversation Profile ID>`.
657
+ # @param participant_role [::Google::Cloud::Dialogflow::V2::Participant::Role]
658
+ # Required. The participant role to add or update the suggestion feature
659
+ # config. Only HUMAN_AGENT or END_USER can be used.
660
+ # @param suggestion_feature_config [::Google::Cloud::Dialogflow::V2::HumanAgentAssistantConfig::SuggestionFeatureConfig, ::Hash]
661
+ # Required. The suggestion feature config to add or update.
662
+ #
663
+ # @yield [response, operation] Access the result along with the RPC operation
664
+ # @yieldparam response [::Gapic::Operation]
665
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
666
+ #
667
+ # @return [::Gapic::Operation]
668
+ #
669
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
670
+ #
671
+ # @example Basic example
672
+ # require "google/cloud/dialogflow/v2"
673
+ #
674
+ # # Create a client object. The client can be reused for multiple calls.
675
+ # client = Google::Cloud::Dialogflow::V2::ConversationProfiles::Client.new
676
+ #
677
+ # # Create a request. To set request fields, pass in keyword arguments.
678
+ # request = Google::Cloud::Dialogflow::V2::SetSuggestionFeatureConfigRequest.new
679
+ #
680
+ # # Call the set_suggestion_feature_config method.
681
+ # result = client.set_suggestion_feature_config request
682
+ #
683
+ # # The returned object is of type Gapic::Operation. You can use this
684
+ # # object to check the status of an operation, cancel it, or wait
685
+ # # for results. Here is how to block until completion:
686
+ # result.wait_until_done! timeout: 60
687
+ # if result.response?
688
+ # p result.response
689
+ # else
690
+ # puts "Error!"
691
+ # end
692
+ #
693
+ def set_suggestion_feature_config request, options = nil
694
+ raise ::ArgumentError, "request must be provided" if request.nil?
695
+
696
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::SetSuggestionFeatureConfigRequest
697
+
698
+ # Converts hash and nil to an options object
699
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
700
+
701
+ # Customize the options with defaults
702
+ metadata = @config.rpcs.set_suggestion_feature_config.metadata.to_h
703
+
704
+ # Set x-goog-api-client and x-goog-user-project headers
705
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
706
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
707
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
708
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
709
+
710
+ header_params = {}
711
+ if request.conversation_profile
712
+ header_params["conversation_profile"] = request.conversation_profile
713
+ end
714
+
715
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
716
+ metadata[:"x-goog-request-params"] ||= request_params_header
717
+
718
+ options.apply_defaults timeout: @config.rpcs.set_suggestion_feature_config.timeout,
719
+ metadata: metadata,
720
+ retry_policy: @config.rpcs.set_suggestion_feature_config.retry_policy
721
+
722
+ options.apply_defaults timeout: @config.timeout,
723
+ metadata: @config.metadata,
724
+ retry_policy: @config.retry_policy
725
+
726
+ @conversation_profiles_stub.call_rpc :set_suggestion_feature_config, request, options: options do |response, operation|
727
+ response = ::Gapic::Operation.new response, @operations_client, options: options
728
+ yield response, operation if block_given?
729
+ return response
730
+ end
731
+ rescue ::GRPC::BadStatus => e
732
+ raise ::Google::Cloud::Error.from_error(e)
733
+ end
734
+
735
+ ##
736
+ # Clears a suggestion feature from a conversation profile for the given
737
+ # participant role.
738
+ #
739
+ # This method is a [long-running
740
+ # operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
741
+ # The returned `Operation` type has the following method-specific fields:
742
+ #
743
+ # - `metadata`: {::Google::Cloud::Dialogflow::V2::ClearSuggestionFeatureConfigOperationMetadata ClearSuggestionFeatureConfigOperationMetadata}
744
+ # - `response`: {::Google::Cloud::Dialogflow::V2::ConversationProfile ConversationProfile}
745
+ #
746
+ # @overload clear_suggestion_feature_config(request, options = nil)
747
+ # Pass arguments to `clear_suggestion_feature_config` via a request object, either of type
748
+ # {::Google::Cloud::Dialogflow::V2::ClearSuggestionFeatureConfigRequest} or an equivalent Hash.
749
+ #
750
+ # @param request [::Google::Cloud::Dialogflow::V2::ClearSuggestionFeatureConfigRequest, ::Hash]
751
+ # A request object representing the call parameters. Required. To specify no
752
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
753
+ # @param options [::Gapic::CallOptions, ::Hash]
754
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
755
+ #
756
+ # @overload clear_suggestion_feature_config(conversation_profile: nil, participant_role: nil, suggestion_feature_type: nil)
757
+ # Pass arguments to `clear_suggestion_feature_config` via keyword arguments. Note that at
758
+ # least one keyword argument is required. To specify no parameters, or to keep all
759
+ # the default parameter values, pass an empty Hash as a request object (see above).
760
+ #
761
+ # @param conversation_profile [::String]
762
+ # Required. The Conversation Profile to add or update the suggestion feature
763
+ # config. Format: `projects/<Project ID>/locations/<Location
764
+ # ID>/conversationProfiles/<Conversation Profile ID>`.
765
+ # @param participant_role [::Google::Cloud::Dialogflow::V2::Participant::Role]
766
+ # Required. The participant role to remove the suggestion feature
767
+ # config. Only HUMAN_AGENT or END_USER can be used.
768
+ # @param suggestion_feature_type [::Google::Cloud::Dialogflow::V2::SuggestionFeature::Type]
769
+ # Required. The type of the suggestion feature to remove.
770
+ #
771
+ # @yield [response, operation] Access the result along with the RPC operation
772
+ # @yieldparam response [::Gapic::Operation]
773
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
774
+ #
775
+ # @return [::Gapic::Operation]
776
+ #
777
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
778
+ #
779
+ # @example Basic example
780
+ # require "google/cloud/dialogflow/v2"
781
+ #
782
+ # # Create a client object. The client can be reused for multiple calls.
783
+ # client = Google::Cloud::Dialogflow::V2::ConversationProfiles::Client.new
784
+ #
785
+ # # Create a request. To set request fields, pass in keyword arguments.
786
+ # request = Google::Cloud::Dialogflow::V2::ClearSuggestionFeatureConfigRequest.new
787
+ #
788
+ # # Call the clear_suggestion_feature_config method.
789
+ # result = client.clear_suggestion_feature_config request
790
+ #
791
+ # # The returned object is of type Gapic::Operation. You can use this
792
+ # # object to check the status of an operation, cancel it, or wait
793
+ # # for results. Here is how to block until completion:
794
+ # result.wait_until_done! timeout: 60
795
+ # if result.response?
796
+ # p result.response
797
+ # else
798
+ # puts "Error!"
799
+ # end
800
+ #
801
+ def clear_suggestion_feature_config request, options = nil
802
+ raise ::ArgumentError, "request must be provided" if request.nil?
803
+
804
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::ClearSuggestionFeatureConfigRequest
805
+
806
+ # Converts hash and nil to an options object
807
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
808
+
809
+ # Customize the options with defaults
810
+ metadata = @config.rpcs.clear_suggestion_feature_config.metadata.to_h
811
+
812
+ # Set x-goog-api-client and x-goog-user-project headers
813
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
814
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
815
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
816
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
817
+
818
+ header_params = {}
819
+ if request.conversation_profile
820
+ header_params["conversation_profile"] = request.conversation_profile
821
+ end
822
+
823
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
824
+ metadata[:"x-goog-request-params"] ||= request_params_header
825
+
826
+ options.apply_defaults timeout: @config.rpcs.clear_suggestion_feature_config.timeout,
827
+ metadata: metadata,
828
+ retry_policy: @config.rpcs.clear_suggestion_feature_config.retry_policy
829
+
830
+ options.apply_defaults timeout: @config.timeout,
831
+ metadata: @config.metadata,
832
+ retry_policy: @config.retry_policy
833
+
834
+ @conversation_profiles_stub.call_rpc :clear_suggestion_feature_config, request, options: options do |response, operation|
835
+ response = ::Gapic::Operation.new response, @operations_client, options: options
836
+ yield response, operation if block_given?
837
+ return response
838
+ end
839
+ rescue ::GRPC::BadStatus => e
840
+ raise ::Google::Cloud::Error.from_error(e)
841
+ end
842
+
607
843
  ##
608
844
  # Configuration class for the ConversationProfiles API.
609
845
  #
@@ -764,6 +1000,16 @@ module Google
764
1000
  # @return [::Gapic::Config::Method]
765
1001
  #
766
1002
  attr_reader :delete_conversation_profile
1003
+ ##
1004
+ # RPC-specific configuration for `set_suggestion_feature_config`
1005
+ # @return [::Gapic::Config::Method]
1006
+ #
1007
+ attr_reader :set_suggestion_feature_config
1008
+ ##
1009
+ # RPC-specific configuration for `clear_suggestion_feature_config`
1010
+ # @return [::Gapic::Config::Method]
1011
+ #
1012
+ attr_reader :clear_suggestion_feature_config
767
1013
 
768
1014
  # @private
769
1015
  def initialize parent_rpcs = nil
@@ -777,6 +1023,10 @@ module Google
777
1023
  @update_conversation_profile = ::Gapic::Config::Method.new update_conversation_profile_config
778
1024
  delete_conversation_profile_config = parent_rpcs.delete_conversation_profile if parent_rpcs.respond_to? :delete_conversation_profile
779
1025
  @delete_conversation_profile = ::Gapic::Config::Method.new delete_conversation_profile_config
1026
+ set_suggestion_feature_config_config = parent_rpcs.set_suggestion_feature_config if parent_rpcs.respond_to? :set_suggestion_feature_config
1027
+ @set_suggestion_feature_config = ::Gapic::Config::Method.new set_suggestion_feature_config_config
1028
+ clear_suggestion_feature_config_config = parent_rpcs.clear_suggestion_feature_config if parent_rpcs.respond_to? :clear_suggestion_feature_config
1029
+ @clear_suggestion_feature_config = ::Gapic::Config::Method.new clear_suggestion_feature_config_config
780
1030
 
781
1031
  yield self if block_given?
782
1032
  end