google-cloud-dialogflow-v2 0.6.4 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.md +188 -190
  3. data/README.md +66 -2
  4. data/lib/google/cloud/dialogflow/v2.rb +11 -2
  5. data/lib/google/cloud/dialogflow/v2/agent_services_pb.rb +9 -9
  6. data/lib/google/cloud/dialogflow/v2/agents/client.rb +24 -18
  7. data/lib/google/cloud/dialogflow/v2/agents/operations.rb +96 -11
  8. data/lib/google/cloud/dialogflow/v2/answer_record_pb.rb +100 -0
  9. data/lib/google/cloud/dialogflow/v2/answer_record_services_pb.rb +49 -0
  10. data/lib/google/cloud/dialogflow/v2/answer_records.rb +50 -0
  11. data/lib/google/cloud/dialogflow/v2/answer_records/client.rb +479 -0
  12. data/lib/google/cloud/dialogflow/v2/answer_records/credentials.rb +52 -0
  13. data/lib/google/cloud/dialogflow/v2/answer_records/paths.rb +105 -0
  14. data/lib/google/cloud/dialogflow/v2/audio_config_pb.rb +7 -0
  15. data/lib/google/cloud/dialogflow/v2/context_services_pb.rb +7 -24
  16. data/lib/google/cloud/dialogflow/v2/contexts.rb +1 -18
  17. data/lib/google/cloud/dialogflow/v2/contexts/client.rb +22 -33
  18. data/lib/google/cloud/dialogflow/v2/contexts/paths.rb +2 -2
  19. data/lib/google/cloud/dialogflow/v2/conversation_event_pb.rb +39 -0
  20. data/lib/google/cloud/dialogflow/v2/conversation_pb.rb +89 -0
  21. data/lib/google/cloud/dialogflow/v2/conversation_profile_pb.rb +182 -0
  22. data/lib/google/cloud/dialogflow/v2/conversation_profile_services_pb.rb +61 -0
  23. data/lib/google/cloud/dialogflow/v2/conversation_profiles.rb +49 -0
  24. data/lib/google/cloud/dialogflow/v2/conversation_profiles/client.rb +699 -0
  25. data/lib/google/cloud/dialogflow/v2/conversation_profiles/credentials.rb +52 -0
  26. data/lib/google/cloud/dialogflow/v2/conversation_profiles/paths.rb +205 -0
  27. data/lib/google/cloud/dialogflow/v2/conversation_services_pb.rb +75 -0
  28. data/lib/google/cloud/dialogflow/v2/conversations.rb +49 -0
  29. data/lib/google/cloud/dialogflow/v2/conversations/client.rb +757 -0
  30. data/lib/google/cloud/dialogflow/v2/conversations/credentials.rb +52 -0
  31. data/lib/google/cloud/dialogflow/v2/conversations/paths.rb +146 -0
  32. data/lib/google/cloud/dialogflow/v2/document_pb.rb +99 -0
  33. data/lib/google/cloud/dialogflow/v2/document_services_pb.rb +73 -0
  34. data/lib/google/cloud/dialogflow/v2/documents.rb +50 -0
  35. data/lib/google/cloud/dialogflow/v2/documents/client.rb +810 -0
  36. data/lib/google/cloud/dialogflow/v2/documents/credentials.rb +52 -0
  37. data/lib/google/cloud/dialogflow/v2/documents/operations.rb +655 -0
  38. data/lib/google/cloud/dialogflow/v2/documents/paths.rb +119 -0
  39. data/lib/google/cloud/dialogflow/v2/entity_type_services_pb.rb +11 -38
  40. data/lib/google/cloud/dialogflow/v2/entity_types.rb +1 -28
  41. data/lib/google/cloud/dialogflow/v2/entity_types/client.rb +26 -47
  42. data/lib/google/cloud/dialogflow/v2/entity_types/operations.rb +96 -11
  43. data/lib/google/cloud/dialogflow/v2/environment_services_pb.rb +2 -2
  44. data/lib/google/cloud/dialogflow/v2/environments.rb +1 -1
  45. data/lib/google/cloud/dialogflow/v2/environments/client.rb +17 -11
  46. data/lib/google/cloud/dialogflow/v2/gcs_pb.rb +20 -0
  47. data/lib/google/cloud/dialogflow/v2/human_agent_assistant_event_pb.rb +26 -0
  48. data/lib/google/cloud/dialogflow/v2/intent_pb.rb +2 -0
  49. data/lib/google/cloud/dialogflow/v2/intent_services_pb.rb +8 -39
  50. data/lib/google/cloud/dialogflow/v2/intents.rb +1 -32
  51. data/lib/google/cloud/dialogflow/v2/intents/client.rb +23 -48
  52. data/lib/google/cloud/dialogflow/v2/intents/operations.rb +96 -11
  53. data/lib/google/cloud/dialogflow/v2/intents/paths.rb +1 -1
  54. data/lib/google/cloud/dialogflow/v2/knowledge_base_pb.rb +60 -0
  55. data/lib/google/cloud/dialogflow/v2/knowledge_base_services_pb.rb +53 -0
  56. data/lib/google/cloud/dialogflow/v2/knowledge_bases.rb +49 -0
  57. data/lib/google/cloud/dialogflow/v2/knowledge_bases/client.rb +696 -0
  58. data/lib/google/cloud/dialogflow/v2/knowledge_bases/credentials.rb +52 -0
  59. data/lib/google/cloud/dialogflow/v2/knowledge_bases/paths.rb +105 -0
  60. data/lib/google/cloud/dialogflow/v2/participant_pb.rb +172 -0
  61. data/lib/google/cloud/dialogflow/v2/participant_services_pb.rb +64 -0
  62. data/lib/google/cloud/dialogflow/v2/participants.rb +49 -0
  63. data/lib/google/cloud/dialogflow/v2/participants/client.rb +894 -0
  64. data/lib/google/cloud/dialogflow/v2/participants/credentials.rb +52 -0
  65. data/lib/google/cloud/dialogflow/v2/participants/paths.rb +258 -0
  66. data/lib/google/cloud/dialogflow/v2/session_entity_type_services_pb.rb +6 -22
  67. data/lib/google/cloud/dialogflow/v2/session_entity_types.rb +1 -17
  68. data/lib/google/cloud/dialogflow/v2/session_entity_types/client.rb +21 -31
  69. data/lib/google/cloud/dialogflow/v2/session_entity_types/paths.rb +2 -2
  70. data/lib/google/cloud/dialogflow/v2/session_pb.rb +1 -0
  71. data/lib/google/cloud/dialogflow/v2/session_services_pb.rb +14 -6
  72. data/lib/google/cloud/dialogflow/v2/sessions.rb +4 -4
  73. data/lib/google/cloud/dialogflow/v2/sessions/client.rb +43 -21
  74. data/lib/google/cloud/dialogflow/v2/sessions/paths.rb +3 -3
  75. data/lib/google/cloud/dialogflow/v2/version.rb +1 -1
  76. data/proto_docs/google/api/field_behavior.rb +6 -0
  77. data/proto_docs/google/api/resource.rb +50 -14
  78. data/proto_docs/google/cloud/dialogflow/v2/agent.rb +1 -2
  79. data/proto_docs/google/cloud/dialogflow/v2/answer_record.rb +259 -0
  80. data/proto_docs/google/cloud/dialogflow/v2/audio_config.rb +25 -0
  81. data/proto_docs/google/cloud/dialogflow/v2/context.rb +17 -2
  82. data/proto_docs/google/cloud/dialogflow/v2/conversation.rb +253 -0
  83. data/proto_docs/google/cloud/dialogflow/v2/conversation_event.rb +83 -0
  84. data/proto_docs/google/cloud/dialogflow/v2/conversation_profile.rb +510 -0
  85. data/proto_docs/google/cloud/dialogflow/v2/document.rb +267 -0
  86. data/proto_docs/google/cloud/dialogflow/v2/entity_type.rb +12 -3
  87. data/proto_docs/google/cloud/dialogflow/v2/environment.rb +18 -1
  88. data/proto_docs/google/cloud/dialogflow/v2/human_agent_assistant_event.rb +45 -0
  89. data/proto_docs/google/cloud/dialogflow/v2/intent.rb +20 -3
  90. data/proto_docs/google/cloud/dialogflow/v2/knowledge_base.rb +139 -0
  91. data/proto_docs/google/cloud/dialogflow/v2/participant.rb +503 -0
  92. data/proto_docs/google/cloud/dialogflow/v2/session.rb +52 -7
  93. data/proto_docs/google/cloud/dialogflow/v2/session_entity_type.rb +7 -6
  94. data/proto_docs/google/cloud/dialogflow/v2/validation_result.rb +1 -1
  95. data/proto_docs/google/cloud/dialogflow/v2/webhook.rb +2 -2
  96. data/proto_docs/google/longrunning/operations.rb +17 -3
  97. data/proto_docs/google/protobuf/any.rb +5 -2
  98. data/proto_docs/google/protobuf/timestamp.rb +10 -1
  99. data/proto_docs/google/type/latlng.rb +2 -2
  100. metadata +59 -9
@@ -0,0 +1,49 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: google/cloud/dialogflow/v2/answer_record.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/answer_record_pb'
21
+
22
+ module Google
23
+ module Cloud
24
+ module Dialogflow
25
+ module V2
26
+ module AnswerRecords
27
+ # Service for managing
28
+ # [AnswerRecords][google.cloud.dialogflow.v2.AnswerRecord].
29
+ class Service
30
+
31
+ include GRPC::GenericService
32
+
33
+ self.marshal_class_method = :encode
34
+ self.unmarshal_class_method = :decode
35
+ self.service_name = 'google.cloud.dialogflow.v2.AnswerRecords'
36
+
37
+ # Returns the list of all answer records in the specified project in reverse
38
+ # chronological order.
39
+ rpc :ListAnswerRecords, ::Google::Cloud::Dialogflow::V2::ListAnswerRecordsRequest, ::Google::Cloud::Dialogflow::V2::ListAnswerRecordsResponse
40
+ # Updates the specified answer record.
41
+ rpc :UpdateAnswerRecord, ::Google::Cloud::Dialogflow::V2::UpdateAnswerRecordRequest, ::Google::Cloud::Dialogflow::V2::AnswerRecord
42
+ end
43
+
44
+ Stub = Service.rpc_stub_class
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,50 @@
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/answer_records/credentials"
26
+ require "google/cloud/dialogflow/v2/answer_records/paths"
27
+ require "google/cloud/dialogflow/v2/answer_records/client"
28
+
29
+ module Google
30
+ module Cloud
31
+ module Dialogflow
32
+ module V2
33
+ ##
34
+ # Service for managing
35
+ # {::Google::Cloud::Dialogflow::V2::AnswerRecord AnswerRecords}.
36
+ #
37
+ # To load this service and instantiate a client:
38
+ #
39
+ # require "google/cloud/dialogflow/v2/answer_records"
40
+ # client = ::Google::Cloud::Dialogflow::V2::AnswerRecords::Client.new
41
+ #
42
+ module AnswerRecords
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+
49
+ helper_path = ::File.join __dir__, "answer_records", "helpers.rb"
50
+ require "google/cloud/dialogflow/v2/answer_records/helpers" if ::File.file? helper_path
@@ -0,0 +1,479 @@
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/answer_record_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Dialogflow
25
+ module V2
26
+ module AnswerRecords
27
+ ##
28
+ # Client for the AnswerRecords service.
29
+ #
30
+ # Service for managing
31
+ # {::Google::Cloud::Dialogflow::V2::AnswerRecord AnswerRecords}.
32
+ #
33
+ class Client
34
+ include Paths
35
+
36
+ # @private
37
+ attr_reader :answer_records_stub
38
+
39
+ ##
40
+ # Configure the AnswerRecords Client class.
41
+ #
42
+ # See {::Google::Cloud::Dialogflow::V2::AnswerRecords::Client::Configuration}
43
+ # for a description of the configuration fields.
44
+ #
45
+ # ## Example
46
+ #
47
+ # To modify the configuration for all AnswerRecords clients:
48
+ #
49
+ # ::Google::Cloud::Dialogflow::V2::AnswerRecords::Client.configure do |config|
50
+ # config.timeout = 10.0
51
+ # end
52
+ #
53
+ # @yield [config] Configure the Client client.
54
+ # @yieldparam config [Client::Configuration]
55
+ #
56
+ # @return [Client::Configuration]
57
+ #
58
+ def self.configure
59
+ @configure ||= begin
60
+ namespace = ["Google", "Cloud", "Dialogflow", "V2"]
61
+ parent_config = while namespace.any?
62
+ parent_name = namespace.join "::"
63
+ parent_const = const_get parent_name
64
+ break parent_const.configure if parent_const.respond_to? :configure
65
+ namespace.pop
66
+ end
67
+ default_config = Client::Configuration.new parent_config
68
+
69
+ default_config.timeout = 60.0
70
+ default_config.retry_policy = {
71
+ initial_delay: 0.1,
72
+ max_delay: 60.0,
73
+ multiplier: 1.3,
74
+ retry_codes: [14]
75
+ }
76
+
77
+ default_config
78
+ end
79
+ yield @configure if block_given?
80
+ @configure
81
+ end
82
+
83
+ ##
84
+ # Configure the AnswerRecords Client instance.
85
+ #
86
+ # The configuration is set to the derived mode, meaning that values can be changed,
87
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
88
+ # should be made on {Client.configure}.
89
+ #
90
+ # See {::Google::Cloud::Dialogflow::V2::AnswerRecords::Client::Configuration}
91
+ # for a description of the configuration fields.
92
+ #
93
+ # @yield [config] Configure the Client client.
94
+ # @yieldparam config [Client::Configuration]
95
+ #
96
+ # @return [Client::Configuration]
97
+ #
98
+ def configure
99
+ yield @config if block_given?
100
+ @config
101
+ end
102
+
103
+ ##
104
+ # Create a new AnswerRecords client object.
105
+ #
106
+ # ## Examples
107
+ #
108
+ # To create a new AnswerRecords client with the default
109
+ # configuration:
110
+ #
111
+ # client = ::Google::Cloud::Dialogflow::V2::AnswerRecords::Client.new
112
+ #
113
+ # To create a new AnswerRecords client with a custom
114
+ # configuration:
115
+ #
116
+ # client = ::Google::Cloud::Dialogflow::V2::AnswerRecords::Client.new do |config|
117
+ # config.timeout = 10.0
118
+ # end
119
+ #
120
+ # @yield [config] Configure the AnswerRecords client.
121
+ # @yieldparam config [Client::Configuration]
122
+ #
123
+ def initialize
124
+ # These require statements are intentionally placed here to initialize
125
+ # the gRPC module only when it's required.
126
+ # See https://github.com/googleapis/toolkit/issues/446
127
+ require "gapic/grpc"
128
+ require "google/cloud/dialogflow/v2/answer_record_services_pb"
129
+
130
+ # Create the configuration object
131
+ @config = Configuration.new Client.configure
132
+
133
+ # Yield the configuration if needed
134
+ yield @config if block_given?
135
+
136
+ # Create credentials
137
+ credentials = @config.credentials
138
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
139
+ # but only if the default endpoint does not have a region prefix.
140
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
141
+ @config.endpoint == Client.configure.endpoint &&
142
+ !@config.endpoint.split(".").first.include?("-")
143
+ credentials ||= Credentials.default scope: @config.scope,
144
+ enable_self_signed_jwt: enable_self_signed_jwt
145
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
146
+ credentials = Credentials.new credentials, scope: @config.scope
147
+ end
148
+ @quota_project_id = @config.quota_project
149
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
150
+
151
+ @answer_records_stub = ::Gapic::ServiceStub.new(
152
+ ::Google::Cloud::Dialogflow::V2::AnswerRecords::Stub,
153
+ credentials: credentials,
154
+ endpoint: @config.endpoint,
155
+ channel_args: @config.channel_args,
156
+ interceptors: @config.interceptors
157
+ )
158
+ end
159
+
160
+ # Service calls
161
+
162
+ ##
163
+ # Returns the list of all answer records in the specified project in reverse
164
+ # chronological order.
165
+ #
166
+ # @overload list_answer_records(request, options = nil)
167
+ # Pass arguments to `list_answer_records` via a request object, either of type
168
+ # {::Google::Cloud::Dialogflow::V2::ListAnswerRecordsRequest} or an equivalent Hash.
169
+ #
170
+ # @param request [::Google::Cloud::Dialogflow::V2::ListAnswerRecordsRequest, ::Hash]
171
+ # A request object representing the call parameters. Required. To specify no
172
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
173
+ # @param options [::Gapic::CallOptions, ::Hash]
174
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
175
+ #
176
+ # @overload list_answer_records(parent: nil, filter: nil, page_size: nil, page_token: nil)
177
+ # Pass arguments to `list_answer_records` via keyword arguments. Note that at
178
+ # least one keyword argument is required. To specify no parameters, or to keep all
179
+ # the default parameter values, pass an empty Hash as a request object (see above).
180
+ #
181
+ # @param parent [::String]
182
+ # Required. The project to list all answer records for in reverse
183
+ # chronological order. Format: `projects/<Project ID>/locations/<Location
184
+ # ID>`.
185
+ # @param filter [::String]
186
+ # Required. Filters to restrict results to specific answer records.
187
+ # Filter on answer record type. Currently predicates on `type` is supported,
188
+ # valid values are `ARTICLE_ANSWER`, `FAQ_ANSWER`.
189
+ #
190
+ # For more information about filtering, see
191
+ # [API Filtering](https://aip.dev/160).
192
+ # @param page_size [::Integer]
193
+ # Optional. The maximum number of records to return in a single page.
194
+ # The server may return fewer records than this. If unspecified, we use 10.
195
+ # The maximum is 100.
196
+ # @param page_token [::String]
197
+ # Optional. The
198
+ # {::Google::Cloud::Dialogflow::V2::ListAnswerRecordsResponse#next_page_token ListAnswerRecordsResponse.next_page_token}
199
+ # value returned from a previous list request used to continue listing on
200
+ # the next page.
201
+ #
202
+ # @yield [response, operation] Access the result along with the RPC operation
203
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::V2::AnswerRecord>]
204
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
205
+ #
206
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::V2::AnswerRecord>]
207
+ #
208
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
209
+ #
210
+ def list_answer_records request, options = nil
211
+ raise ::ArgumentError, "request must be provided" if request.nil?
212
+
213
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::ListAnswerRecordsRequest
214
+
215
+ # Converts hash and nil to an options object
216
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
217
+
218
+ # Customize the options with defaults
219
+ metadata = @config.rpcs.list_answer_records.metadata.to_h
220
+
221
+ # Set x-goog-api-client and x-goog-user-project headers
222
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
223
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
224
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
225
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
226
+
227
+ header_params = {
228
+ "parent" => request.parent
229
+ }
230
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
231
+ metadata[:"x-goog-request-params"] ||= request_params_header
232
+
233
+ options.apply_defaults timeout: @config.rpcs.list_answer_records.timeout,
234
+ metadata: metadata,
235
+ retry_policy: @config.rpcs.list_answer_records.retry_policy
236
+ options.apply_defaults metadata: @config.metadata,
237
+ retry_policy: @config.retry_policy
238
+
239
+ @answer_records_stub.call_rpc :list_answer_records, request, options: options do |response, operation|
240
+ response = ::Gapic::PagedEnumerable.new @answer_records_stub, :list_answer_records, request, response, operation, options
241
+ yield response, operation if block_given?
242
+ return response
243
+ end
244
+ rescue ::GRPC::BadStatus => e
245
+ raise ::Google::Cloud::Error.from_error(e)
246
+ end
247
+
248
+ ##
249
+ # Updates the specified answer record.
250
+ #
251
+ # @overload update_answer_record(request, options = nil)
252
+ # Pass arguments to `update_answer_record` via a request object, either of type
253
+ # {::Google::Cloud::Dialogflow::V2::UpdateAnswerRecordRequest} or an equivalent Hash.
254
+ #
255
+ # @param request [::Google::Cloud::Dialogflow::V2::UpdateAnswerRecordRequest, ::Hash]
256
+ # A request object representing the call parameters. Required. To specify no
257
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
258
+ # @param options [::Gapic::CallOptions, ::Hash]
259
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
260
+ #
261
+ # @overload update_answer_record(answer_record: nil, update_mask: nil)
262
+ # Pass arguments to `update_answer_record` via keyword arguments. Note that at
263
+ # least one keyword argument is required. To specify no parameters, or to keep all
264
+ # the default parameter values, pass an empty Hash as a request object (see above).
265
+ #
266
+ # @param answer_record [::Google::Cloud::Dialogflow::V2::AnswerRecord, ::Hash]
267
+ # Required. Answer record to update.
268
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
269
+ # Required. The mask to control which fields get updated.
270
+ #
271
+ # @yield [response, operation] Access the result along with the RPC operation
272
+ # @yieldparam response [::Google::Cloud::Dialogflow::V2::AnswerRecord]
273
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
274
+ #
275
+ # @return [::Google::Cloud::Dialogflow::V2::AnswerRecord]
276
+ #
277
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
278
+ #
279
+ def update_answer_record request, options = nil
280
+ raise ::ArgumentError, "request must be provided" if request.nil?
281
+
282
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::UpdateAnswerRecordRequest
283
+
284
+ # Converts hash and nil to an options object
285
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
286
+
287
+ # Customize the options with defaults
288
+ metadata = @config.rpcs.update_answer_record.metadata.to_h
289
+
290
+ # Set x-goog-api-client and x-goog-user-project headers
291
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
292
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
293
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
294
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
295
+
296
+ header_params = {
297
+ "answer_record.name" => request.answer_record.name
298
+ }
299
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
300
+ metadata[:"x-goog-request-params"] ||= request_params_header
301
+
302
+ options.apply_defaults timeout: @config.rpcs.update_answer_record.timeout,
303
+ metadata: metadata,
304
+ retry_policy: @config.rpcs.update_answer_record.retry_policy
305
+ options.apply_defaults metadata: @config.metadata,
306
+ retry_policy: @config.retry_policy
307
+
308
+ @answer_records_stub.call_rpc :update_answer_record, request, options: options do |response, operation|
309
+ yield response, operation if block_given?
310
+ return response
311
+ end
312
+ rescue ::GRPC::BadStatus => e
313
+ raise ::Google::Cloud::Error.from_error(e)
314
+ end
315
+
316
+ ##
317
+ # Configuration class for the AnswerRecords API.
318
+ #
319
+ # This class represents the configuration for AnswerRecords,
320
+ # providing control over timeouts, retry behavior, logging, transport
321
+ # parameters, and other low-level controls. Certain parameters can also be
322
+ # applied individually to specific RPCs. See
323
+ # {::Google::Cloud::Dialogflow::V2::AnswerRecords::Client::Configuration::Rpcs}
324
+ # for a list of RPCs that can be configured independently.
325
+ #
326
+ # Configuration can be applied globally to all clients, or to a single client
327
+ # on construction.
328
+ #
329
+ # # Examples
330
+ #
331
+ # To modify the global config, setting the timeout for list_answer_records
332
+ # to 20 seconds, and all remaining timeouts to 10 seconds:
333
+ #
334
+ # ::Google::Cloud::Dialogflow::V2::AnswerRecords::Client.configure do |config|
335
+ # config.timeout = 10.0
336
+ # config.rpcs.list_answer_records.timeout = 20.0
337
+ # end
338
+ #
339
+ # To apply the above configuration only to a new client:
340
+ #
341
+ # client = ::Google::Cloud::Dialogflow::V2::AnswerRecords::Client.new do |config|
342
+ # config.timeout = 10.0
343
+ # config.rpcs.list_answer_records.timeout = 20.0
344
+ # end
345
+ #
346
+ # @!attribute [rw] endpoint
347
+ # The hostname or hostname:port of the service endpoint.
348
+ # Defaults to `"dialogflow.googleapis.com"`.
349
+ # @return [::String]
350
+ # @!attribute [rw] credentials
351
+ # Credentials to send with calls. You may provide any of the following types:
352
+ # * (`String`) The path to a service account key file in JSON format
353
+ # * (`Hash`) A service account key as a Hash
354
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
355
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
356
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
357
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
358
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
359
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
360
+ # * (`nil`) indicating no credentials
361
+ # @return [::Object]
362
+ # @!attribute [rw] scope
363
+ # The OAuth scopes
364
+ # @return [::Array<::String>]
365
+ # @!attribute [rw] lib_name
366
+ # The library name as recorded in instrumentation and logging
367
+ # @return [::String]
368
+ # @!attribute [rw] lib_version
369
+ # The library version as recorded in instrumentation and logging
370
+ # @return [::String]
371
+ # @!attribute [rw] channel_args
372
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
373
+ # `GRPC::Core::Channel` object is provided as the credential.
374
+ # @return [::Hash]
375
+ # @!attribute [rw] interceptors
376
+ # An array of interceptors that are run before calls are executed.
377
+ # @return [::Array<::GRPC::ClientInterceptor>]
378
+ # @!attribute [rw] timeout
379
+ # The call timeout in seconds.
380
+ # @return [::Numeric]
381
+ # @!attribute [rw] metadata
382
+ # Additional gRPC headers to be sent with the call.
383
+ # @return [::Hash{::Symbol=>::String}]
384
+ # @!attribute [rw] retry_policy
385
+ # The retry policy. The value is a hash with the following keys:
386
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
387
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
388
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
389
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
390
+ # trigger a retry.
391
+ # @return [::Hash]
392
+ # @!attribute [rw] quota_project
393
+ # A separate project against which to charge quota.
394
+ # @return [::String]
395
+ #
396
+ class Configuration
397
+ extend ::Gapic::Config
398
+
399
+ config_attr :endpoint, "dialogflow.googleapis.com", ::String
400
+ config_attr :credentials, nil do |value|
401
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
402
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
403
+ allowed.any? { |klass| klass === value }
404
+ end
405
+ config_attr :scope, nil, ::String, ::Array, nil
406
+ config_attr :lib_name, nil, ::String, nil
407
+ config_attr :lib_version, nil, ::String, nil
408
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
409
+ config_attr :interceptors, nil, ::Array, nil
410
+ config_attr :timeout, nil, ::Numeric, nil
411
+ config_attr :metadata, nil, ::Hash, nil
412
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
413
+ config_attr :quota_project, nil, ::String, nil
414
+
415
+ # @private
416
+ def initialize parent_config = nil
417
+ @parent_config = parent_config unless parent_config.nil?
418
+
419
+ yield self if block_given?
420
+ end
421
+
422
+ ##
423
+ # Configurations for individual RPCs
424
+ # @return [Rpcs]
425
+ #
426
+ def rpcs
427
+ @rpcs ||= begin
428
+ parent_rpcs = nil
429
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
430
+ Rpcs.new parent_rpcs
431
+ end
432
+ end
433
+
434
+ ##
435
+ # Configuration RPC class for the AnswerRecords API.
436
+ #
437
+ # Includes fields providing the configuration for each RPC in this service.
438
+ # Each configuration object is of type `Gapic::Config::Method` and includes
439
+ # the following configuration fields:
440
+ #
441
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
442
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
443
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
444
+ # include the following keys:
445
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
446
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
447
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
448
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
449
+ # trigger a retry.
450
+ #
451
+ class Rpcs
452
+ ##
453
+ # RPC-specific configuration for `list_answer_records`
454
+ # @return [::Gapic::Config::Method]
455
+ #
456
+ attr_reader :list_answer_records
457
+ ##
458
+ # RPC-specific configuration for `update_answer_record`
459
+ # @return [::Gapic::Config::Method]
460
+ #
461
+ attr_reader :update_answer_record
462
+
463
+ # @private
464
+ def initialize parent_rpcs = nil
465
+ list_answer_records_config = parent_rpcs.list_answer_records if parent_rpcs.respond_to? :list_answer_records
466
+ @list_answer_records = ::Gapic::Config::Method.new list_answer_records_config
467
+ update_answer_record_config = parent_rpcs.update_answer_record if parent_rpcs.respond_to? :update_answer_record
468
+ @update_answer_record = ::Gapic::Config::Method.new update_answer_record_config
469
+
470
+ yield self if block_given?
471
+ end
472
+ end
473
+ end
474
+ end
475
+ end
476
+ end
477
+ end
478
+ end
479
+ end