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