google-cloud-retail-v2 0.12.0 → 0.14.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 +1 -1
- data/lib/google/cloud/retail/v2/catalog_service/client.rb +18 -6
- data/lib/google/cloud/retail/v2/catalog_service/rest/client.rb +1220 -0
- data/lib/google/cloud/retail/v2/catalog_service/rest/service_stub.rb +704 -0
- data/lib/google/cloud/retail/v2/catalog_service/rest.rb +52 -0
- data/lib/google/cloud/retail/v2/catalog_service.rb +6 -0
- data/lib/google/cloud/retail/v2/completion_service/client.rb +18 -4
- data/lib/google/cloud/retail/v2/completion_service/operations.rb +12 -14
- data/lib/google/cloud/retail/v2/completion_service/rest/client.rb +533 -0
- data/lib/google/cloud/retail/v2/completion_service/rest/operations.rb +828 -0
- data/lib/google/cloud/retail/v2/completion_service/rest/service_stub.rb +167 -0
- data/lib/google/cloud/retail/v2/completion_service/rest.rb +56 -0
- data/lib/google/cloud/retail/v2/completion_service.rb +6 -0
- data/lib/google/cloud/retail/v2/control_service/client.rb +18 -6
- data/lib/google/cloud/retail/v2/control_service/rest/client.rb +680 -0
- data/lib/google/cloud/retail/v2/control_service/rest/service_stub.rb +345 -0
- data/lib/google/cloud/retail/v2/control_service/rest.rb +52 -0
- data/lib/google/cloud/retail/v2/control_service.rb +6 -0
- data/lib/google/cloud/retail/v2/prediction_service/client.rb +14 -0
- data/lib/google/cloud/retail/v2/prediction_service/rest/client.rb +486 -0
- data/lib/google/cloud/retail/v2/prediction_service/rest/service_stub.rb +116 -0
- data/lib/google/cloud/retail/v2/prediction_service/rest.rb +52 -0
- data/lib/google/cloud/retail/v2/prediction_service.rb +6 -0
- data/lib/google/cloud/retail/v2/product_service/client.rb +42 -30
- data/lib/google/cloud/retail/v2/product_service/operations.rb +12 -14
- data/lib/google/cloud/retail/v2/product_service/rest/client.rb +1649 -0
- data/lib/google/cloud/retail/v2/product_service/rest/operations.rb +828 -0
- data/lib/google/cloud/retail/v2/product_service/rest/service_stub.rb +705 -0
- data/lib/google/cloud/retail/v2/product_service/rest.rb +54 -0
- data/lib/google/cloud/retail/v2/product_service.rb +6 -0
- data/lib/google/cloud/retail/v2/rest.rb +44 -0
- data/lib/google/cloud/retail/v2/search_service/client.rb +18 -6
- data/lib/google/cloud/retail/v2/search_service/rest/client.rb +598 -0
- data/lib/google/cloud/retail/v2/search_service/rest/service_stub.rb +116 -0
- data/lib/google/cloud/retail/v2/search_service/rest.rb +55 -0
- data/lib/google/cloud/retail/v2/search_service.rb +6 -0
- data/lib/google/cloud/retail/v2/serving_config_service/client.rb +18 -6
- data/lib/google/cloud/retail/v2/serving_config_service/rest/client.rb +825 -0
- data/lib/google/cloud/retail/v2/serving_config_service/rest/service_stub.rb +465 -0
- data/lib/google/cloud/retail/v2/serving_config_service/rest.rb +52 -0
- data/lib/google/cloud/retail/v2/serving_config_service.rb +6 -0
- data/lib/google/cloud/retail/v2/user_event_service/client.rb +26 -12
- data/lib/google/cloud/retail/v2/user_event_service/operations.rb +12 -14
- data/lib/google/cloud/retail/v2/user_event_service/rest/client.rb +755 -0
- data/lib/google/cloud/retail/v2/user_event_service/rest/operations.rb +828 -0
- data/lib/google/cloud/retail/v2/user_event_service/rest/service_stub.rb +347 -0
- data/lib/google/cloud/retail/v2/user_event_service/rest.rb +53 -0
- data/lib/google/cloud/retail/v2/user_event_service.rb +6 -0
- data/lib/google/cloud/retail/v2/version.rb +1 -1
- data/lib/google/cloud/retail/v2.rb +5 -0
- metadata +58 -8
@@ -0,0 +1,167 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/retail/v2/completion_service_pb"
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Cloud
|
23
|
+
module Retail
|
24
|
+
module V2
|
25
|
+
module CompletionService
|
26
|
+
module Rest
|
27
|
+
##
|
28
|
+
# REST service stub for the CompletionService service.
|
29
|
+
# Service stub contains baseline method implementations
|
30
|
+
# including transcoding, making the REST call, and deserialing the response.
|
31
|
+
#
|
32
|
+
class ServiceStub
|
33
|
+
def initialize endpoint:, credentials:
|
34
|
+
# These require statements are intentionally placed here to initialize
|
35
|
+
# the REST modules only when it's required.
|
36
|
+
require "gapic/rest"
|
37
|
+
|
38
|
+
@client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, credentials: credentials,
|
39
|
+
numeric_enums: true,
|
40
|
+
raise_faraday_errors: false
|
41
|
+
end
|
42
|
+
|
43
|
+
##
|
44
|
+
# Baseline implementation for the complete_query REST call
|
45
|
+
#
|
46
|
+
# @param request_pb [::Google::Cloud::Retail::V2::CompleteQueryRequest]
|
47
|
+
# A request object representing the call parameters. Required.
|
48
|
+
# @param options [::Gapic::CallOptions]
|
49
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
50
|
+
#
|
51
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
52
|
+
# @yieldparam result [::Google::Cloud::Retail::V2::CompleteQueryResponse]
|
53
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
54
|
+
#
|
55
|
+
# @return [::Google::Cloud::Retail::V2::CompleteQueryResponse]
|
56
|
+
# A result object deserialized from the server's reply
|
57
|
+
def complete_query request_pb, options = nil
|
58
|
+
raise ::ArgumentError, "request must be provided" if request_pb.nil?
|
59
|
+
|
60
|
+
verb, uri, query_string_params, body = ServiceStub.transcode_complete_query_request request_pb
|
61
|
+
query_string_params = if query_string_params.any?
|
62
|
+
query_string_params.to_h { |p| p.split("=", 2) }
|
63
|
+
else
|
64
|
+
{}
|
65
|
+
end
|
66
|
+
|
67
|
+
response = @client_stub.make_http_request(
|
68
|
+
verb,
|
69
|
+
uri: uri,
|
70
|
+
body: body || "",
|
71
|
+
params: query_string_params,
|
72
|
+
options: options
|
73
|
+
)
|
74
|
+
operation = ::Gapic::Rest::TransportOperation.new response
|
75
|
+
result = ::Google::Cloud::Retail::V2::CompleteQueryResponse.decode_json response.body, ignore_unknown_fields: true
|
76
|
+
|
77
|
+
yield result, operation if block_given?
|
78
|
+
result
|
79
|
+
end
|
80
|
+
|
81
|
+
##
|
82
|
+
# Baseline implementation for the import_completion_data REST call
|
83
|
+
#
|
84
|
+
# @param request_pb [::Google::Cloud::Retail::V2::ImportCompletionDataRequest]
|
85
|
+
# A request object representing the call parameters. Required.
|
86
|
+
# @param options [::Gapic::CallOptions]
|
87
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
88
|
+
#
|
89
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
90
|
+
# @yieldparam result [::Google::Longrunning::Operation]
|
91
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
92
|
+
#
|
93
|
+
# @return [::Google::Longrunning::Operation]
|
94
|
+
# A result object deserialized from the server's reply
|
95
|
+
def import_completion_data request_pb, options = nil
|
96
|
+
raise ::ArgumentError, "request must be provided" if request_pb.nil?
|
97
|
+
|
98
|
+
verb, uri, query_string_params, body = ServiceStub.transcode_import_completion_data_request request_pb
|
99
|
+
query_string_params = if query_string_params.any?
|
100
|
+
query_string_params.to_h { |p| p.split("=", 2) }
|
101
|
+
else
|
102
|
+
{}
|
103
|
+
end
|
104
|
+
|
105
|
+
response = @client_stub.make_http_request(
|
106
|
+
verb,
|
107
|
+
uri: uri,
|
108
|
+
body: body || "",
|
109
|
+
params: query_string_params,
|
110
|
+
options: options
|
111
|
+
)
|
112
|
+
operation = ::Gapic::Rest::TransportOperation.new response
|
113
|
+
result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
|
114
|
+
|
115
|
+
yield result, operation if block_given?
|
116
|
+
result
|
117
|
+
end
|
118
|
+
|
119
|
+
##
|
120
|
+
# @private
|
121
|
+
#
|
122
|
+
# GRPC transcoding helper method for the complete_query REST call
|
123
|
+
#
|
124
|
+
# @param request_pb [::Google::Cloud::Retail::V2::CompleteQueryRequest]
|
125
|
+
# A request object representing the call parameters. Required.
|
126
|
+
# @return [Array(String, [String, nil], Hash{String => String})]
|
127
|
+
# Uri, Body, Query string parameters
|
128
|
+
def self.transcode_complete_query_request request_pb
|
129
|
+
transcoder = Gapic::Rest::GrpcTranscoder.new
|
130
|
+
.with_bindings(
|
131
|
+
uri_method: :get,
|
132
|
+
uri_template: "/v2/{catalog}:completeQuery",
|
133
|
+
matches: [
|
134
|
+
["catalog", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false]
|
135
|
+
]
|
136
|
+
)
|
137
|
+
transcoder.transcode request_pb
|
138
|
+
end
|
139
|
+
|
140
|
+
##
|
141
|
+
# @private
|
142
|
+
#
|
143
|
+
# GRPC transcoding helper method for the import_completion_data REST call
|
144
|
+
#
|
145
|
+
# @param request_pb [::Google::Cloud::Retail::V2::ImportCompletionDataRequest]
|
146
|
+
# A request object representing the call parameters. Required.
|
147
|
+
# @return [Array(String, [String, nil], Hash{String => String})]
|
148
|
+
# Uri, Body, Query string parameters
|
149
|
+
def self.transcode_import_completion_data_request request_pb
|
150
|
+
transcoder = Gapic::Rest::GrpcTranscoder.new
|
151
|
+
.with_bindings(
|
152
|
+
uri_method: :post,
|
153
|
+
uri_template: "/v2/{parent}/completionData:import",
|
154
|
+
body: "*",
|
155
|
+
matches: [
|
156
|
+
["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false]
|
157
|
+
]
|
158
|
+
)
|
159
|
+
transcoder.transcode request_pb
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "gapic/rest"
|
20
|
+
require "gapic/config"
|
21
|
+
require "gapic/config/method"
|
22
|
+
|
23
|
+
require "google/cloud/retail/v2/version"
|
24
|
+
|
25
|
+
require "google/cloud/retail/v2/completion_service/credentials"
|
26
|
+
require "google/cloud/retail/v2/completion_service/paths"
|
27
|
+
require "google/cloud/retail/v2/completion_service/rest/operations"
|
28
|
+
require "google/cloud/retail/v2/completion_service/rest/client"
|
29
|
+
|
30
|
+
module Google
|
31
|
+
module Cloud
|
32
|
+
module Retail
|
33
|
+
module V2
|
34
|
+
##
|
35
|
+
# Auto-completion service for retail.
|
36
|
+
#
|
37
|
+
# This feature is only available for users who have Retail Search enabled.
|
38
|
+
# Enable Retail Search on Cloud Console before using this feature.
|
39
|
+
#
|
40
|
+
# To load this service and instantiate a REST client:
|
41
|
+
#
|
42
|
+
# require "google/cloud/retail/v2/completion_service/rest"
|
43
|
+
# client = ::Google::Cloud::Retail::V2::CompletionService::Rest::Client.new
|
44
|
+
#
|
45
|
+
module CompletionService
|
46
|
+
# Client for the REST transport
|
47
|
+
module Rest
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
helper_path = ::File.join __dir__, "rest", "helpers.rb"
|
56
|
+
require "google/cloud/retail/v2/completion_service/rest/helpers" if ::File.file? helper_path
|
@@ -26,6 +26,7 @@ require "google/cloud/retail/v2/completion_service/credentials"
|
|
26
26
|
require "google/cloud/retail/v2/completion_service/paths"
|
27
27
|
require "google/cloud/retail/v2/completion_service/operations"
|
28
28
|
require "google/cloud/retail/v2/completion_service/client"
|
29
|
+
require "google/cloud/retail/v2/completion_service/rest"
|
29
30
|
|
30
31
|
module Google
|
31
32
|
module Cloud
|
@@ -42,6 +43,11 @@ module Google
|
|
42
43
|
# require "google/cloud/retail/v2/completion_service"
|
43
44
|
# client = ::Google::Cloud::Retail::V2::CompletionService::Client.new
|
44
45
|
#
|
46
|
+
# @example Load this service and instantiate a REST client
|
47
|
+
#
|
48
|
+
# require "google/cloud/retail/v2/completion_service/rest"
|
49
|
+
# client = ::Google::Cloud::Retail::V2::CompletionService::Rest::Client.new
|
50
|
+
#
|
45
51
|
module CompletionService
|
46
52
|
end
|
47
53
|
end
|
@@ -18,6 +18,7 @@
|
|
18
18
|
|
19
19
|
require "google/cloud/errors"
|
20
20
|
require "google/cloud/retail/v2/control_service_pb"
|
21
|
+
require "google/cloud/location"
|
21
22
|
|
22
23
|
module Google
|
23
24
|
module Cloud
|
@@ -133,6 +134,12 @@ module Google
|
|
133
134
|
@quota_project_id = @config.quota_project
|
134
135
|
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
135
136
|
|
137
|
+
@location_client = Google::Cloud::Location::Locations::Client.new do |config|
|
138
|
+
config.credentials = credentials
|
139
|
+
config.quota_project = @quota_project_id
|
140
|
+
config.endpoint = @config.endpoint
|
141
|
+
end
|
142
|
+
|
136
143
|
@control_service_stub = ::Gapic::ServiceStub.new(
|
137
144
|
::Google::Cloud::Retail::V2::ControlService::Stub,
|
138
145
|
credentials: credentials,
|
@@ -142,6 +149,13 @@ module Google
|
|
142
149
|
)
|
143
150
|
end
|
144
151
|
|
152
|
+
##
|
153
|
+
# Get the associated client for mix-in of the Locations.
|
154
|
+
#
|
155
|
+
# @return [Google::Cloud::Location::Locations::Client]
|
156
|
+
#
|
157
|
+
attr_reader :location_client
|
158
|
+
|
145
159
|
# Service calls
|
146
160
|
|
147
161
|
##
|
@@ -570,13 +584,11 @@ module Google
|
|
570
584
|
# # Call the list_controls method.
|
571
585
|
# result = client.list_controls request
|
572
586
|
#
|
573
|
-
# # The returned object is of type Gapic::PagedEnumerable. You can
|
574
|
-
# #
|
575
|
-
#
|
576
|
-
# # methods are also available for managing paging directly.
|
577
|
-
# result.each do |response|
|
587
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
588
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
589
|
+
# result.each do |item|
|
578
590
|
# # Each element is of type ::Google::Cloud::Retail::V2::Control.
|
579
|
-
# p
|
591
|
+
# p item
|
580
592
|
# end
|
581
593
|
#
|
582
594
|
def list_controls request, options = nil
|