google-cloud-discovery_engine-v1beta 0.a → 0.1.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.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +149 -0
  4. data/README.md +144 -8
  5. data/lib/google/cloud/discovery_engine/v1beta/completion_service/client.rb +429 -0
  6. data/lib/google/cloud/discovery_engine/v1beta/completion_service/credentials.rb +47 -0
  7. data/lib/google/cloud/discovery_engine/v1beta/completion_service/paths.rb +78 -0
  8. data/lib/google/cloud/discovery_engine/v1beta/completion_service/rest/client.rb +386 -0
  9. data/lib/google/cloud/discovery_engine/v1beta/completion_service/rest/service_stub.rb +114 -0
  10. data/lib/google/cloud/discovery_engine/v1beta/completion_service/rest.rb +52 -0
  11. data/lib/google/cloud/discovery_engine/v1beta/completion_service.rb +55 -0
  12. data/lib/google/cloud/discovery_engine/v1beta/document_service/client.rb +1107 -0
  13. data/lib/google/cloud/discovery_engine/v1beta/document_service/credentials.rb +47 -0
  14. data/lib/google/cloud/discovery_engine/v1beta/document_service/operations.rb +768 -0
  15. data/lib/google/cloud/discovery_engine/v1beta/document_service/paths.rb +135 -0
  16. data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/client.rb +908 -0
  17. data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/operations.rb +905 -0
  18. data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/service_stub.rb +518 -0
  19. data/lib/google/cloud/discovery_engine/v1beta/document_service/rest.rb +55 -0
  20. data/lib/google/cloud/discovery_engine/v1beta/document_service.rb +58 -0
  21. data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/client.rb +486 -0
  22. data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/credentials.rb +47 -0
  23. data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/paths.rb +135 -0
  24. data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/rest/client.rb +443 -0
  25. data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/rest/service_stub.rb +116 -0
  26. data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/rest.rb +52 -0
  27. data/lib/google/cloud/discovery_engine/v1beta/recommendation_service.rb +55 -0
  28. data/lib/google/cloud/discovery_engine/v1beta/rest.rb +42 -0
  29. data/lib/google/cloud/discovery_engine/v1beta/schema_service/client.rb +840 -0
  30. data/lib/google/cloud/discovery_engine/v1beta/schema_service/credentials.rb +47 -0
  31. data/lib/google/cloud/discovery_engine/v1beta/schema_service/operations.rb +768 -0
  32. data/lib/google/cloud/discovery_engine/v1beta/schema_service/paths.rb +127 -0
  33. data/lib/google/cloud/discovery_engine/v1beta/schema_service/rest/client.rb +680 -0
  34. data/lib/google/cloud/discovery_engine/v1beta/schema_service/rest/operations.rb +905 -0
  35. data/lib/google/cloud/discovery_engine/v1beta/schema_service/rest/service_stub.rb +382 -0
  36. data/lib/google/cloud/discovery_engine/v1beta/schema_service/rest.rb +53 -0
  37. data/lib/google/cloud/discovery_engine/v1beta/schema_service.rb +56 -0
  38. data/lib/google/cloud/discovery_engine/v1beta/search_service/client.rb +513 -0
  39. data/lib/google/cloud/discovery_engine/v1beta/search_service/credentials.rb +47 -0
  40. data/lib/google/cloud/discovery_engine/v1beta/search_service/paths.rb +131 -0
  41. data/lib/google/cloud/discovery_engine/v1beta/search_service/rest/client.rb +465 -0
  42. data/lib/google/cloud/discovery_engine/v1beta/search_service/rest/service_stub.rb +116 -0
  43. data/lib/google/cloud/discovery_engine/v1beta/search_service/rest.rb +52 -0
  44. data/lib/google/cloud/discovery_engine/v1beta/search_service.rb +55 -0
  45. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/client.rb +638 -0
  46. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/credentials.rb +47 -0
  47. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/operations.rb +768 -0
  48. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/paths.rb +131 -0
  49. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest/client.rb +542 -0
  50. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest/operations.rb +905 -0
  51. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest/service_stub.rb +250 -0
  52. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest.rb +53 -0
  53. data/lib/google/cloud/discovery_engine/v1beta/user_event_service.rb +56 -0
  54. data/lib/google/cloud/discovery_engine/v1beta/version.rb +7 -2
  55. data/lib/google/cloud/discovery_engine/v1beta.rb +50 -0
  56. data/lib/google/cloud/discoveryengine/v1beta/common_pb.rb +41 -0
  57. data/lib/google/cloud/discoveryengine/v1beta/completion_service_pb.rb +38 -0
  58. data/lib/google/cloud/discoveryengine/v1beta/completion_service_services_pb.rb +45 -0
  59. data/lib/google/cloud/discoveryengine/v1beta/document_pb.rb +43 -0
  60. data/lib/google/cloud/discoveryengine/v1beta/document_service_pb.rb +58 -0
  61. data/lib/google/cloud/discoveryengine/v1beta/document_service_services_pb.rb +81 -0
  62. data/lib/google/cloud/discoveryengine/v1beta/import_config_pb.rb +109 -0
  63. data/lib/google/cloud/discoveryengine/v1beta/purge_config_pb.rb +40 -0
  64. data/lib/google/cloud/discoveryengine/v1beta/recommendation_service_pb.rb +49 -0
  65. data/lib/google/cloud/discoveryengine/v1beta/recommendation_service_services_pb.rb +45 -0
  66. data/lib/google/cloud/discoveryengine/v1beta/schema_pb.rb +30 -0
  67. data/lib/google/cloud/discoveryengine/v1beta/schema_service_pb.rb +72 -0
  68. data/lib/google/cloud/discoveryengine/v1beta/schema_service_services_pb.rb +53 -0
  69. data/lib/google/cloud/discoveryengine/v1beta/search_service_pb.rb +151 -0
  70. data/lib/google/cloud/discoveryengine/v1beta/search_service_services_pb.rb +45 -0
  71. data/lib/google/cloud/discoveryengine/v1beta/user_event_pb.rb +93 -0
  72. data/lib/google/cloud/discoveryengine/v1beta/user_event_service_pb.rb +39 -0
  73. data/lib/google/cloud/discoveryengine/v1beta/user_event_service_services_pb.rb +59 -0
  74. data/lib/google-cloud-discovery_engine-v1beta.rb +21 -0
  75. data/proto_docs/README.md +4 -0
  76. data/proto_docs/google/api/client.rb +381 -0
  77. data/proto_docs/google/api/field_behavior.rb +71 -0
  78. data/proto_docs/google/api/httpbody.rb +80 -0
  79. data/proto_docs/google/api/launch_stage.rb +71 -0
  80. data/proto_docs/google/api/resource.rb +222 -0
  81. data/proto_docs/google/cloud/discoveryengine/v1beta/common.rb +107 -0
  82. data/proto_docs/google/cloud/discoveryengine/v1beta/completion_service.rb +98 -0
  83. data/proto_docs/google/cloud/discoveryengine/v1beta/document.rb +107 -0
  84. data/proto_docs/google/cloud/discoveryengine/v1beta/document_service.rb +181 -0
  85. data/proto_docs/google/cloud/discoveryengine/v1beta/import_config.rb +286 -0
  86. data/proto_docs/google/cloud/discoveryengine/v1beta/purge_config.rb +84 -0
  87. data/proto_docs/google/cloud/discoveryengine/v1beta/recommendation_service.rb +210 -0
  88. data/proto_docs/google/cloud/discoveryengine/v1beta/schema.rb +45 -0
  89. data/proto_docs/google/cloud/discoveryengine/v1beta/schema_service.rb +180 -0
  90. data/proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb +605 -0
  91. data/proto_docs/google/cloud/discoveryengine/v1beta/user_event.rb +473 -0
  92. data/proto_docs/google/cloud/discoveryengine/v1beta/user_event_service.rb +64 -0
  93. data/proto_docs/google/longrunning/operations.rb +164 -0
  94. data/proto_docs/google/protobuf/any.rb +141 -0
  95. data/proto_docs/google/protobuf/duration.rb +98 -0
  96. data/proto_docs/google/protobuf/empty.rb +34 -0
  97. data/proto_docs/google/protobuf/struct.rb +96 -0
  98. data/proto_docs/google/protobuf/timestamp.rb +129 -0
  99. data/proto_docs/google/rpc/status.rb +48 -0
  100. data/proto_docs/google/type/date.rb +53 -0
  101. metadata +254 -12
@@ -0,0 +1,513 @@
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/errors"
20
+ require "google/cloud/discoveryengine/v1beta/search_service_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module DiscoveryEngine
25
+ module V1beta
26
+ module SearchService
27
+ ##
28
+ # Client for the SearchService service.
29
+ #
30
+ # Service for search.
31
+ #
32
+ class Client
33
+ include Paths
34
+
35
+ # @private
36
+ attr_reader :search_service_stub
37
+
38
+ ##
39
+ # Configure the SearchService Client class.
40
+ #
41
+ # See {::Google::Cloud::DiscoveryEngine::V1beta::SearchService::Client::Configuration}
42
+ # for a description of the configuration fields.
43
+ #
44
+ # @example
45
+ #
46
+ # # Modify the configuration for all SearchService clients
47
+ # ::Google::Cloud::DiscoveryEngine::V1beta::SearchService::Client.configure do |config|
48
+ # config.timeout = 10.0
49
+ # end
50
+ #
51
+ # @yield [config] Configure the Client client.
52
+ # @yieldparam config [Client::Configuration]
53
+ #
54
+ # @return [Client::Configuration]
55
+ #
56
+ def self.configure
57
+ @configure ||= begin
58
+ namespace = ["Google", "Cloud", "DiscoveryEngine", "V1beta"]
59
+ parent_config = while namespace.any?
60
+ parent_name = namespace.join "::"
61
+ parent_const = const_get parent_name
62
+ break parent_const.configure if parent_const.respond_to? :configure
63
+ namespace.pop
64
+ end
65
+ default_config = Client::Configuration.new parent_config
66
+
67
+ default_config.timeout = 5.0
68
+ default_config.retry_policy = {
69
+ initial_delay: 0.1, max_delay: 5.0, multiplier: 1.3, retry_codes: [14]
70
+ }
71
+
72
+ default_config
73
+ end
74
+ yield @configure if block_given?
75
+ @configure
76
+ end
77
+
78
+ ##
79
+ # Configure the SearchService Client instance.
80
+ #
81
+ # The configuration is set to the derived mode, meaning that values can be changed,
82
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
83
+ # should be made on {Client.configure}.
84
+ #
85
+ # See {::Google::Cloud::DiscoveryEngine::V1beta::SearchService::Client::Configuration}
86
+ # for a description of the configuration fields.
87
+ #
88
+ # @yield [config] Configure the Client client.
89
+ # @yieldparam config [Client::Configuration]
90
+ #
91
+ # @return [Client::Configuration]
92
+ #
93
+ def configure
94
+ yield @config if block_given?
95
+ @config
96
+ end
97
+
98
+ ##
99
+ # Create a new SearchService client object.
100
+ #
101
+ # @example
102
+ #
103
+ # # Create a client using the default configuration
104
+ # client = ::Google::Cloud::DiscoveryEngine::V1beta::SearchService::Client.new
105
+ #
106
+ # # Create a client using a custom configuration
107
+ # client = ::Google::Cloud::DiscoveryEngine::V1beta::SearchService::Client.new do |config|
108
+ # config.timeout = 10.0
109
+ # end
110
+ #
111
+ # @yield [config] Configure the SearchService client.
112
+ # @yieldparam config [Client::Configuration]
113
+ #
114
+ def initialize
115
+ # These require statements are intentionally placed here to initialize
116
+ # the gRPC module only when it's required.
117
+ # See https://github.com/googleapis/toolkit/issues/446
118
+ require "gapic/grpc"
119
+ require "google/cloud/discoveryengine/v1beta/search_service_services_pb"
120
+
121
+ # Create the configuration object
122
+ @config = Configuration.new Client.configure
123
+
124
+ # Yield the configuration if needed
125
+ yield @config if block_given?
126
+
127
+ # Create credentials
128
+ credentials = @config.credentials
129
+ # Use self-signed JWT if the endpoint is unchanged from default,
130
+ # but only if the default endpoint does not have a region prefix.
131
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
132
+ !@config.endpoint.split(".").first.include?("-")
133
+ credentials ||= Credentials.default scope: @config.scope,
134
+ enable_self_signed_jwt: enable_self_signed_jwt
135
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
136
+ credentials = Credentials.new credentials, scope: @config.scope
137
+ end
138
+ @quota_project_id = @config.quota_project
139
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
140
+
141
+ @search_service_stub = ::Gapic::ServiceStub.new(
142
+ ::Google::Cloud::DiscoveryEngine::V1beta::SearchService::Stub,
143
+ credentials: credentials,
144
+ endpoint: @config.endpoint,
145
+ channel_args: @config.channel_args,
146
+ interceptors: @config.interceptors
147
+ )
148
+ end
149
+
150
+ # Service calls
151
+
152
+ ##
153
+ # Performs a search.
154
+ #
155
+ # @overload search(request, options = nil)
156
+ # Pass arguments to `search` via a request object, either of type
157
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest} or an equivalent Hash.
158
+ #
159
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest, ::Hash]
160
+ # A request object representing the call parameters. Required. To specify no
161
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
162
+ # @param options [::Gapic::CallOptions, ::Hash]
163
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
164
+ #
165
+ # @overload search(serving_config: nil, branch: nil, query: nil, page_size: nil, page_token: nil, offset: nil, filter: nil, order_by: nil, user_info: nil, facet_specs: nil, boost_spec: nil, params: nil, query_expansion_spec: nil, spell_correction_spec: nil, user_pseudo_id: nil, content_search_spec: nil, safe_search: nil, user_labels: nil)
166
+ # Pass arguments to `search` via keyword arguments. Note that at
167
+ # least one keyword argument is required. To specify no parameters, or to keep all
168
+ # the default parameter values, pass an empty Hash as a request object (see above).
169
+ #
170
+ # @param serving_config [::String]
171
+ # Required. The resource name of the Search serving config, such as
172
+ # `projects/*/locations/global/collections/default_collection/dataStores/default_data_store/servingConfigs/default_serving_config`.
173
+ # This field is used to identify the serving configuration name, set
174
+ # of models used to make the search.
175
+ # @param branch [::String]
176
+ # The branch resource name, such as
177
+ # `projects/*/locations/global/collections/default_collection/dataStores/default_data_store/branches/0`.
178
+ #
179
+ # Use `default_branch` as the branch ID or leave this field empty, to search
180
+ # documents under the default branch.
181
+ # @param query [::String]
182
+ # Raw search query.
183
+ # @param page_size [::Integer]
184
+ # Maximum number of {::Google::Cloud::DiscoveryEngine::V1beta::Document Document}s
185
+ # to return. If unspecified, defaults to a reasonable value. The maximum
186
+ # allowed value is 100. Values above 100 will be coerced to 100.
187
+ #
188
+ # If this field is negative, an `INVALID_ARGUMENT` is returned.
189
+ # @param page_token [::String]
190
+ # A page token received from a previous
191
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SearchService::Client#search SearchService.Search}
192
+ # call. Provide this to retrieve the subsequent page.
193
+ #
194
+ # When paginating, all other parameters provided to
195
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SearchService::Client#search SearchService.Search}
196
+ # must match the call that provided the page token. Otherwise, an
197
+ # `INVALID_ARGUMENT` error is returned.
198
+ # @param offset [::Integer]
199
+ # A 0-indexed integer that specifies the current offset (that is, starting
200
+ # result location, amongst the
201
+ # {::Google::Cloud::DiscoveryEngine::V1beta::Document Document}s deemed by the API
202
+ # as relevant) in search results. This field is only considered if
203
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest#page_token page_token}
204
+ # is unset.
205
+ #
206
+ # If this field is negative, an `INVALID_ARGUMENT` is returned.
207
+ # @param filter [::String]
208
+ # The filter syntax consists of an expression language for constructing a
209
+ # predicate from one or more fields of the documents being filtered. Filter
210
+ # expression is case-sensitive.
211
+ #
212
+ # If this field is unrecognizable, an `INVALID_ARGUMENT` is returned.
213
+ # @param order_by [::String]
214
+ # The order in which documents are returned. Document can be ordered by
215
+ # a field in an {::Google::Cloud::DiscoveryEngine::V1beta::Document Document}
216
+ # object. Leave it unset if ordered by relevance. OrderBy expression is
217
+ # case-sensitive.
218
+ #
219
+ # If this field is unrecognizable, an `INVALID_ARGUMENT` is returned.
220
+ # @param user_info [::Google::Cloud::DiscoveryEngine::V1beta::UserInfo, ::Hash]
221
+ # Information about the end user.
222
+ # Highly recommended for analytics. The user_agent string in UserInfo will
223
+ # be used to deduce device_type for analytics.
224
+ # @param facet_specs [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::FacetSpec, ::Hash>]
225
+ # Facet specifications for faceted search. If empty, no facets are returned.
226
+ #
227
+ # A maximum of 100 values are allowed. Otherwise, an `INVALID_ARGUMENT`
228
+ # error is returned.
229
+ # @param boost_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::BoostSpec, ::Hash]
230
+ # Boost specification to boost certain documents.
231
+ # @param params [::Hash{::String => ::Google::Protobuf::Value, ::Hash}]
232
+ # Additional search parameters.
233
+ #
234
+ # For
235
+ # [IndustryVertical.SITE_SEARCH][google.cloud.discoveryengine.v1beta.IndustryVertical.SITE_SEARCH]
236
+ # vertical, supported values are:
237
+ #
238
+ # * `user_country_code`: string. Default empty. If set to non-empty, results
239
+ # are restricted or boosted based on the location provided.
240
+ # * `search_type`: double. Default empty. Enables non-webpage searching
241
+ # depending on the value. The only valid non-default value is 1,
242
+ # which enables image searching.
243
+ # @param query_expansion_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec, ::Hash]
244
+ # The query expansion specification that specifies the conditions under which
245
+ # query expansion will occur.
246
+ # @param spell_correction_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec, ::Hash]
247
+ # The spell correction specification that specifies the mode under
248
+ # which spell correction will take effect.
249
+ # @param user_pseudo_id [::String]
250
+ # A unique identifier for tracking visitors. For example, this could be
251
+ # implemented with an HTTP cookie, which should be able to uniquely identify
252
+ # a visitor on a single device. This unique identifier should not change if
253
+ # the visitor logs in or out of the website.
254
+ #
255
+ # This field should NOT have a fixed value such as `unknown_visitor`.
256
+ #
257
+ # This should be the same identifier as
258
+ # {::Google::Cloud::DiscoveryEngine::V1beta::UserEvent#user_pseudo_id UserEvent.user_pseudo_id}
259
+ # and
260
+ # {::Google::Cloud::DiscoveryEngine::V1beta::CompleteQueryRequest#user_pseudo_id CompleteQueryRequest.user_pseudo_id}
261
+ #
262
+ # The field must be a UTF-8 encoded string with a length limit of 128
263
+ # characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
264
+ # @param content_search_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec, ::Hash]
265
+ # The content search spec that configs the desired behavior of content
266
+ # search.
267
+ # @param safe_search [::Boolean]
268
+ # Whether to turn on safe search. This is only supported for
269
+ # [ContentConfig.PUBLIC_WEBSITE][].
270
+ # @param user_labels [::Hash{::String => ::String}]
271
+ # The user labels applied to a resource must meet the following requirements:
272
+ #
273
+ # * Each resource can have multiple labels, up to a maximum of 64.
274
+ # * Each label must be a key-value pair.
275
+ # * Keys have a minimum length of 1 character and a maximum length of 63
276
+ # characters and cannot be empty. Values can be empty and have a maximum
277
+ # length of 63 characters.
278
+ # * Keys and values can contain only lowercase letters, numeric characters,
279
+ # underscores, and dashes. All characters must use UTF-8 encoding, and
280
+ # international characters are allowed.
281
+ # * The key portion of a label must be unique. However, you can use the same
282
+ # key with multiple resources.
283
+ # * Keys must start with a lowercase letter or international character.
284
+ #
285
+ # See [Google Cloud
286
+ # Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
287
+ # for more details.
288
+ #
289
+ # @yield [response, operation] Access the result along with the RPC operation
290
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::SearchResult>]
291
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
292
+ #
293
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::SearchResult>]
294
+ #
295
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
296
+ #
297
+ # @example Basic example
298
+ # require "google/cloud/discovery_engine/v1beta"
299
+ #
300
+ # # Create a client object. The client can be reused for multiple calls.
301
+ # client = Google::Cloud::DiscoveryEngine::V1beta::SearchService::Client.new
302
+ #
303
+ # # Create a request. To set request fields, pass in keyword arguments.
304
+ # request = Google::Cloud::DiscoveryEngine::V1beta::SearchRequest.new
305
+ #
306
+ # # Call the search method.
307
+ # result = client.search request
308
+ #
309
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
310
+ # # over elements, and API calls will be issued to fetch pages as needed.
311
+ # result.each do |item|
312
+ # # Each element is of type ::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::SearchResult.
313
+ # p item
314
+ # end
315
+ #
316
+ def search request, options = nil
317
+ raise ::ArgumentError, "request must be provided" if request.nil?
318
+
319
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest
320
+
321
+ # Converts hash and nil to an options object
322
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
323
+
324
+ # Customize the options with defaults
325
+ metadata = @config.rpcs.search.metadata.to_h
326
+
327
+ # Set x-goog-api-client and x-goog-user-project headers
328
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
329
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
330
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION
331
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
332
+
333
+ header_params = {}
334
+ if request.serving_config
335
+ header_params["serving_config"] = request.serving_config
336
+ end
337
+
338
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
339
+ metadata[:"x-goog-request-params"] ||= request_params_header
340
+
341
+ options.apply_defaults timeout: @config.rpcs.search.timeout,
342
+ metadata: metadata,
343
+ retry_policy: @config.rpcs.search.retry_policy
344
+
345
+ options.apply_defaults timeout: @config.timeout,
346
+ metadata: @config.metadata,
347
+ retry_policy: @config.retry_policy
348
+
349
+ @search_service_stub.call_rpc :search, request, options: options do |response, operation|
350
+ response = ::Gapic::PagedEnumerable.new @search_service_stub, :search, request, response, operation, options
351
+ yield response, operation if block_given?
352
+ return response
353
+ end
354
+ rescue ::GRPC::BadStatus => e
355
+ raise ::Google::Cloud::Error.from_error(e)
356
+ end
357
+
358
+ ##
359
+ # Configuration class for the SearchService API.
360
+ #
361
+ # This class represents the configuration for SearchService,
362
+ # providing control over timeouts, retry behavior, logging, transport
363
+ # parameters, and other low-level controls. Certain parameters can also be
364
+ # applied individually to specific RPCs. See
365
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SearchService::Client::Configuration::Rpcs}
366
+ # for a list of RPCs that can be configured independently.
367
+ #
368
+ # Configuration can be applied globally to all clients, or to a single client
369
+ # on construction.
370
+ #
371
+ # @example
372
+ #
373
+ # # Modify the global config, setting the timeout for
374
+ # # search to 20 seconds,
375
+ # # and all remaining timeouts to 10 seconds.
376
+ # ::Google::Cloud::DiscoveryEngine::V1beta::SearchService::Client.configure do |config|
377
+ # config.timeout = 10.0
378
+ # config.rpcs.search.timeout = 20.0
379
+ # end
380
+ #
381
+ # # Apply the above configuration only to a new client.
382
+ # client = ::Google::Cloud::DiscoveryEngine::V1beta::SearchService::Client.new do |config|
383
+ # config.timeout = 10.0
384
+ # config.rpcs.search.timeout = 20.0
385
+ # end
386
+ #
387
+ # @!attribute [rw] endpoint
388
+ # The hostname or hostname:port of the service endpoint.
389
+ # Defaults to `"discoveryengine.googleapis.com"`.
390
+ # @return [::String]
391
+ # @!attribute [rw] credentials
392
+ # Credentials to send with calls. You may provide any of the following types:
393
+ # * (`String`) The path to a service account key file in JSON format
394
+ # * (`Hash`) A service account key as a Hash
395
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
396
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
397
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
398
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
399
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
400
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
401
+ # * (`nil`) indicating no credentials
402
+ # @return [::Object]
403
+ # @!attribute [rw] scope
404
+ # The OAuth scopes
405
+ # @return [::Array<::String>]
406
+ # @!attribute [rw] lib_name
407
+ # The library name as recorded in instrumentation and logging
408
+ # @return [::String]
409
+ # @!attribute [rw] lib_version
410
+ # The library version as recorded in instrumentation and logging
411
+ # @return [::String]
412
+ # @!attribute [rw] channel_args
413
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
414
+ # `GRPC::Core::Channel` object is provided as the credential.
415
+ # @return [::Hash]
416
+ # @!attribute [rw] interceptors
417
+ # An array of interceptors that are run before calls are executed.
418
+ # @return [::Array<::GRPC::ClientInterceptor>]
419
+ # @!attribute [rw] timeout
420
+ # The call timeout in seconds.
421
+ # @return [::Numeric]
422
+ # @!attribute [rw] metadata
423
+ # Additional gRPC headers to be sent with the call.
424
+ # @return [::Hash{::Symbol=>::String}]
425
+ # @!attribute [rw] retry_policy
426
+ # The retry policy. The value is a hash with the following keys:
427
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
428
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
429
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
430
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
431
+ # trigger a retry.
432
+ # @return [::Hash]
433
+ # @!attribute [rw] quota_project
434
+ # A separate project against which to charge quota.
435
+ # @return [::String]
436
+ #
437
+ class Configuration
438
+ extend ::Gapic::Config
439
+
440
+ config_attr :endpoint, "discoveryengine.googleapis.com", ::String
441
+ config_attr :credentials, nil do |value|
442
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
443
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
444
+ allowed.any? { |klass| klass === value }
445
+ end
446
+ config_attr :scope, nil, ::String, ::Array, nil
447
+ config_attr :lib_name, nil, ::String, nil
448
+ config_attr :lib_version, nil, ::String, nil
449
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
450
+ config_attr :interceptors, nil, ::Array, nil
451
+ config_attr :timeout, nil, ::Numeric, nil
452
+ config_attr :metadata, nil, ::Hash, nil
453
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
454
+ config_attr :quota_project, nil, ::String, nil
455
+
456
+ # @private
457
+ def initialize parent_config = nil
458
+ @parent_config = parent_config unless parent_config.nil?
459
+
460
+ yield self if block_given?
461
+ end
462
+
463
+ ##
464
+ # Configurations for individual RPCs
465
+ # @return [Rpcs]
466
+ #
467
+ def rpcs
468
+ @rpcs ||= begin
469
+ parent_rpcs = nil
470
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
471
+ Rpcs.new parent_rpcs
472
+ end
473
+ end
474
+
475
+ ##
476
+ # Configuration RPC class for the SearchService API.
477
+ #
478
+ # Includes fields providing the configuration for each RPC in this service.
479
+ # Each configuration object is of type `Gapic::Config::Method` and includes
480
+ # the following configuration fields:
481
+ #
482
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
483
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
484
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
485
+ # include the following keys:
486
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
487
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
488
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
489
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
490
+ # trigger a retry.
491
+ #
492
+ class Rpcs
493
+ ##
494
+ # RPC-specific configuration for `search`
495
+ # @return [::Gapic::Config::Method]
496
+ #
497
+ attr_reader :search
498
+
499
+ # @private
500
+ def initialize parent_rpcs = nil
501
+ search_config = parent_rpcs.search if parent_rpcs.respond_to? :search
502
+ @search = ::Gapic::Config::Method.new search_config
503
+
504
+ yield self if block_given?
505
+ end
506
+ end
507
+ end
508
+ end
509
+ end
510
+ end
511
+ end
512
+ end
513
+ end
@@ -0,0 +1,47 @@
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 "googleauth"
20
+
21
+ module Google
22
+ module Cloud
23
+ module DiscoveryEngine
24
+ module V1beta
25
+ module SearchService
26
+ # Credentials for the SearchService API.
27
+ class Credentials < ::Google::Auth::Credentials
28
+ self.scope = [
29
+ "https://www.googleapis.com/auth/cloud-platform"
30
+ ]
31
+ self.env_vars = [
32
+ "GOOGLE_CLOUD_CREDENTIALS",
33
+ "GOOGLE_CLOUD_KEYFILE",
34
+ "GCLOUD_KEYFILE",
35
+ "GOOGLE_CLOUD_CREDENTIALS_JSON",
36
+ "GOOGLE_CLOUD_KEYFILE_JSON",
37
+ "GCLOUD_KEYFILE_JSON"
38
+ ]
39
+ self.paths = [
40
+ "~/.config/google_cloud/application_default_credentials.json"
41
+ ]
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end