google-cloud-retail-v2 1.0.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +30 -20
- data/lib/google/cloud/retail/v2/analytics_service/client.rb +29 -2
- data/lib/google/cloud/retail/v2/analytics_service/operations.rb +12 -15
- data/lib/google/cloud/retail/v2/analytics_service/rest/client.rb +29 -2
- data/lib/google/cloud/retail/v2/analytics_service/rest/operations.rb +43 -38
- data/lib/google/cloud/retail/v2/analytics_service/rest/service_stub.rb +22 -8
- data/lib/google/cloud/retail/v2/catalog_service/client.rb +29 -12
- data/lib/google/cloud/retail/v2/catalog_service/rest/client.rb +29 -12
- data/lib/google/cloud/retail/v2/catalog_service/rest/service_stub.rb +102 -68
- data/lib/google/cloud/retail/v2/completion_service/client.rb +31 -5
- data/lib/google/cloud/retail/v2/completion_service/operations.rb +12 -15
- data/lib/google/cloud/retail/v2/completion_service/rest/client.rb +31 -5
- data/lib/google/cloud/retail/v2/completion_service/rest/operations.rb +43 -38
- data/lib/google/cloud/retail/v2/completion_service/rest/service_stub.rb +30 -14
- data/lib/google/cloud/retail/v2/completion_service_pb.rb +2 -1
- data/lib/google/cloud/retail/v2/control_service/client.rb +29 -6
- data/lib/google/cloud/retail/v2/control_service/rest/client.rb +29 -6
- data/lib/google/cloud/retail/v2/control_service/rest/service_stub.rb +54 -32
- data/lib/google/cloud/retail/v2/generative_question_pb.rb +45 -0
- data/lib/google/cloud/retail/v2/generative_question_service/client.rb +853 -0
- data/lib/google/cloud/retail/v2/generative_question_service/credentials.rb +51 -0
- data/lib/google/cloud/retail/v2/generative_question_service/paths.rb +52 -0
- data/lib/google/cloud/retail/v2/generative_question_service/rest/client.rb +792 -0
- data/lib/google/cloud/retail/v2/generative_question_service/rest/service_stub.rb +389 -0
- data/lib/google/cloud/retail/v2/generative_question_service/rest.rb +52 -0
- data/lib/google/cloud/retail/v2/generative_question_service.rb +55 -0
- data/lib/google/cloud/retail/v2/generative_question_service_pb.rb +57 -0
- data/lib/google/cloud/retail/v2/generative_question_service_services_pb.rb +55 -0
- data/lib/google/cloud/retail/v2/model_service/client.rb +31 -9
- data/lib/google/cloud/retail/v2/model_service/operations.rb +12 -15
- data/lib/google/cloud/retail/v2/model_service/rest/client.rb +31 -9
- data/lib/google/cloud/retail/v2/model_service/rest/operations.rb +43 -38
- data/lib/google/cloud/retail/v2/model_service/rest/service_stub.rb +78 -50
- data/lib/google/cloud/retail/v2/prediction_service/client.rb +28 -2
- data/lib/google/cloud/retail/v2/prediction_service/rest/client.rb +28 -2
- data/lib/google/cloud/retail/v2/prediction_service/rest/service_stub.rb +22 -8
- data/lib/google/cloud/retail/v2/product_service/client.rb +36 -13
- data/lib/google/cloud/retail/v2/product_service/operations.rb +12 -15
- data/lib/google/cloud/retail/v2/product_service/rest/client.rb +36 -13
- data/lib/google/cloud/retail/v2/product_service/rest/operations.rb +43 -38
- data/lib/google/cloud/retail/v2/product_service/rest/service_stub.rb +110 -74
- data/lib/google/cloud/retail/v2/rest.rb +1 -0
- data/lib/google/cloud/retail/v2/search_service/client.rb +35 -3
- data/lib/google/cloud/retail/v2/search_service/rest/client.rb +34 -3
- data/lib/google/cloud/retail/v2/search_service/rest/service_stub.rb +22 -8
- data/lib/google/cloud/retail/v2/search_service_pb.rb +13 -2
- data/lib/google/cloud/retail/v2/serving_config_service/client.rb +29 -8
- data/lib/google/cloud/retail/v2/serving_config_service/rest/client.rb +29 -8
- data/lib/google/cloud/retail/v2/serving_config_service/rest/service_stub.rb +70 -44
- data/lib/google/cloud/retail/v2/user_event_service/client.rb +31 -6
- data/lib/google/cloud/retail/v2/user_event_service/operations.rb +12 -15
- data/lib/google/cloud/retail/v2/user_event_service/rest/client.rb +31 -6
- data/lib/google/cloud/retail/v2/user_event_service/rest/operations.rb +43 -38
- data/lib/google/cloud/retail/v2/user_event_service/rest/service_stub.rb +54 -32
- data/lib/google/cloud/retail/v2/version.rb +1 -1
- data/lib/google/cloud/retail/v2.rb +1 -0
- data/proto_docs/google/api/client.rb +39 -0
- data/proto_docs/google/cloud/retail/v2/common.rb +1 -1
- data/proto_docs/google/cloud/retail/v2/completion_service.rb +30 -2
- data/proto_docs/google/cloud/retail/v2/generative_question.rb +75 -0
- data/proto_docs/google/cloud/retail/v2/generative_question_service.rb +109 -0
- data/proto_docs/google/cloud/retail/v2/product.rb +9 -2
- data/proto_docs/google/cloud/retail/v2/search_service.rb +204 -0
- data/proto_docs/google/longrunning/operations.rb +19 -14
- metadata +17 -5
@@ -151,14 +151,26 @@ module Google
|
|
151
151
|
endpoint: @config.endpoint,
|
152
152
|
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
153
153
|
universe_domain: @config.universe_domain,
|
154
|
-
credentials: credentials
|
154
|
+
credentials: credentials,
|
155
|
+
logger: @config.logger
|
155
156
|
)
|
156
157
|
|
158
|
+
@control_service_stub.logger(stub: true)&.info do |entry|
|
159
|
+
entry.set_system_name
|
160
|
+
entry.set_service
|
161
|
+
entry.message = "Created client for #{entry.service}"
|
162
|
+
entry.set_credentials_fields credentials
|
163
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
164
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
165
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
166
|
+
end
|
167
|
+
|
157
168
|
@location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
|
158
169
|
config.credentials = credentials
|
159
170
|
config.quota_project = @quota_project_id
|
160
171
|
config.endpoint = @control_service_stub.endpoint
|
161
172
|
config.universe_domain = @control_service_stub.universe_domain
|
173
|
+
config.logger = @control_service_stub.logger if config.respond_to? :logger=
|
162
174
|
end
|
163
175
|
end
|
164
176
|
|
@@ -169,6 +181,15 @@ module Google
|
|
169
181
|
#
|
170
182
|
attr_reader :location_client
|
171
183
|
|
184
|
+
##
|
185
|
+
# The logger used for request/response debug logging.
|
186
|
+
#
|
187
|
+
# @return [Logger]
|
188
|
+
#
|
189
|
+
def logger
|
190
|
+
@control_service_stub.logger
|
191
|
+
end
|
192
|
+
|
172
193
|
# Service calls
|
173
194
|
|
174
195
|
##
|
@@ -256,7 +277,6 @@ module Google
|
|
256
277
|
|
257
278
|
@control_service_stub.create_control request, options do |result, operation|
|
258
279
|
yield result, operation if block_given?
|
259
|
-
return result
|
260
280
|
end
|
261
281
|
rescue ::Gapic::Rest::Error => e
|
262
282
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -339,7 +359,6 @@ module Google
|
|
339
359
|
|
340
360
|
@control_service_stub.delete_control request, options do |result, operation|
|
341
361
|
yield result, operation if block_given?
|
342
|
-
return result
|
343
362
|
end
|
344
363
|
rescue ::Gapic::Rest::Error => e
|
345
364
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -431,7 +450,6 @@ module Google
|
|
431
450
|
|
432
451
|
@control_service_stub.update_control request, options do |result, operation|
|
433
452
|
yield result, operation if block_given?
|
434
|
-
return result
|
435
453
|
end
|
436
454
|
rescue ::Gapic::Rest::Error => e
|
437
455
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -511,7 +529,6 @@ module Google
|
|
511
529
|
|
512
530
|
@control_service_stub.get_control request, options do |result, operation|
|
513
531
|
yield result, operation if block_given?
|
514
|
-
return result
|
515
532
|
end
|
516
533
|
rescue ::Gapic::Rest::Error => e
|
517
534
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -610,7 +627,7 @@ module Google
|
|
610
627
|
@control_service_stub.list_controls request, options do |result, operation|
|
611
628
|
result = ::Gapic::Rest::PagedEnumerable.new @control_service_stub, :list_controls, "controls", request, result, options
|
612
629
|
yield result, operation if block_given?
|
613
|
-
|
630
|
+
throw :response, result
|
614
631
|
end
|
615
632
|
rescue ::Gapic::Rest::Error => e
|
616
633
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -690,6 +707,11 @@ module Google
|
|
690
707
|
# default endpoint URL. The default value of nil uses the environment
|
691
708
|
# universe (usually the default "googleapis.com" universe).
|
692
709
|
# @return [::String,nil]
|
710
|
+
# @!attribute [rw] logger
|
711
|
+
# A custom logger to use for request/response debug logging, or the value
|
712
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
713
|
+
# explicitly disable logging.
|
714
|
+
# @return [::Logger,:default,nil]
|
693
715
|
#
|
694
716
|
class Configuration
|
695
717
|
extend ::Gapic::Config
|
@@ -711,6 +733,7 @@ module Google
|
|
711
733
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
712
734
|
config_attr :quota_project, nil, ::String, nil
|
713
735
|
config_attr :universe_domain, nil, ::String, nil
|
736
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
714
737
|
|
715
738
|
# @private
|
716
739
|
def initialize parent_config = nil
|
@@ -30,7 +30,8 @@ module Google
|
|
30
30
|
# including transcoding, making the REST call, and deserialing the response.
|
31
31
|
#
|
32
32
|
class ServiceStub
|
33
|
-
|
33
|
+
# @private
|
34
|
+
def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
|
34
35
|
# These require statements are intentionally placed here to initialize
|
35
36
|
# the REST modules only when it's required.
|
36
37
|
require "gapic/rest"
|
@@ -40,7 +41,9 @@ module Google
|
|
40
41
|
universe_domain: universe_domain,
|
41
42
|
credentials: credentials,
|
42
43
|
numeric_enums: true,
|
43
|
-
|
44
|
+
service_name: self.class,
|
45
|
+
raise_faraday_errors: false,
|
46
|
+
logger: logger
|
44
47
|
end
|
45
48
|
|
46
49
|
##
|
@@ -61,6 +64,15 @@ module Google
|
|
61
64
|
@client_stub.endpoint
|
62
65
|
end
|
63
66
|
|
67
|
+
##
|
68
|
+
# The logger used for request/response debug logging.
|
69
|
+
#
|
70
|
+
# @return [Logger]
|
71
|
+
#
|
72
|
+
def logger stub: false
|
73
|
+
stub ? @client_stub.stub_logger : @client_stub.logger
|
74
|
+
end
|
75
|
+
|
64
76
|
##
|
65
77
|
# Baseline implementation for the create_control REST call
|
66
78
|
#
|
@@ -87,16 +99,18 @@ module Google
|
|
87
99
|
|
88
100
|
response = @client_stub.make_http_request(
|
89
101
|
verb,
|
90
|
-
uri:
|
91
|
-
body:
|
92
|
-
params:
|
102
|
+
uri: uri,
|
103
|
+
body: body || "",
|
104
|
+
params: query_string_params,
|
105
|
+
method_name: "create_control",
|
93
106
|
options: options
|
94
107
|
)
|
95
108
|
operation = ::Gapic::Rest::TransportOperation.new response
|
96
109
|
result = ::Google::Cloud::Retail::V2::Control.decode_json response.body, ignore_unknown_fields: true
|
97
|
-
|
98
|
-
|
99
|
-
|
110
|
+
catch :response do
|
111
|
+
yield result, operation if block_given?
|
112
|
+
result
|
113
|
+
end
|
100
114
|
end
|
101
115
|
|
102
116
|
##
|
@@ -125,16 +139,18 @@ module Google
|
|
125
139
|
|
126
140
|
response = @client_stub.make_http_request(
|
127
141
|
verb,
|
128
|
-
uri:
|
129
|
-
body:
|
130
|
-
params:
|
142
|
+
uri: uri,
|
143
|
+
body: body || "",
|
144
|
+
params: query_string_params,
|
145
|
+
method_name: "delete_control",
|
131
146
|
options: options
|
132
147
|
)
|
133
148
|
operation = ::Gapic::Rest::TransportOperation.new response
|
134
149
|
result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
|
135
|
-
|
136
|
-
|
137
|
-
|
150
|
+
catch :response do
|
151
|
+
yield result, operation if block_given?
|
152
|
+
result
|
153
|
+
end
|
138
154
|
end
|
139
155
|
|
140
156
|
##
|
@@ -163,16 +179,18 @@ module Google
|
|
163
179
|
|
164
180
|
response = @client_stub.make_http_request(
|
165
181
|
verb,
|
166
|
-
uri:
|
167
|
-
body:
|
168
|
-
params:
|
182
|
+
uri: uri,
|
183
|
+
body: body || "",
|
184
|
+
params: query_string_params,
|
185
|
+
method_name: "update_control",
|
169
186
|
options: options
|
170
187
|
)
|
171
188
|
operation = ::Gapic::Rest::TransportOperation.new response
|
172
189
|
result = ::Google::Cloud::Retail::V2::Control.decode_json response.body, ignore_unknown_fields: true
|
173
|
-
|
174
|
-
|
175
|
-
|
190
|
+
catch :response do
|
191
|
+
yield result, operation if block_given?
|
192
|
+
result
|
193
|
+
end
|
176
194
|
end
|
177
195
|
|
178
196
|
##
|
@@ -201,16 +219,18 @@ module Google
|
|
201
219
|
|
202
220
|
response = @client_stub.make_http_request(
|
203
221
|
verb,
|
204
|
-
uri:
|
205
|
-
body:
|
206
|
-
params:
|
222
|
+
uri: uri,
|
223
|
+
body: body || "",
|
224
|
+
params: query_string_params,
|
225
|
+
method_name: "get_control",
|
207
226
|
options: options
|
208
227
|
)
|
209
228
|
operation = ::Gapic::Rest::TransportOperation.new response
|
210
229
|
result = ::Google::Cloud::Retail::V2::Control.decode_json response.body, ignore_unknown_fields: true
|
211
|
-
|
212
|
-
|
213
|
-
|
230
|
+
catch :response do
|
231
|
+
yield result, operation if block_given?
|
232
|
+
result
|
233
|
+
end
|
214
234
|
end
|
215
235
|
|
216
236
|
##
|
@@ -239,16 +259,18 @@ module Google
|
|
239
259
|
|
240
260
|
response = @client_stub.make_http_request(
|
241
261
|
verb,
|
242
|
-
uri:
|
243
|
-
body:
|
244
|
-
params:
|
262
|
+
uri: uri,
|
263
|
+
body: body || "",
|
264
|
+
params: query_string_params,
|
265
|
+
method_name: "list_controls",
|
245
266
|
options: options
|
246
267
|
)
|
247
268
|
operation = ::Gapic::Rest::TransportOperation.new response
|
248
269
|
result = ::Google::Cloud::Retail::V2::ListControlsResponse.decode_json response.body, ignore_unknown_fields: true
|
249
|
-
|
250
|
-
|
251
|
-
|
270
|
+
catch :response do
|
271
|
+
yield result, operation if block_given?
|
272
|
+
result
|
273
|
+
end
|
252
274
|
end
|
253
275
|
|
254
276
|
##
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
3
|
+
# source: google/cloud/retail/v2/generative_question.proto
|
4
|
+
|
5
|
+
require 'google/protobuf'
|
6
|
+
|
7
|
+
require 'google/api/field_behavior_pb'
|
8
|
+
|
9
|
+
|
10
|
+
descriptor_data = "\n0google/cloud/retail/v2/generative_question.proto\x12\x16google.cloud.retail.v2\x1a\x1fgoogle/api/field_behavior.proto\"u\n GenerativeQuestionsFeatureConfig\x12\x14\n\x07\x63\x61talog\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x1c\n\x0f\x66\x65\x61ture_enabled\x18\x02 \x01(\x08\x42\x03\xe0\x41\x01\x12\x1d\n\x10minimum_products\x18\x03 \x01(\x05\x42\x03\xe0\x41\x01\"\xdd\x01\n\x18GenerativeQuestionConfig\x12\x14\n\x07\x63\x61talog\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x12\n\x05\x66\x61\x63\x65t\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x1f\n\x12generated_question\x18\x03 \x01(\tB\x03\xe0\x41\x03\x12\x1b\n\x0e\x66inal_question\x18\x04 \x01(\tB\x03\xe0\x41\x01\x12\x1b\n\x0e\x65xample_values\x18\x05 \x03(\tB\x03\xe0\x41\x03\x12\x16\n\tfrequency\x18\x06 \x01(\x02\x42\x03\xe0\x41\x03\x12$\n\x17\x61llowed_in_conversation\x18\x07 \x01(\x08\x42\x03\xe0\x41\x01\x42\xc2\x01\n\x1a\x63om.google.cloud.retail.v2B\x17GenerativeQuestionProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3"
|
11
|
+
|
12
|
+
pool = Google::Protobuf::DescriptorPool.generated_pool
|
13
|
+
|
14
|
+
begin
|
15
|
+
pool.add_serialized_file(descriptor_data)
|
16
|
+
rescue TypeError
|
17
|
+
# Compatibility code: will be removed in the next major version.
|
18
|
+
require 'google/protobuf/descriptor_pb'
|
19
|
+
parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
|
20
|
+
parsed.clear_dependency
|
21
|
+
serialized = parsed.class.encode(parsed)
|
22
|
+
file = pool.add_serialized_file(serialized)
|
23
|
+
warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
|
24
|
+
imports = [
|
25
|
+
]
|
26
|
+
imports.each do |type_name, expected_filename|
|
27
|
+
import_file = pool.lookup(type_name).file_descriptor
|
28
|
+
if import_file.name != expected_filename
|
29
|
+
warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
warn "Each proto file must use a consistent fully-qualified name."
|
33
|
+
warn "This will become an error in the next major version."
|
34
|
+
end
|
35
|
+
|
36
|
+
module Google
|
37
|
+
module Cloud
|
38
|
+
module Retail
|
39
|
+
module V2
|
40
|
+
GenerativeQuestionsFeatureConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.GenerativeQuestionsFeatureConfig").msgclass
|
41
|
+
GenerativeQuestionConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.GenerativeQuestionConfig").msgclass
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|