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,116 @@
|
|
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/search_service_pb"
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Cloud
|
23
|
+
module Retail
|
24
|
+
module V2
|
25
|
+
module SearchService
|
26
|
+
module Rest
|
27
|
+
##
|
28
|
+
# REST service stub for the SearchService 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 search REST call
|
45
|
+
#
|
46
|
+
# @param request_pb [::Google::Cloud::Retail::V2::SearchRequest]
|
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::SearchResponse]
|
53
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
54
|
+
#
|
55
|
+
# @return [::Google::Cloud::Retail::V2::SearchResponse]
|
56
|
+
# A result object deserialized from the server's reply
|
57
|
+
def search 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_search_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::SearchResponse.decode_json response.body, ignore_unknown_fields: true
|
76
|
+
|
77
|
+
yield result, operation if block_given?
|
78
|
+
result
|
79
|
+
end
|
80
|
+
|
81
|
+
##
|
82
|
+
# @private
|
83
|
+
#
|
84
|
+
# GRPC transcoding helper method for the search REST call
|
85
|
+
#
|
86
|
+
# @param request_pb [::Google::Cloud::Retail::V2::SearchRequest]
|
87
|
+
# A request object representing the call parameters. Required.
|
88
|
+
# @return [Array(String, [String, nil], Hash{String => String})]
|
89
|
+
# Uri, Body, Query string parameters
|
90
|
+
def self.transcode_search_request request_pb
|
91
|
+
transcoder = Gapic::Rest::GrpcTranscoder.new
|
92
|
+
.with_bindings(
|
93
|
+
uri_method: :post,
|
94
|
+
uri_template: "/v2/{placement}:search",
|
95
|
+
body: "*",
|
96
|
+
matches: [
|
97
|
+
["placement", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/placements/[^/]+/?$}, false]
|
98
|
+
]
|
99
|
+
)
|
100
|
+
.with_bindings(
|
101
|
+
uri_method: :post,
|
102
|
+
uri_template: "/v2/{placement}:search",
|
103
|
+
body: "*",
|
104
|
+
matches: [
|
105
|
+
["placement", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/servingConfigs/[^/]+/?$}, false]
|
106
|
+
]
|
107
|
+
)
|
108
|
+
transcoder.transcode request_pb
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
@@ -0,0 +1,55 @@
|
|
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/search_service/credentials"
|
26
|
+
require "google/cloud/retail/v2/search_service/paths"
|
27
|
+
require "google/cloud/retail/v2/search_service/rest/client"
|
28
|
+
|
29
|
+
module Google
|
30
|
+
module Cloud
|
31
|
+
module Retail
|
32
|
+
module V2
|
33
|
+
##
|
34
|
+
# Service for search.
|
35
|
+
#
|
36
|
+
# This feature is only available for users who have Retail Search enabled.
|
37
|
+
# Enable Retail Search on Cloud Console before using this feature.
|
38
|
+
#
|
39
|
+
# To load this service and instantiate a REST client:
|
40
|
+
#
|
41
|
+
# require "google/cloud/retail/v2/search_service/rest"
|
42
|
+
# client = ::Google::Cloud::Retail::V2::SearchService::Rest::Client.new
|
43
|
+
#
|
44
|
+
module SearchService
|
45
|
+
# Client for the REST transport
|
46
|
+
module Rest
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
helper_path = ::File.join __dir__, "rest", "helpers.rb"
|
55
|
+
require "google/cloud/retail/v2/search_service/rest/helpers" if ::File.file? helper_path
|
@@ -25,6 +25,7 @@ require "google/cloud/retail/v2/version"
|
|
25
25
|
require "google/cloud/retail/v2/search_service/credentials"
|
26
26
|
require "google/cloud/retail/v2/search_service/paths"
|
27
27
|
require "google/cloud/retail/v2/search_service/client"
|
28
|
+
require "google/cloud/retail/v2/search_service/rest"
|
28
29
|
|
29
30
|
module Google
|
30
31
|
module Cloud
|
@@ -41,6 +42,11 @@ module Google
|
|
41
42
|
# require "google/cloud/retail/v2/search_service"
|
42
43
|
# client = ::Google::Cloud::Retail::V2::SearchService::Client.new
|
43
44
|
#
|
45
|
+
# @example Load this service and instantiate a REST client
|
46
|
+
#
|
47
|
+
# require "google/cloud/retail/v2/search_service/rest"
|
48
|
+
# client = ::Google::Cloud::Retail::V2::SearchService::Rest::Client.new
|
49
|
+
#
|
44
50
|
module SearchService
|
45
51
|
end
|
46
52
|
end
|
@@ -18,6 +18,7 @@
|
|
18
18
|
|
19
19
|
require "google/cloud/errors"
|
20
20
|
require "google/cloud/retail/v2/serving_config_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
|
@serving_config_service_stub = ::Gapic::ServiceStub.new(
|
137
144
|
::Google::Cloud::Retail::V2::ServingConfigService::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
|
##
|
@@ -560,13 +574,11 @@ module Google
|
|
560
574
|
# # Call the list_serving_configs method.
|
561
575
|
# result = client.list_serving_configs request
|
562
576
|
#
|
563
|
-
# # The returned object is of type Gapic::PagedEnumerable. You can
|
564
|
-
# #
|
565
|
-
#
|
566
|
-
# # methods are also available for managing paging directly.
|
567
|
-
# result.each do |response|
|
577
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
578
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
579
|
+
# result.each do |item|
|
568
580
|
# # Each element is of type ::Google::Cloud::Retail::V2::ServingConfig.
|
569
|
-
# p
|
581
|
+
# p item
|
570
582
|
# end
|
571
583
|
#
|
572
584
|
def list_serving_configs request, options = nil
|