google-cloud-discovery_engine-v1beta 0.20.1 → 0.21.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 (23) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/client.rb +27 -7
  3. data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/rest/client.rb +27 -7
  4. data/lib/google/cloud/discovery_engine/v1beta/rest.rb +1 -0
  5. data/lib/google/cloud/discovery_engine/v1beta/search_service/client.rb +16 -28
  6. data/lib/google/cloud/discovery_engine/v1beta/search_service/rest/client.rb +16 -28
  7. data/lib/google/cloud/discovery_engine/v1beta/session_service/client.rb +920 -0
  8. data/lib/google/cloud/discovery_engine/v1beta/session_service/credentials.rb +47 -0
  9. data/lib/google/cloud/discovery_engine/v1beta/session_service/paths.rb +330 -0
  10. data/lib/google/cloud/discovery_engine/v1beta/session_service/rest/client.rb +859 -0
  11. data/lib/google/cloud/discovery_engine/v1beta/session_service/rest/service_stub.rb +462 -0
  12. data/lib/google/cloud/discovery_engine/v1beta/session_service/rest.rb +52 -0
  13. data/lib/google/cloud/discovery_engine/v1beta/session_service.rb +55 -0
  14. data/lib/google/cloud/discovery_engine/v1beta/version.rb +1 -1
  15. data/lib/google/cloud/discovery_engine/v1beta.rb +1 -0
  16. data/lib/google/cloud/discoveryengine/v1beta/conversational_search_service_pb.rb +1 -1
  17. data/lib/google/cloud/discoveryengine/v1beta/session_pb.rb +3 -1
  18. data/lib/google/cloud/discoveryengine/v1beta/session_service_pb.rb +49 -0
  19. data/lib/google/cloud/discoveryengine/v1beta/session_service_services_pb.rb +64 -0
  20. data/proto_docs/google/cloud/discoveryengine/v1beta/conversational_search_service.rb +26 -5
  21. data/proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb +8 -14
  22. data/proto_docs/google/cloud/discoveryengine/v1beta/session.rb +38 -4
  23. metadata +10 -1
@@ -0,0 +1,859 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2025 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/cloud/discoveryengine/v1beta/session_service_pb"
21
+ require "google/cloud/discovery_engine/v1beta/session_service/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module DiscoveryEngine
27
+ module V1beta
28
+ module SessionService
29
+ module Rest
30
+ ##
31
+ # REST client for the SessionService service.
32
+ #
33
+ # Service for managing Sessions and Session-related resources.
34
+ #
35
+ class Client
36
+ # @private
37
+ API_VERSION = ""
38
+
39
+ # @private
40
+ DEFAULT_ENDPOINT_TEMPLATE = "discoveryengine.$UNIVERSE_DOMAIN$"
41
+
42
+ include Paths
43
+
44
+ # @private
45
+ attr_reader :session_service_stub
46
+
47
+ ##
48
+ # Configure the SessionService Client class.
49
+ #
50
+ # See {::Google::Cloud::DiscoveryEngine::V1beta::SessionService::Rest::Client::Configuration}
51
+ # for a description of the configuration fields.
52
+ #
53
+ # @example
54
+ #
55
+ # # Modify the configuration for all SessionService clients
56
+ # ::Google::Cloud::DiscoveryEngine::V1beta::SessionService::Rest::Client.configure do |config|
57
+ # config.timeout = 10.0
58
+ # end
59
+ #
60
+ # @yield [config] Configure the Client client.
61
+ # @yieldparam config [Client::Configuration]
62
+ #
63
+ # @return [Client::Configuration]
64
+ #
65
+ def self.configure
66
+ @configure ||= begin
67
+ namespace = ["Google", "Cloud", "DiscoveryEngine", "V1beta"]
68
+ parent_config = while namespace.any?
69
+ parent_name = namespace.join "::"
70
+ parent_const = const_get parent_name
71
+ break parent_const.configure if parent_const.respond_to? :configure
72
+ namespace.pop
73
+ end
74
+ default_config = Client::Configuration.new parent_config
75
+
76
+ default_config.timeout = 30.0
77
+ default_config.retry_policy = {
78
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
79
+ }
80
+
81
+ default_config
82
+ end
83
+ yield @configure if block_given?
84
+ @configure
85
+ end
86
+
87
+ ##
88
+ # Configure the SessionService Client instance.
89
+ #
90
+ # The configuration is set to the derived mode, meaning that values can be changed,
91
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
92
+ # should be made on {Client.configure}.
93
+ #
94
+ # See {::Google::Cloud::DiscoveryEngine::V1beta::SessionService::Rest::Client::Configuration}
95
+ # for a description of the configuration fields.
96
+ #
97
+ # @yield [config] Configure the Client client.
98
+ # @yieldparam config [Client::Configuration]
99
+ #
100
+ # @return [Client::Configuration]
101
+ #
102
+ def configure
103
+ yield @config if block_given?
104
+ @config
105
+ end
106
+
107
+ ##
108
+ # The effective universe domain
109
+ #
110
+ # @return [String]
111
+ #
112
+ def universe_domain
113
+ @session_service_stub.universe_domain
114
+ end
115
+
116
+ ##
117
+ # Create a new SessionService REST client object.
118
+ #
119
+ # @example
120
+ #
121
+ # # Create a client using the default configuration
122
+ # client = ::Google::Cloud::DiscoveryEngine::V1beta::SessionService::Rest::Client.new
123
+ #
124
+ # # Create a client using a custom configuration
125
+ # client = ::Google::Cloud::DiscoveryEngine::V1beta::SessionService::Rest::Client.new do |config|
126
+ # config.timeout = 10.0
127
+ # end
128
+ #
129
+ # @yield [config] Configure the SessionService client.
130
+ # @yieldparam config [Client::Configuration]
131
+ #
132
+ def initialize
133
+ # Create the configuration object
134
+ @config = Configuration.new Client.configure
135
+
136
+ # Yield the configuration if needed
137
+ yield @config if block_given?
138
+
139
+ # Create credentials
140
+ credentials = @config.credentials
141
+ # Use self-signed JWT if the endpoint is unchanged from default,
142
+ # but only if the default endpoint does not have a region prefix.
143
+ enable_self_signed_jwt = @config.endpoint.nil? ||
144
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
145
+ !@config.endpoint.split(".").first.include?("-"))
146
+ credentials ||= Credentials.default scope: @config.scope,
147
+ enable_self_signed_jwt: enable_self_signed_jwt
148
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
149
+ credentials = Credentials.new credentials, scope: @config.scope
150
+ end
151
+
152
+ @quota_project_id = @config.quota_project
153
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
154
+
155
+ @session_service_stub = ::Google::Cloud::DiscoveryEngine::V1beta::SessionService::Rest::ServiceStub.new(
156
+ endpoint: @config.endpoint,
157
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
158
+ universe_domain: @config.universe_domain,
159
+ credentials: credentials,
160
+ logger: @config.logger
161
+ )
162
+
163
+ @session_service_stub.logger(stub: true)&.info do |entry|
164
+ entry.set_system_name
165
+ entry.set_service
166
+ entry.message = "Created client for #{entry.service}"
167
+ entry.set_credentials_fields credentials
168
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
169
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
170
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
171
+ end
172
+
173
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
174
+ config.credentials = credentials
175
+ config.quota_project = @quota_project_id
176
+ config.endpoint = @session_service_stub.endpoint
177
+ config.universe_domain = @session_service_stub.universe_domain
178
+ config.logger = @session_service_stub.logger if config.respond_to? :logger=
179
+ end
180
+ end
181
+
182
+ ##
183
+ # Get the associated client for mix-in of the Locations.
184
+ #
185
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
186
+ #
187
+ attr_reader :location_client
188
+
189
+ ##
190
+ # The logger used for request/response debug logging.
191
+ #
192
+ # @return [Logger]
193
+ #
194
+ def logger
195
+ @session_service_stub.logger
196
+ end
197
+
198
+ # Service calls
199
+
200
+ ##
201
+ # Creates a Session.
202
+ #
203
+ # If the {::Google::Cloud::DiscoveryEngine::V1beta::Session Session} to create
204
+ # already exists, an ALREADY_EXISTS error is returned.
205
+ #
206
+ # @overload create_session(request, options = nil)
207
+ # Pass arguments to `create_session` via a request object, either of type
208
+ # {::Google::Cloud::DiscoveryEngine::V1beta::CreateSessionRequest} or an equivalent Hash.
209
+ #
210
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::CreateSessionRequest, ::Hash]
211
+ # A request object representing the call parameters. Required. To specify no
212
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
213
+ # @param options [::Gapic::CallOptions, ::Hash]
214
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
215
+ #
216
+ # @overload create_session(parent: nil, session: nil)
217
+ # Pass arguments to `create_session` via keyword arguments. Note that at
218
+ # least one keyword argument is required. To specify no parameters, or to keep all
219
+ # the default parameter values, pass an empty Hash as a request object (see above).
220
+ #
221
+ # @param parent [::String]
222
+ # Required. Full resource name of parent data store. Format:
223
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store_id}`
224
+ # @param session [::Google::Cloud::DiscoveryEngine::V1beta::Session, ::Hash]
225
+ # Required. The session to create.
226
+ # @yield [result, operation] Access the result along with the TransportOperation object
227
+ # @yieldparam result [::Google::Cloud::DiscoveryEngine::V1beta::Session]
228
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
229
+ #
230
+ # @return [::Google::Cloud::DiscoveryEngine::V1beta::Session]
231
+ #
232
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
233
+ #
234
+ # @example Basic example
235
+ # require "google/cloud/discovery_engine/v1beta"
236
+ #
237
+ # # Create a client object. The client can be reused for multiple calls.
238
+ # client = Google::Cloud::DiscoveryEngine::V1beta::SessionService::Rest::Client.new
239
+ #
240
+ # # Create a request. To set request fields, pass in keyword arguments.
241
+ # request = Google::Cloud::DiscoveryEngine::V1beta::CreateSessionRequest.new
242
+ #
243
+ # # Call the create_session method.
244
+ # result = client.create_session request
245
+ #
246
+ # # The returned object is of type Google::Cloud::DiscoveryEngine::V1beta::Session.
247
+ # p result
248
+ #
249
+ def create_session request, options = nil
250
+ raise ::ArgumentError, "request must be provided" if request.nil?
251
+
252
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::CreateSessionRequest
253
+
254
+ # Converts hash and nil to an options object
255
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
256
+
257
+ # Customize the options with defaults
258
+ call_metadata = @config.rpcs.create_session.metadata.to_h
259
+
260
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
261
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
262
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
263
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION,
264
+ transports_version_send: [:rest]
265
+
266
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
267
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
268
+
269
+ options.apply_defaults timeout: @config.rpcs.create_session.timeout,
270
+ metadata: call_metadata,
271
+ retry_policy: @config.rpcs.create_session.retry_policy
272
+
273
+ options.apply_defaults timeout: @config.timeout,
274
+ metadata: @config.metadata,
275
+ retry_policy: @config.retry_policy
276
+
277
+ @session_service_stub.create_session request, options do |result, operation|
278
+ yield result, operation if block_given?
279
+ end
280
+ rescue ::Gapic::Rest::Error => e
281
+ raise ::Google::Cloud::Error.from_error(e)
282
+ end
283
+
284
+ ##
285
+ # Deletes a Session.
286
+ #
287
+ # If the {::Google::Cloud::DiscoveryEngine::V1beta::Session Session} to delete
288
+ # does not exist, a NOT_FOUND error is returned.
289
+ #
290
+ # @overload delete_session(request, options = nil)
291
+ # Pass arguments to `delete_session` via a request object, either of type
292
+ # {::Google::Cloud::DiscoveryEngine::V1beta::DeleteSessionRequest} or an equivalent Hash.
293
+ #
294
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::DeleteSessionRequest, ::Hash]
295
+ # A request object representing the call parameters. Required. To specify no
296
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
297
+ # @param options [::Gapic::CallOptions, ::Hash]
298
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
299
+ #
300
+ # @overload delete_session(name: nil)
301
+ # Pass arguments to `delete_session` via keyword arguments. Note that at
302
+ # least one keyword argument is required. To specify no parameters, or to keep all
303
+ # the default parameter values, pass an empty Hash as a request object (see above).
304
+ #
305
+ # @param name [::String]
306
+ # Required. The resource name of the Session to delete. Format:
307
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store_id}/sessions/{session_id}`
308
+ # @yield [result, operation] Access the result along with the TransportOperation object
309
+ # @yieldparam result [::Google::Protobuf::Empty]
310
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
311
+ #
312
+ # @return [::Google::Protobuf::Empty]
313
+ #
314
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
315
+ #
316
+ # @example Basic example
317
+ # require "google/cloud/discovery_engine/v1beta"
318
+ #
319
+ # # Create a client object. The client can be reused for multiple calls.
320
+ # client = Google::Cloud::DiscoveryEngine::V1beta::SessionService::Rest::Client.new
321
+ #
322
+ # # Create a request. To set request fields, pass in keyword arguments.
323
+ # request = Google::Cloud::DiscoveryEngine::V1beta::DeleteSessionRequest.new
324
+ #
325
+ # # Call the delete_session method.
326
+ # result = client.delete_session request
327
+ #
328
+ # # The returned object is of type Google::Protobuf::Empty.
329
+ # p result
330
+ #
331
+ def delete_session request, options = nil
332
+ raise ::ArgumentError, "request must be provided" if request.nil?
333
+
334
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::DeleteSessionRequest
335
+
336
+ # Converts hash and nil to an options object
337
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
338
+
339
+ # Customize the options with defaults
340
+ call_metadata = @config.rpcs.delete_session.metadata.to_h
341
+
342
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
343
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
344
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
345
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION,
346
+ transports_version_send: [:rest]
347
+
348
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
349
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
350
+
351
+ options.apply_defaults timeout: @config.rpcs.delete_session.timeout,
352
+ metadata: call_metadata,
353
+ retry_policy: @config.rpcs.delete_session.retry_policy
354
+
355
+ options.apply_defaults timeout: @config.timeout,
356
+ metadata: @config.metadata,
357
+ retry_policy: @config.retry_policy
358
+
359
+ @session_service_stub.delete_session request, options do |result, operation|
360
+ yield result, operation if block_given?
361
+ end
362
+ rescue ::Gapic::Rest::Error => e
363
+ raise ::Google::Cloud::Error.from_error(e)
364
+ end
365
+
366
+ ##
367
+ # Updates a Session.
368
+ #
369
+ # {::Google::Cloud::DiscoveryEngine::V1beta::Session Session} action type cannot
370
+ # be changed. If the {::Google::Cloud::DiscoveryEngine::V1beta::Session Session}
371
+ # to update does not exist, a NOT_FOUND error is returned.
372
+ #
373
+ # @overload update_session(request, options = nil)
374
+ # Pass arguments to `update_session` via a request object, either of type
375
+ # {::Google::Cloud::DiscoveryEngine::V1beta::UpdateSessionRequest} or an equivalent Hash.
376
+ #
377
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::UpdateSessionRequest, ::Hash]
378
+ # A request object representing the call parameters. Required. To specify no
379
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
380
+ # @param options [::Gapic::CallOptions, ::Hash]
381
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
382
+ #
383
+ # @overload update_session(session: nil, update_mask: nil)
384
+ # Pass arguments to `update_session` via keyword arguments. Note that at
385
+ # least one keyword argument is required. To specify no parameters, or to keep all
386
+ # the default parameter values, pass an empty Hash as a request object (see above).
387
+ #
388
+ # @param session [::Google::Cloud::DiscoveryEngine::V1beta::Session, ::Hash]
389
+ # Required. The Session to update.
390
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
391
+ # Indicates which fields in the provided
392
+ # {::Google::Cloud::DiscoveryEngine::V1beta::Session Session} to update. The
393
+ # following are NOT supported:
394
+ #
395
+ # * {::Google::Cloud::DiscoveryEngine::V1beta::Session#name Session.name}
396
+ #
397
+ # If not set or empty, all supported fields are updated.
398
+ # @yield [result, operation] Access the result along with the TransportOperation object
399
+ # @yieldparam result [::Google::Cloud::DiscoveryEngine::V1beta::Session]
400
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
401
+ #
402
+ # @return [::Google::Cloud::DiscoveryEngine::V1beta::Session]
403
+ #
404
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
405
+ #
406
+ # @example Basic example
407
+ # require "google/cloud/discovery_engine/v1beta"
408
+ #
409
+ # # Create a client object. The client can be reused for multiple calls.
410
+ # client = Google::Cloud::DiscoveryEngine::V1beta::SessionService::Rest::Client.new
411
+ #
412
+ # # Create a request. To set request fields, pass in keyword arguments.
413
+ # request = Google::Cloud::DiscoveryEngine::V1beta::UpdateSessionRequest.new
414
+ #
415
+ # # Call the update_session method.
416
+ # result = client.update_session request
417
+ #
418
+ # # The returned object is of type Google::Cloud::DiscoveryEngine::V1beta::Session.
419
+ # p result
420
+ #
421
+ def update_session request, options = nil
422
+ raise ::ArgumentError, "request must be provided" if request.nil?
423
+
424
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::UpdateSessionRequest
425
+
426
+ # Converts hash and nil to an options object
427
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
428
+
429
+ # Customize the options with defaults
430
+ call_metadata = @config.rpcs.update_session.metadata.to_h
431
+
432
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
433
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
434
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
435
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION,
436
+ transports_version_send: [:rest]
437
+
438
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
439
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
440
+
441
+ options.apply_defaults timeout: @config.rpcs.update_session.timeout,
442
+ metadata: call_metadata,
443
+ retry_policy: @config.rpcs.update_session.retry_policy
444
+
445
+ options.apply_defaults timeout: @config.timeout,
446
+ metadata: @config.metadata,
447
+ retry_policy: @config.retry_policy
448
+
449
+ @session_service_stub.update_session request, options do |result, operation|
450
+ yield result, operation if block_given?
451
+ end
452
+ rescue ::Gapic::Rest::Error => e
453
+ raise ::Google::Cloud::Error.from_error(e)
454
+ end
455
+
456
+ ##
457
+ # Gets a Session.
458
+ #
459
+ # @overload get_session(request, options = nil)
460
+ # Pass arguments to `get_session` via a request object, either of type
461
+ # {::Google::Cloud::DiscoveryEngine::V1beta::GetSessionRequest} or an equivalent Hash.
462
+ #
463
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::GetSessionRequest, ::Hash]
464
+ # A request object representing the call parameters. Required. To specify no
465
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
466
+ # @param options [::Gapic::CallOptions, ::Hash]
467
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
468
+ #
469
+ # @overload get_session(name: nil, include_answer_details: nil)
470
+ # Pass arguments to `get_session` via keyword arguments. Note that at
471
+ # least one keyword argument is required. To specify no parameters, or to keep all
472
+ # the default parameter values, pass an empty Hash as a request object (see above).
473
+ #
474
+ # @param name [::String]
475
+ # Required. The resource name of the Session to get. Format:
476
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store_id}/sessions/{session_id}`
477
+ # @param include_answer_details [::Boolean]
478
+ # Optional. If set to true, the full session including all answer details
479
+ # will be returned.
480
+ # @yield [result, operation] Access the result along with the TransportOperation object
481
+ # @yieldparam result [::Google::Cloud::DiscoveryEngine::V1beta::Session]
482
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
483
+ #
484
+ # @return [::Google::Cloud::DiscoveryEngine::V1beta::Session]
485
+ #
486
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
487
+ #
488
+ # @example Basic example
489
+ # require "google/cloud/discovery_engine/v1beta"
490
+ #
491
+ # # Create a client object. The client can be reused for multiple calls.
492
+ # client = Google::Cloud::DiscoveryEngine::V1beta::SessionService::Rest::Client.new
493
+ #
494
+ # # Create a request. To set request fields, pass in keyword arguments.
495
+ # request = Google::Cloud::DiscoveryEngine::V1beta::GetSessionRequest.new
496
+ #
497
+ # # Call the get_session method.
498
+ # result = client.get_session request
499
+ #
500
+ # # The returned object is of type Google::Cloud::DiscoveryEngine::V1beta::Session.
501
+ # p result
502
+ #
503
+ def get_session request, options = nil
504
+ raise ::ArgumentError, "request must be provided" if request.nil?
505
+
506
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::GetSessionRequest
507
+
508
+ # Converts hash and nil to an options object
509
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
510
+
511
+ # Customize the options with defaults
512
+ call_metadata = @config.rpcs.get_session.metadata.to_h
513
+
514
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
515
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
516
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
517
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION,
518
+ transports_version_send: [:rest]
519
+
520
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
521
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
522
+
523
+ options.apply_defaults timeout: @config.rpcs.get_session.timeout,
524
+ metadata: call_metadata,
525
+ retry_policy: @config.rpcs.get_session.retry_policy
526
+
527
+ options.apply_defaults timeout: @config.timeout,
528
+ metadata: @config.metadata,
529
+ retry_policy: @config.retry_policy
530
+
531
+ @session_service_stub.get_session request, options do |result, operation|
532
+ yield result, operation if block_given?
533
+ end
534
+ rescue ::Gapic::Rest::Error => e
535
+ raise ::Google::Cloud::Error.from_error(e)
536
+ end
537
+
538
+ ##
539
+ # Lists all Sessions by their parent
540
+ # {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore}.
541
+ #
542
+ # @overload list_sessions(request, options = nil)
543
+ # Pass arguments to `list_sessions` via a request object, either of type
544
+ # {::Google::Cloud::DiscoveryEngine::V1beta::ListSessionsRequest} or an equivalent Hash.
545
+ #
546
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::ListSessionsRequest, ::Hash]
547
+ # A request object representing the call parameters. Required. To specify no
548
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
549
+ # @param options [::Gapic::CallOptions, ::Hash]
550
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
551
+ #
552
+ # @overload list_sessions(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
553
+ # Pass arguments to `list_sessions` via keyword arguments. Note that at
554
+ # least one keyword argument is required. To specify no parameters, or to keep all
555
+ # the default parameter values, pass an empty Hash as a request object (see above).
556
+ #
557
+ # @param parent [::String]
558
+ # Required. The data store resource name. Format:
559
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store_id}`
560
+ # @param page_size [::Integer]
561
+ # Maximum number of results to return. If unspecified, defaults
562
+ # to 50. Max allowed value is 1000.
563
+ # @param page_token [::String]
564
+ # A page token, received from a previous `ListSessions` call.
565
+ # Provide this to retrieve the subsequent page.
566
+ # @param filter [::String]
567
+ # A comma-separated list of fields to filter by, in EBNF grammar.
568
+ # The supported fields are:
569
+ # * `user_pseudo_id`
570
+ # * `state`
571
+ # * `display_name`
572
+ # * `starred`
573
+ # * `is_pinned`
574
+ # * `labels`
575
+ # * `create_time`
576
+ # * `update_time`
577
+ #
578
+ # Examples:
579
+ # "user_pseudo_id = some_id"
580
+ # "display_name = \"some_name\""
581
+ # "starred = true"
582
+ # "is_pinned=true AND (NOT labels:hidden)"
583
+ # "create_time > \"1970-01-01T12:00:00Z\""
584
+ # @param order_by [::String]
585
+ # A comma-separated list of fields to order by, sorted in ascending order.
586
+ # Use "desc" after a field name for descending.
587
+ # Supported fields:
588
+ #
589
+ # * `update_time`
590
+ # * `create_time`
591
+ # * `session_name`
592
+ # * `is_pinned`
593
+ #
594
+ # Example:
595
+ #
596
+ # * "update_time desc"
597
+ # * "create_time"
598
+ # * "is_pinned desc,update_time desc": list sessions by is_pinned first, then
599
+ # by update_time.
600
+ # @yield [result, operation] Access the result along with the TransportOperation object
601
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1beta::Session>]
602
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
603
+ #
604
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1beta::Session>]
605
+ #
606
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
607
+ #
608
+ # @example Basic example
609
+ # require "google/cloud/discovery_engine/v1beta"
610
+ #
611
+ # # Create a client object. The client can be reused for multiple calls.
612
+ # client = Google::Cloud::DiscoveryEngine::V1beta::SessionService::Rest::Client.new
613
+ #
614
+ # # Create a request. To set request fields, pass in keyword arguments.
615
+ # request = Google::Cloud::DiscoveryEngine::V1beta::ListSessionsRequest.new
616
+ #
617
+ # # Call the list_sessions method.
618
+ # result = client.list_sessions request
619
+ #
620
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
621
+ # # over elements, and API calls will be issued to fetch pages as needed.
622
+ # result.each do |item|
623
+ # # Each element is of type ::Google::Cloud::DiscoveryEngine::V1beta::Session.
624
+ # p item
625
+ # end
626
+ #
627
+ def list_sessions request, options = nil
628
+ raise ::ArgumentError, "request must be provided" if request.nil?
629
+
630
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::ListSessionsRequest
631
+
632
+ # Converts hash and nil to an options object
633
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
634
+
635
+ # Customize the options with defaults
636
+ call_metadata = @config.rpcs.list_sessions.metadata.to_h
637
+
638
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
639
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
640
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
641
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION,
642
+ transports_version_send: [:rest]
643
+
644
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
645
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
646
+
647
+ options.apply_defaults timeout: @config.rpcs.list_sessions.timeout,
648
+ metadata: call_metadata,
649
+ retry_policy: @config.rpcs.list_sessions.retry_policy
650
+
651
+ options.apply_defaults timeout: @config.timeout,
652
+ metadata: @config.metadata,
653
+ retry_policy: @config.retry_policy
654
+
655
+ @session_service_stub.list_sessions request, options do |result, operation|
656
+ result = ::Gapic::Rest::PagedEnumerable.new @session_service_stub, :list_sessions, "sessions", request, result, options
657
+ yield result, operation if block_given?
658
+ throw :response, result
659
+ end
660
+ rescue ::Gapic::Rest::Error => e
661
+ raise ::Google::Cloud::Error.from_error(e)
662
+ end
663
+
664
+ ##
665
+ # Configuration class for the SessionService REST API.
666
+ #
667
+ # This class represents the configuration for SessionService REST,
668
+ # providing control over timeouts, retry behavior, logging, transport
669
+ # parameters, and other low-level controls. Certain parameters can also be
670
+ # applied individually to specific RPCs. See
671
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SessionService::Rest::Client::Configuration::Rpcs}
672
+ # for a list of RPCs that can be configured independently.
673
+ #
674
+ # Configuration can be applied globally to all clients, or to a single client
675
+ # on construction.
676
+ #
677
+ # @example
678
+ #
679
+ # # Modify the global config, setting the timeout for
680
+ # # create_session to 20 seconds,
681
+ # # and all remaining timeouts to 10 seconds.
682
+ # ::Google::Cloud::DiscoveryEngine::V1beta::SessionService::Rest::Client.configure do |config|
683
+ # config.timeout = 10.0
684
+ # config.rpcs.create_session.timeout = 20.0
685
+ # end
686
+ #
687
+ # # Apply the above configuration only to a new client.
688
+ # client = ::Google::Cloud::DiscoveryEngine::V1beta::SessionService::Rest::Client.new do |config|
689
+ # config.timeout = 10.0
690
+ # config.rpcs.create_session.timeout = 20.0
691
+ # end
692
+ #
693
+ # @!attribute [rw] endpoint
694
+ # A custom service endpoint, as a hostname or hostname:port. The default is
695
+ # nil, indicating to use the default endpoint in the current universe domain.
696
+ # @return [::String,nil]
697
+ # @!attribute [rw] credentials
698
+ # Credentials to send with calls. You may provide any of the following types:
699
+ # * (`String`) The path to a service account key file in JSON format
700
+ # * (`Hash`) A service account key as a Hash
701
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
702
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
703
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
704
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
705
+ # * (`nil`) indicating no credentials
706
+ #
707
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
708
+ # external source for authentication to Google Cloud, you must validate it before
709
+ # providing it to a Google API client library. Providing an unvalidated credential
710
+ # configuration to Google APIs can compromise the security of your systems and data.
711
+ # For more information, refer to [Validate credential configurations from external
712
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
713
+ # @return [::Object]
714
+ # @!attribute [rw] scope
715
+ # The OAuth scopes
716
+ # @return [::Array<::String>]
717
+ # @!attribute [rw] lib_name
718
+ # The library name as recorded in instrumentation and logging
719
+ # @return [::String]
720
+ # @!attribute [rw] lib_version
721
+ # The library version as recorded in instrumentation and logging
722
+ # @return [::String]
723
+ # @!attribute [rw] timeout
724
+ # The call timeout in seconds.
725
+ # @return [::Numeric]
726
+ # @!attribute [rw] metadata
727
+ # Additional headers to be sent with the call.
728
+ # @return [::Hash{::Symbol=>::String}]
729
+ # @!attribute [rw] retry_policy
730
+ # The retry policy. The value is a hash with the following keys:
731
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
732
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
733
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
734
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
735
+ # trigger a retry.
736
+ # @return [::Hash]
737
+ # @!attribute [rw] quota_project
738
+ # A separate project against which to charge quota.
739
+ # @return [::String]
740
+ # @!attribute [rw] universe_domain
741
+ # The universe domain within which to make requests. This determines the
742
+ # default endpoint URL. The default value of nil uses the environment
743
+ # universe (usually the default "googleapis.com" universe).
744
+ # @return [::String,nil]
745
+ # @!attribute [rw] logger
746
+ # A custom logger to use for request/response debug logging, or the value
747
+ # `:default` (the default) to construct a default logger, or `nil` to
748
+ # explicitly disable logging.
749
+ # @return [::Logger,:default,nil]
750
+ #
751
+ class Configuration
752
+ extend ::Gapic::Config
753
+
754
+ # @private
755
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
756
+ DEFAULT_ENDPOINT = "discoveryengine.googleapis.com"
757
+
758
+ config_attr :endpoint, nil, ::String, nil
759
+ config_attr :credentials, nil do |value|
760
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
761
+ allowed.any? { |klass| klass === value }
762
+ end
763
+ config_attr :scope, nil, ::String, ::Array, nil
764
+ config_attr :lib_name, nil, ::String, nil
765
+ config_attr :lib_version, nil, ::String, nil
766
+ config_attr :timeout, nil, ::Numeric, nil
767
+ config_attr :metadata, nil, ::Hash, nil
768
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
769
+ config_attr :quota_project, nil, ::String, nil
770
+ config_attr :universe_domain, nil, ::String, nil
771
+ config_attr :logger, :default, ::Logger, nil, :default
772
+
773
+ # @private
774
+ def initialize parent_config = nil
775
+ @parent_config = parent_config unless parent_config.nil?
776
+
777
+ yield self if block_given?
778
+ end
779
+
780
+ ##
781
+ # Configurations for individual RPCs
782
+ # @return [Rpcs]
783
+ #
784
+ def rpcs
785
+ @rpcs ||= begin
786
+ parent_rpcs = nil
787
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
788
+ Rpcs.new parent_rpcs
789
+ end
790
+ end
791
+
792
+ ##
793
+ # Configuration RPC class for the SessionService API.
794
+ #
795
+ # Includes fields providing the configuration for each RPC in this service.
796
+ # Each configuration object is of type `Gapic::Config::Method` and includes
797
+ # the following configuration fields:
798
+ #
799
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
800
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
801
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
802
+ # include the following keys:
803
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
804
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
805
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
806
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
807
+ # trigger a retry.
808
+ #
809
+ class Rpcs
810
+ ##
811
+ # RPC-specific configuration for `create_session`
812
+ # @return [::Gapic::Config::Method]
813
+ #
814
+ attr_reader :create_session
815
+ ##
816
+ # RPC-specific configuration for `delete_session`
817
+ # @return [::Gapic::Config::Method]
818
+ #
819
+ attr_reader :delete_session
820
+ ##
821
+ # RPC-specific configuration for `update_session`
822
+ # @return [::Gapic::Config::Method]
823
+ #
824
+ attr_reader :update_session
825
+ ##
826
+ # RPC-specific configuration for `get_session`
827
+ # @return [::Gapic::Config::Method]
828
+ #
829
+ attr_reader :get_session
830
+ ##
831
+ # RPC-specific configuration for `list_sessions`
832
+ # @return [::Gapic::Config::Method]
833
+ #
834
+ attr_reader :list_sessions
835
+
836
+ # @private
837
+ def initialize parent_rpcs = nil
838
+ create_session_config = parent_rpcs.create_session if parent_rpcs.respond_to? :create_session
839
+ @create_session = ::Gapic::Config::Method.new create_session_config
840
+ delete_session_config = parent_rpcs.delete_session if parent_rpcs.respond_to? :delete_session
841
+ @delete_session = ::Gapic::Config::Method.new delete_session_config
842
+ update_session_config = parent_rpcs.update_session if parent_rpcs.respond_to? :update_session
843
+ @update_session = ::Gapic::Config::Method.new update_session_config
844
+ get_session_config = parent_rpcs.get_session if parent_rpcs.respond_to? :get_session
845
+ @get_session = ::Gapic::Config::Method.new get_session_config
846
+ list_sessions_config = parent_rpcs.list_sessions if parent_rpcs.respond_to? :list_sessions
847
+ @list_sessions = ::Gapic::Config::Method.new list_sessions_config
848
+
849
+ yield self if block_given?
850
+ end
851
+ end
852
+ end
853
+ end
854
+ end
855
+ end
856
+ end
857
+ end
858
+ end
859
+ end