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