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,51 @@
|
|
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 "googleauth"
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Cloud
|
23
|
+
module Retail
|
24
|
+
module V2
|
25
|
+
module CatalogService
|
26
|
+
# Credentials for the CatalogService API.
|
27
|
+
class Credentials < ::Google::Auth::Credentials
|
28
|
+
self.scope = [
|
29
|
+
"https://www.googleapis.com/auth/cloud-platform"
|
30
|
+
]
|
31
|
+
self.env_vars = [
|
32
|
+
"RETAIL_CREDENTIALS",
|
33
|
+
"RETAIL_KEYFILE",
|
34
|
+
"GOOGLE_CLOUD_CREDENTIALS",
|
35
|
+
"GOOGLE_CLOUD_KEYFILE",
|
36
|
+
"GCLOUD_KEYFILE",
|
37
|
+
"RETAIL_CREDENTIALS_JSON",
|
38
|
+
"RETAIL_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,69 @@
|
|
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 CatalogService
|
25
|
+
# Path helper methods for the CatalogService API.
|
26
|
+
module Paths
|
27
|
+
##
|
28
|
+
# Create a fully-qualified Catalog resource string.
|
29
|
+
#
|
30
|
+
# The resource will be in the following format:
|
31
|
+
#
|
32
|
+
# `projects/{project}/locations/{location}/catalogs/{catalog}`
|
33
|
+
#
|
34
|
+
# @param project [String]
|
35
|
+
# @param location [String]
|
36
|
+
# @param catalog [String]
|
37
|
+
#
|
38
|
+
# @return [::String]
|
39
|
+
def catalog_path project:, location:, catalog:
|
40
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
41
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
42
|
+
|
43
|
+
"projects/#{project}/locations/#{location}/catalogs/#{catalog}"
|
44
|
+
end
|
45
|
+
|
46
|
+
##
|
47
|
+
# Create a fully-qualified Location resource string.
|
48
|
+
#
|
49
|
+
# The resource will be in the following format:
|
50
|
+
#
|
51
|
+
# `projects/{project}/locations/{location}`
|
52
|
+
#
|
53
|
+
# @param project [String]
|
54
|
+
# @param location [String]
|
55
|
+
#
|
56
|
+
# @return [::String]
|
57
|
+
def location_path project:, location:
|
58
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
59
|
+
|
60
|
+
"projects/#{project}/locations/#{location}"
|
61
|
+
end
|
62
|
+
|
63
|
+
extend self
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/cloud/retail/v2/catalog_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/catalog_pb'
|
11
|
+
require 'google/protobuf/empty_pb'
|
12
|
+
require 'google/protobuf/field_mask_pb'
|
13
|
+
require 'google/protobuf/timestamp_pb'
|
14
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
15
|
+
add_file("google/cloud/retail/v2/catalog_service.proto", :syntax => :proto3) do
|
16
|
+
add_message "google.cloud.retail.v2.ListCatalogsRequest" do
|
17
|
+
optional :parent, :string, 1
|
18
|
+
optional :page_size, :int32, 2
|
19
|
+
optional :page_token, :string, 3
|
20
|
+
end
|
21
|
+
add_message "google.cloud.retail.v2.ListCatalogsResponse" do
|
22
|
+
repeated :catalogs, :message, 1, "google.cloud.retail.v2.Catalog"
|
23
|
+
optional :next_page_token, :string, 2
|
24
|
+
end
|
25
|
+
add_message "google.cloud.retail.v2.UpdateCatalogRequest" do
|
26
|
+
optional :catalog, :message, 1, "google.cloud.retail.v2.Catalog"
|
27
|
+
optional :update_mask, :message, 2, "google.protobuf.FieldMask"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
module Google
|
33
|
+
module Cloud
|
34
|
+
module Retail
|
35
|
+
module V2
|
36
|
+
ListCatalogsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ListCatalogsRequest").msgclass
|
37
|
+
ListCatalogsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ListCatalogsResponse").msgclass
|
38
|
+
UpdateCatalogRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UpdateCatalogRequest").msgclass
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# Source: google/cloud/retail/v2/catalog_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/catalog_service_pb'
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Retail
|
25
|
+
module V2
|
26
|
+
module CatalogService
|
27
|
+
# Service for managing catalog configuration.
|
28
|
+
class Service
|
29
|
+
|
30
|
+
include GRPC::GenericService
|
31
|
+
|
32
|
+
self.marshal_class_method = :encode
|
33
|
+
self.unmarshal_class_method = :decode
|
34
|
+
self.service_name = 'google.cloud.retail.v2.CatalogService'
|
35
|
+
|
36
|
+
# Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with
|
37
|
+
# the project.
|
38
|
+
rpc :ListCatalogs, ::Google::Cloud::Retail::V2::ListCatalogsRequest, ::Google::Cloud::Retail::V2::ListCatalogsResponse
|
39
|
+
# Updates the [Catalog][google.cloud.retail.v2.Catalog]s.
|
40
|
+
rpc :UpdateCatalog, ::Google::Cloud::Retail::V2::UpdateCatalogRequest, ::Google::Cloud::Retail::V2::Catalog
|
41
|
+
end
|
42
|
+
|
43
|
+
Stub = Service.rpc_stub_class
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/cloud/retail/v2/common.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'google/api/annotations_pb'
|
7
|
+
require 'google/api/field_behavior_pb'
|
8
|
+
require 'google/protobuf/timestamp_pb'
|
9
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
10
|
+
add_file("google/cloud/retail/v2/common.proto", :syntax => :proto3) do
|
11
|
+
add_message "google.cloud.retail.v2.CustomAttribute" do
|
12
|
+
repeated :text, :string, 1
|
13
|
+
repeated :numbers, :double, 2
|
14
|
+
end
|
15
|
+
add_message "google.cloud.retail.v2.Image" do
|
16
|
+
optional :uri, :string, 1
|
17
|
+
optional :height, :int32, 2
|
18
|
+
optional :width, :int32, 3
|
19
|
+
end
|
20
|
+
add_message "google.cloud.retail.v2.PriceInfo" do
|
21
|
+
optional :currency_code, :string, 1
|
22
|
+
optional :price, :float, 2
|
23
|
+
optional :original_price, :float, 3
|
24
|
+
optional :cost, :float, 4
|
25
|
+
end
|
26
|
+
add_message "google.cloud.retail.v2.UserInfo" do
|
27
|
+
optional :user_id, :string, 1
|
28
|
+
optional :ip_address, :string, 2
|
29
|
+
optional :user_agent, :string, 3
|
30
|
+
optional :direct_user_request, :bool, 4
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
module Google
|
36
|
+
module Cloud
|
37
|
+
module Retail
|
38
|
+
module V2
|
39
|
+
CustomAttribute = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CustomAttribute").msgclass
|
40
|
+
Image = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Image").msgclass
|
41
|
+
PriceInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.PriceInfo").msgclass
|
42
|
+
UserInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UserInfo").msgclass
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/cloud/retail/v2/import_config.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/product_pb'
|
9
|
+
require 'google/cloud/retail/v2/user_event_pb'
|
10
|
+
require 'google/protobuf/field_mask_pb'
|
11
|
+
require 'google/protobuf/timestamp_pb'
|
12
|
+
require 'google/rpc/status_pb'
|
13
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
14
|
+
add_file("google/cloud/retail/v2/import_config.proto", :syntax => :proto3) do
|
15
|
+
add_message "google.cloud.retail.v2.GcsSource" do
|
16
|
+
repeated :input_uris, :string, 1
|
17
|
+
optional :data_schema, :string, 2
|
18
|
+
end
|
19
|
+
add_message "google.cloud.retail.v2.BigQuerySource" do
|
20
|
+
optional :project_id, :string, 5
|
21
|
+
optional :dataset_id, :string, 1
|
22
|
+
optional :table_id, :string, 2
|
23
|
+
optional :gcs_staging_dir, :string, 3
|
24
|
+
optional :data_schema, :string, 4
|
25
|
+
end
|
26
|
+
add_message "google.cloud.retail.v2.ProductInlineSource" do
|
27
|
+
repeated :products, :message, 1, "google.cloud.retail.v2.Product"
|
28
|
+
end
|
29
|
+
add_message "google.cloud.retail.v2.UserEventInlineSource" do
|
30
|
+
repeated :user_events, :message, 1, "google.cloud.retail.v2.UserEvent"
|
31
|
+
end
|
32
|
+
add_message "google.cloud.retail.v2.ImportErrorsConfig" do
|
33
|
+
oneof :destination do
|
34
|
+
optional :gcs_prefix, :string, 1
|
35
|
+
end
|
36
|
+
end
|
37
|
+
add_message "google.cloud.retail.v2.ImportProductsRequest" do
|
38
|
+
optional :parent, :string, 1
|
39
|
+
optional :input_config, :message, 2, "google.cloud.retail.v2.ProductInputConfig"
|
40
|
+
optional :errors_config, :message, 3, "google.cloud.retail.v2.ImportErrorsConfig"
|
41
|
+
optional :update_mask, :message, 4, "google.protobuf.FieldMask"
|
42
|
+
end
|
43
|
+
add_message "google.cloud.retail.v2.ImportUserEventsRequest" do
|
44
|
+
optional :parent, :string, 1
|
45
|
+
optional :input_config, :message, 2, "google.cloud.retail.v2.UserEventInputConfig"
|
46
|
+
optional :errors_config, :message, 3, "google.cloud.retail.v2.ImportErrorsConfig"
|
47
|
+
end
|
48
|
+
add_message "google.cloud.retail.v2.ProductInputConfig" do
|
49
|
+
oneof :source do
|
50
|
+
optional :product_inline_source, :message, 1, "google.cloud.retail.v2.ProductInlineSource"
|
51
|
+
optional :gcs_source, :message, 2, "google.cloud.retail.v2.GcsSource"
|
52
|
+
optional :big_query_source, :message, 3, "google.cloud.retail.v2.BigQuerySource"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
add_message "google.cloud.retail.v2.UserEventInputConfig" do
|
56
|
+
oneof :source do
|
57
|
+
optional :user_event_inline_source, :message, 1, "google.cloud.retail.v2.UserEventInlineSource"
|
58
|
+
optional :gcs_source, :message, 2, "google.cloud.retail.v2.GcsSource"
|
59
|
+
optional :big_query_source, :message, 3, "google.cloud.retail.v2.BigQuerySource"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
add_message "google.cloud.retail.v2.ImportMetadata" do
|
63
|
+
optional :create_time, :message, 1, "google.protobuf.Timestamp"
|
64
|
+
optional :update_time, :message, 2, "google.protobuf.Timestamp"
|
65
|
+
optional :success_count, :int64, 3
|
66
|
+
optional :failure_count, :int64, 4
|
67
|
+
end
|
68
|
+
add_message "google.cloud.retail.v2.ImportProductsResponse" do
|
69
|
+
repeated :error_samples, :message, 1, "google.rpc.Status"
|
70
|
+
optional :errors_config, :message, 2, "google.cloud.retail.v2.ImportErrorsConfig"
|
71
|
+
end
|
72
|
+
add_message "google.cloud.retail.v2.ImportUserEventsResponse" do
|
73
|
+
repeated :error_samples, :message, 1, "google.rpc.Status"
|
74
|
+
optional :errors_config, :message, 2, "google.cloud.retail.v2.ImportErrorsConfig"
|
75
|
+
optional :import_summary, :message, 3, "google.cloud.retail.v2.UserEventImportSummary"
|
76
|
+
end
|
77
|
+
add_message "google.cloud.retail.v2.UserEventImportSummary" do
|
78
|
+
optional :joined_events_count, :int64, 1
|
79
|
+
optional :unjoined_events_count, :int64, 2
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
module Google
|
85
|
+
module Cloud
|
86
|
+
module Retail
|
87
|
+
module V2
|
88
|
+
GcsSource = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.GcsSource").msgclass
|
89
|
+
BigQuerySource = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.BigQuerySource").msgclass
|
90
|
+
ProductInlineSource = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ProductInlineSource").msgclass
|
91
|
+
UserEventInlineSource = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UserEventInlineSource").msgclass
|
92
|
+
ImportErrorsConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportErrorsConfig").msgclass
|
93
|
+
ImportProductsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportProductsRequest").msgclass
|
94
|
+
ImportUserEventsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportUserEventsRequest").msgclass
|
95
|
+
ProductInputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ProductInputConfig").msgclass
|
96
|
+
UserEventInputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UserEventInputConfig").msgclass
|
97
|
+
ImportMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportMetadata").msgclass
|
98
|
+
ImportProductsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportProductsResponse").msgclass
|
99
|
+
ImportUserEventsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportUserEventsResponse").msgclass
|
100
|
+
UserEventImportSummary = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UserEventImportSummary").msgclass
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,49 @@
|
|
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/prediction_service/credentials"
|
26
|
+
require "google/cloud/retail/v2/prediction_service/paths"
|
27
|
+
require "google/cloud/retail/v2/prediction_service/client"
|
28
|
+
|
29
|
+
module Google
|
30
|
+
module Cloud
|
31
|
+
module Retail
|
32
|
+
module V2
|
33
|
+
##
|
34
|
+
# Service for making recommendation prediction.
|
35
|
+
#
|
36
|
+
# To load this service and instantiate a client:
|
37
|
+
#
|
38
|
+
# require "google/cloud/retail/v2/prediction_service"
|
39
|
+
# client = ::Google::Cloud::Retail::V2::PredictionService::Client.new
|
40
|
+
#
|
41
|
+
module PredictionService
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
helper_path = ::File.join __dir__, "prediction_service", "helpers.rb"
|
49
|
+
require "google/cloud/retail/v2/prediction_service/helpers" if ::File.file? helper_path
|
@@ -0,0 +1,472 @@
|
|
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/prediction_service_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Retail
|
25
|
+
module V2
|
26
|
+
module PredictionService
|
27
|
+
##
|
28
|
+
# Client for the PredictionService service.
|
29
|
+
#
|
30
|
+
# Service for making recommendation prediction.
|
31
|
+
#
|
32
|
+
class Client
|
33
|
+
include Paths
|
34
|
+
|
35
|
+
# @private
|
36
|
+
attr_reader :prediction_service_stub
|
37
|
+
|
38
|
+
##
|
39
|
+
# Configure the PredictionService Client class.
|
40
|
+
#
|
41
|
+
# See {::Google::Cloud::Retail::V2::PredictionService::Client::Configuration}
|
42
|
+
# for a description of the configuration fields.
|
43
|
+
#
|
44
|
+
# ## Example
|
45
|
+
#
|
46
|
+
# To modify the configuration for all PredictionService clients:
|
47
|
+
#
|
48
|
+
# ::Google::Cloud::Retail::V2::PredictionService::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 PredictionService 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::PredictionService::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 PredictionService client object.
|
104
|
+
#
|
105
|
+
# ## Examples
|
106
|
+
#
|
107
|
+
# To create a new PredictionService client with the default
|
108
|
+
# configuration:
|
109
|
+
#
|
110
|
+
# client = ::Google::Cloud::Retail::V2::PredictionService::Client.new
|
111
|
+
#
|
112
|
+
# To create a new PredictionService client with a custom
|
113
|
+
# configuration:
|
114
|
+
#
|
115
|
+
# client = ::Google::Cloud::Retail::V2::PredictionService::Client.new do |config|
|
116
|
+
# config.timeout = 10.0
|
117
|
+
# end
|
118
|
+
#
|
119
|
+
# @yield [config] Configure the PredictionService 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/prediction_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
|
+
@prediction_service_stub = ::Gapic::ServiceStub.new(
|
145
|
+
::Google::Cloud::Retail::V2::PredictionService::Stub,
|
146
|
+
credentials: credentials,
|
147
|
+
endpoint: @config.endpoint,
|
148
|
+
channel_args: @config.channel_args,
|
149
|
+
interceptors: @config.interceptors
|
150
|
+
)
|
151
|
+
end
|
152
|
+
|
153
|
+
# Service calls
|
154
|
+
|
155
|
+
##
|
156
|
+
# Makes a recommendation prediction.
|
157
|
+
#
|
158
|
+
# @overload predict(request, options = nil)
|
159
|
+
# Pass arguments to `predict` via a request object, either of type
|
160
|
+
# {::Google::Cloud::Retail::V2::PredictRequest} or an equivalent Hash.
|
161
|
+
#
|
162
|
+
# @param request [::Google::Cloud::Retail::V2::PredictRequest, ::Hash]
|
163
|
+
# A request object representing the call parameters. Required. To specify no
|
164
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
165
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
166
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
167
|
+
#
|
168
|
+
# @overload predict(placement: nil, user_event: nil, page_size: nil, page_token: nil, filter: nil, validate_only: nil, params: nil, labels: nil)
|
169
|
+
# Pass arguments to `predict` via keyword arguments. Note that at
|
170
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
171
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
172
|
+
#
|
173
|
+
# @param placement [::String]
|
174
|
+
# Required. Full resource name of the format:
|
175
|
+
# \\{name=projects/*/locations/global/catalogs/default_catalog/placements/*}
|
176
|
+
# The id of the recommendation engine placement. This id is used to identify
|
177
|
+
# the set of models that will be used to make the prediction.
|
178
|
+
#
|
179
|
+
# We currently support three placements with the following IDs by default:
|
180
|
+
#
|
181
|
+
# * `shopping_cart`: Predicts products frequently bought together with one or
|
182
|
+
# more products in the same shopping session. Commonly displayed after
|
183
|
+
# `add-to-cart` events, on product detail pages, or on the shopping cart
|
184
|
+
# page.
|
185
|
+
#
|
186
|
+
# * `home_page`: Predicts the next product that a user will most likely
|
187
|
+
# engage with or purchase based on the shopping or viewing history of the
|
188
|
+
# specified `userId` or `visitorId`. For example - Recommendations for you.
|
189
|
+
#
|
190
|
+
# * `product_detail`: Predicts the next product that a user will most likely
|
191
|
+
# engage with or purchase. The prediction is based on the shopping or
|
192
|
+
# viewing history of the specified `userId` or `visitorId` and its
|
193
|
+
# relevance to a specified `CatalogItem`. Typically used on product detail
|
194
|
+
# pages. For example - More products like this.
|
195
|
+
#
|
196
|
+
# * `recently_viewed_default`: Returns up to 75 products recently viewed by
|
197
|
+
# the specified `userId` or `visitorId`, most recent ones first. Returns
|
198
|
+
# nothing if neither of them has viewed any products yet. For example -
|
199
|
+
# Recently viewed.
|
200
|
+
#
|
201
|
+
# The full list of available placements can be seen at
|
202
|
+
# https://console.cloud.google.com/recommendation/catalogs/default_catalog/placements
|
203
|
+
# @param user_event [::Google::Cloud::Retail::V2::UserEvent, ::Hash]
|
204
|
+
# Required. Context about the user, what they are looking at and what action
|
205
|
+
# they took to trigger the predict request. Note that this user event detail
|
206
|
+
# won't be ingested to userEvent logs. Thus, a separate userEvent write
|
207
|
+
# request is required for event logging.
|
208
|
+
# @param page_size [::Integer]
|
209
|
+
# Maximum number of results to return per page. Set this property
|
210
|
+
# to the number of prediction results needed. If zero, the service will
|
211
|
+
# choose a reasonable default. The maximum allowed value is 100. Values
|
212
|
+
# above 100 will be coerced to 100.
|
213
|
+
# @param page_token [::String]
|
214
|
+
# The previous PredictResponse.next_page_token.
|
215
|
+
# @param filter [::String]
|
216
|
+
# Filter for restricting prediction results with a length limit of 5,000
|
217
|
+
# characters. Accepts values for tags and the `filterOutOfStockItems` flag.
|
218
|
+
#
|
219
|
+
# * Tag expressions. Restricts predictions to products that match all of the
|
220
|
+
# specified tags. Boolean operators `OR` and `NOT` are supported if the
|
221
|
+
# expression is enclosed in parentheses, and must be separated from the
|
222
|
+
# tag values by a space. `-"tagA"` is also supported and is equivalent to
|
223
|
+
# `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings
|
224
|
+
# with a size limit of 1,000 characters.
|
225
|
+
#
|
226
|
+
# * filterOutOfStockItems. Restricts predictions to products that do not
|
227
|
+
# have a
|
228
|
+
# stockState value of OUT_OF_STOCK.
|
229
|
+
#
|
230
|
+
# Examples:
|
231
|
+
#
|
232
|
+
# * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional")
|
233
|
+
# * filterOutOfStockItems tag=(-"promotional")
|
234
|
+
# * filterOutOfStockItems
|
235
|
+
#
|
236
|
+
# If your filter blocks all prediction results, nothing will be returned. If
|
237
|
+
# you want generic (unfiltered) popular products to be returned instead, set
|
238
|
+
# `strictFiltering` to false in `PredictRequest.params`.
|
239
|
+
# @param validate_only [::Boolean]
|
240
|
+
# Use validate only mode for this prediction query. If set to true, a
|
241
|
+
# dummy model will be used that returns arbitrary products.
|
242
|
+
# Note that the validate only mode should only be used for testing the API,
|
243
|
+
# or if the model is not ready.
|
244
|
+
# @param params [::Hash{::String => ::Google::Protobuf::Value, ::Hash}]
|
245
|
+
# Additional domain specific parameters for the predictions.
|
246
|
+
#
|
247
|
+
# Allowed values:
|
248
|
+
#
|
249
|
+
# * `returnProduct`: Boolean. If set to true, the associated product
|
250
|
+
# object will be returned in the `results.metadata` field in the
|
251
|
+
# prediction response.
|
252
|
+
# * `returnScore`: Boolean. If set to true, the prediction 'score'
|
253
|
+
# corresponding to each returned product will be set in the
|
254
|
+
# `results.metadata` field in the prediction response. The given
|
255
|
+
# 'score' indicates the probability of an product being clicked/purchased
|
256
|
+
# given the user's context and history.
|
257
|
+
# * `strictFiltering`: Boolean. True by default. If set to false, the service
|
258
|
+
# will return generic (unfiltered) popular products instead of empty if
|
259
|
+
# your filter blocks all prediction results.
|
260
|
+
# @param labels [::Hash{::String => ::String}]
|
261
|
+
# The labels for the predict request.
|
262
|
+
#
|
263
|
+
# * Label keys can contain lowercase letters, digits and hyphens, must start
|
264
|
+
# with a letter, and must end with a letter or digit.
|
265
|
+
# * Non-zero label values can contain lowercase letters, digits and hyphens,
|
266
|
+
# must start with a letter, and must end with a letter or digit.
|
267
|
+
# * No more than 64 labels can be associated with a given request.
|
268
|
+
#
|
269
|
+
# See https://goo.gl/xmQnxf for more information on and examples of labels.
|
270
|
+
#
|
271
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
272
|
+
# @yieldparam response [::Google::Cloud::Retail::V2::PredictResponse]
|
273
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
274
|
+
#
|
275
|
+
# @return [::Google::Cloud::Retail::V2::PredictResponse]
|
276
|
+
#
|
277
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
278
|
+
#
|
279
|
+
def predict request, options = nil
|
280
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
281
|
+
|
282
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::PredictRequest
|
283
|
+
|
284
|
+
# Converts hash and nil to an options object
|
285
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
286
|
+
|
287
|
+
# Customize the options with defaults
|
288
|
+
metadata = @config.rpcs.predict.metadata.to_h
|
289
|
+
|
290
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
291
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
292
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
293
|
+
gapic_version: ::Google::Cloud::Retail::V2::VERSION
|
294
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
295
|
+
|
296
|
+
header_params = {
|
297
|
+
"placement" => request.placement
|
298
|
+
}
|
299
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
300
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
301
|
+
|
302
|
+
options.apply_defaults timeout: @config.rpcs.predict.timeout,
|
303
|
+
metadata: metadata,
|
304
|
+
retry_policy: @config.rpcs.predict.retry_policy
|
305
|
+
options.apply_defaults metadata: @config.metadata,
|
306
|
+
retry_policy: @config.retry_policy
|
307
|
+
|
308
|
+
@prediction_service_stub.call_rpc :predict, request, options: options do |response, operation|
|
309
|
+
yield response, operation if block_given?
|
310
|
+
return response
|
311
|
+
end
|
312
|
+
rescue ::GRPC::BadStatus => e
|
313
|
+
raise ::Google::Cloud::Error.from_error(e)
|
314
|
+
end
|
315
|
+
|
316
|
+
##
|
317
|
+
# Configuration class for the PredictionService API.
|
318
|
+
#
|
319
|
+
# This class represents the configuration for PredictionService,
|
320
|
+
# providing control over timeouts, retry behavior, logging, transport
|
321
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
322
|
+
# applied individually to specific RPCs. See
|
323
|
+
# {::Google::Cloud::Retail::V2::PredictionService::Client::Configuration::Rpcs}
|
324
|
+
# for a list of RPCs that can be configured independently.
|
325
|
+
#
|
326
|
+
# Configuration can be applied globally to all clients, or to a single client
|
327
|
+
# on construction.
|
328
|
+
#
|
329
|
+
# # Examples
|
330
|
+
#
|
331
|
+
# To modify the global config, setting the timeout for predict
|
332
|
+
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
333
|
+
#
|
334
|
+
# ::Google::Cloud::Retail::V2::PredictionService::Client.configure do |config|
|
335
|
+
# config.timeout = 10.0
|
336
|
+
# config.rpcs.predict.timeout = 20.0
|
337
|
+
# end
|
338
|
+
#
|
339
|
+
# To apply the above configuration only to a new client:
|
340
|
+
#
|
341
|
+
# client = ::Google::Cloud::Retail::V2::PredictionService::Client.new do |config|
|
342
|
+
# config.timeout = 10.0
|
343
|
+
# config.rpcs.predict.timeout = 20.0
|
344
|
+
# end
|
345
|
+
#
|
346
|
+
# @!attribute [rw] endpoint
|
347
|
+
# The hostname or hostname:port of the service endpoint.
|
348
|
+
# Defaults to `"retail.googleapis.com"`.
|
349
|
+
# @return [::String]
|
350
|
+
# @!attribute [rw] credentials
|
351
|
+
# Credentials to send with calls. You may provide any of the following types:
|
352
|
+
# * (`String`) The path to a service account key file in JSON format
|
353
|
+
# * (`Hash`) A service account key as a Hash
|
354
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
355
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
356
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
357
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
358
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
359
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
360
|
+
# * (`nil`) indicating no credentials
|
361
|
+
# @return [::Object]
|
362
|
+
# @!attribute [rw] scope
|
363
|
+
# The OAuth scopes
|
364
|
+
# @return [::Array<::String>]
|
365
|
+
# @!attribute [rw] lib_name
|
366
|
+
# The library name as recorded in instrumentation and logging
|
367
|
+
# @return [::String]
|
368
|
+
# @!attribute [rw] lib_version
|
369
|
+
# The library version as recorded in instrumentation and logging
|
370
|
+
# @return [::String]
|
371
|
+
# @!attribute [rw] channel_args
|
372
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
373
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
374
|
+
# @return [::Hash]
|
375
|
+
# @!attribute [rw] interceptors
|
376
|
+
# An array of interceptors that are run before calls are executed.
|
377
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
378
|
+
# @!attribute [rw] timeout
|
379
|
+
# The call timeout in seconds.
|
380
|
+
# @return [::Numeric]
|
381
|
+
# @!attribute [rw] metadata
|
382
|
+
# Additional gRPC headers to be sent with the call.
|
383
|
+
# @return [::Hash{::Symbol=>::String}]
|
384
|
+
# @!attribute [rw] retry_policy
|
385
|
+
# The retry policy. The value is a hash with the following keys:
|
386
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
387
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
388
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
389
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
390
|
+
# trigger a retry.
|
391
|
+
# @return [::Hash]
|
392
|
+
# @!attribute [rw] quota_project
|
393
|
+
# A separate project against which to charge quota.
|
394
|
+
# @return [::String]
|
395
|
+
#
|
396
|
+
class Configuration
|
397
|
+
extend ::Gapic::Config
|
398
|
+
|
399
|
+
config_attr :endpoint, "retail.googleapis.com", ::String
|
400
|
+
config_attr :credentials, nil do |value|
|
401
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
402
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
403
|
+
allowed.any? { |klass| klass === value }
|
404
|
+
end
|
405
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
406
|
+
config_attr :lib_name, nil, ::String, nil
|
407
|
+
config_attr :lib_version, nil, ::String, nil
|
408
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
409
|
+
config_attr :interceptors, nil, ::Array, nil
|
410
|
+
config_attr :timeout, nil, ::Numeric, nil
|
411
|
+
config_attr :metadata, nil, ::Hash, nil
|
412
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
413
|
+
config_attr :quota_project, nil, ::String, nil
|
414
|
+
|
415
|
+
# @private
|
416
|
+
def initialize parent_config = nil
|
417
|
+
@parent_config = parent_config unless parent_config.nil?
|
418
|
+
|
419
|
+
yield self if block_given?
|
420
|
+
end
|
421
|
+
|
422
|
+
##
|
423
|
+
# Configurations for individual RPCs
|
424
|
+
# @return [Rpcs]
|
425
|
+
#
|
426
|
+
def rpcs
|
427
|
+
@rpcs ||= begin
|
428
|
+
parent_rpcs = nil
|
429
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
|
430
|
+
Rpcs.new parent_rpcs
|
431
|
+
end
|
432
|
+
end
|
433
|
+
|
434
|
+
##
|
435
|
+
# Configuration RPC class for the PredictionService API.
|
436
|
+
#
|
437
|
+
# Includes fields providing the configuration for each RPC in this service.
|
438
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
439
|
+
# the following configuration fields:
|
440
|
+
#
|
441
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
|
442
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
443
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
444
|
+
# include the following keys:
|
445
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
446
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
447
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
448
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
449
|
+
# trigger a retry.
|
450
|
+
#
|
451
|
+
class Rpcs
|
452
|
+
##
|
453
|
+
# RPC-specific configuration for `predict`
|
454
|
+
# @return [::Gapic::Config::Method]
|
455
|
+
#
|
456
|
+
attr_reader :predict
|
457
|
+
|
458
|
+
# @private
|
459
|
+
def initialize parent_rpcs = nil
|
460
|
+
predict_config = parent_rpcs&.predict if parent_rpcs&.respond_to? :predict
|
461
|
+
@predict = ::Gapic::Config::Method.new predict_config
|
462
|
+
|
463
|
+
yield self if block_given?
|
464
|
+
end
|
465
|
+
end
|
466
|
+
end
|
467
|
+
end
|
468
|
+
end
|
469
|
+
end
|
470
|
+
end
|
471
|
+
end
|
472
|
+
end
|