google-cloud-retail-v2 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/google/cloud/retail/v2/conversational_search_service/client.rb +557 -0
- data/lib/google/cloud/retail/v2/conversational_search_service/credentials.rb +51 -0
- data/lib/google/cloud/retail/v2/conversational_search_service/paths.rb +54 -0
- data/lib/google/cloud/retail/v2/conversational_search_service/rest/client.rb +526 -0
- data/lib/google/cloud/retail/v2/conversational_search_service/rest/service_stub.rb +145 -0
- data/lib/google/cloud/retail/v2/conversational_search_service/rest.rb +56 -0
- data/lib/google/cloud/retail/v2/conversational_search_service.rb +59 -0
- data/lib/google/cloud/retail/v2/conversational_search_service_pb.rb +65 -0
- data/lib/google/cloud/retail/v2/conversational_search_service_services_pb.rb +52 -0
- data/lib/google/cloud/retail/v2/rest.rb +2 -1
- data/lib/google/cloud/retail/v2/safety_pb.rb +47 -0
- data/lib/google/cloud/retail/v2/version.rb +1 -1
- data/lib/google/cloud/retail/v2.rb +2 -1
- data/proto_docs/google/cloud/retail/v2/conversational_search_service.rb +358 -0
- data/proto_docs/google/cloud/retail/v2/safety.rb +96 -0
- metadata +15 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77da9c5db8965ec543ef31d3e06b80607d7f122aac1b635816b5397ec29d9a64
|
4
|
+
data.tar.gz: 76368c3a722f4bf954a58ce3791fee63954eebc510295ccbb8c9fbe12feb3660
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6c4aab54b1375d9e7399b196371702baad4f1f8b121d915c42aa3ed2ed862d4607bc8e79af0906bdceb9e2f8097bb20169a07ee494be13c31a9841d75802576
|
7
|
+
data.tar.gz: af4b393b4348b57f70a9dff8d0a3a406982d488cd4eac5782cbf35c8c8b9d802cbc37ee5337da35d5e3dc1ecc306654252d9cb0e0c7f60329966f97da3532308
|
@@ -0,0 +1,557 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2025 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/conversational_search_service_pb"
|
21
|
+
require "google/cloud/location"
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Cloud
|
25
|
+
module Retail
|
26
|
+
module V2
|
27
|
+
module ConversationalSearchService
|
28
|
+
##
|
29
|
+
# Client for the ConversationalSearchService service.
|
30
|
+
#
|
31
|
+
# Service for retail conversational search.
|
32
|
+
#
|
33
|
+
# This feature is only available for users who have Retail Conversational
|
34
|
+
# Search enabled. Enable Retail Conversational Search on Cloud Console
|
35
|
+
# before using this feature.
|
36
|
+
#
|
37
|
+
class Client
|
38
|
+
# @private
|
39
|
+
API_VERSION = ""
|
40
|
+
|
41
|
+
# @private
|
42
|
+
DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$"
|
43
|
+
|
44
|
+
include Paths
|
45
|
+
|
46
|
+
# @private
|
47
|
+
attr_reader :conversational_search_service_stub
|
48
|
+
|
49
|
+
##
|
50
|
+
# Configure the ConversationalSearchService Client class.
|
51
|
+
#
|
52
|
+
# See {::Google::Cloud::Retail::V2::ConversationalSearchService::Client::Configuration}
|
53
|
+
# for a description of the configuration fields.
|
54
|
+
#
|
55
|
+
# @example
|
56
|
+
#
|
57
|
+
# # Modify the configuration for all ConversationalSearchService clients
|
58
|
+
# ::Google::Cloud::Retail::V2::ConversationalSearchService::Client.configure do |config|
|
59
|
+
# config.timeout = 10.0
|
60
|
+
# end
|
61
|
+
#
|
62
|
+
# @yield [config] Configure the Client client.
|
63
|
+
# @yieldparam config [Client::Configuration]
|
64
|
+
#
|
65
|
+
# @return [Client::Configuration]
|
66
|
+
#
|
67
|
+
def self.configure
|
68
|
+
@configure ||= begin
|
69
|
+
namespace = ["Google", "Cloud", "Retail", "V2"]
|
70
|
+
parent_config = while namespace.any?
|
71
|
+
parent_name = namespace.join "::"
|
72
|
+
parent_const = const_get parent_name
|
73
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
74
|
+
namespace.pop
|
75
|
+
end
|
76
|
+
default_config = Client::Configuration.new parent_config
|
77
|
+
|
78
|
+
default_config
|
79
|
+
end
|
80
|
+
yield @configure if block_given?
|
81
|
+
@configure
|
82
|
+
end
|
83
|
+
|
84
|
+
##
|
85
|
+
# Configure the ConversationalSearchService Client instance.
|
86
|
+
#
|
87
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
88
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
89
|
+
# should be made on {Client.configure}.
|
90
|
+
#
|
91
|
+
# See {::Google::Cloud::Retail::V2::ConversationalSearchService::Client::Configuration}
|
92
|
+
# for a description of the configuration fields.
|
93
|
+
#
|
94
|
+
# @yield [config] Configure the Client client.
|
95
|
+
# @yieldparam config [Client::Configuration]
|
96
|
+
#
|
97
|
+
# @return [Client::Configuration]
|
98
|
+
#
|
99
|
+
def configure
|
100
|
+
yield @config if block_given?
|
101
|
+
@config
|
102
|
+
end
|
103
|
+
|
104
|
+
##
|
105
|
+
# The effective universe domain
|
106
|
+
#
|
107
|
+
# @return [String]
|
108
|
+
#
|
109
|
+
def universe_domain
|
110
|
+
@conversational_search_service_stub.universe_domain
|
111
|
+
end
|
112
|
+
|
113
|
+
##
|
114
|
+
# Create a new ConversationalSearchService client object.
|
115
|
+
#
|
116
|
+
# @example
|
117
|
+
#
|
118
|
+
# # Create a client using the default configuration
|
119
|
+
# client = ::Google::Cloud::Retail::V2::ConversationalSearchService::Client.new
|
120
|
+
#
|
121
|
+
# # Create a client using a custom configuration
|
122
|
+
# client = ::Google::Cloud::Retail::V2::ConversationalSearchService::Client.new do |config|
|
123
|
+
# config.timeout = 10.0
|
124
|
+
# end
|
125
|
+
#
|
126
|
+
# @yield [config] Configure the ConversationalSearchService client.
|
127
|
+
# @yieldparam config [Client::Configuration]
|
128
|
+
#
|
129
|
+
def initialize
|
130
|
+
# These require statements are intentionally placed here to initialize
|
131
|
+
# the gRPC module only when it's required.
|
132
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
133
|
+
require "gapic/grpc"
|
134
|
+
require "google/cloud/retail/v2/conversational_search_service_services_pb"
|
135
|
+
|
136
|
+
# Create the configuration object
|
137
|
+
@config = Configuration.new Client.configure
|
138
|
+
|
139
|
+
# Yield the configuration if needed
|
140
|
+
yield @config if block_given?
|
141
|
+
|
142
|
+
# Create credentials
|
143
|
+
credentials = @config.credentials
|
144
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
145
|
+
# but only if the default endpoint does not have a region prefix.
|
146
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
147
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
148
|
+
!@config.endpoint.split(".").first.include?("-"))
|
149
|
+
credentials ||= Credentials.default scope: @config.scope,
|
150
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
151
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
152
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
153
|
+
end
|
154
|
+
@quota_project_id = @config.quota_project
|
155
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
156
|
+
|
157
|
+
@conversational_search_service_stub = ::Gapic::ServiceStub.new(
|
158
|
+
::Google::Cloud::Retail::V2::ConversationalSearchService::Stub,
|
159
|
+
credentials: credentials,
|
160
|
+
endpoint: @config.endpoint,
|
161
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
162
|
+
universe_domain: @config.universe_domain,
|
163
|
+
channel_args: @config.channel_args,
|
164
|
+
interceptors: @config.interceptors,
|
165
|
+
channel_pool_config: @config.channel_pool,
|
166
|
+
logger: @config.logger
|
167
|
+
)
|
168
|
+
|
169
|
+
@conversational_search_service_stub.stub_logger&.info do |entry|
|
170
|
+
entry.set_system_name
|
171
|
+
entry.set_service
|
172
|
+
entry.message = "Created client for #{entry.service}"
|
173
|
+
entry.set_credentials_fields credentials
|
174
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
175
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
176
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
177
|
+
end
|
178
|
+
|
179
|
+
@location_client = Google::Cloud::Location::Locations::Client.new do |config|
|
180
|
+
config.credentials = credentials
|
181
|
+
config.quota_project = @quota_project_id
|
182
|
+
config.endpoint = @conversational_search_service_stub.endpoint
|
183
|
+
config.universe_domain = @conversational_search_service_stub.universe_domain
|
184
|
+
config.logger = @conversational_search_service_stub.logger if config.respond_to? :logger=
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
##
|
189
|
+
# Get the associated client for mix-in of the Locations.
|
190
|
+
#
|
191
|
+
# @return [Google::Cloud::Location::Locations::Client]
|
192
|
+
#
|
193
|
+
attr_reader :location_client
|
194
|
+
|
195
|
+
##
|
196
|
+
# The logger used for request/response debug logging.
|
197
|
+
#
|
198
|
+
# @return [Logger]
|
199
|
+
#
|
200
|
+
def logger
|
201
|
+
@conversational_search_service_stub.logger
|
202
|
+
end
|
203
|
+
|
204
|
+
# Service calls
|
205
|
+
|
206
|
+
##
|
207
|
+
# Performs a conversational search.
|
208
|
+
#
|
209
|
+
# This feature is only available for users who have Conversational Search
|
210
|
+
# enabled.
|
211
|
+
#
|
212
|
+
# @overload conversational_search(request, options = nil)
|
213
|
+
# Pass arguments to `conversational_search` via a request object, either of type
|
214
|
+
# {::Google::Cloud::Retail::V2::ConversationalSearchRequest} or an equivalent Hash.
|
215
|
+
#
|
216
|
+
# @param request [::Google::Cloud::Retail::V2::ConversationalSearchRequest, ::Hash]
|
217
|
+
# A request object representing the call parameters. Required. To specify no
|
218
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
219
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
220
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
221
|
+
#
|
222
|
+
# @overload conversational_search(placement: nil, branch: nil, query: nil, page_categories: nil, conversation_id: nil, search_params: nil, visitor_id: nil, user_info: nil, conversational_filtering_spec: nil, user_labels: nil, safety_settings: nil)
|
223
|
+
# Pass arguments to `conversational_search` via keyword arguments. Note that at
|
224
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
225
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
226
|
+
#
|
227
|
+
# @param placement [::String]
|
228
|
+
# Required. The resource name of the search engine placement, such as
|
229
|
+
# `projects/*/locations/global/catalogs/default_catalog/placements/default_search`
|
230
|
+
# or
|
231
|
+
# `projects/*/locations/global/catalogs/default_catalog/servingConfigs/default_serving_config`
|
232
|
+
# This field is used to identify the serving config name and the set
|
233
|
+
# of models that will be used to make the search.
|
234
|
+
# @param branch [::String]
|
235
|
+
# Required. The branch resource name, such as
|
236
|
+
# `projects/*/locations/global/catalogs/default_catalog/branches/0`.
|
237
|
+
#
|
238
|
+
# Use "default_branch" as the branch ID or leave this field empty, to search
|
239
|
+
# products under the default branch.
|
240
|
+
# @param query [::String]
|
241
|
+
# Optional. Raw search query to be searched for.
|
242
|
+
#
|
243
|
+
# If this field is empty, the request is considered a category browsing
|
244
|
+
# request.
|
245
|
+
# @param page_categories [::Array<::String>]
|
246
|
+
# Optional. The categories associated with a category page. Must be set for
|
247
|
+
# category navigation queries to achieve good search quality. The format
|
248
|
+
# should be the same as
|
249
|
+
# {::Google::Cloud::Retail::V2::UserEvent#page_categories UserEvent.page_categories};
|
250
|
+
#
|
251
|
+
# To represent full path of category, use '>' sign to separate different
|
252
|
+
# hierarchies. If '>' is part of the category name, replace it with
|
253
|
+
# other character(s).
|
254
|
+
#
|
255
|
+
# Category pages include special pages such as sales or promotions. For
|
256
|
+
# instance, a special sale page may have the category hierarchy:
|
257
|
+
# "pageCategories" : ["Sales > 2017 Black Friday Deals"].
|
258
|
+
# @param conversation_id [::String]
|
259
|
+
# Optional. This field specifies the conversation id, which maintains the
|
260
|
+
# state of the conversation between client side and server side. Use the
|
261
|
+
# value from the previous
|
262
|
+
# {::Google::Cloud::Retail::V2::ConversationalSearchResponse#conversation_id ConversationalSearchResponse.conversation_id}.
|
263
|
+
# For the initial request, this should be empty.
|
264
|
+
# @param search_params [::Google::Cloud::Retail::V2::ConversationalSearchRequest::SearchParams, ::Hash]
|
265
|
+
# Optional. Search parameters.
|
266
|
+
# @param visitor_id [::String]
|
267
|
+
# Required. A unique identifier for tracking visitors. For example, this
|
268
|
+
# could be implemented with an HTTP cookie, which should be able to uniquely
|
269
|
+
# identify a visitor on a single device. This unique identifier should not
|
270
|
+
# change if the visitor logs in or out of the website.
|
271
|
+
#
|
272
|
+
# This should be the same identifier as
|
273
|
+
# {::Google::Cloud::Retail::V2::UserEvent#visitor_id UserEvent.visitor_id}.
|
274
|
+
#
|
275
|
+
# The field must be a UTF-8 encoded string with a length limit of 128
|
276
|
+
# characters. Otherwise, an INVALID_ARGUMENT error is returned.
|
277
|
+
# @param user_info [::Google::Cloud::Retail::V2::UserInfo, ::Hash]
|
278
|
+
# Optional. User information.
|
279
|
+
# @param conversational_filtering_spec [::Google::Cloud::Retail::V2::ConversationalSearchRequest::ConversationalFilteringSpec, ::Hash]
|
280
|
+
# Optional. This field specifies all conversational filtering related
|
281
|
+
# parameters.
|
282
|
+
# @param user_labels [::Hash{::String => ::String}]
|
283
|
+
# Optional. The user labels applied to a resource must meet the following
|
284
|
+
# requirements:
|
285
|
+
#
|
286
|
+
# * Each resource can have multiple labels, up to a maximum of 64.
|
287
|
+
# * Each label must be a key-value pair.
|
288
|
+
# * Keys have a minimum length of 1 character and a maximum length of 63
|
289
|
+
# characters and cannot be empty. Values can be empty and have a maximum
|
290
|
+
# length of 63 characters.
|
291
|
+
# * Keys and values can contain only lowercase letters, numeric characters,
|
292
|
+
# underscores, and dashes. All characters must use UTF-8 encoding, and
|
293
|
+
# international characters are allowed.
|
294
|
+
# * The key portion of a label must be unique. However, you can use the same
|
295
|
+
# key with multiple resources.
|
296
|
+
# * Keys must start with a lowercase letter or international character.
|
297
|
+
#
|
298
|
+
# See [Google Cloud
|
299
|
+
# Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
|
300
|
+
# for more details.
|
301
|
+
# @param safety_settings [::Array<::Google::Cloud::Retail::V2::SafetySetting, ::Hash>]
|
302
|
+
# Optional. The safety settings to be applied to the generated content.
|
303
|
+
#
|
304
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
305
|
+
# @yieldparam response [::Enumerable<::Google::Cloud::Retail::V2::ConversationalSearchResponse>]
|
306
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
307
|
+
#
|
308
|
+
# @return [::Enumerable<::Google::Cloud::Retail::V2::ConversationalSearchResponse>]
|
309
|
+
#
|
310
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
311
|
+
#
|
312
|
+
# @example Basic example
|
313
|
+
# require "google/cloud/retail/v2"
|
314
|
+
#
|
315
|
+
# # Create a client object. The client can be reused for multiple calls.
|
316
|
+
# client = Google::Cloud::Retail::V2::ConversationalSearchService::Client.new
|
317
|
+
#
|
318
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
319
|
+
# request = Google::Cloud::Retail::V2::ConversationalSearchRequest.new
|
320
|
+
#
|
321
|
+
# # Call the conversational_search method to start streaming.
|
322
|
+
# output = client.conversational_search request
|
323
|
+
#
|
324
|
+
# # The returned object is a streamed enumerable yielding elements of type
|
325
|
+
# # ::Google::Cloud::Retail::V2::ConversationalSearchResponse
|
326
|
+
# output.each do |current_response|
|
327
|
+
# p current_response
|
328
|
+
# end
|
329
|
+
#
|
330
|
+
def conversational_search request, options = nil
|
331
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
332
|
+
|
333
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ConversationalSearchRequest
|
334
|
+
|
335
|
+
# Converts hash and nil to an options object
|
336
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
337
|
+
|
338
|
+
# Customize the options with defaults
|
339
|
+
metadata = @config.rpcs.conversational_search.metadata.to_h
|
340
|
+
|
341
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
342
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
343
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
344
|
+
gapic_version: ::Google::Cloud::Retail::V2::VERSION
|
345
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
346
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
347
|
+
|
348
|
+
header_params = {}
|
349
|
+
if request.placement
|
350
|
+
header_params["placement"] = request.placement
|
351
|
+
end
|
352
|
+
|
353
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
354
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
355
|
+
|
356
|
+
options.apply_defaults timeout: @config.rpcs.conversational_search.timeout,
|
357
|
+
metadata: metadata,
|
358
|
+
retry_policy: @config.rpcs.conversational_search.retry_policy
|
359
|
+
|
360
|
+
options.apply_defaults timeout: @config.timeout,
|
361
|
+
metadata: @config.metadata,
|
362
|
+
retry_policy: @config.retry_policy
|
363
|
+
|
364
|
+
@conversational_search_service_stub.call_rpc :conversational_search, request, options: options do |response, operation|
|
365
|
+
yield response, operation if block_given?
|
366
|
+
end
|
367
|
+
rescue ::GRPC::BadStatus => e
|
368
|
+
raise ::Google::Cloud::Error.from_error(e)
|
369
|
+
end
|
370
|
+
|
371
|
+
##
|
372
|
+
# Configuration class for the ConversationalSearchService API.
|
373
|
+
#
|
374
|
+
# This class represents the configuration for ConversationalSearchService,
|
375
|
+
# providing control over timeouts, retry behavior, logging, transport
|
376
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
377
|
+
# applied individually to specific RPCs. See
|
378
|
+
# {::Google::Cloud::Retail::V2::ConversationalSearchService::Client::Configuration::Rpcs}
|
379
|
+
# for a list of RPCs that can be configured independently.
|
380
|
+
#
|
381
|
+
# Configuration can be applied globally to all clients, or to a single client
|
382
|
+
# on construction.
|
383
|
+
#
|
384
|
+
# @example
|
385
|
+
#
|
386
|
+
# # Modify the global config, setting the timeout for
|
387
|
+
# # conversational_search to 20 seconds,
|
388
|
+
# # and all remaining timeouts to 10 seconds.
|
389
|
+
# ::Google::Cloud::Retail::V2::ConversationalSearchService::Client.configure do |config|
|
390
|
+
# config.timeout = 10.0
|
391
|
+
# config.rpcs.conversational_search.timeout = 20.0
|
392
|
+
# end
|
393
|
+
#
|
394
|
+
# # Apply the above configuration only to a new client.
|
395
|
+
# client = ::Google::Cloud::Retail::V2::ConversationalSearchService::Client.new do |config|
|
396
|
+
# config.timeout = 10.0
|
397
|
+
# config.rpcs.conversational_search.timeout = 20.0
|
398
|
+
# end
|
399
|
+
#
|
400
|
+
# @!attribute [rw] endpoint
|
401
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
402
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
403
|
+
# @return [::String,nil]
|
404
|
+
# @!attribute [rw] credentials
|
405
|
+
# Credentials to send with calls. You may provide any of the following types:
|
406
|
+
# * (`String`) The path to a service account key file in JSON format
|
407
|
+
# * (`Hash`) A service account key as a Hash
|
408
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
409
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
410
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
411
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
412
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
413
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
414
|
+
# * (`nil`) indicating no credentials
|
415
|
+
#
|
416
|
+
# Warning: If you accept a credential configuration (JSON file or Hash) from an
|
417
|
+
# external source for authentication to Google Cloud, you must validate it before
|
418
|
+
# providing it to a Google API client library. Providing an unvalidated credential
|
419
|
+
# configuration to Google APIs can compromise the security of your systems and data.
|
420
|
+
# For more information, refer to [Validate credential configurations from external
|
421
|
+
# sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
|
422
|
+
# @return [::Object]
|
423
|
+
# @!attribute [rw] scope
|
424
|
+
# The OAuth scopes
|
425
|
+
# @return [::Array<::String>]
|
426
|
+
# @!attribute [rw] lib_name
|
427
|
+
# The library name as recorded in instrumentation and logging
|
428
|
+
# @return [::String]
|
429
|
+
# @!attribute [rw] lib_version
|
430
|
+
# The library version as recorded in instrumentation and logging
|
431
|
+
# @return [::String]
|
432
|
+
# @!attribute [rw] channel_args
|
433
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
434
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
435
|
+
# @return [::Hash]
|
436
|
+
# @!attribute [rw] interceptors
|
437
|
+
# An array of interceptors that are run before calls are executed.
|
438
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
439
|
+
# @!attribute [rw] timeout
|
440
|
+
# The call timeout in seconds.
|
441
|
+
# @return [::Numeric]
|
442
|
+
# @!attribute [rw] metadata
|
443
|
+
# Additional gRPC headers to be sent with the call.
|
444
|
+
# @return [::Hash{::Symbol=>::String}]
|
445
|
+
# @!attribute [rw] retry_policy
|
446
|
+
# The retry policy. The value is a hash with the following keys:
|
447
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
448
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
449
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
450
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
451
|
+
# trigger a retry.
|
452
|
+
# @return [::Hash]
|
453
|
+
# @!attribute [rw] quota_project
|
454
|
+
# A separate project against which to charge quota.
|
455
|
+
# @return [::String]
|
456
|
+
# @!attribute [rw] universe_domain
|
457
|
+
# The universe domain within which to make requests. This determines the
|
458
|
+
# default endpoint URL. The default value of nil uses the environment
|
459
|
+
# universe (usually the default "googleapis.com" universe).
|
460
|
+
# @return [::String,nil]
|
461
|
+
# @!attribute [rw] logger
|
462
|
+
# A custom logger to use for request/response debug logging, or the value
|
463
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
464
|
+
# explicitly disable logging.
|
465
|
+
# @return [::Logger,:default,nil]
|
466
|
+
#
|
467
|
+
class Configuration
|
468
|
+
extend ::Gapic::Config
|
469
|
+
|
470
|
+
# @private
|
471
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
472
|
+
DEFAULT_ENDPOINT = "retail.googleapis.com"
|
473
|
+
|
474
|
+
config_attr :endpoint, nil, ::String, nil
|
475
|
+
config_attr :credentials, nil do |value|
|
476
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
|
477
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel
|
478
|
+
allowed.any? { |klass| klass === value }
|
479
|
+
end
|
480
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
481
|
+
config_attr :lib_name, nil, ::String, nil
|
482
|
+
config_attr :lib_version, nil, ::String, nil
|
483
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
484
|
+
config_attr :interceptors, nil, ::Array, nil
|
485
|
+
config_attr :timeout, nil, ::Numeric, nil
|
486
|
+
config_attr :metadata, nil, ::Hash, nil
|
487
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
488
|
+
config_attr :quota_project, nil, ::String, nil
|
489
|
+
config_attr :universe_domain, nil, ::String, nil
|
490
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
491
|
+
|
492
|
+
# @private
|
493
|
+
def initialize parent_config = nil
|
494
|
+
@parent_config = parent_config unless parent_config.nil?
|
495
|
+
|
496
|
+
yield self if block_given?
|
497
|
+
end
|
498
|
+
|
499
|
+
##
|
500
|
+
# Configurations for individual RPCs
|
501
|
+
# @return [Rpcs]
|
502
|
+
#
|
503
|
+
def rpcs
|
504
|
+
@rpcs ||= begin
|
505
|
+
parent_rpcs = nil
|
506
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
507
|
+
Rpcs.new parent_rpcs
|
508
|
+
end
|
509
|
+
end
|
510
|
+
|
511
|
+
##
|
512
|
+
# Configuration for the channel pool
|
513
|
+
# @return [::Gapic::ServiceStub::ChannelPool::Configuration]
|
514
|
+
#
|
515
|
+
def channel_pool
|
516
|
+
@channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
|
517
|
+
end
|
518
|
+
|
519
|
+
##
|
520
|
+
# Configuration RPC class for the ConversationalSearchService API.
|
521
|
+
#
|
522
|
+
# Includes fields providing the configuration for each RPC in this service.
|
523
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
524
|
+
# the following configuration fields:
|
525
|
+
#
|
526
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
527
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
528
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
529
|
+
# include the following keys:
|
530
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
531
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
532
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
533
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
534
|
+
# trigger a retry.
|
535
|
+
#
|
536
|
+
class Rpcs
|
537
|
+
##
|
538
|
+
# RPC-specific configuration for `conversational_search`
|
539
|
+
# @return [::Gapic::Config::Method]
|
540
|
+
#
|
541
|
+
attr_reader :conversational_search
|
542
|
+
|
543
|
+
# @private
|
544
|
+
def initialize parent_rpcs = nil
|
545
|
+
conversational_search_config = parent_rpcs.conversational_search if parent_rpcs.respond_to? :conversational_search
|
546
|
+
@conversational_search = ::Gapic::Config::Method.new conversational_search_config
|
547
|
+
|
548
|
+
yield self if block_given?
|
549
|
+
end
|
550
|
+
end
|
551
|
+
end
|
552
|
+
end
|
553
|
+
end
|
554
|
+
end
|
555
|
+
end
|
556
|
+
end
|
557
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2025 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 ConversationalSearchService
|
26
|
+
# Credentials for the ConversationalSearchService 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,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2025 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 ConversationalSearchService
|
25
|
+
# Path helper methods for the ConversationalSearchService 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
|
+
extend self
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|