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,638 @@
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/user_event_service_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module DiscoveryEngine
25
+ module V1beta
26
+ module UserEventService
27
+ ##
28
+ # Client for the UserEventService service.
29
+ #
30
+ # Service for ingesting end user actions on a website to Discovery Engine API.
31
+ #
32
+ class Client
33
+ include Paths
34
+
35
+ # @private
36
+ attr_reader :user_event_service_stub
37
+
38
+ ##
39
+ # Configure the UserEventService Client class.
40
+ #
41
+ # See {::Google::Cloud::DiscoveryEngine::V1beta::UserEventService::Client::Configuration}
42
+ # for a description of the configuration fields.
43
+ #
44
+ # @example
45
+ #
46
+ # # Modify the configuration for all UserEventService clients
47
+ # ::Google::Cloud::DiscoveryEngine::V1beta::UserEventService::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 = 30.0
68
+ default_config.retry_policy = {
69
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
70
+ }
71
+
72
+ default_config.rpcs.import_user_events.timeout = 300.0
73
+ default_config.rpcs.import_user_events.retry_policy = {
74
+ initial_delay: 1.0, max_delay: 30.0, multiplier: 1.3, retry_codes: [14]
75
+ }
76
+
77
+ default_config
78
+ end
79
+ yield @configure if block_given?
80
+ @configure
81
+ end
82
+
83
+ ##
84
+ # Configure the UserEventService Client instance.
85
+ #
86
+ # The configuration is set to the derived mode, meaning that values can be changed,
87
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
88
+ # should be made on {Client.configure}.
89
+ #
90
+ # See {::Google::Cloud::DiscoveryEngine::V1beta::UserEventService::Client::Configuration}
91
+ # for a description of the configuration fields.
92
+ #
93
+ # @yield [config] Configure the Client client.
94
+ # @yieldparam config [Client::Configuration]
95
+ #
96
+ # @return [Client::Configuration]
97
+ #
98
+ def configure
99
+ yield @config if block_given?
100
+ @config
101
+ end
102
+
103
+ ##
104
+ # Create a new UserEventService client object.
105
+ #
106
+ # @example
107
+ #
108
+ # # Create a client using the default configuration
109
+ # client = ::Google::Cloud::DiscoveryEngine::V1beta::UserEventService::Client.new
110
+ #
111
+ # # Create a client using a custom configuration
112
+ # client = ::Google::Cloud::DiscoveryEngine::V1beta::UserEventService::Client.new do |config|
113
+ # config.timeout = 10.0
114
+ # end
115
+ #
116
+ # @yield [config] Configure the UserEventService client.
117
+ # @yieldparam config [Client::Configuration]
118
+ #
119
+ def initialize
120
+ # These require statements are intentionally placed here to initialize
121
+ # the gRPC module only when it's required.
122
+ # See https://github.com/googleapis/toolkit/issues/446
123
+ require "gapic/grpc"
124
+ require "google/cloud/discoveryengine/v1beta/user_event_service_services_pb"
125
+
126
+ # Create the configuration object
127
+ @config = Configuration.new Client.configure
128
+
129
+ # Yield the configuration if needed
130
+ yield @config if block_given?
131
+
132
+ # Create credentials
133
+ credentials = @config.credentials
134
+ # Use self-signed JWT if the endpoint is unchanged from default,
135
+ # but only if the default endpoint does not have a region prefix.
136
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
137
+ !@config.endpoint.split(".").first.include?("-")
138
+ credentials ||= Credentials.default scope: @config.scope,
139
+ enable_self_signed_jwt: enable_self_signed_jwt
140
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
141
+ credentials = Credentials.new credentials, scope: @config.scope
142
+ end
143
+ @quota_project_id = @config.quota_project
144
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
145
+
146
+ @operations_client = Operations.new do |config|
147
+ config.credentials = credentials
148
+ config.quota_project = @quota_project_id
149
+ config.endpoint = @config.endpoint
150
+ end
151
+
152
+ @user_event_service_stub = ::Gapic::ServiceStub.new(
153
+ ::Google::Cloud::DiscoveryEngine::V1beta::UserEventService::Stub,
154
+ credentials: credentials,
155
+ endpoint: @config.endpoint,
156
+ channel_args: @config.channel_args,
157
+ interceptors: @config.interceptors
158
+ )
159
+ end
160
+
161
+ ##
162
+ # Get the associated client for long-running operations.
163
+ #
164
+ # @return [::Google::Cloud::DiscoveryEngine::V1beta::UserEventService::Operations]
165
+ #
166
+ attr_reader :operations_client
167
+
168
+ # Service calls
169
+
170
+ ##
171
+ # Writes a single user event.
172
+ #
173
+ # @overload write_user_event(request, options = nil)
174
+ # Pass arguments to `write_user_event` via a request object, either of type
175
+ # {::Google::Cloud::DiscoveryEngine::V1beta::WriteUserEventRequest} or an equivalent Hash.
176
+ #
177
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::WriteUserEventRequest, ::Hash]
178
+ # A request object representing the call parameters. Required. To specify no
179
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
180
+ # @param options [::Gapic::CallOptions, ::Hash]
181
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
182
+ #
183
+ # @overload write_user_event(parent: nil, user_event: nil)
184
+ # Pass arguments to `write_user_event` via keyword arguments. Note that at
185
+ # least one keyword argument is required. To specify no parameters, or to keep all
186
+ # the default parameter values, pass an empty Hash as a request object (see above).
187
+ #
188
+ # @param parent [::String]
189
+ # Required. The parent DataStore resource name, such as
190
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`.
191
+ # @param user_event [::Google::Cloud::DiscoveryEngine::V1beta::UserEvent, ::Hash]
192
+ # Required. User event to write.
193
+ #
194
+ # @yield [response, operation] Access the result along with the RPC operation
195
+ # @yieldparam response [::Google::Cloud::DiscoveryEngine::V1beta::UserEvent]
196
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
197
+ #
198
+ # @return [::Google::Cloud::DiscoveryEngine::V1beta::UserEvent]
199
+ #
200
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
201
+ #
202
+ # @example Basic example
203
+ # require "google/cloud/discovery_engine/v1beta"
204
+ #
205
+ # # Create a client object. The client can be reused for multiple calls.
206
+ # client = Google::Cloud::DiscoveryEngine::V1beta::UserEventService::Client.new
207
+ #
208
+ # # Create a request. To set request fields, pass in keyword arguments.
209
+ # request = Google::Cloud::DiscoveryEngine::V1beta::WriteUserEventRequest.new
210
+ #
211
+ # # Call the write_user_event method.
212
+ # result = client.write_user_event request
213
+ #
214
+ # # The returned object is of type Google::Cloud::DiscoveryEngine::V1beta::UserEvent.
215
+ # p result
216
+ #
217
+ def write_user_event request, options = nil
218
+ raise ::ArgumentError, "request must be provided" if request.nil?
219
+
220
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::WriteUserEventRequest
221
+
222
+ # Converts hash and nil to an options object
223
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
224
+
225
+ # Customize the options with defaults
226
+ metadata = @config.rpcs.write_user_event.metadata.to_h
227
+
228
+ # Set x-goog-api-client and x-goog-user-project headers
229
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
230
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
231
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION
232
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
233
+
234
+ header_params = {}
235
+ if request.parent
236
+ header_params["parent"] = request.parent
237
+ end
238
+
239
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
240
+ metadata[:"x-goog-request-params"] ||= request_params_header
241
+
242
+ options.apply_defaults timeout: @config.rpcs.write_user_event.timeout,
243
+ metadata: metadata,
244
+ retry_policy: @config.rpcs.write_user_event.retry_policy
245
+
246
+ options.apply_defaults timeout: @config.timeout,
247
+ metadata: @config.metadata,
248
+ retry_policy: @config.retry_policy
249
+
250
+ @user_event_service_stub.call_rpc :write_user_event, request, options: options do |response, operation|
251
+ yield response, operation if block_given?
252
+ return response
253
+ end
254
+ rescue ::GRPC::BadStatus => e
255
+ raise ::Google::Cloud::Error.from_error(e)
256
+ end
257
+
258
+ ##
259
+ # Writes a single user event from the browser. This uses a GET request to
260
+ # due to browser restriction of POST-ing to a 3rd party domain.
261
+ #
262
+ # This method is used only by the Discovery Engine API JavaScript pixel and
263
+ # Google Tag Manager. Users should not call this method directly.
264
+ #
265
+ # @overload collect_user_event(request, options = nil)
266
+ # Pass arguments to `collect_user_event` via a request object, either of type
267
+ # {::Google::Cloud::DiscoveryEngine::V1beta::CollectUserEventRequest} or an equivalent Hash.
268
+ #
269
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::CollectUserEventRequest, ::Hash]
270
+ # A request object representing the call parameters. Required. To specify no
271
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
272
+ # @param options [::Gapic::CallOptions, ::Hash]
273
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
274
+ #
275
+ # @overload collect_user_event(parent: nil, user_event: nil, uri: nil, ets: nil)
276
+ # Pass arguments to `collect_user_event` via keyword arguments. Note that at
277
+ # least one keyword argument is required. To specify no parameters, or to keep all
278
+ # the default parameter values, pass an empty Hash as a request object (see above).
279
+ #
280
+ # @param parent [::String]
281
+ # Required. The parent DataStore resource name, such as
282
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`.
283
+ # @param user_event [::String]
284
+ # Required. URL encoded UserEvent proto with a length limit of 2,000,000
285
+ # characters.
286
+ # @param uri [::String]
287
+ # The URL including cgi-parameters but excluding the hash fragment with a
288
+ # length limit of 5,000 characters. This is often more useful than the
289
+ # referer URL, because many browsers only send the domain for 3rd party
290
+ # requests.
291
+ # @param ets [::Integer]
292
+ # The event timestamp in milliseconds. This prevents browser caching of
293
+ # otherwise identical get requests. The name is abbreviated to reduce the
294
+ # payload bytes.
295
+ #
296
+ # @yield [response, operation] Access the result along with the RPC operation
297
+ # @yieldparam response [::Google::Api::HttpBody]
298
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
299
+ #
300
+ # @return [::Google::Api::HttpBody]
301
+ #
302
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
303
+ #
304
+ # @example Basic example
305
+ # require "google/cloud/discovery_engine/v1beta"
306
+ #
307
+ # # Create a client object. The client can be reused for multiple calls.
308
+ # client = Google::Cloud::DiscoveryEngine::V1beta::UserEventService::Client.new
309
+ #
310
+ # # Create a request. To set request fields, pass in keyword arguments.
311
+ # request = Google::Cloud::DiscoveryEngine::V1beta::CollectUserEventRequest.new
312
+ #
313
+ # # Call the collect_user_event method.
314
+ # result = client.collect_user_event request
315
+ #
316
+ # # The returned object is of type Google::Api::HttpBody.
317
+ # p result
318
+ #
319
+ def collect_user_event request, options = nil
320
+ raise ::ArgumentError, "request must be provided" if request.nil?
321
+
322
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::CollectUserEventRequest
323
+
324
+ # Converts hash and nil to an options object
325
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
326
+
327
+ # Customize the options with defaults
328
+ metadata = @config.rpcs.collect_user_event.metadata.to_h
329
+
330
+ # Set x-goog-api-client and x-goog-user-project headers
331
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
332
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
333
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION
334
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
335
+
336
+ header_params = {}
337
+ if request.parent
338
+ header_params["parent"] = request.parent
339
+ end
340
+
341
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
342
+ metadata[:"x-goog-request-params"] ||= request_params_header
343
+
344
+ options.apply_defaults timeout: @config.rpcs.collect_user_event.timeout,
345
+ metadata: metadata,
346
+ retry_policy: @config.rpcs.collect_user_event.retry_policy
347
+
348
+ options.apply_defaults timeout: @config.timeout,
349
+ metadata: @config.metadata,
350
+ retry_policy: @config.retry_policy
351
+
352
+ @user_event_service_stub.call_rpc :collect_user_event, request, options: options do |response, operation|
353
+ yield response, operation if block_given?
354
+ return response
355
+ end
356
+ rescue ::GRPC::BadStatus => e
357
+ raise ::Google::Cloud::Error.from_error(e)
358
+ end
359
+
360
+ ##
361
+ # Bulk import of User events. Request processing might be
362
+ # synchronous. Events that already exist are skipped.
363
+ # Use this method for backfilling historical user events.
364
+ #
365
+ # Operation.response is of type ImportResponse. Note that it is
366
+ # possible for a subset of the items to be successfully inserted.
367
+ # Operation.metadata is of type ImportMetadata.
368
+ #
369
+ # @overload import_user_events(request, options = nil)
370
+ # Pass arguments to `import_user_events` via a request object, either of type
371
+ # {::Google::Cloud::DiscoveryEngine::V1beta::ImportUserEventsRequest} or an equivalent Hash.
372
+ #
373
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::ImportUserEventsRequest, ::Hash]
374
+ # A request object representing the call parameters. Required. To specify no
375
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
376
+ # @param options [::Gapic::CallOptions, ::Hash]
377
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
378
+ #
379
+ # @overload import_user_events(inline_source: nil, gcs_source: nil, bigquery_source: nil, parent: nil, error_config: nil)
380
+ # Pass arguments to `import_user_events` via keyword arguments. Note that at
381
+ # least one keyword argument is required. To specify no parameters, or to keep all
382
+ # the default parameter values, pass an empty Hash as a request object (see above).
383
+ #
384
+ # @param inline_source [::Google::Cloud::DiscoveryEngine::V1beta::ImportUserEventsRequest::InlineSource, ::Hash]
385
+ # Required. The Inline source for the input content for UserEvents.
386
+ # @param gcs_source [::Google::Cloud::DiscoveryEngine::V1beta::GcsSource, ::Hash]
387
+ # Required. Cloud Storage location for the input content.
388
+ # @param bigquery_source [::Google::Cloud::DiscoveryEngine::V1beta::BigQuerySource, ::Hash]
389
+ # Required. BigQuery input source.
390
+ # @param parent [::String]
391
+ # Required. Parent DataStore resource name, of the form
392
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`
393
+ # @param error_config [::Google::Cloud::DiscoveryEngine::V1beta::ImportErrorConfig, ::Hash]
394
+ # The desired location of errors incurred during the Import. Cannot be set
395
+ # for inline user event imports.
396
+ #
397
+ # @yield [response, operation] Access the result along with the RPC operation
398
+ # @yieldparam response [::Gapic::Operation]
399
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
400
+ #
401
+ # @return [::Gapic::Operation]
402
+ #
403
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
404
+ #
405
+ # @example Basic example
406
+ # require "google/cloud/discovery_engine/v1beta"
407
+ #
408
+ # # Create a client object. The client can be reused for multiple calls.
409
+ # client = Google::Cloud::DiscoveryEngine::V1beta::UserEventService::Client.new
410
+ #
411
+ # # Create a request. To set request fields, pass in keyword arguments.
412
+ # request = Google::Cloud::DiscoveryEngine::V1beta::ImportUserEventsRequest.new
413
+ #
414
+ # # Call the import_user_events method.
415
+ # result = client.import_user_events request
416
+ #
417
+ # # The returned object is of type Gapic::Operation. You can use it to
418
+ # # check the status of an operation, cancel it, or wait for results.
419
+ # # Here is how to wait for a response.
420
+ # result.wait_until_done! timeout: 60
421
+ # if result.response?
422
+ # p result.response
423
+ # else
424
+ # puts "No response received."
425
+ # end
426
+ #
427
+ def import_user_events request, options = nil
428
+ raise ::ArgumentError, "request must be provided" if request.nil?
429
+
430
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::ImportUserEventsRequest
431
+
432
+ # Converts hash and nil to an options object
433
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
434
+
435
+ # Customize the options with defaults
436
+ metadata = @config.rpcs.import_user_events.metadata.to_h
437
+
438
+ # Set x-goog-api-client and x-goog-user-project headers
439
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
440
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
441
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION
442
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
443
+
444
+ header_params = {}
445
+ if request.parent
446
+ header_params["parent"] = request.parent
447
+ end
448
+
449
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
450
+ metadata[:"x-goog-request-params"] ||= request_params_header
451
+
452
+ options.apply_defaults timeout: @config.rpcs.import_user_events.timeout,
453
+ metadata: metadata,
454
+ retry_policy: @config.rpcs.import_user_events.retry_policy
455
+
456
+ options.apply_defaults timeout: @config.timeout,
457
+ metadata: @config.metadata,
458
+ retry_policy: @config.retry_policy
459
+
460
+ @user_event_service_stub.call_rpc :import_user_events, request, options: options do |response, operation|
461
+ response = ::Gapic::Operation.new response, @operations_client, options: options
462
+ yield response, operation if block_given?
463
+ return response
464
+ end
465
+ rescue ::GRPC::BadStatus => e
466
+ raise ::Google::Cloud::Error.from_error(e)
467
+ end
468
+
469
+ ##
470
+ # Configuration class for the UserEventService API.
471
+ #
472
+ # This class represents the configuration for UserEventService,
473
+ # providing control over timeouts, retry behavior, logging, transport
474
+ # parameters, and other low-level controls. Certain parameters can also be
475
+ # applied individually to specific RPCs. See
476
+ # {::Google::Cloud::DiscoveryEngine::V1beta::UserEventService::Client::Configuration::Rpcs}
477
+ # for a list of RPCs that can be configured independently.
478
+ #
479
+ # Configuration can be applied globally to all clients, or to a single client
480
+ # on construction.
481
+ #
482
+ # @example
483
+ #
484
+ # # Modify the global config, setting the timeout for
485
+ # # write_user_event to 20 seconds,
486
+ # # and all remaining timeouts to 10 seconds.
487
+ # ::Google::Cloud::DiscoveryEngine::V1beta::UserEventService::Client.configure do |config|
488
+ # config.timeout = 10.0
489
+ # config.rpcs.write_user_event.timeout = 20.0
490
+ # end
491
+ #
492
+ # # Apply the above configuration only to a new client.
493
+ # client = ::Google::Cloud::DiscoveryEngine::V1beta::UserEventService::Client.new do |config|
494
+ # config.timeout = 10.0
495
+ # config.rpcs.write_user_event.timeout = 20.0
496
+ # end
497
+ #
498
+ # @!attribute [rw] endpoint
499
+ # The hostname or hostname:port of the service endpoint.
500
+ # Defaults to `"discoveryengine.googleapis.com"`.
501
+ # @return [::String]
502
+ # @!attribute [rw] credentials
503
+ # Credentials to send with calls. You may provide any of the following types:
504
+ # * (`String`) The path to a service account key file in JSON format
505
+ # * (`Hash`) A service account key as a Hash
506
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
507
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
508
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
509
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
510
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
511
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
512
+ # * (`nil`) indicating no credentials
513
+ # @return [::Object]
514
+ # @!attribute [rw] scope
515
+ # The OAuth scopes
516
+ # @return [::Array<::String>]
517
+ # @!attribute [rw] lib_name
518
+ # The library name as recorded in instrumentation and logging
519
+ # @return [::String]
520
+ # @!attribute [rw] lib_version
521
+ # The library version as recorded in instrumentation and logging
522
+ # @return [::String]
523
+ # @!attribute [rw] channel_args
524
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
525
+ # `GRPC::Core::Channel` object is provided as the credential.
526
+ # @return [::Hash]
527
+ # @!attribute [rw] interceptors
528
+ # An array of interceptors that are run before calls are executed.
529
+ # @return [::Array<::GRPC::ClientInterceptor>]
530
+ # @!attribute [rw] timeout
531
+ # The call timeout in seconds.
532
+ # @return [::Numeric]
533
+ # @!attribute [rw] metadata
534
+ # Additional gRPC headers to be sent with the call.
535
+ # @return [::Hash{::Symbol=>::String}]
536
+ # @!attribute [rw] retry_policy
537
+ # The retry policy. The value is a hash with the following keys:
538
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
539
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
540
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
541
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
542
+ # trigger a retry.
543
+ # @return [::Hash]
544
+ # @!attribute [rw] quota_project
545
+ # A separate project against which to charge quota.
546
+ # @return [::String]
547
+ #
548
+ class Configuration
549
+ extend ::Gapic::Config
550
+
551
+ config_attr :endpoint, "discoveryengine.googleapis.com", ::String
552
+ config_attr :credentials, nil do |value|
553
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
554
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
555
+ allowed.any? { |klass| klass === value }
556
+ end
557
+ config_attr :scope, nil, ::String, ::Array, nil
558
+ config_attr :lib_name, nil, ::String, nil
559
+ config_attr :lib_version, nil, ::String, nil
560
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
561
+ config_attr :interceptors, nil, ::Array, nil
562
+ config_attr :timeout, nil, ::Numeric, nil
563
+ config_attr :metadata, nil, ::Hash, nil
564
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
565
+ config_attr :quota_project, nil, ::String, nil
566
+
567
+ # @private
568
+ def initialize parent_config = nil
569
+ @parent_config = parent_config unless parent_config.nil?
570
+
571
+ yield self if block_given?
572
+ end
573
+
574
+ ##
575
+ # Configurations for individual RPCs
576
+ # @return [Rpcs]
577
+ #
578
+ def rpcs
579
+ @rpcs ||= begin
580
+ parent_rpcs = nil
581
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
582
+ Rpcs.new parent_rpcs
583
+ end
584
+ end
585
+
586
+ ##
587
+ # Configuration RPC class for the UserEventService API.
588
+ #
589
+ # Includes fields providing the configuration for each RPC in this service.
590
+ # Each configuration object is of type `Gapic::Config::Method` and includes
591
+ # the following configuration fields:
592
+ #
593
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
594
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
595
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
596
+ # include the following keys:
597
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
598
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
599
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
600
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
601
+ # trigger a retry.
602
+ #
603
+ class Rpcs
604
+ ##
605
+ # RPC-specific configuration for `write_user_event`
606
+ # @return [::Gapic::Config::Method]
607
+ #
608
+ attr_reader :write_user_event
609
+ ##
610
+ # RPC-specific configuration for `collect_user_event`
611
+ # @return [::Gapic::Config::Method]
612
+ #
613
+ attr_reader :collect_user_event
614
+ ##
615
+ # RPC-specific configuration for `import_user_events`
616
+ # @return [::Gapic::Config::Method]
617
+ #
618
+ attr_reader :import_user_events
619
+
620
+ # @private
621
+ def initialize parent_rpcs = nil
622
+ write_user_event_config = parent_rpcs.write_user_event if parent_rpcs.respond_to? :write_user_event
623
+ @write_user_event = ::Gapic::Config::Method.new write_user_event_config
624
+ collect_user_event_config = parent_rpcs.collect_user_event if parent_rpcs.respond_to? :collect_user_event
625
+ @collect_user_event = ::Gapic::Config::Method.new collect_user_event_config
626
+ import_user_events_config = parent_rpcs.import_user_events if parent_rpcs.respond_to? :import_user_events
627
+ @import_user_events = ::Gapic::Config::Method.new import_user_events_config
628
+
629
+ yield self if block_given?
630
+ end
631
+ end
632
+ end
633
+ end
634
+ end
635
+ end
636
+ end
637
+ end
638
+ 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 UserEventService
26
+ # Credentials for the UserEventService 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