google-cloud-discovery_engine-v1 0.a → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +149 -0
  4. data/README.md +144 -8
  5. data/lib/google/cloud/discovery_engine/v1/completion_service/client.rb +451 -0
  6. data/lib/google/cloud/discovery_engine/v1/completion_service/credentials.rb +47 -0
  7. data/lib/google/cloud/discovery_engine/v1/completion_service/paths.rb +78 -0
  8. data/lib/google/cloud/discovery_engine/v1/completion_service/rest/client.rb +408 -0
  9. data/lib/google/cloud/discovery_engine/v1/completion_service/rest/service_stub.rb +114 -0
  10. data/lib/google/cloud/discovery_engine/v1/completion_service/rest.rb +52 -0
  11. data/lib/google/cloud/discovery_engine/v1/completion_service.rb +55 -0
  12. data/lib/google/cloud/discovery_engine/v1/conversational_search_service/client.rb +959 -0
  13. data/lib/google/cloud/discovery_engine/v1/conversational_search_service/credentials.rb +47 -0
  14. data/lib/google/cloud/discovery_engine/v1/conversational_search_service/paths.rb +176 -0
  15. data/lib/google/cloud/discovery_engine/v1/conversational_search_service/rest/client.rb +797 -0
  16. data/lib/google/cloud/discovery_engine/v1/conversational_search_service/rest/service_stub.rb +450 -0
  17. data/lib/google/cloud/discovery_engine/v1/conversational_search_service/rest.rb +52 -0
  18. data/lib/google/cloud/discovery_engine/v1/conversational_search_service.rb +55 -0
  19. data/lib/google/cloud/discovery_engine/v1/document_service/client.rb +1170 -0
  20. data/lib/google/cloud/discovery_engine/v1/document_service/credentials.rb +47 -0
  21. data/lib/google/cloud/discovery_engine/v1/document_service/operations.rb +770 -0
  22. data/lib/google/cloud/discovery_engine/v1/document_service/paths.rb +135 -0
  23. data/lib/google/cloud/discovery_engine/v1/document_service/rest/client.rb +971 -0
  24. data/lib/google/cloud/discovery_engine/v1/document_service/rest/operations.rb +977 -0
  25. data/lib/google/cloud/discovery_engine/v1/document_service/rest/service_stub.rb +518 -0
  26. data/lib/google/cloud/discovery_engine/v1/document_service/rest.rb +54 -0
  27. data/lib/google/cloud/discovery_engine/v1/document_service.rb +57 -0
  28. data/lib/google/cloud/discovery_engine/v1/rest.rb +42 -0
  29. data/lib/google/cloud/discovery_engine/v1/schema_service/client.rb +853 -0
  30. data/lib/google/cloud/discovery_engine/v1/schema_service/credentials.rb +47 -0
  31. data/lib/google/cloud/discovery_engine/v1/schema_service/operations.rb +770 -0
  32. data/lib/google/cloud/discovery_engine/v1/schema_service/paths.rb +127 -0
  33. data/lib/google/cloud/discovery_engine/v1/schema_service/rest/client.rb +693 -0
  34. data/lib/google/cloud/discovery_engine/v1/schema_service/rest/operations.rb +977 -0
  35. data/lib/google/cloud/discovery_engine/v1/schema_service/rest/service_stub.rb +382 -0
  36. data/lib/google/cloud/discovery_engine/v1/schema_service/rest.rb +53 -0
  37. data/lib/google/cloud/discovery_engine/v1/schema_service.rb +56 -0
  38. data/lib/google/cloud/discovery_engine/v1/search_service/client.rb +529 -0
  39. data/lib/google/cloud/discovery_engine/v1/search_service/credentials.rb +47 -0
  40. data/lib/google/cloud/discovery_engine/v1/search_service/paths.rb +131 -0
  41. data/lib/google/cloud/discovery_engine/v1/search_service/rest/client.rb +481 -0
  42. data/lib/google/cloud/discovery_engine/v1/search_service/rest/service_stub.rb +116 -0
  43. data/lib/google/cloud/discovery_engine/v1/search_service/rest.rb +52 -0
  44. data/lib/google/cloud/discovery_engine/v1/search_service.rb +55 -0
  45. data/lib/google/cloud/discovery_engine/v1/user_event_service/client.rb +654 -0
  46. data/lib/google/cloud/discovery_engine/v1/user_event_service/credentials.rb +47 -0
  47. data/lib/google/cloud/discovery_engine/v1/user_event_service/operations.rb +770 -0
  48. data/lib/google/cloud/discovery_engine/v1/user_event_service/paths.rb +131 -0
  49. data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/client.rb +558 -0
  50. data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/operations.rb +977 -0
  51. data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/service_stub.rb +250 -0
  52. data/lib/google/cloud/discovery_engine/v1/user_event_service/rest.rb +53 -0
  53. data/lib/google/cloud/discovery_engine/v1/user_event_service.rb +56 -0
  54. data/lib/google/cloud/discovery_engine/v1/version.rb +7 -2
  55. data/lib/google/cloud/discovery_engine/v1.rb +50 -0
  56. data/lib/google/cloud/discoveryengine/v1/common_pb.rb +46 -0
  57. data/lib/google/cloud/discoveryengine/v1/completion_service_pb.rb +49 -0
  58. data/lib/google/cloud/discoveryengine/v1/completion_service_services_pb.rb +45 -0
  59. data/lib/google/cloud/discoveryengine/v1/conversation_pb.rb +54 -0
  60. data/lib/google/cloud/discoveryengine/v1/conversational_search_service_pb.rb +61 -0
  61. data/lib/google/cloud/discoveryengine/v1/conversational_search_service_services_pb.rb +67 -0
  62. data/lib/google/cloud/discoveryengine/v1/document_pb.rb +48 -0
  63. data/lib/google/cloud/discoveryengine/v1/document_service_pb.rb +58 -0
  64. data/lib/google/cloud/discoveryengine/v1/document_service_services_pb.rb +79 -0
  65. data/lib/google/cloud/discoveryengine/v1/import_config_pb.rb +66 -0
  66. data/lib/google/cloud/discoveryengine/v1/purge_config_pb.rb +49 -0
  67. data/lib/google/cloud/discoveryengine/v1/schema_pb.rb +47 -0
  68. data/lib/google/cloud/discoveryengine/v1/schema_service_pb.rb +61 -0
  69. data/lib/google/cloud/discoveryengine/v1/schema_service_services_pb.rb +53 -0
  70. data/lib/google/cloud/discoveryengine/v1/search_service_pb.rb +73 -0
  71. data/lib/google/cloud/discoveryengine/v1/search_service_services_pb.rb +45 -0
  72. data/lib/google/cloud/discoveryengine/v1/user_event_pb.rb +58 -0
  73. data/lib/google/cloud/discoveryengine/v1/user_event_service_pb.rb +53 -0
  74. data/lib/google/cloud/discoveryengine/v1/user_event_service_services_pb.rb +59 -0
  75. data/lib/google-cloud-discovery_engine-v1.rb +21 -0
  76. data/proto_docs/README.md +4 -0
  77. data/proto_docs/google/api/client.rb +381 -0
  78. data/proto_docs/google/api/field_behavior.rb +85 -0
  79. data/proto_docs/google/api/httpbody.rb +80 -0
  80. data/proto_docs/google/api/launch_stage.rb +71 -0
  81. data/proto_docs/google/api/resource.rb +222 -0
  82. data/proto_docs/google/cloud/discoveryengine/v1/common.rb +106 -0
  83. data/proto_docs/google/cloud/discoveryengine/v1/completion_service.rb +111 -0
  84. data/proto_docs/google/cloud/discoveryengine/v1/conversation.rb +113 -0
  85. data/proto_docs/google/cloud/discoveryengine/v1/conversational_search_service.rb +206 -0
  86. data/proto_docs/google/cloud/discoveryengine/v1/document.rb +108 -0
  87. data/proto_docs/google/cloud/discoveryengine/v1/document_service.rb +181 -0
  88. data/proto_docs/google/cloud/discoveryengine/v1/import_config.rb +340 -0
  89. data/proto_docs/google/cloud/discoveryengine/v1/purge_config.rb +84 -0
  90. data/proto_docs/google/cloud/discoveryengine/v1/schema.rb +45 -0
  91. data/proto_docs/google/cloud/discoveryengine/v1/schema_service.rb +177 -0
  92. data/proto_docs/google/cloud/discoveryengine/v1/search_service.rb +730 -0
  93. data/proto_docs/google/cloud/discoveryengine/v1/user_event.rb +478 -0
  94. data/proto_docs/google/cloud/discoveryengine/v1/user_event_service.rb +64 -0
  95. data/proto_docs/google/longrunning/operations.rb +164 -0
  96. data/proto_docs/google/protobuf/any.rb +144 -0
  97. data/proto_docs/google/protobuf/duration.rb +98 -0
  98. data/proto_docs/google/protobuf/empty.rb +34 -0
  99. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  100. data/proto_docs/google/protobuf/struct.rb +96 -0
  101. data/proto_docs/google/protobuf/timestamp.rb +127 -0
  102. data/proto_docs/google/rpc/status.rb +48 -0
  103. data/proto_docs/google/type/date.rb +53 -0
  104. metadata +277 -13
@@ -0,0 +1,558 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 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/discoveryengine/v1/user_event_service_pb"
21
+ require "google/cloud/discovery_engine/v1/user_event_service/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module DiscoveryEngine
27
+ module V1
28
+ module UserEventService
29
+ module Rest
30
+ ##
31
+ # REST client for the UserEventService service.
32
+ #
33
+ # Service for ingesting end user actions on a website to Discovery Engine API.
34
+ #
35
+ class Client
36
+ include Paths
37
+
38
+ # @private
39
+ attr_reader :user_event_service_stub
40
+
41
+ ##
42
+ # Configure the UserEventService Client class.
43
+ #
44
+ # See {::Google::Cloud::DiscoveryEngine::V1::UserEventService::Rest::Client::Configuration}
45
+ # for a description of the configuration fields.
46
+ #
47
+ # @example
48
+ #
49
+ # # Modify the configuration for all UserEventService clients
50
+ # ::Google::Cloud::DiscoveryEngine::V1::UserEventService::Rest::Client.configure do |config|
51
+ # config.timeout = 10.0
52
+ # end
53
+ #
54
+ # @yield [config] Configure the Client client.
55
+ # @yieldparam config [Client::Configuration]
56
+ #
57
+ # @return [Client::Configuration]
58
+ #
59
+ def self.configure
60
+ @configure ||= begin
61
+ namespace = ["Google", "Cloud", "DiscoveryEngine", "V1"]
62
+ parent_config = while namespace.any?
63
+ parent_name = namespace.join "::"
64
+ parent_const = const_get parent_name
65
+ break parent_const.configure if parent_const.respond_to? :configure
66
+ namespace.pop
67
+ end
68
+ default_config = Client::Configuration.new parent_config
69
+
70
+ default_config.timeout = 30.0
71
+ default_config.retry_policy = {
72
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
73
+ }
74
+
75
+ default_config.rpcs.import_user_events.timeout = 300.0
76
+ default_config.rpcs.import_user_events.retry_policy = {
77
+ initial_delay: 1.0, max_delay: 30.0, multiplier: 1.3, retry_codes: [14]
78
+ }
79
+
80
+ default_config
81
+ end
82
+ yield @configure if block_given?
83
+ @configure
84
+ end
85
+
86
+ ##
87
+ # Configure the UserEventService Client instance.
88
+ #
89
+ # The configuration is set to the derived mode, meaning that values can be changed,
90
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
91
+ # should be made on {Client.configure}.
92
+ #
93
+ # See {::Google::Cloud::DiscoveryEngine::V1::UserEventService::Rest::Client::Configuration}
94
+ # for a description of the configuration fields.
95
+ #
96
+ # @yield [config] Configure the Client client.
97
+ # @yieldparam config [Client::Configuration]
98
+ #
99
+ # @return [Client::Configuration]
100
+ #
101
+ def configure
102
+ yield @config if block_given?
103
+ @config
104
+ end
105
+
106
+ ##
107
+ # Create a new UserEventService REST client object.
108
+ #
109
+ # @example
110
+ #
111
+ # # Create a client using the default configuration
112
+ # client = ::Google::Cloud::DiscoveryEngine::V1::UserEventService::Rest::Client.new
113
+ #
114
+ # # Create a client using a custom configuration
115
+ # client = ::Google::Cloud::DiscoveryEngine::V1::UserEventService::Rest::Client.new do |config|
116
+ # config.timeout = 10.0
117
+ # end
118
+ #
119
+ # @yield [config] Configure the UserEventService client.
120
+ # @yieldparam config [Client::Configuration]
121
+ #
122
+ def initialize
123
+ # Create the configuration object
124
+ @config = Configuration.new Client.configure
125
+
126
+ # Yield the configuration if needed
127
+ yield @config if block_given?
128
+
129
+ # Create credentials
130
+ credentials = @config.credentials
131
+ # Use self-signed JWT if the endpoint is unchanged from default,
132
+ # but only if the default endpoint does not have a region prefix.
133
+ enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
134
+ !@config.endpoint.split(".").first.include?("-")
135
+ credentials ||= Credentials.default scope: @config.scope,
136
+ enable_self_signed_jwt: enable_self_signed_jwt
137
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
138
+ credentials = Credentials.new credentials, scope: @config.scope
139
+ end
140
+
141
+ @quota_project_id = @config.quota_project
142
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
143
+
144
+ @operations_client = ::Google::Cloud::DiscoveryEngine::V1::UserEventService::Rest::Operations.new do |config|
145
+ config.credentials = credentials
146
+ config.quota_project = @quota_project_id
147
+ config.endpoint = @config.endpoint
148
+ end
149
+
150
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
151
+ config.credentials = credentials
152
+ config.quota_project = @quota_project_id
153
+ config.endpoint = @config.endpoint
154
+ end
155
+
156
+ @user_event_service_stub = ::Google::Cloud::DiscoveryEngine::V1::UserEventService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
157
+ end
158
+
159
+ ##
160
+ # Get the associated client for long-running operations.
161
+ #
162
+ # @return [::Google::Cloud::DiscoveryEngine::V1::UserEventService::Rest::Operations]
163
+ #
164
+ attr_reader :operations_client
165
+
166
+ ##
167
+ # Get the associated client for mix-in of the Locations.
168
+ #
169
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
170
+ #
171
+ attr_reader :location_client
172
+
173
+ # Service calls
174
+
175
+ ##
176
+ # Writes a single user event.
177
+ #
178
+ # @overload write_user_event(request, options = nil)
179
+ # Pass arguments to `write_user_event` via a request object, either of type
180
+ # {::Google::Cloud::DiscoveryEngine::V1::WriteUserEventRequest} or an equivalent Hash.
181
+ #
182
+ # @param request [::Google::Cloud::DiscoveryEngine::V1::WriteUserEventRequest, ::Hash]
183
+ # A request object representing the call parameters. Required. To specify no
184
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
185
+ # @param options [::Gapic::CallOptions, ::Hash]
186
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
187
+ #
188
+ # @overload write_user_event(parent: nil, user_event: nil)
189
+ # Pass arguments to `write_user_event` via keyword arguments. Note that at
190
+ # least one keyword argument is required. To specify no parameters, or to keep all
191
+ # the default parameter values, pass an empty Hash as a request object (see above).
192
+ #
193
+ # @param parent [::String]
194
+ # Required. The parent DataStore resource name, such as
195
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`.
196
+ # @param user_event [::Google::Cloud::DiscoveryEngine::V1::UserEvent, ::Hash]
197
+ # Required. User event to write.
198
+ # @yield [result, operation] Access the result along with the TransportOperation object
199
+ # @yieldparam result [::Google::Cloud::DiscoveryEngine::V1::UserEvent]
200
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
201
+ #
202
+ # @return [::Google::Cloud::DiscoveryEngine::V1::UserEvent]
203
+ #
204
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
205
+ def write_user_event request, options = nil
206
+ raise ::ArgumentError, "request must be provided" if request.nil?
207
+
208
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::WriteUserEventRequest
209
+
210
+ # Converts hash and nil to an options object
211
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
212
+
213
+ # Customize the options with defaults
214
+ call_metadata = @config.rpcs.write_user_event.metadata.to_h
215
+
216
+ # Set x-goog-api-client and x-goog-user-project headers
217
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
218
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
219
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION,
220
+ transports_version_send: [:rest]
221
+
222
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
223
+
224
+ options.apply_defaults timeout: @config.rpcs.write_user_event.timeout,
225
+ metadata: call_metadata,
226
+ retry_policy: @config.rpcs.write_user_event.retry_policy
227
+
228
+ options.apply_defaults timeout: @config.timeout,
229
+ metadata: @config.metadata,
230
+ retry_policy: @config.retry_policy
231
+
232
+ @user_event_service_stub.write_user_event request, options do |result, operation|
233
+ yield result, operation if block_given?
234
+ return result
235
+ end
236
+ rescue ::Gapic::Rest::Error => e
237
+ raise ::Google::Cloud::Error.from_error(e)
238
+ end
239
+
240
+ ##
241
+ # Writes a single user event from the browser. This uses a GET request to
242
+ # due to browser restriction of POST-ing to a third-party domain.
243
+ #
244
+ # This method is used only by the Discovery Engine API JavaScript pixel and
245
+ # Google Tag Manager. Users should not call this method directly.
246
+ #
247
+ # @overload collect_user_event(request, options = nil)
248
+ # Pass arguments to `collect_user_event` via a request object, either of type
249
+ # {::Google::Cloud::DiscoveryEngine::V1::CollectUserEventRequest} or an equivalent Hash.
250
+ #
251
+ # @param request [::Google::Cloud::DiscoveryEngine::V1::CollectUserEventRequest, ::Hash]
252
+ # A request object representing the call parameters. Required. To specify no
253
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
254
+ # @param options [::Gapic::CallOptions, ::Hash]
255
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
256
+ #
257
+ # @overload collect_user_event(parent: nil, user_event: nil, uri: nil, ets: nil)
258
+ # Pass arguments to `collect_user_event` via keyword arguments. Note that at
259
+ # least one keyword argument is required. To specify no parameters, or to keep all
260
+ # the default parameter values, pass an empty Hash as a request object (see above).
261
+ #
262
+ # @param parent [::String]
263
+ # Required. The parent DataStore resource name, such as
264
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`.
265
+ # @param user_event [::String]
266
+ # Required. URL encoded UserEvent proto with a length limit of 2,000,000
267
+ # characters.
268
+ # @param uri [::String]
269
+ # The URL including cgi-parameters but excluding the hash fragment with a
270
+ # length limit of 5,000 characters. This is often more useful than the
271
+ # referer URL, because many browsers only send the domain for third-party
272
+ # requests.
273
+ # @param ets [::Integer]
274
+ # The event timestamp in milliseconds. This prevents browser caching of
275
+ # otherwise identical get requests. The name is abbreviated to reduce the
276
+ # payload bytes.
277
+ # @yield [result, operation] Access the result along with the TransportOperation object
278
+ # @yieldparam result [::Google::Api::HttpBody]
279
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
280
+ #
281
+ # @return [::Google::Api::HttpBody]
282
+ #
283
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
284
+ def collect_user_event request, options = nil
285
+ raise ::ArgumentError, "request must be provided" if request.nil?
286
+
287
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::CollectUserEventRequest
288
+
289
+ # Converts hash and nil to an options object
290
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
291
+
292
+ # Customize the options with defaults
293
+ call_metadata = @config.rpcs.collect_user_event.metadata.to_h
294
+
295
+ # Set x-goog-api-client and x-goog-user-project headers
296
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
297
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
298
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION,
299
+ transports_version_send: [:rest]
300
+
301
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
302
+
303
+ options.apply_defaults timeout: @config.rpcs.collect_user_event.timeout,
304
+ metadata: call_metadata,
305
+ retry_policy: @config.rpcs.collect_user_event.retry_policy
306
+
307
+ options.apply_defaults timeout: @config.timeout,
308
+ metadata: @config.metadata,
309
+ retry_policy: @config.retry_policy
310
+
311
+ @user_event_service_stub.collect_user_event request, options do |result, operation|
312
+ yield result, operation if block_given?
313
+ return result
314
+ end
315
+ rescue ::Gapic::Rest::Error => e
316
+ raise ::Google::Cloud::Error.from_error(e)
317
+ end
318
+
319
+ ##
320
+ # Bulk import of User events. Request processing might be
321
+ # synchronous. Events that already exist are skipped.
322
+ # Use this method for backfilling historical user events.
323
+ #
324
+ # Operation.response is of type ImportResponse. Note that it is
325
+ # possible for a subset of the items to be successfully inserted.
326
+ # Operation.metadata is of type ImportMetadata.
327
+ #
328
+ # @overload import_user_events(request, options = nil)
329
+ # Pass arguments to `import_user_events` via a request object, either of type
330
+ # {::Google::Cloud::DiscoveryEngine::V1::ImportUserEventsRequest} or an equivalent Hash.
331
+ #
332
+ # @param request [::Google::Cloud::DiscoveryEngine::V1::ImportUserEventsRequest, ::Hash]
333
+ # A request object representing the call parameters. Required. To specify no
334
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
335
+ # @param options [::Gapic::CallOptions, ::Hash]
336
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
337
+ #
338
+ # @overload import_user_events(inline_source: nil, gcs_source: nil, bigquery_source: nil, parent: nil, error_config: nil)
339
+ # Pass arguments to `import_user_events` via keyword arguments. Note that at
340
+ # least one keyword argument is required. To specify no parameters, or to keep all
341
+ # the default parameter values, pass an empty Hash as a request object (see above).
342
+ #
343
+ # @param inline_source [::Google::Cloud::DiscoveryEngine::V1::ImportUserEventsRequest::InlineSource, ::Hash]
344
+ # The Inline source for the input content for UserEvents.
345
+ # @param gcs_source [::Google::Cloud::DiscoveryEngine::V1::GcsSource, ::Hash]
346
+ # Cloud Storage location for the input content.
347
+ # @param bigquery_source [::Google::Cloud::DiscoveryEngine::V1::BigQuerySource, ::Hash]
348
+ # BigQuery input source.
349
+ # @param parent [::String]
350
+ # Required. Parent DataStore resource name, of the form
351
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`
352
+ # @param error_config [::Google::Cloud::DiscoveryEngine::V1::ImportErrorConfig, ::Hash]
353
+ # The desired location of errors incurred during the Import. Cannot be set
354
+ # for inline user event imports.
355
+ # @yield [result, operation] Access the result along with the TransportOperation object
356
+ # @yieldparam result [::Gapic::Operation]
357
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
358
+ #
359
+ # @return [::Gapic::Operation]
360
+ #
361
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
362
+ def import_user_events request, options = nil
363
+ raise ::ArgumentError, "request must be provided" if request.nil?
364
+
365
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::ImportUserEventsRequest
366
+
367
+ # Converts hash and nil to an options object
368
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
369
+
370
+ # Customize the options with defaults
371
+ call_metadata = @config.rpcs.import_user_events.metadata.to_h
372
+
373
+ # Set x-goog-api-client and x-goog-user-project headers
374
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
375
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
376
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION,
377
+ transports_version_send: [:rest]
378
+
379
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
380
+
381
+ options.apply_defaults timeout: @config.rpcs.import_user_events.timeout,
382
+ metadata: call_metadata,
383
+ retry_policy: @config.rpcs.import_user_events.retry_policy
384
+
385
+ options.apply_defaults timeout: @config.timeout,
386
+ metadata: @config.metadata,
387
+ retry_policy: @config.retry_policy
388
+
389
+ @user_event_service_stub.import_user_events request, options do |result, operation|
390
+ result = ::Gapic::Operation.new result, @operations_client, options: options
391
+ yield result, operation if block_given?
392
+ return result
393
+ end
394
+ rescue ::Gapic::Rest::Error => e
395
+ raise ::Google::Cloud::Error.from_error(e)
396
+ end
397
+
398
+ ##
399
+ # Configuration class for the UserEventService REST API.
400
+ #
401
+ # This class represents the configuration for UserEventService REST,
402
+ # providing control over timeouts, retry behavior, logging, transport
403
+ # parameters, and other low-level controls. Certain parameters can also be
404
+ # applied individually to specific RPCs. See
405
+ # {::Google::Cloud::DiscoveryEngine::V1::UserEventService::Rest::Client::Configuration::Rpcs}
406
+ # for a list of RPCs that can be configured independently.
407
+ #
408
+ # Configuration can be applied globally to all clients, or to a single client
409
+ # on construction.
410
+ #
411
+ # @example
412
+ #
413
+ # # Modify the global config, setting the timeout for
414
+ # # write_user_event to 20 seconds,
415
+ # # and all remaining timeouts to 10 seconds.
416
+ # ::Google::Cloud::DiscoveryEngine::V1::UserEventService::Rest::Client.configure do |config|
417
+ # config.timeout = 10.0
418
+ # config.rpcs.write_user_event.timeout = 20.0
419
+ # end
420
+ #
421
+ # # Apply the above configuration only to a new client.
422
+ # client = ::Google::Cloud::DiscoveryEngine::V1::UserEventService::Rest::Client.new do |config|
423
+ # config.timeout = 10.0
424
+ # config.rpcs.write_user_event.timeout = 20.0
425
+ # end
426
+ #
427
+ # @!attribute [rw] endpoint
428
+ # The hostname or hostname:port of the service endpoint.
429
+ # Defaults to `"discoveryengine.googleapis.com"`.
430
+ # @return [::String]
431
+ # @!attribute [rw] credentials
432
+ # Credentials to send with calls. You may provide any of the following types:
433
+ # * (`String`) The path to a service account key file in JSON format
434
+ # * (`Hash`) A service account key as a Hash
435
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
436
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
437
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
438
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
439
+ # * (`nil`) indicating no credentials
440
+ # @return [::Object]
441
+ # @!attribute [rw] scope
442
+ # The OAuth scopes
443
+ # @return [::Array<::String>]
444
+ # @!attribute [rw] lib_name
445
+ # The library name as recorded in instrumentation and logging
446
+ # @return [::String]
447
+ # @!attribute [rw] lib_version
448
+ # The library version as recorded in instrumentation and logging
449
+ # @return [::String]
450
+ # @!attribute [rw] timeout
451
+ # The call timeout in seconds.
452
+ # @return [::Numeric]
453
+ # @!attribute [rw] metadata
454
+ # Additional headers to be sent with the call.
455
+ # @return [::Hash{::Symbol=>::String}]
456
+ # @!attribute [rw] retry_policy
457
+ # The retry policy. The value is a hash with the following keys:
458
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
459
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
460
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
461
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
462
+ # trigger a retry.
463
+ # @return [::Hash]
464
+ # @!attribute [rw] quota_project
465
+ # A separate project against which to charge quota.
466
+ # @return [::String]
467
+ #
468
+ class Configuration
469
+ extend ::Gapic::Config
470
+
471
+ DEFAULT_ENDPOINT = "discoveryengine.googleapis.com"
472
+
473
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
474
+ config_attr :credentials, nil do |value|
475
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
476
+ allowed.any? { |klass| klass === value }
477
+ end
478
+ config_attr :scope, nil, ::String, ::Array, nil
479
+ config_attr :lib_name, nil, ::String, nil
480
+ config_attr :lib_version, nil, ::String, nil
481
+ config_attr :timeout, nil, ::Numeric, nil
482
+ config_attr :metadata, nil, ::Hash, nil
483
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
484
+ config_attr :quota_project, nil, ::String, nil
485
+
486
+ # @private
487
+ def initialize parent_config = nil
488
+ @parent_config = parent_config unless parent_config.nil?
489
+
490
+ yield self if block_given?
491
+ end
492
+
493
+ ##
494
+ # Configurations for individual RPCs
495
+ # @return [Rpcs]
496
+ #
497
+ def rpcs
498
+ @rpcs ||= begin
499
+ parent_rpcs = nil
500
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
501
+ Rpcs.new parent_rpcs
502
+ end
503
+ end
504
+
505
+ ##
506
+ # Configuration RPC class for the UserEventService API.
507
+ #
508
+ # Includes fields providing the configuration for each RPC in this service.
509
+ # Each configuration object is of type `Gapic::Config::Method` and includes
510
+ # the following configuration fields:
511
+ #
512
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
513
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
514
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
515
+ # include the following keys:
516
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
517
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
518
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
519
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
520
+ # trigger a retry.
521
+ #
522
+ class Rpcs
523
+ ##
524
+ # RPC-specific configuration for `write_user_event`
525
+ # @return [::Gapic::Config::Method]
526
+ #
527
+ attr_reader :write_user_event
528
+ ##
529
+ # RPC-specific configuration for `collect_user_event`
530
+ # @return [::Gapic::Config::Method]
531
+ #
532
+ attr_reader :collect_user_event
533
+ ##
534
+ # RPC-specific configuration for `import_user_events`
535
+ # @return [::Gapic::Config::Method]
536
+ #
537
+ attr_reader :import_user_events
538
+
539
+ # @private
540
+ def initialize parent_rpcs = nil
541
+ write_user_event_config = parent_rpcs.write_user_event if parent_rpcs.respond_to? :write_user_event
542
+ @write_user_event = ::Gapic::Config::Method.new write_user_event_config
543
+ collect_user_event_config = parent_rpcs.collect_user_event if parent_rpcs.respond_to? :collect_user_event
544
+ @collect_user_event = ::Gapic::Config::Method.new collect_user_event_config
545
+ import_user_events_config = parent_rpcs.import_user_events if parent_rpcs.respond_to? :import_user_events
546
+ @import_user_events = ::Gapic::Config::Method.new import_user_events_config
547
+
548
+ yield self if block_given?
549
+ end
550
+ end
551
+ end
552
+ end
553
+ end
554
+ end
555
+ end
556
+ end
557
+ end
558
+ end