google-cloud-discovery_engine-v1beta 0.a → 0.2.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 +1159 -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 +960 -0
  17. data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/operations.rb +919 -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 +919 -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 +511 -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 +463 -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 +919 -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 +46 -0
  57. data/lib/google/cloud/discoveryengine/v1beta/completion_service_pb.rb +49 -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 +48 -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 +66 -0
  63. data/lib/google/cloud/discoveryengine/v1beta/purge_config_pb.rb +49 -0
  64. data/lib/google/cloud/discoveryengine/v1beta/recommendation_service_pb.rb +55 -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 +47 -0
  67. data/lib/google/cloud/discoveryengine/v1beta/schema_service_pb.rb +61 -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 +71 -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 +58 -0
  72. data/lib/google/cloud/discoveryengine/v1beta/user_event_service_pb.rb +53 -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 +340 -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 +603 -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 +144 -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 +127 -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,463 @@
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 public website search only, supported values are:
226
+ #
227
+ # * `user_country_code`: string. Default empty. If set to non-empty, results
228
+ # are restricted or boosted based on the location provided.
229
+ # * `search_type`: double. Default empty. Enables non-webpage searching
230
+ # depending on the value. The only valid non-default value is 1,
231
+ # which enables image searching.
232
+ # @param query_expansion_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec, ::Hash]
233
+ # The query expansion specification that specifies the conditions under which
234
+ # query expansion will occur.
235
+ # @param spell_correction_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec, ::Hash]
236
+ # The spell correction specification that specifies the mode under
237
+ # which spell correction will take effect.
238
+ # @param user_pseudo_id [::String]
239
+ # A unique identifier for tracking visitors. For example, this could be
240
+ # implemented with an HTTP cookie, which should be able to uniquely identify
241
+ # a visitor on a single device. This unique identifier should not change if
242
+ # the visitor logs in or out of the website.
243
+ #
244
+ # This field should NOT have a fixed value such as `unknown_visitor`.
245
+ #
246
+ # This should be the same identifier as
247
+ # {::Google::Cloud::DiscoveryEngine::V1beta::UserEvent#user_pseudo_id UserEvent.user_pseudo_id}
248
+ # and
249
+ # {::Google::Cloud::DiscoveryEngine::V1beta::CompleteQueryRequest#user_pseudo_id CompleteQueryRequest.user_pseudo_id}
250
+ #
251
+ # The field must be a UTF-8 encoded string with a length limit of 128
252
+ # characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
253
+ # @param content_search_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec, ::Hash]
254
+ # The content search spec that configs the desired behavior of content
255
+ # search.
256
+ # @param safe_search [::Boolean]
257
+ # Whether to turn on safe search. This is only supported for
258
+ # [ContentConfig.PUBLIC_WEBSITE][].
259
+ # @param user_labels [::Hash{::String => ::String}]
260
+ # The user labels applied to a resource must meet the following requirements:
261
+ #
262
+ # * Each resource can have multiple labels, up to a maximum of 64.
263
+ # * Each label must be a key-value pair.
264
+ # * Keys have a minimum length of 1 character and a maximum length of 63
265
+ # characters and cannot be empty. Values can be empty and have a maximum
266
+ # length of 63 characters.
267
+ # * Keys and values can contain only lowercase letters, numeric characters,
268
+ # underscores, and dashes. All characters must use UTF-8 encoding, and
269
+ # international characters are allowed.
270
+ # * The key portion of a label must be unique. However, you can use the same
271
+ # key with multiple resources.
272
+ # * Keys must start with a lowercase letter or international character.
273
+ #
274
+ # See [Google Cloud
275
+ # Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
276
+ # for more details.
277
+ # @yield [result, operation] Access the result along with the TransportOperation object
278
+ # @yieldparam result [::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse]
279
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
280
+ #
281
+ # @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse]
282
+ #
283
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
284
+ def search request, options = nil
285
+ raise ::ArgumentError, "request must be provided" if request.nil?
286
+
287
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest
288
+
289
+ # Converts hash and nil to an options object
290
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
291
+
292
+ # Customize the options with defaults
293
+ call_metadata = @config.rpcs.search.metadata.to_h
294
+
295
+ # Set x-goog-api-client and x-goog-user-project headers
296
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
297
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
298
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION,
299
+ transports_version_send: [:rest]
300
+
301
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
302
+
303
+ options.apply_defaults timeout: @config.rpcs.search.timeout,
304
+ metadata: call_metadata,
305
+ retry_policy: @config.rpcs.search.retry_policy
306
+
307
+ options.apply_defaults timeout: @config.timeout,
308
+ metadata: @config.metadata,
309
+ retry_policy: @config.retry_policy
310
+
311
+ @search_service_stub.search request, options do |result, operation|
312
+ yield result, operation if block_given?
313
+ return result
314
+ end
315
+ rescue ::Gapic::Rest::Error => e
316
+ raise ::Google::Cloud::Error.from_error(e)
317
+ end
318
+
319
+ ##
320
+ # Configuration class for the SearchService REST API.
321
+ #
322
+ # This class represents the configuration for SearchService REST,
323
+ # providing control over timeouts, retry behavior, logging, transport
324
+ # parameters, and other low-level controls. Certain parameters can also be
325
+ # applied individually to specific RPCs. See
326
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SearchService::Rest::Client::Configuration::Rpcs}
327
+ # for a list of RPCs that can be configured independently.
328
+ #
329
+ # Configuration can be applied globally to all clients, or to a single client
330
+ # on construction.
331
+ #
332
+ # @example
333
+ #
334
+ # # Modify the global config, setting the timeout for
335
+ # # search to 20 seconds,
336
+ # # and all remaining timeouts to 10 seconds.
337
+ # ::Google::Cloud::DiscoveryEngine::V1beta::SearchService::Rest::Client.configure do |config|
338
+ # config.timeout = 10.0
339
+ # config.rpcs.search.timeout = 20.0
340
+ # end
341
+ #
342
+ # # Apply the above configuration only to a new client.
343
+ # client = ::Google::Cloud::DiscoveryEngine::V1beta::SearchService::Rest::Client.new do |config|
344
+ # config.timeout = 10.0
345
+ # config.rpcs.search.timeout = 20.0
346
+ # end
347
+ #
348
+ # @!attribute [rw] endpoint
349
+ # The hostname or hostname:port of the service endpoint.
350
+ # Defaults to `"discoveryengine.googleapis.com"`.
351
+ # @return [::String]
352
+ # @!attribute [rw] credentials
353
+ # Credentials to send with calls. You may provide any of the following types:
354
+ # * (`String`) The path to a service account key file in JSON format
355
+ # * (`Hash`) A service account key as a Hash
356
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
357
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
358
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
359
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
360
+ # * (`nil`) indicating no credentials
361
+ # @return [::Object]
362
+ # @!attribute [rw] scope
363
+ # The OAuth scopes
364
+ # @return [::Array<::String>]
365
+ # @!attribute [rw] lib_name
366
+ # The library name as recorded in instrumentation and logging
367
+ # @return [::String]
368
+ # @!attribute [rw] lib_version
369
+ # The library version as recorded in instrumentation and logging
370
+ # @return [::String]
371
+ # @!attribute [rw] timeout
372
+ # The call timeout in seconds.
373
+ # @return [::Numeric]
374
+ # @!attribute [rw] metadata
375
+ # Additional headers to be sent with the call.
376
+ # @return [::Hash{::Symbol=>::String}]
377
+ # @!attribute [rw] retry_policy
378
+ # The retry policy. The value is a hash with the following keys:
379
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
380
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
381
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
382
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
383
+ # trigger a retry.
384
+ # @return [::Hash]
385
+ # @!attribute [rw] quota_project
386
+ # A separate project against which to charge quota.
387
+ # @return [::String]
388
+ #
389
+ class Configuration
390
+ extend ::Gapic::Config
391
+
392
+ config_attr :endpoint, "discoveryengine.googleapis.com", ::String
393
+ config_attr :credentials, nil do |value|
394
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
395
+ allowed.any? { |klass| klass === value }
396
+ end
397
+ config_attr :scope, nil, ::String, ::Array, nil
398
+ config_attr :lib_name, nil, ::String, nil
399
+ config_attr :lib_version, nil, ::String, nil
400
+ config_attr :timeout, nil, ::Numeric, nil
401
+ config_attr :metadata, nil, ::Hash, nil
402
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
403
+ config_attr :quota_project, nil, ::String, nil
404
+
405
+ # @private
406
+ def initialize parent_config = nil
407
+ @parent_config = parent_config unless parent_config.nil?
408
+
409
+ yield self if block_given?
410
+ end
411
+
412
+ ##
413
+ # Configurations for individual RPCs
414
+ # @return [Rpcs]
415
+ #
416
+ def rpcs
417
+ @rpcs ||= begin
418
+ parent_rpcs = nil
419
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
420
+ Rpcs.new parent_rpcs
421
+ end
422
+ end
423
+
424
+ ##
425
+ # Configuration RPC class for the SearchService API.
426
+ #
427
+ # Includes fields providing the configuration for each RPC in this service.
428
+ # Each configuration object is of type `Gapic::Config::Method` and includes
429
+ # the following configuration fields:
430
+ #
431
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
432
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
433
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
434
+ # include the following keys:
435
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
436
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
437
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
438
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
439
+ # trigger a retry.
440
+ #
441
+ class Rpcs
442
+ ##
443
+ # RPC-specific configuration for `search`
444
+ # @return [::Gapic::Config::Method]
445
+ #
446
+ attr_reader :search
447
+
448
+ # @private
449
+ def initialize parent_rpcs = nil
450
+ search_config = parent_rpcs.search if parent_rpcs.respond_to? :search
451
+ @search = ::Gapic::Config::Method.new search_config
452
+
453
+ yield self if block_given?
454
+ end
455
+ end
456
+ end
457
+ end
458
+ end
459
+ end
460
+ end
461
+ end
462
+ end
463
+ end