google-cloud-retail-v2 0.13.0 → 0.14.0
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.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/google/cloud/retail/v2/catalog_service/rest/client.rb +1220 -0
- data/lib/google/cloud/retail/v2/catalog_service/rest/service_stub.rb +704 -0
- data/lib/google/cloud/retail/v2/catalog_service/rest.rb +52 -0
- data/lib/google/cloud/retail/v2/catalog_service.rb +6 -0
- data/lib/google/cloud/retail/v2/completion_service/rest/client.rb +533 -0
- data/lib/google/cloud/retail/v2/completion_service/rest/operations.rb +828 -0
- data/lib/google/cloud/retail/v2/completion_service/rest/service_stub.rb +167 -0
- data/lib/google/cloud/retail/v2/completion_service/rest.rb +56 -0
- data/lib/google/cloud/retail/v2/completion_service.rb +6 -0
- data/lib/google/cloud/retail/v2/control_service/rest/client.rb +680 -0
- data/lib/google/cloud/retail/v2/control_service/rest/service_stub.rb +345 -0
- data/lib/google/cloud/retail/v2/control_service/rest.rb +52 -0
- data/lib/google/cloud/retail/v2/control_service.rb +6 -0
- data/lib/google/cloud/retail/v2/prediction_service/rest/client.rb +486 -0
- data/lib/google/cloud/retail/v2/prediction_service/rest/service_stub.rb +116 -0
- data/lib/google/cloud/retail/v2/prediction_service/rest.rb +52 -0
- data/lib/google/cloud/retail/v2/prediction_service.rb +6 -0
- data/lib/google/cloud/retail/v2/product_service/rest/client.rb +1649 -0
- data/lib/google/cloud/retail/v2/product_service/rest/operations.rb +828 -0
- data/lib/google/cloud/retail/v2/product_service/rest/service_stub.rb +705 -0
- data/lib/google/cloud/retail/v2/product_service/rest.rb +54 -0
- data/lib/google/cloud/retail/v2/product_service.rb +6 -0
- data/lib/google/cloud/retail/v2/rest.rb +44 -0
- data/lib/google/cloud/retail/v2/search_service/rest/client.rb +598 -0
- data/lib/google/cloud/retail/v2/search_service/rest/service_stub.rb +116 -0
- data/lib/google/cloud/retail/v2/search_service/rest.rb +55 -0
- data/lib/google/cloud/retail/v2/search_service.rb +6 -0
- data/lib/google/cloud/retail/v2/serving_config_service/rest/client.rb +825 -0
- data/lib/google/cloud/retail/v2/serving_config_service/rest/service_stub.rb +465 -0
- data/lib/google/cloud/retail/v2/serving_config_service/rest.rb +52 -0
- data/lib/google/cloud/retail/v2/serving_config_service.rb +6 -0
- data/lib/google/cloud/retail/v2/user_event_service/rest/client.rb +755 -0
- data/lib/google/cloud/retail/v2/user_event_service/rest/operations.rb +828 -0
- data/lib/google/cloud/retail/v2/user_event_service/rest/service_stub.rb +347 -0
- data/lib/google/cloud/retail/v2/user_event_service/rest.rb +53 -0
- data/lib/google/cloud/retail/v2/user_event_service.rb +6 -0
- data/lib/google/cloud/retail/v2/version.rb +1 -1
- data/lib/google/cloud/retail/v2.rb +5 -0
- metadata +35 -5
@@ -0,0 +1,755 @@
|
|
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/retail/v2/user_event_service_pb"
|
21
|
+
require "google/cloud/retail/v2/user_event_service/rest/service_stub"
|
22
|
+
require "google/cloud/location/rest"
|
23
|
+
|
24
|
+
module Google
|
25
|
+
module Cloud
|
26
|
+
module Retail
|
27
|
+
module V2
|
28
|
+
module UserEventService
|
29
|
+
module Rest
|
30
|
+
##
|
31
|
+
# REST client for the UserEventService service.
|
32
|
+
#
|
33
|
+
# Service for ingesting end user actions on the customer website.
|
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::Retail::V2::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::Retail::V2::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", "Retail", "V2"]
|
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 = 5.0
|
71
|
+
default_config.retry_policy = {
|
72
|
+
initial_delay: 0.1, max_delay: 5.0, multiplier: 1.3, retry_codes: [14, 4]
|
73
|
+
}
|
74
|
+
|
75
|
+
default_config.rpcs.purge_user_events.timeout = 30.0
|
76
|
+
default_config.rpcs.purge_user_events.retry_policy = {
|
77
|
+
initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [14, 4]
|
78
|
+
}
|
79
|
+
|
80
|
+
default_config.rpcs.import_user_events.timeout = 600.0
|
81
|
+
default_config.rpcs.import_user_events.retry_policy = {
|
82
|
+
initial_delay: 0.1, max_delay: 300.0, multiplier: 1.3, retry_codes: [14, 4]
|
83
|
+
}
|
84
|
+
|
85
|
+
default_config
|
86
|
+
end
|
87
|
+
yield @configure if block_given?
|
88
|
+
@configure
|
89
|
+
end
|
90
|
+
|
91
|
+
##
|
92
|
+
# Configure the UserEventService Client instance.
|
93
|
+
#
|
94
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
95
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
96
|
+
# should be made on {Client.configure}.
|
97
|
+
#
|
98
|
+
# See {::Google::Cloud::Retail::V2::UserEventService::Rest::Client::Configuration}
|
99
|
+
# for a description of the configuration fields.
|
100
|
+
#
|
101
|
+
# @yield [config] Configure the Client client.
|
102
|
+
# @yieldparam config [Client::Configuration]
|
103
|
+
#
|
104
|
+
# @return [Client::Configuration]
|
105
|
+
#
|
106
|
+
def configure
|
107
|
+
yield @config if block_given?
|
108
|
+
@config
|
109
|
+
end
|
110
|
+
|
111
|
+
##
|
112
|
+
# Create a new UserEventService REST client object.
|
113
|
+
#
|
114
|
+
# @example
|
115
|
+
#
|
116
|
+
# # Create a client using the default configuration
|
117
|
+
# client = ::Google::Cloud::Retail::V2::UserEventService::Rest::Client.new
|
118
|
+
#
|
119
|
+
# # Create a client using a custom configuration
|
120
|
+
# client = ::Google::Cloud::Retail::V2::UserEventService::Rest::Client.new do |config|
|
121
|
+
# config.timeout = 10.0
|
122
|
+
# end
|
123
|
+
#
|
124
|
+
# @yield [config] Configure the UserEventService client.
|
125
|
+
# @yieldparam config [Client::Configuration]
|
126
|
+
#
|
127
|
+
def initialize
|
128
|
+
# Create the configuration object
|
129
|
+
@config = Configuration.new Client.configure
|
130
|
+
|
131
|
+
# Yield the configuration if needed
|
132
|
+
yield @config if block_given?
|
133
|
+
|
134
|
+
# Create credentials
|
135
|
+
credentials = @config.credentials
|
136
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
137
|
+
# but only if the default endpoint does not have a region prefix.
|
138
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
139
|
+
!@config.endpoint.split(".").first.include?("-")
|
140
|
+
credentials ||= Credentials.default scope: @config.scope,
|
141
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
142
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
143
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
144
|
+
end
|
145
|
+
|
146
|
+
@quota_project_id = @config.quota_project
|
147
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
148
|
+
|
149
|
+
@operations_client = ::Google::Cloud::Retail::V2::UserEventService::Rest::Operations.new do |config|
|
150
|
+
config.credentials = credentials
|
151
|
+
config.quota_project = @quota_project_id
|
152
|
+
config.endpoint = @config.endpoint
|
153
|
+
end
|
154
|
+
|
155
|
+
@location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
|
156
|
+
config.credentials = credentials
|
157
|
+
config.quota_project = @quota_project_id
|
158
|
+
config.endpoint = @config.endpoint
|
159
|
+
end
|
160
|
+
|
161
|
+
@user_event_service_stub = ::Google::Cloud::Retail::V2::UserEventService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
|
162
|
+
end
|
163
|
+
|
164
|
+
##
|
165
|
+
# Get the associated client for long-running operations.
|
166
|
+
#
|
167
|
+
# @return [::Google::Cloud::Retail::V2::UserEventService::Rest::Operations]
|
168
|
+
#
|
169
|
+
attr_reader :operations_client
|
170
|
+
|
171
|
+
##
|
172
|
+
# Get the associated client for mix-in of the Locations.
|
173
|
+
#
|
174
|
+
# @return [Google::Cloud::Location::Locations::Rest::Client]
|
175
|
+
#
|
176
|
+
attr_reader :location_client
|
177
|
+
|
178
|
+
# Service calls
|
179
|
+
|
180
|
+
##
|
181
|
+
# Writes a single user event.
|
182
|
+
#
|
183
|
+
# @overload write_user_event(request, options = nil)
|
184
|
+
# Pass arguments to `write_user_event` via a request object, either of type
|
185
|
+
# {::Google::Cloud::Retail::V2::WriteUserEventRequest} or an equivalent Hash.
|
186
|
+
#
|
187
|
+
# @param request [::Google::Cloud::Retail::V2::WriteUserEventRequest, ::Hash]
|
188
|
+
# A request object representing the call parameters. Required. To specify no
|
189
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
190
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
191
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
192
|
+
#
|
193
|
+
# @overload write_user_event(parent: nil, user_event: nil, write_async: nil)
|
194
|
+
# Pass arguments to `write_user_event` via keyword arguments. Note that at
|
195
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
196
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
197
|
+
#
|
198
|
+
# @param parent [::String]
|
199
|
+
# Required. The parent catalog resource name, such as
|
200
|
+
# `projects/1234/locations/global/catalogs/default_catalog`.
|
201
|
+
# @param user_event [::Google::Cloud::Retail::V2::UserEvent, ::Hash]
|
202
|
+
# Required. User event to write.
|
203
|
+
# @param write_async [::Boolean]
|
204
|
+
# If set to true, the user event will be written asynchronously after
|
205
|
+
# validation, and the API will respond without waiting for the write.
|
206
|
+
# Therefore, silent failures can occur even if the API returns success. In
|
207
|
+
# case of silent failures, error messages can be found in Stackdriver logs.
|
208
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
209
|
+
# @yieldparam result [::Google::Cloud::Retail::V2::UserEvent]
|
210
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
211
|
+
#
|
212
|
+
# @return [::Google::Cloud::Retail::V2::UserEvent]
|
213
|
+
#
|
214
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
215
|
+
def write_user_event request, options = nil
|
216
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
217
|
+
|
218
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::WriteUserEventRequest
|
219
|
+
|
220
|
+
# Converts hash and nil to an options object
|
221
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
222
|
+
|
223
|
+
# Customize the options with defaults
|
224
|
+
call_metadata = @config.rpcs.write_user_event.metadata.to_h
|
225
|
+
|
226
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
227
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
228
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
229
|
+
gapic_version: ::Google::Cloud::Retail::V2::VERSION,
|
230
|
+
transports_version_send: [:rest]
|
231
|
+
|
232
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
233
|
+
|
234
|
+
options.apply_defaults timeout: @config.rpcs.write_user_event.timeout,
|
235
|
+
metadata: call_metadata,
|
236
|
+
retry_policy: @config.rpcs.write_user_event.retry_policy
|
237
|
+
|
238
|
+
options.apply_defaults timeout: @config.timeout,
|
239
|
+
metadata: @config.metadata,
|
240
|
+
retry_policy: @config.retry_policy
|
241
|
+
|
242
|
+
@user_event_service_stub.write_user_event request, options do |result, operation|
|
243
|
+
yield result, operation if block_given?
|
244
|
+
return result
|
245
|
+
end
|
246
|
+
rescue ::Gapic::Rest::Error => e
|
247
|
+
raise ::Google::Cloud::Error.from_error(e)
|
248
|
+
end
|
249
|
+
|
250
|
+
##
|
251
|
+
# Writes a single user event from the browser. This uses a GET request to
|
252
|
+
# due to browser restriction of POST-ing to a 3rd party domain.
|
253
|
+
#
|
254
|
+
# This method is used only by the Retail API JavaScript pixel and Google Tag
|
255
|
+
# Manager. Users should not call this method directly.
|
256
|
+
#
|
257
|
+
# @overload collect_user_event(request, options = nil)
|
258
|
+
# Pass arguments to `collect_user_event` via a request object, either of type
|
259
|
+
# {::Google::Cloud::Retail::V2::CollectUserEventRequest} or an equivalent Hash.
|
260
|
+
#
|
261
|
+
# @param request [::Google::Cloud::Retail::V2::CollectUserEventRequest, ::Hash]
|
262
|
+
# A request object representing the call parameters. Required. To specify no
|
263
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
264
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
265
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
266
|
+
#
|
267
|
+
# @overload collect_user_event(prebuilt_rule: nil, parent: nil, user_event: nil, uri: nil, ets: nil, raw_json: nil)
|
268
|
+
# Pass arguments to `collect_user_event` via keyword arguments. Note that at
|
269
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
270
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
271
|
+
#
|
272
|
+
# @param prebuilt_rule [::String]
|
273
|
+
# The prebuilt rule name that can convert a specific type of raw_json.
|
274
|
+
# For example: "default_schema/v1.0"
|
275
|
+
# @param parent [::String]
|
276
|
+
# Required. The parent catalog name, such as
|
277
|
+
# `projects/1234/locations/global/catalogs/default_catalog`.
|
278
|
+
# @param user_event [::String]
|
279
|
+
# Required. URL encoded UserEvent proto with a length limit of 2,000,000
|
280
|
+
# characters.
|
281
|
+
# @param uri [::String]
|
282
|
+
# The URL including cgi-parameters but excluding the hash fragment with a
|
283
|
+
# length limit of 5,000 characters. This is often more useful than the
|
284
|
+
# referer URL, because many browsers only send the domain for 3rd party
|
285
|
+
# requests.
|
286
|
+
# @param ets [::Integer]
|
287
|
+
# The event timestamp in milliseconds. This prevents browser caching of
|
288
|
+
# otherwise identical get requests. The name is abbreviated to reduce the
|
289
|
+
# payload bytes.
|
290
|
+
# @param raw_json [::String]
|
291
|
+
# An arbitrary serialized JSON string that contains necessary information
|
292
|
+
# that can comprise a user event. When this field is specified, the
|
293
|
+
# user_event field will be ignored. Note: line-delimited JSON is not
|
294
|
+
# supported, a single JSON only.
|
295
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
296
|
+
# @yieldparam result [::Google::Api::HttpBody]
|
297
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
298
|
+
#
|
299
|
+
# @return [::Google::Api::HttpBody]
|
300
|
+
#
|
301
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
302
|
+
def collect_user_event request, options = nil
|
303
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
304
|
+
|
305
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::CollectUserEventRequest
|
306
|
+
|
307
|
+
# Converts hash and nil to an options object
|
308
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
309
|
+
|
310
|
+
# Customize the options with defaults
|
311
|
+
call_metadata = @config.rpcs.collect_user_event.metadata.to_h
|
312
|
+
|
313
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
314
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
315
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
316
|
+
gapic_version: ::Google::Cloud::Retail::V2::VERSION,
|
317
|
+
transports_version_send: [:rest]
|
318
|
+
|
319
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
320
|
+
|
321
|
+
options.apply_defaults timeout: @config.rpcs.collect_user_event.timeout,
|
322
|
+
metadata: call_metadata,
|
323
|
+
retry_policy: @config.rpcs.collect_user_event.retry_policy
|
324
|
+
|
325
|
+
options.apply_defaults timeout: @config.timeout,
|
326
|
+
metadata: @config.metadata,
|
327
|
+
retry_policy: @config.retry_policy
|
328
|
+
|
329
|
+
@user_event_service_stub.collect_user_event request, options do |result, operation|
|
330
|
+
yield result, operation if block_given?
|
331
|
+
return result
|
332
|
+
end
|
333
|
+
rescue ::Gapic::Rest::Error => e
|
334
|
+
raise ::Google::Cloud::Error.from_error(e)
|
335
|
+
end
|
336
|
+
|
337
|
+
##
|
338
|
+
# Deletes permanently all user events specified by the filter provided.
|
339
|
+
# Depending on the number of events specified by the filter, this operation
|
340
|
+
# could take hours or days to complete. To test a filter, use the list
|
341
|
+
# command first.
|
342
|
+
#
|
343
|
+
# @overload purge_user_events(request, options = nil)
|
344
|
+
# Pass arguments to `purge_user_events` via a request object, either of type
|
345
|
+
# {::Google::Cloud::Retail::V2::PurgeUserEventsRequest} or an equivalent Hash.
|
346
|
+
#
|
347
|
+
# @param request [::Google::Cloud::Retail::V2::PurgeUserEventsRequest, ::Hash]
|
348
|
+
# A request object representing the call parameters. Required. To specify no
|
349
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
350
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
351
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
352
|
+
#
|
353
|
+
# @overload purge_user_events(parent: nil, filter: nil, force: nil)
|
354
|
+
# Pass arguments to `purge_user_events` via keyword arguments. Note that at
|
355
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
356
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
357
|
+
#
|
358
|
+
# @param parent [::String]
|
359
|
+
# Required. The resource name of the catalog under which the events are
|
360
|
+
# created. The format is
|
361
|
+
# `projects/${projectId}/locations/global/catalogs/${catalogId}`
|
362
|
+
# @param filter [::String]
|
363
|
+
# Required. The filter string to specify the events to be deleted with a
|
364
|
+
# length limit of 5,000 characters. Empty string filter is not allowed. The
|
365
|
+
# eligible fields for filtering are:
|
366
|
+
#
|
367
|
+
# * `eventType`: Double quoted
|
368
|
+
# {::Google::Cloud::Retail::V2::UserEvent#event_type UserEvent.event_type} string.
|
369
|
+
# * `eventTime`: in ISO 8601 "zulu" format.
|
370
|
+
# * `visitorId`: Double quoted string. Specifying this will delete all
|
371
|
+
# events associated with a visitor.
|
372
|
+
# * `userId`: Double quoted string. Specifying this will delete all events
|
373
|
+
# associated with a user.
|
374
|
+
#
|
375
|
+
# Examples:
|
376
|
+
#
|
377
|
+
# * Deleting all events in a time range:
|
378
|
+
# `eventTime > "2012-04-23T18:25:43.511Z"
|
379
|
+
# eventTime < "2012-04-23T18:30:43.511Z"`
|
380
|
+
# * Deleting specific eventType in time range:
|
381
|
+
# `eventTime > "2012-04-23T18:25:43.511Z" eventType = "detail-page-view"`
|
382
|
+
# * Deleting all events for a specific visitor:
|
383
|
+
# `visitorId = "visitor1024"`
|
384
|
+
#
|
385
|
+
# The filtering fields are assumed to have an implicit AND.
|
386
|
+
# @param force [::Boolean]
|
387
|
+
# Actually perform the purge.
|
388
|
+
# If `force` is set to false, the method will return the expected purge count
|
389
|
+
# without deleting any user events.
|
390
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
391
|
+
# @yieldparam result [::Gapic::Operation]
|
392
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
393
|
+
#
|
394
|
+
# @return [::Gapic::Operation]
|
395
|
+
#
|
396
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
397
|
+
def purge_user_events request, options = nil
|
398
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
399
|
+
|
400
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::PurgeUserEventsRequest
|
401
|
+
|
402
|
+
# Converts hash and nil to an options object
|
403
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
404
|
+
|
405
|
+
# Customize the options with defaults
|
406
|
+
call_metadata = @config.rpcs.purge_user_events.metadata.to_h
|
407
|
+
|
408
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
409
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
410
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
411
|
+
gapic_version: ::Google::Cloud::Retail::V2::VERSION,
|
412
|
+
transports_version_send: [:rest]
|
413
|
+
|
414
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
415
|
+
|
416
|
+
options.apply_defaults timeout: @config.rpcs.purge_user_events.timeout,
|
417
|
+
metadata: call_metadata,
|
418
|
+
retry_policy: @config.rpcs.purge_user_events.retry_policy
|
419
|
+
|
420
|
+
options.apply_defaults timeout: @config.timeout,
|
421
|
+
metadata: @config.metadata,
|
422
|
+
retry_policy: @config.retry_policy
|
423
|
+
|
424
|
+
@user_event_service_stub.purge_user_events request, options do |result, operation|
|
425
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
426
|
+
yield result, operation if block_given?
|
427
|
+
return result
|
428
|
+
end
|
429
|
+
rescue ::Gapic::Rest::Error => e
|
430
|
+
raise ::Google::Cloud::Error.from_error(e)
|
431
|
+
end
|
432
|
+
|
433
|
+
##
|
434
|
+
# Bulk import of User events. Request processing might be
|
435
|
+
# synchronous. Events that already exist are skipped.
|
436
|
+
# Use this method for backfilling historical user events.
|
437
|
+
#
|
438
|
+
# `Operation.response` is of type `ImportResponse`. Note that it is
|
439
|
+
# possible for a subset of the items to be successfully inserted.
|
440
|
+
# `Operation.metadata` is of type `ImportMetadata`.
|
441
|
+
#
|
442
|
+
# @overload import_user_events(request, options = nil)
|
443
|
+
# Pass arguments to `import_user_events` via a request object, either of type
|
444
|
+
# {::Google::Cloud::Retail::V2::ImportUserEventsRequest} or an equivalent Hash.
|
445
|
+
#
|
446
|
+
# @param request [::Google::Cloud::Retail::V2::ImportUserEventsRequest, ::Hash]
|
447
|
+
# A request object representing the call parameters. Required. To specify no
|
448
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
449
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
450
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
451
|
+
#
|
452
|
+
# @overload import_user_events(parent: nil, input_config: nil, errors_config: nil)
|
453
|
+
# Pass arguments to `import_user_events` via keyword arguments. Note that at
|
454
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
455
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
456
|
+
#
|
457
|
+
# @param parent [::String]
|
458
|
+
# Required. `projects/1234/locations/global/catalogs/default_catalog`
|
459
|
+
# @param input_config [::Google::Cloud::Retail::V2::UserEventInputConfig, ::Hash]
|
460
|
+
# Required. The desired input location of the data.
|
461
|
+
# @param errors_config [::Google::Cloud::Retail::V2::ImportErrorsConfig, ::Hash]
|
462
|
+
# The desired location of errors incurred during the Import. Cannot be set
|
463
|
+
# for inline user event imports.
|
464
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
465
|
+
# @yieldparam result [::Gapic::Operation]
|
466
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
467
|
+
#
|
468
|
+
# @return [::Gapic::Operation]
|
469
|
+
#
|
470
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
471
|
+
def import_user_events request, options = nil
|
472
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
473
|
+
|
474
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ImportUserEventsRequest
|
475
|
+
|
476
|
+
# Converts hash and nil to an options object
|
477
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
478
|
+
|
479
|
+
# Customize the options with defaults
|
480
|
+
call_metadata = @config.rpcs.import_user_events.metadata.to_h
|
481
|
+
|
482
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
483
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
484
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
485
|
+
gapic_version: ::Google::Cloud::Retail::V2::VERSION,
|
486
|
+
transports_version_send: [:rest]
|
487
|
+
|
488
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
489
|
+
|
490
|
+
options.apply_defaults timeout: @config.rpcs.import_user_events.timeout,
|
491
|
+
metadata: call_metadata,
|
492
|
+
retry_policy: @config.rpcs.import_user_events.retry_policy
|
493
|
+
|
494
|
+
options.apply_defaults timeout: @config.timeout,
|
495
|
+
metadata: @config.metadata,
|
496
|
+
retry_policy: @config.retry_policy
|
497
|
+
|
498
|
+
@user_event_service_stub.import_user_events request, options do |result, operation|
|
499
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
500
|
+
yield result, operation if block_given?
|
501
|
+
return result
|
502
|
+
end
|
503
|
+
rescue ::Gapic::Rest::Error => e
|
504
|
+
raise ::Google::Cloud::Error.from_error(e)
|
505
|
+
end
|
506
|
+
|
507
|
+
##
|
508
|
+
# Starts a user-event rejoin operation with latest product catalog. Events
|
509
|
+
# are not annotated with detailed product information for products that are
|
510
|
+
# missing from the catalog when the user event is ingested. These
|
511
|
+
# events are stored as unjoined events with limited usage on training and
|
512
|
+
# serving. You can use this method to start a join operation on specified
|
513
|
+
# events with the latest version of product catalog. You can also use this
|
514
|
+
# method to correct events joined with the wrong product catalog. A rejoin
|
515
|
+
# operation can take hours or days to complete.
|
516
|
+
#
|
517
|
+
# @overload rejoin_user_events(request, options = nil)
|
518
|
+
# Pass arguments to `rejoin_user_events` via a request object, either of type
|
519
|
+
# {::Google::Cloud::Retail::V2::RejoinUserEventsRequest} or an equivalent Hash.
|
520
|
+
#
|
521
|
+
# @param request [::Google::Cloud::Retail::V2::RejoinUserEventsRequest, ::Hash]
|
522
|
+
# A request object representing the call parameters. Required. To specify no
|
523
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
524
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
525
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
526
|
+
#
|
527
|
+
# @overload rejoin_user_events(parent: nil, user_event_rejoin_scope: nil)
|
528
|
+
# Pass arguments to `rejoin_user_events` via keyword arguments. Note that at
|
529
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
530
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
531
|
+
#
|
532
|
+
# @param parent [::String]
|
533
|
+
# Required. The parent catalog resource name, such as
|
534
|
+
# `projects/1234/locations/global/catalogs/default_catalog`.
|
535
|
+
# @param user_event_rejoin_scope [::Google::Cloud::Retail::V2::RejoinUserEventsRequest::UserEventRejoinScope]
|
536
|
+
# The type of the user event rejoin to define the scope and range of the user
|
537
|
+
# events to be rejoined with the latest product catalog. Defaults to
|
538
|
+
# `USER_EVENT_REJOIN_SCOPE_UNSPECIFIED` if this field is not set, or set to
|
539
|
+
# an invalid integer value.
|
540
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
541
|
+
# @yieldparam result [::Gapic::Operation]
|
542
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
543
|
+
#
|
544
|
+
# @return [::Gapic::Operation]
|
545
|
+
#
|
546
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
547
|
+
def rejoin_user_events request, options = nil
|
548
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
549
|
+
|
550
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::RejoinUserEventsRequest
|
551
|
+
|
552
|
+
# Converts hash and nil to an options object
|
553
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
554
|
+
|
555
|
+
# Customize the options with defaults
|
556
|
+
call_metadata = @config.rpcs.rejoin_user_events.metadata.to_h
|
557
|
+
|
558
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
559
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
560
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
561
|
+
gapic_version: ::Google::Cloud::Retail::V2::VERSION,
|
562
|
+
transports_version_send: [:rest]
|
563
|
+
|
564
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
565
|
+
|
566
|
+
options.apply_defaults timeout: @config.rpcs.rejoin_user_events.timeout,
|
567
|
+
metadata: call_metadata,
|
568
|
+
retry_policy: @config.rpcs.rejoin_user_events.retry_policy
|
569
|
+
|
570
|
+
options.apply_defaults timeout: @config.timeout,
|
571
|
+
metadata: @config.metadata,
|
572
|
+
retry_policy: @config.retry_policy
|
573
|
+
|
574
|
+
@user_event_service_stub.rejoin_user_events request, options do |result, operation|
|
575
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
576
|
+
yield result, operation if block_given?
|
577
|
+
return result
|
578
|
+
end
|
579
|
+
rescue ::Gapic::Rest::Error => e
|
580
|
+
raise ::Google::Cloud::Error.from_error(e)
|
581
|
+
end
|
582
|
+
|
583
|
+
##
|
584
|
+
# Configuration class for the UserEventService REST API.
|
585
|
+
#
|
586
|
+
# This class represents the configuration for UserEventService REST,
|
587
|
+
# providing control over timeouts, retry behavior, logging, transport
|
588
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
589
|
+
# applied individually to specific RPCs. See
|
590
|
+
# {::Google::Cloud::Retail::V2::UserEventService::Rest::Client::Configuration::Rpcs}
|
591
|
+
# for a list of RPCs that can be configured independently.
|
592
|
+
#
|
593
|
+
# Configuration can be applied globally to all clients, or to a single client
|
594
|
+
# on construction.
|
595
|
+
#
|
596
|
+
# @example
|
597
|
+
#
|
598
|
+
# # Modify the global config, setting the timeout for
|
599
|
+
# # write_user_event to 20 seconds,
|
600
|
+
# # and all remaining timeouts to 10 seconds.
|
601
|
+
# ::Google::Cloud::Retail::V2::UserEventService::Rest::Client.configure do |config|
|
602
|
+
# config.timeout = 10.0
|
603
|
+
# config.rpcs.write_user_event.timeout = 20.0
|
604
|
+
# end
|
605
|
+
#
|
606
|
+
# # Apply the above configuration only to a new client.
|
607
|
+
# client = ::Google::Cloud::Retail::V2::UserEventService::Rest::Client.new do |config|
|
608
|
+
# config.timeout = 10.0
|
609
|
+
# config.rpcs.write_user_event.timeout = 20.0
|
610
|
+
# end
|
611
|
+
#
|
612
|
+
# @!attribute [rw] endpoint
|
613
|
+
# The hostname or hostname:port of the service endpoint.
|
614
|
+
# Defaults to `"retail.googleapis.com"`.
|
615
|
+
# @return [::String]
|
616
|
+
# @!attribute [rw] credentials
|
617
|
+
# Credentials to send with calls. You may provide any of the following types:
|
618
|
+
# * (`String`) The path to a service account key file in JSON format
|
619
|
+
# * (`Hash`) A service account key as a Hash
|
620
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
621
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
622
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
623
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
624
|
+
# * (`nil`) indicating no credentials
|
625
|
+
# @return [::Object]
|
626
|
+
# @!attribute [rw] scope
|
627
|
+
# The OAuth scopes
|
628
|
+
# @return [::Array<::String>]
|
629
|
+
# @!attribute [rw] lib_name
|
630
|
+
# The library name as recorded in instrumentation and logging
|
631
|
+
# @return [::String]
|
632
|
+
# @!attribute [rw] lib_version
|
633
|
+
# The library version as recorded in instrumentation and logging
|
634
|
+
# @return [::String]
|
635
|
+
# @!attribute [rw] timeout
|
636
|
+
# The call timeout in seconds.
|
637
|
+
# @return [::Numeric]
|
638
|
+
# @!attribute [rw] metadata
|
639
|
+
# Additional headers to be sent with the call.
|
640
|
+
# @return [::Hash{::Symbol=>::String}]
|
641
|
+
# @!attribute [rw] retry_policy
|
642
|
+
# The retry policy. The value is a hash with the following keys:
|
643
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
644
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
645
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
646
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
647
|
+
# trigger a retry.
|
648
|
+
# @return [::Hash]
|
649
|
+
# @!attribute [rw] quota_project
|
650
|
+
# A separate project against which to charge quota.
|
651
|
+
# @return [::String]
|
652
|
+
#
|
653
|
+
class Configuration
|
654
|
+
extend ::Gapic::Config
|
655
|
+
|
656
|
+
config_attr :endpoint, "retail.googleapis.com", ::String
|
657
|
+
config_attr :credentials, nil do |value|
|
658
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
659
|
+
allowed.any? { |klass| klass === value }
|
660
|
+
end
|
661
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
662
|
+
config_attr :lib_name, nil, ::String, nil
|
663
|
+
config_attr :lib_version, nil, ::String, nil
|
664
|
+
config_attr :timeout, nil, ::Numeric, nil
|
665
|
+
config_attr :metadata, nil, ::Hash, nil
|
666
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
667
|
+
config_attr :quota_project, nil, ::String, nil
|
668
|
+
|
669
|
+
# @private
|
670
|
+
def initialize parent_config = nil
|
671
|
+
@parent_config = parent_config unless parent_config.nil?
|
672
|
+
|
673
|
+
yield self if block_given?
|
674
|
+
end
|
675
|
+
|
676
|
+
##
|
677
|
+
# Configurations for individual RPCs
|
678
|
+
# @return [Rpcs]
|
679
|
+
#
|
680
|
+
def rpcs
|
681
|
+
@rpcs ||= begin
|
682
|
+
parent_rpcs = nil
|
683
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
684
|
+
Rpcs.new parent_rpcs
|
685
|
+
end
|
686
|
+
end
|
687
|
+
|
688
|
+
##
|
689
|
+
# Configuration RPC class for the UserEventService API.
|
690
|
+
#
|
691
|
+
# Includes fields providing the configuration for each RPC in this service.
|
692
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
693
|
+
# the following configuration fields:
|
694
|
+
#
|
695
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
696
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
697
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
698
|
+
# include the following keys:
|
699
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
700
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
701
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
702
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
703
|
+
# trigger a retry.
|
704
|
+
#
|
705
|
+
class Rpcs
|
706
|
+
##
|
707
|
+
# RPC-specific configuration for `write_user_event`
|
708
|
+
# @return [::Gapic::Config::Method]
|
709
|
+
#
|
710
|
+
attr_reader :write_user_event
|
711
|
+
##
|
712
|
+
# RPC-specific configuration for `collect_user_event`
|
713
|
+
# @return [::Gapic::Config::Method]
|
714
|
+
#
|
715
|
+
attr_reader :collect_user_event
|
716
|
+
##
|
717
|
+
# RPC-specific configuration for `purge_user_events`
|
718
|
+
# @return [::Gapic::Config::Method]
|
719
|
+
#
|
720
|
+
attr_reader :purge_user_events
|
721
|
+
##
|
722
|
+
# RPC-specific configuration for `import_user_events`
|
723
|
+
# @return [::Gapic::Config::Method]
|
724
|
+
#
|
725
|
+
attr_reader :import_user_events
|
726
|
+
##
|
727
|
+
# RPC-specific configuration for `rejoin_user_events`
|
728
|
+
# @return [::Gapic::Config::Method]
|
729
|
+
#
|
730
|
+
attr_reader :rejoin_user_events
|
731
|
+
|
732
|
+
# @private
|
733
|
+
def initialize parent_rpcs = nil
|
734
|
+
write_user_event_config = parent_rpcs.write_user_event if parent_rpcs.respond_to? :write_user_event
|
735
|
+
@write_user_event = ::Gapic::Config::Method.new write_user_event_config
|
736
|
+
collect_user_event_config = parent_rpcs.collect_user_event if parent_rpcs.respond_to? :collect_user_event
|
737
|
+
@collect_user_event = ::Gapic::Config::Method.new collect_user_event_config
|
738
|
+
purge_user_events_config = parent_rpcs.purge_user_events if parent_rpcs.respond_to? :purge_user_events
|
739
|
+
@purge_user_events = ::Gapic::Config::Method.new purge_user_events_config
|
740
|
+
import_user_events_config = parent_rpcs.import_user_events if parent_rpcs.respond_to? :import_user_events
|
741
|
+
@import_user_events = ::Gapic::Config::Method.new import_user_events_config
|
742
|
+
rejoin_user_events_config = parent_rpcs.rejoin_user_events if parent_rpcs.respond_to? :rejoin_user_events
|
743
|
+
@rejoin_user_events = ::Gapic::Config::Method.new rejoin_user_events_config
|
744
|
+
|
745
|
+
yield self if block_given?
|
746
|
+
end
|
747
|
+
end
|
748
|
+
end
|
749
|
+
end
|
750
|
+
end
|
751
|
+
end
|
752
|
+
end
|
753
|
+
end
|
754
|
+
end
|
755
|
+
end
|