google-cloud-retail-v2 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-retail-v2.rb +21 -0
- data/lib/google/cloud/retail/v2.rb +41 -0
- data/lib/google/cloud/retail/v2/catalog_pb.rb +32 -0
- data/lib/google/cloud/retail/v2/catalog_service.rb +49 -0
- data/lib/google/cloud/retail/v2/catalog_service/client.rb +490 -0
- data/lib/google/cloud/retail/v2/catalog_service/credentials.rb +51 -0
- data/lib/google/cloud/retail/v2/catalog_service/paths.rb +69 -0
- data/lib/google/cloud/retail/v2/catalog_service_pb.rb +42 -0
- data/lib/google/cloud/retail/v2/catalog_service_services_pb.rb +48 -0
- data/lib/google/cloud/retail/v2/common_pb.rb +46 -0
- data/lib/google/cloud/retail/v2/import_config_pb.rb +104 -0
- data/lib/google/cloud/retail/v2/prediction_service.rb +49 -0
- data/lib/google/cloud/retail/v2/prediction_service/client.rb +472 -0
- data/lib/google/cloud/retail/v2/prediction_service/credentials.rb +51 -0
- data/lib/google/cloud/retail/v2/prediction_service/paths.rb +56 -0
- data/lib/google/cloud/retail/v2/prediction_service_pb.rb +46 -0
- data/lib/google/cloud/retail/v2/prediction_service_services_pb.rb +45 -0
- data/lib/google/cloud/retail/v2/product_pb.rb +58 -0
- data/lib/google/cloud/retail/v2/product_service.rb +51 -0
- data/lib/google/cloud/retail/v2/product_service/client.rb +752 -0
- data/lib/google/cloud/retail/v2/product_service/credentials.rb +51 -0
- data/lib/google/cloud/retail/v2/product_service/operations.rb +570 -0
- data/lib/google/cloud/retail/v2/product_service/paths.rb +77 -0
- data/lib/google/cloud/retail/v2/product_service_pb.rb +47 -0
- data/lib/google/cloud/retail/v2/product_service_services_pb.rb +60 -0
- data/lib/google/cloud/retail/v2/purge_config_pb.rb +33 -0
- data/lib/google/cloud/retail/v2/user_event_pb.rb +55 -0
- data/lib/google/cloud/retail/v2/user_event_service.rb +50 -0
- data/lib/google/cloud/retail/v2/user_event_service/client.rb +760 -0
- data/lib/google/cloud/retail/v2/user_event_service/credentials.rb +51 -0
- data/lib/google/cloud/retail/v2/user_event_service/operations.rb +570 -0
- data/lib/google/cloud/retail/v2/user_event_service/paths.rb +56 -0
- data/lib/google/cloud/retail/v2/user_event_service_pb.rb +56 -0
- data/lib/google/cloud/retail/v2/user_event_service_services_pb.rb +72 -0
- data/lib/google/cloud/retail/v2/version.rb +28 -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/retail/v2/catalog.rb +101 -0
- data/proto_docs/google/cloud/retail/v2/catalog_service.rb +106 -0
- data/proto_docs/google/cloud/retail/v2/common.rb +169 -0
- data/proto_docs/google/cloud/retail/v2/import_config.rb +270 -0
- data/proto_docs/google/cloud/retail/v2/prediction_service.rb +205 -0
- data/proto_docs/google/cloud/retail/v2/product.rb +278 -0
- data/proto_docs/google/cloud/retail/v2/product_service.rb +117 -0
- data/proto_docs/google/cloud/retail/v2/purge_config.rb +85 -0
- data/proto_docs/google/cloud/retail/v2/user_event.rb +238 -0
- data/proto_docs/google/cloud/retail/v2/user_event_service.rb +114 -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/protobuf/wrappers.rb +121 -0
- data/proto_docs/google/rpc/status.rb +46 -0
- metadata +245 -0
@@ -0,0 +1,77 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
|
20
|
+
module Google
|
21
|
+
module Cloud
|
22
|
+
module Retail
|
23
|
+
module V2
|
24
|
+
module ProductService
|
25
|
+
# Path helper methods for the ProductService API.
|
26
|
+
module Paths
|
27
|
+
##
|
28
|
+
# Create a fully-qualified Branch resource string.
|
29
|
+
#
|
30
|
+
# The resource will be in the following format:
|
31
|
+
#
|
32
|
+
# `projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}`
|
33
|
+
#
|
34
|
+
# @param project [String]
|
35
|
+
# @param location [String]
|
36
|
+
# @param catalog [String]
|
37
|
+
# @param branch [String]
|
38
|
+
#
|
39
|
+
# @return [::String]
|
40
|
+
def branch_path project:, location:, catalog:, branch:
|
41
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
42
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
43
|
+
raise ::ArgumentError, "catalog cannot contain /" if catalog.to_s.include? "/"
|
44
|
+
|
45
|
+
"projects/#{project}/locations/#{location}/catalogs/#{catalog}/branches/#{branch}"
|
46
|
+
end
|
47
|
+
|
48
|
+
##
|
49
|
+
# Create a fully-qualified Product resource string.
|
50
|
+
#
|
51
|
+
# The resource will be in the following format:
|
52
|
+
#
|
53
|
+
# `projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}`
|
54
|
+
#
|
55
|
+
# @param project [String]
|
56
|
+
# @param location [String]
|
57
|
+
# @param catalog [String]
|
58
|
+
# @param branch [String]
|
59
|
+
# @param product [String]
|
60
|
+
#
|
61
|
+
# @return [::String]
|
62
|
+
def product_path project:, location:, catalog:, branch:, product:
|
63
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
64
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
65
|
+
raise ::ArgumentError, "catalog cannot contain /" if catalog.to_s.include? "/"
|
66
|
+
raise ::ArgumentError, "branch cannot contain /" if branch.to_s.include? "/"
|
67
|
+
|
68
|
+
"projects/#{project}/locations/#{location}/catalogs/#{catalog}/branches/#{branch}/products/#{product}"
|
69
|
+
end
|
70
|
+
|
71
|
+
extend self
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/cloud/retail/v2/product_service.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'google/api/annotations_pb'
|
7
|
+
require 'google/api/client_pb'
|
8
|
+
require 'google/api/field_behavior_pb'
|
9
|
+
require 'google/api/resource_pb'
|
10
|
+
require 'google/cloud/retail/v2/import_config_pb'
|
11
|
+
require 'google/cloud/retail/v2/product_pb'
|
12
|
+
require 'google/cloud/retail/v2/purge_config_pb'
|
13
|
+
require 'google/longrunning/operations_pb'
|
14
|
+
require 'google/protobuf/empty_pb'
|
15
|
+
require 'google/protobuf/field_mask_pb'
|
16
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
17
|
+
add_file("google/cloud/retail/v2/product_service.proto", :syntax => :proto3) do
|
18
|
+
add_message "google.cloud.retail.v2.CreateProductRequest" do
|
19
|
+
optional :parent, :string, 1
|
20
|
+
optional :product, :message, 2, "google.cloud.retail.v2.Product"
|
21
|
+
optional :product_id, :string, 3
|
22
|
+
end
|
23
|
+
add_message "google.cloud.retail.v2.GetProductRequest" do
|
24
|
+
optional :name, :string, 1
|
25
|
+
end
|
26
|
+
add_message "google.cloud.retail.v2.UpdateProductRequest" do
|
27
|
+
optional :product, :message, 1, "google.cloud.retail.v2.Product"
|
28
|
+
optional :update_mask, :message, 2, "google.protobuf.FieldMask"
|
29
|
+
end
|
30
|
+
add_message "google.cloud.retail.v2.DeleteProductRequest" do
|
31
|
+
optional :name, :string, 1
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
module Google
|
37
|
+
module Cloud
|
38
|
+
module Retail
|
39
|
+
module V2
|
40
|
+
CreateProductRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CreateProductRequest").msgclass
|
41
|
+
GetProductRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.GetProductRequest").msgclass
|
42
|
+
UpdateProductRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UpdateProductRequest").msgclass
|
43
|
+
DeleteProductRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.DeleteProductRequest").msgclass
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# Source: google/cloud/retail/v2/product_service.proto for package 'Google.Cloud.Retail.V2'
|
3
|
+
# Original file comments:
|
4
|
+
# Copyright 2020 Google LLC
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require 'grpc'
|
20
|
+
require 'google/cloud/retail/v2/product_service_pb'
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Retail
|
25
|
+
module V2
|
26
|
+
module ProductService
|
27
|
+
# Service for ingesting [Product][google.cloud.retail.v2.Product] information
|
28
|
+
# of the customer's website.
|
29
|
+
class Service
|
30
|
+
|
31
|
+
include GRPC::GenericService
|
32
|
+
|
33
|
+
self.marshal_class_method = :encode
|
34
|
+
self.unmarshal_class_method = :decode
|
35
|
+
self.service_name = 'google.cloud.retail.v2.ProductService'
|
36
|
+
|
37
|
+
# Creates a [Product][google.cloud.retail.v2.Product].
|
38
|
+
rpc :CreateProduct, ::Google::Cloud::Retail::V2::CreateProductRequest, ::Google::Cloud::Retail::V2::Product
|
39
|
+
# Gets a [Product][google.cloud.retail.v2.Product].
|
40
|
+
rpc :GetProduct, ::Google::Cloud::Retail::V2::GetProductRequest, ::Google::Cloud::Retail::V2::Product
|
41
|
+
# Updates a [Product][google.cloud.retail.v2.Product].
|
42
|
+
rpc :UpdateProduct, ::Google::Cloud::Retail::V2::UpdateProductRequest, ::Google::Cloud::Retail::V2::Product
|
43
|
+
# Deletes a [Product][google.cloud.retail.v2.Product].
|
44
|
+
rpc :DeleteProduct, ::Google::Cloud::Retail::V2::DeleteProductRequest, ::Google::Protobuf::Empty
|
45
|
+
# Bulk import of multiple [Product][google.cloud.retail.v2.Product]s.
|
46
|
+
#
|
47
|
+
# Request processing may be synchronous. No partial updating is supported.
|
48
|
+
# Non-existing items are created.
|
49
|
+
#
|
50
|
+
# Note that it is possible for a subset of the
|
51
|
+
# [Product][google.cloud.retail.v2.Product]s to be successfully updated.
|
52
|
+
rpc :ImportProducts, ::Google::Cloud::Retail::V2::ImportProductsRequest, ::Google::Longrunning::Operation
|
53
|
+
end
|
54
|
+
|
55
|
+
Stub = Service.rpc_stub_class
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/cloud/retail/v2/purge_config.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'google/api/annotations_pb'
|
7
|
+
require 'google/api/field_behavior_pb'
|
8
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
9
|
+
add_file("google/cloud/retail/v2/purge_config.proto", :syntax => :proto3) do
|
10
|
+
add_message "google.cloud.retail.v2.PurgeMetadata" do
|
11
|
+
end
|
12
|
+
add_message "google.cloud.retail.v2.PurgeUserEventsRequest" do
|
13
|
+
optional :parent, :string, 1
|
14
|
+
optional :filter, :string, 2
|
15
|
+
optional :force, :bool, 3
|
16
|
+
end
|
17
|
+
add_message "google.cloud.retail.v2.PurgeUserEventsResponse" do
|
18
|
+
optional :purged_events_count, :int64, 1
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Cloud
|
25
|
+
module Retail
|
26
|
+
module V2
|
27
|
+
PurgeMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.PurgeMetadata").msgclass
|
28
|
+
PurgeUserEventsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.PurgeUserEventsRequest").msgclass
|
29
|
+
PurgeUserEventsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.PurgeUserEventsResponse").msgclass
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/cloud/retail/v2/user_event.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'google/api/annotations_pb'
|
7
|
+
require 'google/api/field_behavior_pb'
|
8
|
+
require 'google/cloud/retail/v2/common_pb'
|
9
|
+
require 'google/cloud/retail/v2/product_pb'
|
10
|
+
require 'google/protobuf/timestamp_pb'
|
11
|
+
require 'google/protobuf/wrappers_pb'
|
12
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
13
|
+
add_file("google/cloud/retail/v2/user_event.proto", :syntax => :proto3) do
|
14
|
+
add_message "google.cloud.retail.v2.UserEvent" do
|
15
|
+
optional :event_type, :string, 1
|
16
|
+
optional :visitor_id, :string, 2
|
17
|
+
optional :event_time, :message, 3, "google.protobuf.Timestamp"
|
18
|
+
repeated :experiment_ids, :string, 4
|
19
|
+
optional :attribution_token, :string, 5
|
20
|
+
repeated :product_details, :message, 6, "google.cloud.retail.v2.ProductDetail"
|
21
|
+
map :attributes, :string, :message, 7, "google.cloud.retail.v2.CustomAttribute"
|
22
|
+
optional :cart_id, :string, 8
|
23
|
+
optional :purchase_transaction, :message, 9, "google.cloud.retail.v2.PurchaseTransaction"
|
24
|
+
optional :search_query, :string, 10
|
25
|
+
repeated :page_categories, :string, 11
|
26
|
+
optional :user_info, :message, 12, "google.cloud.retail.v2.UserInfo"
|
27
|
+
optional :uri, :string, 13
|
28
|
+
optional :referrer_uri, :string, 14
|
29
|
+
optional :page_view_id, :string, 15
|
30
|
+
end
|
31
|
+
add_message "google.cloud.retail.v2.ProductDetail" do
|
32
|
+
optional :product, :message, 1, "google.cloud.retail.v2.Product"
|
33
|
+
optional :quantity, :message, 2, "google.protobuf.Int32Value"
|
34
|
+
end
|
35
|
+
add_message "google.cloud.retail.v2.PurchaseTransaction" do
|
36
|
+
optional :id, :string, 1
|
37
|
+
optional :revenue, :float, 2
|
38
|
+
optional :tax, :float, 3
|
39
|
+
optional :cost, :float, 4
|
40
|
+
optional :currency_code, :string, 5
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
module Google
|
46
|
+
module Cloud
|
47
|
+
module Retail
|
48
|
+
module V2
|
49
|
+
UserEvent = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UserEvent").msgclass
|
50
|
+
ProductDetail = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ProductDetail").msgclass
|
51
|
+
PurchaseTransaction = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.PurchaseTransaction").msgclass
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "gapic/common"
|
20
|
+
require "gapic/config"
|
21
|
+
require "gapic/config/method"
|
22
|
+
|
23
|
+
require "google/cloud/retail/v2/version"
|
24
|
+
|
25
|
+
require "google/cloud/retail/v2/user_event_service/credentials"
|
26
|
+
require "google/cloud/retail/v2/user_event_service/paths"
|
27
|
+
require "google/cloud/retail/v2/user_event_service/operations"
|
28
|
+
require "google/cloud/retail/v2/user_event_service/client"
|
29
|
+
|
30
|
+
module Google
|
31
|
+
module Cloud
|
32
|
+
module Retail
|
33
|
+
module V2
|
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/retail/v2/user_event_service"
|
40
|
+
# client = ::Google::Cloud::Retail::V2::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/retail/v2/user_event_service/helpers" if ::File.file? helper_path
|
@@ -0,0 +1,760 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/errors"
|
20
|
+
require "google/cloud/retail/v2/user_event_service_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Retail
|
25
|
+
module V2
|
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::Retail::V2::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::Retail::V2::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", "Retail", "V2"]
|
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.timeout = 60.0
|
69
|
+
default_config.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
|
77
|
+
end
|
78
|
+
yield @configure if block_given?
|
79
|
+
@configure
|
80
|
+
end
|
81
|
+
|
82
|
+
##
|
83
|
+
# Configure the UserEventService Client instance.
|
84
|
+
#
|
85
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
86
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
87
|
+
# should be made on {Client.configure}.
|
88
|
+
#
|
89
|
+
# See {::Google::Cloud::Retail::V2::UserEventService::Client::Configuration}
|
90
|
+
# for a description of the configuration fields.
|
91
|
+
#
|
92
|
+
# @yield [config] Configure the Client client.
|
93
|
+
# @yieldparam config [Client::Configuration]
|
94
|
+
#
|
95
|
+
# @return [Client::Configuration]
|
96
|
+
#
|
97
|
+
def configure
|
98
|
+
yield @config if block_given?
|
99
|
+
@config
|
100
|
+
end
|
101
|
+
|
102
|
+
##
|
103
|
+
# Create a new UserEventService client object.
|
104
|
+
#
|
105
|
+
# ## Examples
|
106
|
+
#
|
107
|
+
# To create a new UserEventService client with the default
|
108
|
+
# configuration:
|
109
|
+
#
|
110
|
+
# client = ::Google::Cloud::Retail::V2::UserEventService::Client.new
|
111
|
+
#
|
112
|
+
# To create a new UserEventService client with a custom
|
113
|
+
# configuration:
|
114
|
+
#
|
115
|
+
# client = ::Google::Cloud::Retail::V2::UserEventService::Client.new do |config|
|
116
|
+
# config.timeout = 10.0
|
117
|
+
# end
|
118
|
+
#
|
119
|
+
# @yield [config] Configure the UserEventService client.
|
120
|
+
# @yieldparam config [Client::Configuration]
|
121
|
+
#
|
122
|
+
def initialize
|
123
|
+
# These require statements are intentionally placed here to initialize
|
124
|
+
# the gRPC module only when it's required.
|
125
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
126
|
+
require "gapic/grpc"
|
127
|
+
require "google/cloud/retail/v2/user_event_service_services_pb"
|
128
|
+
|
129
|
+
# Create the configuration object
|
130
|
+
@config = Configuration.new Client.configure
|
131
|
+
|
132
|
+
# Yield the configuration if needed
|
133
|
+
yield @config if block_given?
|
134
|
+
|
135
|
+
# Create credentials
|
136
|
+
credentials = @config.credentials
|
137
|
+
credentials ||= Credentials.default scope: @config.scope
|
138
|
+
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
139
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
140
|
+
end
|
141
|
+
@quota_project_id = @config.quota_project
|
142
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
143
|
+
|
144
|
+
@operations_client = Operations.new do |config|
|
145
|
+
config.credentials = credentials
|
146
|
+
config.endpoint = @config.endpoint
|
147
|
+
end
|
148
|
+
|
149
|
+
@user_event_service_stub = ::Gapic::ServiceStub.new(
|
150
|
+
::Google::Cloud::Retail::V2::UserEventService::Stub,
|
151
|
+
credentials: credentials,
|
152
|
+
endpoint: @config.endpoint,
|
153
|
+
channel_args: @config.channel_args,
|
154
|
+
interceptors: @config.interceptors
|
155
|
+
)
|
156
|
+
end
|
157
|
+
|
158
|
+
##
|
159
|
+
# Get the associated client for long-running operations.
|
160
|
+
#
|
161
|
+
# @return [::Google::Cloud::Retail::V2::UserEventService::Operations]
|
162
|
+
#
|
163
|
+
attr_reader :operations_client
|
164
|
+
|
165
|
+
# Service calls
|
166
|
+
|
167
|
+
##
|
168
|
+
# Writes a single user event.
|
169
|
+
#
|
170
|
+
# @overload write_user_event(request, options = nil)
|
171
|
+
# Pass arguments to `write_user_event` via a request object, either of type
|
172
|
+
# {::Google::Cloud::Retail::V2::WriteUserEventRequest} or an equivalent Hash.
|
173
|
+
#
|
174
|
+
# @param request [::Google::Cloud::Retail::V2::WriteUserEventRequest, ::Hash]
|
175
|
+
# A request object representing the call parameters. Required. To specify no
|
176
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
177
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
178
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
179
|
+
#
|
180
|
+
# @overload write_user_event(parent: nil, user_event: nil)
|
181
|
+
# Pass arguments to `write_user_event` via keyword arguments. Note that at
|
182
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
183
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
184
|
+
#
|
185
|
+
# @param parent [::String]
|
186
|
+
# Required. The parent catalog resource name, such as
|
187
|
+
# "projects/1234/locations/global/catalogs/default_catalog".
|
188
|
+
# @param user_event [::Google::Cloud::Retail::V2::UserEvent, ::Hash]
|
189
|
+
# Required. User event to write.
|
190
|
+
#
|
191
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
192
|
+
# @yieldparam response [::Google::Cloud::Retail::V2::UserEvent]
|
193
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
194
|
+
#
|
195
|
+
# @return [::Google::Cloud::Retail::V2::UserEvent]
|
196
|
+
#
|
197
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
198
|
+
#
|
199
|
+
def write_user_event request, options = nil
|
200
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
201
|
+
|
202
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::WriteUserEventRequest
|
203
|
+
|
204
|
+
# Converts hash and nil to an options object
|
205
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
206
|
+
|
207
|
+
# Customize the options with defaults
|
208
|
+
metadata = @config.rpcs.write_user_event.metadata.to_h
|
209
|
+
|
210
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
211
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
212
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
213
|
+
gapic_version: ::Google::Cloud::Retail::V2::VERSION
|
214
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
215
|
+
|
216
|
+
header_params = {
|
217
|
+
"parent" => request.parent
|
218
|
+
}
|
219
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
220
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
221
|
+
|
222
|
+
options.apply_defaults timeout: @config.rpcs.write_user_event.timeout,
|
223
|
+
metadata: metadata,
|
224
|
+
retry_policy: @config.rpcs.write_user_event.retry_policy
|
225
|
+
options.apply_defaults metadata: @config.metadata,
|
226
|
+
retry_policy: @config.retry_policy
|
227
|
+
|
228
|
+
@user_event_service_stub.call_rpc :write_user_event, request, options: options do |response, operation|
|
229
|
+
yield response, operation if block_given?
|
230
|
+
return response
|
231
|
+
end
|
232
|
+
rescue ::GRPC::BadStatus => e
|
233
|
+
raise ::Google::Cloud::Error.from_error(e)
|
234
|
+
end
|
235
|
+
|
236
|
+
##
|
237
|
+
# Writes a single user event from the browser. This uses a GET request to
|
238
|
+
# due to browser restriction of POST-ing to a 3rd party domain.
|
239
|
+
#
|
240
|
+
# This method is used only by the Retail API JavaScript pixel and Google Tag
|
241
|
+
# Manager. Users should not call this method directly.
|
242
|
+
#
|
243
|
+
# @overload collect_user_event(request, options = nil)
|
244
|
+
# Pass arguments to `collect_user_event` via a request object, either of type
|
245
|
+
# {::Google::Cloud::Retail::V2::CollectUserEventRequest} or an equivalent Hash.
|
246
|
+
#
|
247
|
+
# @param request [::Google::Cloud::Retail::V2::CollectUserEventRequest, ::Hash]
|
248
|
+
# A request object representing the call parameters. Required. To specify no
|
249
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
250
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
251
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
252
|
+
#
|
253
|
+
# @overload collect_user_event(parent: nil, user_event: nil, uri: nil, ets: nil)
|
254
|
+
# Pass arguments to `collect_user_event` via keyword arguments. Note that at
|
255
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
256
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
257
|
+
#
|
258
|
+
# @param parent [::String]
|
259
|
+
# Required. The parent catalog name, such as
|
260
|
+
# "projects/1234/locations/global/catalogs/default_catalog".
|
261
|
+
# @param user_event [::String]
|
262
|
+
# Required. URL encoded UserEvent proto with a length limit of 2,000,000
|
263
|
+
# characters.
|
264
|
+
# @param uri [::String]
|
265
|
+
# The URL including cgi-parameters but excluding the hash fragment with a
|
266
|
+
# length limit of 5,000 characters. This is often more useful than the
|
267
|
+
# referer URL, because many browsers only send the domain for 3rd party
|
268
|
+
# requests.
|
269
|
+
# @param ets [::Integer]
|
270
|
+
# The event timestamp in milliseconds. This prevents browser caching of
|
271
|
+
# otherwise identical get requests. The name is abbreviated to reduce the
|
272
|
+
# payload bytes.
|
273
|
+
#
|
274
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
275
|
+
# @yieldparam response [::Google::Api::HttpBody]
|
276
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
277
|
+
#
|
278
|
+
# @return [::Google::Api::HttpBody]
|
279
|
+
#
|
280
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
281
|
+
#
|
282
|
+
def collect_user_event request, options = nil
|
283
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
284
|
+
|
285
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::CollectUserEventRequest
|
286
|
+
|
287
|
+
# Converts hash and nil to an options object
|
288
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
289
|
+
|
290
|
+
# Customize the options with defaults
|
291
|
+
metadata = @config.rpcs.collect_user_event.metadata.to_h
|
292
|
+
|
293
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
294
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
295
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
296
|
+
gapic_version: ::Google::Cloud::Retail::V2::VERSION
|
297
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
298
|
+
|
299
|
+
header_params = {
|
300
|
+
"parent" => request.parent
|
301
|
+
}
|
302
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
303
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
304
|
+
|
305
|
+
options.apply_defaults timeout: @config.rpcs.collect_user_event.timeout,
|
306
|
+
metadata: metadata,
|
307
|
+
retry_policy: @config.rpcs.collect_user_event.retry_policy
|
308
|
+
options.apply_defaults metadata: @config.metadata,
|
309
|
+
retry_policy: @config.retry_policy
|
310
|
+
|
311
|
+
@user_event_service_stub.call_rpc :collect_user_event, request, options: options do |response, operation|
|
312
|
+
yield response, operation if block_given?
|
313
|
+
return response
|
314
|
+
end
|
315
|
+
rescue ::GRPC::BadStatus => e
|
316
|
+
raise ::Google::Cloud::Error.from_error(e)
|
317
|
+
end
|
318
|
+
|
319
|
+
##
|
320
|
+
# Deletes permanently all user events specified by the filter provided.
|
321
|
+
# Depending on the number of events specified by the filter, this operation
|
322
|
+
# could take hours or days to complete. To test a filter, use the list
|
323
|
+
# command first.
|
324
|
+
#
|
325
|
+
# @overload purge_user_events(request, options = nil)
|
326
|
+
# Pass arguments to `purge_user_events` via a request object, either of type
|
327
|
+
# {::Google::Cloud::Retail::V2::PurgeUserEventsRequest} or an equivalent Hash.
|
328
|
+
#
|
329
|
+
# @param request [::Google::Cloud::Retail::V2::PurgeUserEventsRequest, ::Hash]
|
330
|
+
# A request object representing the call parameters. Required. To specify no
|
331
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
332
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
333
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
334
|
+
#
|
335
|
+
# @overload purge_user_events(parent: nil, filter: nil, force: nil)
|
336
|
+
# Pass arguments to `purge_user_events` via keyword arguments. Note that at
|
337
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
338
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
339
|
+
#
|
340
|
+
# @param parent [::String]
|
341
|
+
# Required. The resource name of the catalog under which the events are
|
342
|
+
# created. The format is
|
343
|
+
# "projects/$\\{projectId}/locations/global/catalogs/$\\{catalogId}"
|
344
|
+
# @param filter [::String]
|
345
|
+
# Required. The filter string to specify the events to be deleted with a
|
346
|
+
# length limit of 5,000 characters. Empty string filter is not allowed. The
|
347
|
+
# eligible fields for filtering are:
|
348
|
+
#
|
349
|
+
# * `eventType`: Double quoted
|
350
|
+
# {::Google::Cloud::Retail::V2::UserEvent#event_type UserEvent.event_type} string.
|
351
|
+
# * `eventTime`: in ISO 8601 "zulu" format.
|
352
|
+
# * `visitorId`: Double quoted string. Specifying this will delete all
|
353
|
+
# events associated with a visitor.
|
354
|
+
# * `userId`: Double quoted string. Specifying this will delete all events
|
355
|
+
# associated with a user.
|
356
|
+
#
|
357
|
+
# Examples:
|
358
|
+
#
|
359
|
+
# * Deleting all events in a time range:
|
360
|
+
# `eventTime > "2012-04-23T18:25:43.511Z"
|
361
|
+
# eventTime < "2012-04-23T18:30:43.511Z"`
|
362
|
+
# * Deleting specific eventType in time range:
|
363
|
+
# `eventTime > "2012-04-23T18:25:43.511Z" eventType = "detail-page-view"`
|
364
|
+
# * Deleting all events for a specific visitor:
|
365
|
+
# `visitorId = "visitor1024"`
|
366
|
+
#
|
367
|
+
# The filtering fields are assumed to have an implicit AND.
|
368
|
+
# @param force [::Boolean]
|
369
|
+
# Actually perform the purge.
|
370
|
+
# If `force` is set to false, the method will return the expected purge count
|
371
|
+
# without deleting any user events.
|
372
|
+
#
|
373
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
374
|
+
# @yieldparam response [::Gapic::Operation]
|
375
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
376
|
+
#
|
377
|
+
# @return [::Gapic::Operation]
|
378
|
+
#
|
379
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
380
|
+
#
|
381
|
+
def purge_user_events request, options = nil
|
382
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
383
|
+
|
384
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::PurgeUserEventsRequest
|
385
|
+
|
386
|
+
# Converts hash and nil to an options object
|
387
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
388
|
+
|
389
|
+
# Customize the options with defaults
|
390
|
+
metadata = @config.rpcs.purge_user_events.metadata.to_h
|
391
|
+
|
392
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
393
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
394
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
395
|
+
gapic_version: ::Google::Cloud::Retail::V2::VERSION
|
396
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
397
|
+
|
398
|
+
header_params = {
|
399
|
+
"parent" => request.parent
|
400
|
+
}
|
401
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
402
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
403
|
+
|
404
|
+
options.apply_defaults timeout: @config.rpcs.purge_user_events.timeout,
|
405
|
+
metadata: metadata,
|
406
|
+
retry_policy: @config.rpcs.purge_user_events.retry_policy
|
407
|
+
options.apply_defaults metadata: @config.metadata,
|
408
|
+
retry_policy: @config.retry_policy
|
409
|
+
|
410
|
+
@user_event_service_stub.call_rpc :purge_user_events, request, options: options do |response, operation|
|
411
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
412
|
+
yield response, operation if block_given?
|
413
|
+
return response
|
414
|
+
end
|
415
|
+
rescue ::GRPC::BadStatus => e
|
416
|
+
raise ::Google::Cloud::Error.from_error(e)
|
417
|
+
end
|
418
|
+
|
419
|
+
##
|
420
|
+
# Bulk import of User events. Request processing might be
|
421
|
+
# synchronous. Events that already exist are skipped.
|
422
|
+
# Use this method for backfilling historical user events.
|
423
|
+
#
|
424
|
+
# Operation.response is of type ImportResponse. Note that it is
|
425
|
+
# possible for a subset of the items to be successfully inserted.
|
426
|
+
# Operation.metadata is of type ImportMetadata.
|
427
|
+
#
|
428
|
+
# @overload import_user_events(request, options = nil)
|
429
|
+
# Pass arguments to `import_user_events` via a request object, either of type
|
430
|
+
# {::Google::Cloud::Retail::V2::ImportUserEventsRequest} or an equivalent Hash.
|
431
|
+
#
|
432
|
+
# @param request [::Google::Cloud::Retail::V2::ImportUserEventsRequest, ::Hash]
|
433
|
+
# A request object representing the call parameters. Required. To specify no
|
434
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
435
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
436
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
437
|
+
#
|
438
|
+
# @overload import_user_events(parent: nil, input_config: nil, errors_config: nil)
|
439
|
+
# Pass arguments to `import_user_events` via keyword arguments. Note that at
|
440
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
441
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
442
|
+
#
|
443
|
+
# @param parent [::String]
|
444
|
+
# Required. "projects/1234/locations/global/catalogs/default_catalog"
|
445
|
+
# @param input_config [::Google::Cloud::Retail::V2::UserEventInputConfig, ::Hash]
|
446
|
+
# Required. The desired input location of the data.
|
447
|
+
# @param errors_config [::Google::Cloud::Retail::V2::ImportErrorsConfig, ::Hash]
|
448
|
+
# The desired location of errors incurred during the Import. Cannot be set
|
449
|
+
# for inline user event imports.
|
450
|
+
#
|
451
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
452
|
+
# @yieldparam response [::Gapic::Operation]
|
453
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
454
|
+
#
|
455
|
+
# @return [::Gapic::Operation]
|
456
|
+
#
|
457
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
458
|
+
#
|
459
|
+
def import_user_events request, options = nil
|
460
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
461
|
+
|
462
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ImportUserEventsRequest
|
463
|
+
|
464
|
+
# Converts hash and nil to an options object
|
465
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
466
|
+
|
467
|
+
# Customize the options with defaults
|
468
|
+
metadata = @config.rpcs.import_user_events.metadata.to_h
|
469
|
+
|
470
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
471
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
472
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
473
|
+
gapic_version: ::Google::Cloud::Retail::V2::VERSION
|
474
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
475
|
+
|
476
|
+
header_params = {
|
477
|
+
"parent" => request.parent
|
478
|
+
}
|
479
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
480
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
481
|
+
|
482
|
+
options.apply_defaults timeout: @config.rpcs.import_user_events.timeout,
|
483
|
+
metadata: metadata,
|
484
|
+
retry_policy: @config.rpcs.import_user_events.retry_policy
|
485
|
+
options.apply_defaults metadata: @config.metadata,
|
486
|
+
retry_policy: @config.retry_policy
|
487
|
+
|
488
|
+
@user_event_service_stub.call_rpc :import_user_events, request, options: options do |response, operation|
|
489
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
490
|
+
yield response, operation if block_given?
|
491
|
+
return response
|
492
|
+
end
|
493
|
+
rescue ::GRPC::BadStatus => e
|
494
|
+
raise ::Google::Cloud::Error.from_error(e)
|
495
|
+
end
|
496
|
+
|
497
|
+
##
|
498
|
+
# Triggers a user event rejoin operation with latest product catalog. Events
|
499
|
+
# will not be annotated with detailed product information if product is
|
500
|
+
# missing from the catalog at the time the user event is ingested, and these
|
501
|
+
# events are stored as unjoined events with a limited usage on training and
|
502
|
+
# serving. This API can be used to trigger a 'join' operation on specified
|
503
|
+
# events with latest version of product catalog. It can also be used to
|
504
|
+
# correct events joined with wrong product catalog.
|
505
|
+
#
|
506
|
+
# @overload rejoin_user_events(request, options = nil)
|
507
|
+
# Pass arguments to `rejoin_user_events` via a request object, either of type
|
508
|
+
# {::Google::Cloud::Retail::V2::RejoinUserEventsRequest} or an equivalent Hash.
|
509
|
+
#
|
510
|
+
# @param request [::Google::Cloud::Retail::V2::RejoinUserEventsRequest, ::Hash]
|
511
|
+
# A request object representing the call parameters. Required. To specify no
|
512
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
513
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
514
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
515
|
+
#
|
516
|
+
# @overload rejoin_user_events(parent: nil, user_event_rejoin_scope: nil)
|
517
|
+
# Pass arguments to `rejoin_user_events` via keyword arguments. Note that at
|
518
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
519
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
520
|
+
#
|
521
|
+
# @param parent [::String]
|
522
|
+
# Required. The parent catalog resource name, such as
|
523
|
+
# "projects/1234/locations/global/catalogs/default_catalog".
|
524
|
+
# @param user_event_rejoin_scope [::Google::Cloud::Retail::V2::RejoinUserEventsRequest::UserEventRejoinScope]
|
525
|
+
# The type of the user event rejoin to define the scope and range of the user
|
526
|
+
# events to be rejoined with the latest product catalog. Defaults to
|
527
|
+
# USER_EVENT_REJOIN_SCOPE_UNSPECIFIED if this field is not set, or set to an
|
528
|
+
# invalid integer value.
|
529
|
+
#
|
530
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
531
|
+
# @yieldparam response [::Gapic::Operation]
|
532
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
533
|
+
#
|
534
|
+
# @return [::Gapic::Operation]
|
535
|
+
#
|
536
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
537
|
+
#
|
538
|
+
def rejoin_user_events request, options = nil
|
539
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
540
|
+
|
541
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::RejoinUserEventsRequest
|
542
|
+
|
543
|
+
# Converts hash and nil to an options object
|
544
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
545
|
+
|
546
|
+
# Customize the options with defaults
|
547
|
+
metadata = @config.rpcs.rejoin_user_events.metadata.to_h
|
548
|
+
|
549
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
550
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
551
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
552
|
+
gapic_version: ::Google::Cloud::Retail::V2::VERSION
|
553
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
554
|
+
|
555
|
+
header_params = {
|
556
|
+
"parent" => request.parent
|
557
|
+
}
|
558
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
559
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
560
|
+
|
561
|
+
options.apply_defaults timeout: @config.rpcs.rejoin_user_events.timeout,
|
562
|
+
metadata: metadata,
|
563
|
+
retry_policy: @config.rpcs.rejoin_user_events.retry_policy
|
564
|
+
options.apply_defaults metadata: @config.metadata,
|
565
|
+
retry_policy: @config.retry_policy
|
566
|
+
|
567
|
+
@user_event_service_stub.call_rpc :rejoin_user_events, request, options: options do |response, operation|
|
568
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
569
|
+
yield response, operation if block_given?
|
570
|
+
return response
|
571
|
+
end
|
572
|
+
rescue ::GRPC::BadStatus => e
|
573
|
+
raise ::Google::Cloud::Error.from_error(e)
|
574
|
+
end
|
575
|
+
|
576
|
+
##
|
577
|
+
# Configuration class for the UserEventService API.
|
578
|
+
#
|
579
|
+
# This class represents the configuration for UserEventService,
|
580
|
+
# providing control over timeouts, retry behavior, logging, transport
|
581
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
582
|
+
# applied individually to specific RPCs. See
|
583
|
+
# {::Google::Cloud::Retail::V2::UserEventService::Client::Configuration::Rpcs}
|
584
|
+
# for a list of RPCs that can be configured independently.
|
585
|
+
#
|
586
|
+
# Configuration can be applied globally to all clients, or to a single client
|
587
|
+
# on construction.
|
588
|
+
#
|
589
|
+
# # Examples
|
590
|
+
#
|
591
|
+
# To modify the global config, setting the timeout for write_user_event
|
592
|
+
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
593
|
+
#
|
594
|
+
# ::Google::Cloud::Retail::V2::UserEventService::Client.configure do |config|
|
595
|
+
# config.timeout = 10.0
|
596
|
+
# config.rpcs.write_user_event.timeout = 20.0
|
597
|
+
# end
|
598
|
+
#
|
599
|
+
# To apply the above configuration only to a new client:
|
600
|
+
#
|
601
|
+
# client = ::Google::Cloud::Retail::V2::UserEventService::Client.new do |config|
|
602
|
+
# config.timeout = 10.0
|
603
|
+
# config.rpcs.write_user_event.timeout = 20.0
|
604
|
+
# end
|
605
|
+
#
|
606
|
+
# @!attribute [rw] endpoint
|
607
|
+
# The hostname or hostname:port of the service endpoint.
|
608
|
+
# Defaults to `"retail.googleapis.com"`.
|
609
|
+
# @return [::String]
|
610
|
+
# @!attribute [rw] credentials
|
611
|
+
# Credentials to send with calls. You may provide any of the following types:
|
612
|
+
# * (`String`) The path to a service account key file in JSON format
|
613
|
+
# * (`Hash`) A service account key as a Hash
|
614
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
615
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
616
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
617
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
618
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
619
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
620
|
+
# * (`nil`) indicating no credentials
|
621
|
+
# @return [::Object]
|
622
|
+
# @!attribute [rw] scope
|
623
|
+
# The OAuth scopes
|
624
|
+
# @return [::Array<::String>]
|
625
|
+
# @!attribute [rw] lib_name
|
626
|
+
# The library name as recorded in instrumentation and logging
|
627
|
+
# @return [::String]
|
628
|
+
# @!attribute [rw] lib_version
|
629
|
+
# The library version as recorded in instrumentation and logging
|
630
|
+
# @return [::String]
|
631
|
+
# @!attribute [rw] channel_args
|
632
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
633
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
634
|
+
# @return [::Hash]
|
635
|
+
# @!attribute [rw] interceptors
|
636
|
+
# An array of interceptors that are run before calls are executed.
|
637
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
638
|
+
# @!attribute [rw] timeout
|
639
|
+
# The call timeout in seconds.
|
640
|
+
# @return [::Numeric]
|
641
|
+
# @!attribute [rw] metadata
|
642
|
+
# Additional gRPC headers to be sent with the call.
|
643
|
+
# @return [::Hash{::Symbol=>::String}]
|
644
|
+
# @!attribute [rw] retry_policy
|
645
|
+
# The retry policy. The value is a hash with the following keys:
|
646
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
647
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
648
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
649
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
650
|
+
# trigger a retry.
|
651
|
+
# @return [::Hash]
|
652
|
+
# @!attribute [rw] quota_project
|
653
|
+
# A separate project against which to charge quota.
|
654
|
+
# @return [::String]
|
655
|
+
#
|
656
|
+
class Configuration
|
657
|
+
extend ::Gapic::Config
|
658
|
+
|
659
|
+
config_attr :endpoint, "retail.googleapis.com", ::String
|
660
|
+
config_attr :credentials, nil do |value|
|
661
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
662
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
663
|
+
allowed.any? { |klass| klass === value }
|
664
|
+
end
|
665
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
666
|
+
config_attr :lib_name, nil, ::String, nil
|
667
|
+
config_attr :lib_version, nil, ::String, nil
|
668
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
669
|
+
config_attr :interceptors, nil, ::Array, nil
|
670
|
+
config_attr :timeout, nil, ::Numeric, nil
|
671
|
+
config_attr :metadata, nil, ::Hash, nil
|
672
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
673
|
+
config_attr :quota_project, nil, ::String, nil
|
674
|
+
|
675
|
+
# @private
|
676
|
+
def initialize parent_config = nil
|
677
|
+
@parent_config = parent_config unless parent_config.nil?
|
678
|
+
|
679
|
+
yield self if block_given?
|
680
|
+
end
|
681
|
+
|
682
|
+
##
|
683
|
+
# Configurations for individual RPCs
|
684
|
+
# @return [Rpcs]
|
685
|
+
#
|
686
|
+
def rpcs
|
687
|
+
@rpcs ||= begin
|
688
|
+
parent_rpcs = nil
|
689
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
|
690
|
+
Rpcs.new parent_rpcs
|
691
|
+
end
|
692
|
+
end
|
693
|
+
|
694
|
+
##
|
695
|
+
# Configuration RPC class for the UserEventService API.
|
696
|
+
#
|
697
|
+
# Includes fields providing the configuration for each RPC in this service.
|
698
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
699
|
+
# the following configuration fields:
|
700
|
+
#
|
701
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
|
702
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
703
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
704
|
+
# include the following keys:
|
705
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
706
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
707
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
708
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
709
|
+
# trigger a retry.
|
710
|
+
#
|
711
|
+
class Rpcs
|
712
|
+
##
|
713
|
+
# RPC-specific configuration for `write_user_event`
|
714
|
+
# @return [::Gapic::Config::Method]
|
715
|
+
#
|
716
|
+
attr_reader :write_user_event
|
717
|
+
##
|
718
|
+
# RPC-specific configuration for `collect_user_event`
|
719
|
+
# @return [::Gapic::Config::Method]
|
720
|
+
#
|
721
|
+
attr_reader :collect_user_event
|
722
|
+
##
|
723
|
+
# RPC-specific configuration for `purge_user_events`
|
724
|
+
# @return [::Gapic::Config::Method]
|
725
|
+
#
|
726
|
+
attr_reader :purge_user_events
|
727
|
+
##
|
728
|
+
# RPC-specific configuration for `import_user_events`
|
729
|
+
# @return [::Gapic::Config::Method]
|
730
|
+
#
|
731
|
+
attr_reader :import_user_events
|
732
|
+
##
|
733
|
+
# RPC-specific configuration for `rejoin_user_events`
|
734
|
+
# @return [::Gapic::Config::Method]
|
735
|
+
#
|
736
|
+
attr_reader :rejoin_user_events
|
737
|
+
|
738
|
+
# @private
|
739
|
+
def initialize parent_rpcs = nil
|
740
|
+
write_user_event_config = parent_rpcs&.write_user_event if parent_rpcs&.respond_to? :write_user_event
|
741
|
+
@write_user_event = ::Gapic::Config::Method.new write_user_event_config
|
742
|
+
collect_user_event_config = parent_rpcs&.collect_user_event if parent_rpcs&.respond_to? :collect_user_event
|
743
|
+
@collect_user_event = ::Gapic::Config::Method.new collect_user_event_config
|
744
|
+
purge_user_events_config = parent_rpcs&.purge_user_events if parent_rpcs&.respond_to? :purge_user_events
|
745
|
+
@purge_user_events = ::Gapic::Config::Method.new purge_user_events_config
|
746
|
+
import_user_events_config = parent_rpcs&.import_user_events if parent_rpcs&.respond_to? :import_user_events
|
747
|
+
@import_user_events = ::Gapic::Config::Method.new import_user_events_config
|
748
|
+
rejoin_user_events_config = parent_rpcs&.rejoin_user_events if parent_rpcs&.respond_to? :rejoin_user_events
|
749
|
+
@rejoin_user_events = ::Gapic::Config::Method.new rejoin_user_events_config
|
750
|
+
|
751
|
+
yield self if block_given?
|
752
|
+
end
|
753
|
+
end
|
754
|
+
end
|
755
|
+
end
|
756
|
+
end
|
757
|
+
end
|
758
|
+
end
|
759
|
+
end
|
760
|
+
end
|