google-cloud-discovery_engine-v1beta 0.a → 0.1.0

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