google-cloud-ces-v1 0.a → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +122 -0
  4. data/README.md +154 -8
  5. data/lib/google/cloud/ces/v1/agent_pb.rb +30 -0
  6. data/lib/google/cloud/ces/v1/agent_service/client.rb +5315 -0
  7. data/lib/google/cloud/ces/v1/agent_service/credentials.rb +48 -0
  8. data/lib/google/cloud/ces/v1/agent_service/operations.rb +841 -0
  9. data/lib/google/cloud/ces/v1/agent_service/paths.rb +424 -0
  10. data/lib/google/cloud/ces/v1/agent_service/rest/client.rb +4944 -0
  11. data/lib/google/cloud/ces/v1/agent_service/rest/operations.rb +925 -0
  12. data/lib/google/cloud/ces/v1/agent_service/rest/service_stub.rb +3028 -0
  13. data/lib/google/cloud/ces/v1/agent_service/rest.rb +55 -0
  14. data/lib/google/cloud/ces/v1/agent_service.rb +57 -0
  15. data/lib/google/cloud/ces/v1/agent_service_pb.rb +105 -0
  16. data/lib/google/cloud/ces/v1/agent_service_services_pb.rb +142 -0
  17. data/lib/google/cloud/ces/v1/agent_tool_pb.rb +24 -0
  18. data/lib/google/cloud/ces/v1/agent_transfers_pb.rb +29 -0
  19. data/lib/google/cloud/ces/v1/app_pb.rb +58 -0
  20. data/lib/google/cloud/ces/v1/app_version_pb.rb +32 -0
  21. data/lib/google/cloud/ces/v1/auth_pb.rb +34 -0
  22. data/lib/google/cloud/ces/v1/bigquery_export_pb.rb +23 -0
  23. data/lib/google/cloud/ces/v1/bindings_override.rb +75 -0
  24. data/lib/google/cloud/ces/v1/changelog_pb.rb +26 -0
  25. data/lib/google/cloud/ces/v1/client_function_pb.rb +24 -0
  26. data/lib/google/cloud/ces/v1/common_pb.rb +46 -0
  27. data/lib/google/cloud/ces/v1/connector_tool_pb.rb +27 -0
  28. data/lib/google/cloud/ces/v1/connector_toolset_pb.rb +25 -0
  29. data/lib/google/cloud/ces/v1/conversation_pb.rb +31 -0
  30. data/lib/google/cloud/ces/v1/data_store_pb.rb +27 -0
  31. data/lib/google/cloud/ces/v1/data_store_tool_pb.rb +40 -0
  32. data/lib/google/cloud/ces/v1/deployment_pb.rb +26 -0
  33. data/lib/google/cloud/ces/v1/example_pb.rb +34 -0
  34. data/lib/google/cloud/ces/v1/fakes_pb.rb +24 -0
  35. data/lib/google/cloud/ces/v1/file_search_tool_pb.rb +24 -0
  36. data/lib/google/cloud/ces/v1/google_search_tool_pb.rb +24 -0
  37. data/lib/google/cloud/ces/v1/guardrail_pb.rb +37 -0
  38. data/lib/google/cloud/ces/v1/mcp_tool_pb.rb +26 -0
  39. data/lib/google/cloud/ces/v1/mcp_toolset_pb.rb +25 -0
  40. data/lib/google/cloud/ces/v1/omnichannel_pb.rb +31 -0
  41. data/lib/google/cloud/ces/v1/omnichannel_service_pb.rb +27 -0
  42. data/lib/google/cloud/ces/v1/open_api_tool_pb.rb +25 -0
  43. data/lib/google/cloud/ces/v1/open_api_toolset_pb.rb +25 -0
  44. data/lib/google/cloud/ces/v1/python_function_pb.rb +23 -0
  45. data/lib/google/cloud/ces/v1/rest.rb +41 -0
  46. data/lib/google/cloud/ces/v1/schema_pb.rb +25 -0
  47. data/lib/google/cloud/ces/v1/search_suggestions_pb.rb +22 -0
  48. data/lib/google/cloud/ces/v1/security_settings_pb.rb +27 -0
  49. data/lib/google/cloud/ces/v1/session_service/client.rb +759 -0
  50. data/lib/google/cloud/ces/v1/session_service/credentials.rb +48 -0
  51. data/lib/google/cloud/ces/v1/session_service/paths.rb +117 -0
  52. data/lib/google/cloud/ces/v1/session_service/rest/client.rb +560 -0
  53. data/lib/google/cloud/ces/v1/session_service/rest/service_stub.rb +199 -0
  54. data/lib/google/cloud/ces/v1/session_service/rest.rb +53 -0
  55. data/lib/google/cloud/ces/v1/session_service.rb +55 -0
  56. data/lib/google/cloud/ces/v1/session_service_pb.rb +50 -0
  57. data/lib/google/cloud/ces/v1/session_service_services_pb.rb +119 -0
  58. data/lib/google/cloud/ces/v1/system_tool_pb.rb +23 -0
  59. data/lib/google/cloud/ces/v1/tool_pb.rb +38 -0
  60. data/lib/google/cloud/ces/v1/tool_service/client.rb +723 -0
  61. data/lib/google/cloud/ces/v1/tool_service/credentials.rb +48 -0
  62. data/lib/google/cloud/ces/v1/tool_service/paths.rb +94 -0
  63. data/lib/google/cloud/ces/v1/tool_service/rest/client.rb +667 -0
  64. data/lib/google/cloud/ces/v1/tool_service/rest/service_stub.rb +267 -0
  65. data/lib/google/cloud/ces/v1/tool_service/rest.rb +53 -0
  66. data/lib/google/cloud/ces/v1/tool_service.rb +55 -0
  67. data/lib/google/cloud/ces/v1/tool_service_pb.rb +35 -0
  68. data/lib/google/cloud/ces/v1/tool_service_services_pb.rb +50 -0
  69. data/lib/google/cloud/ces/v1/toolset_pb.rb +30 -0
  70. data/lib/google/cloud/ces/v1/toolset_tool_pb.rb +24 -0
  71. data/lib/google/cloud/ces/v1/version.rb +7 -2
  72. data/lib/google/cloud/ces/v1/widget_service/client.rb +501 -0
  73. data/lib/google/cloud/ces/v1/widget_service/credentials.rb +48 -0
  74. data/lib/google/cloud/ces/v1/widget_service/paths.rb +75 -0
  75. data/lib/google/cloud/ces/v1/widget_service/rest/client.rb +459 -0
  76. data/lib/google/cloud/ces/v1/widget_service/rest/service_stub.rb +143 -0
  77. data/lib/google/cloud/ces/v1/widget_service/rest.rb +53 -0
  78. data/lib/google/cloud/ces/v1/widget_service.rb +55 -0
  79. data/lib/google/cloud/ces/v1/widget_service_pb.rb +28 -0
  80. data/lib/google/cloud/ces/v1/widget_service_services_pb.rb +46 -0
  81. data/lib/google/cloud/ces/v1/widget_tool_pb.rb +29 -0
  82. data/lib/google/cloud/ces/v1.rb +48 -0
  83. data/lib/google-cloud-ces-v1.rb +21 -0
  84. data/proto_docs/README.md +4 -0
  85. data/proto_docs/google/api/client.rb +593 -0
  86. data/proto_docs/google/api/field_behavior.rb +85 -0
  87. data/proto_docs/google/api/launch_stage.rb +71 -0
  88. data/proto_docs/google/api/resource.rb +227 -0
  89. data/proto_docs/google/cloud/ces/v1/agent.rb +224 -0
  90. data/proto_docs/google/cloud/ces/v1/agent_service.rb +1250 -0
  91. data/proto_docs/google/cloud/ces/v1/agent_tool.rb +42 -0
  92. data/proto_docs/google/cloud/ces/v1/agent_transfers.rb +111 -0
  93. data/proto_docs/google/cloud/ces/v1/app.rb +685 -0
  94. data/proto_docs/google/cloud/ces/v1/app_version.rb +83 -0
  95. data/proto_docs/google/cloud/ces/v1/auth.rb +214 -0
  96. data/proto_docs/google/cloud/ces/v1/bigquery_export.rb +45 -0
  97. data/proto_docs/google/cloud/ces/v1/changelog.rb +73 -0
  98. data/proto_docs/google/cloud/ces/v1/client_function.rb +48 -0
  99. data/proto_docs/google/cloud/ces/v1/common.rb +375 -0
  100. data/proto_docs/google/cloud/ces/v1/connector_tool.rb +122 -0
  101. data/proto_docs/google/cloud/ces/v1/connector_toolset.rb +52 -0
  102. data/proto_docs/google/cloud/ces/v1/conversation.rb +152 -0
  103. data/proto_docs/google/cloud/ces/v1/data_store.rb +102 -0
  104. data/proto_docs/google/cloud/ces/v1/data_store_tool.rb +328 -0
  105. data/proto_docs/google/cloud/ces/v1/deployment.rb +62 -0
  106. data/proto_docs/google/cloud/ces/v1/example.rb +244 -0
  107. data/proto_docs/google/cloud/ces/v1/fakes.rb +55 -0
  108. data/proto_docs/google/cloud/ces/v1/file_search_tool.rb +60 -0
  109. data/proto_docs/google/cloud/ces/v1/google_search_tool.rb +76 -0
  110. data/proto_docs/google/cloud/ces/v1/guardrail.rb +324 -0
  111. data/proto_docs/google/cloud/ces/v1/mcp_tool.rb +85 -0
  112. data/proto_docs/google/cloud/ces/v1/mcp_toolset.rb +71 -0
  113. data/proto_docs/google/cloud/ces/v1/omnichannel.rb +163 -0
  114. data/proto_docs/google/cloud/ces/v1/omnichannel_service.rb +45 -0
  115. data/proto_docs/google/cloud/ces/v1/open_api_tool.rb +66 -0
  116. data/proto_docs/google/cloud/ces/v1/open_api_toolset.rb +57 -0
  117. data/proto_docs/google/cloud/ces/v1/python_function.rb +44 -0
  118. data/proto_docs/google/cloud/ces/v1/schema.rb +162 -0
  119. data/proto_docs/google/cloud/ces/v1/search_suggestions.rb +55 -0
  120. data/proto_docs/google/cloud/ces/v1/security_settings.rb +80 -0
  121. data/proto_docs/google/cloud/ces/v1/session_service.rb +464 -0
  122. data/proto_docs/google/cloud/ces/v1/system_tool.rb +38 -0
  123. data/proto_docs/google/cloud/ces/v1/tool.rb +126 -0
  124. data/proto_docs/google/cloud/ces/v1/tool_service.rb +168 -0
  125. data/proto_docs/google/cloud/ces/v1/toolset.rb +80 -0
  126. data/proto_docs/google/cloud/ces/v1/toolset_tool.rb +40 -0
  127. data/proto_docs/google/cloud/ces/v1/widget_service.rb +62 -0
  128. data/proto_docs/google/cloud/ces/v1/widget_tool.rb +146 -0
  129. data/proto_docs/google/longrunning/operations.rb +191 -0
  130. data/proto_docs/google/protobuf/any.rb +145 -0
  131. data/proto_docs/google/protobuf/duration.rb +98 -0
  132. data/proto_docs/google/protobuf/empty.rb +34 -0
  133. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  134. data/proto_docs/google/protobuf/struct.rb +108 -0
  135. data/proto_docs/google/protobuf/timestamp.rb +127 -0
  136. data/proto_docs/google/rpc/status.rb +48 -0
  137. metadata +183 -9
@@ -0,0 +1,560 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2026 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/ces/v1/session_service_pb"
21
+ require "google/cloud/ces/v1/session_service/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module Ces
27
+ module V1
28
+ module SessionService
29
+ module Rest
30
+ ##
31
+ # REST client for the SessionService service.
32
+ #
33
+ # Session service provides APIs for interacting with CES agents.
34
+ #
35
+ class Client
36
+ # @private
37
+ API_VERSION = ""
38
+
39
+ # @private
40
+ DEFAULT_ENDPOINT_TEMPLATE = "ces.$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::Ces::V1::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::Ces::V1::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", "Ces", "V1"]
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 = 60.0
77
+ default_config.retry_policy = {
78
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
79
+ }
80
+
81
+ default_config.rpcs.run_session.timeout = 220.0
82
+ default_config.rpcs.run_session.retry_policy = {
83
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
84
+ }
85
+
86
+ default_config
87
+ end
88
+ yield @configure if block_given?
89
+ @configure
90
+ end
91
+
92
+ ##
93
+ # Configure the SessionService Client instance.
94
+ #
95
+ # The configuration is set to the derived mode, meaning that values can be changed,
96
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
97
+ # should be made on {Client.configure}.
98
+ #
99
+ # See {::Google::Cloud::Ces::V1::SessionService::Rest::Client::Configuration}
100
+ # for a description of the configuration fields.
101
+ #
102
+ # @yield [config] Configure the Client client.
103
+ # @yieldparam config [Client::Configuration]
104
+ #
105
+ # @return [Client::Configuration]
106
+ #
107
+ def configure
108
+ yield @config if block_given?
109
+ @config
110
+ end
111
+
112
+ ##
113
+ # The effective universe domain
114
+ #
115
+ # @return [String]
116
+ #
117
+ def universe_domain
118
+ @session_service_stub.universe_domain
119
+ end
120
+
121
+ ##
122
+ # Create a new SessionService REST client object.
123
+ #
124
+ # @example
125
+ #
126
+ # # Create a client using the default configuration
127
+ # client = ::Google::Cloud::Ces::V1::SessionService::Rest::Client.new
128
+ #
129
+ # # Create a client using a custom configuration
130
+ # client = ::Google::Cloud::Ces::V1::SessionService::Rest::Client.new do |config|
131
+ # config.timeout = 10.0
132
+ # end
133
+ #
134
+ # @yield [config] Configure the SessionService client.
135
+ # @yieldparam config [Client::Configuration]
136
+ #
137
+ def initialize
138
+ # Create the configuration object
139
+ @config = Configuration.new Client.configure
140
+
141
+ # Yield the configuration if needed
142
+ yield @config if block_given?
143
+
144
+ # Create credentials
145
+ credentials = @config.credentials
146
+ # Use self-signed JWT if the endpoint is unchanged from default,
147
+ # but only if the default endpoint does not have a region prefix.
148
+ enable_self_signed_jwt = @config.endpoint.nil? ||
149
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
150
+ !@config.endpoint.split(".").first.include?("-"))
151
+ credentials ||= Credentials.default scope: @config.scope,
152
+ enable_self_signed_jwt: enable_self_signed_jwt
153
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
154
+ credentials = Credentials.new credentials, scope: @config.scope
155
+ end
156
+
157
+ @quota_project_id = @config.quota_project
158
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
159
+
160
+ @session_service_stub = ::Google::Cloud::Ces::V1::SessionService::Rest::ServiceStub.new(
161
+ endpoint: @config.endpoint,
162
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
163
+ universe_domain: @config.universe_domain,
164
+ credentials: credentials,
165
+ logger: @config.logger
166
+ )
167
+
168
+ @session_service_stub.logger(stub: true)&.info do |entry|
169
+ entry.set_system_name
170
+ entry.set_service
171
+ entry.message = "Created client for #{entry.service}"
172
+ entry.set_credentials_fields credentials
173
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
174
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
175
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
176
+ end
177
+
178
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
179
+ config.credentials = credentials
180
+ config.quota_project = @quota_project_id
181
+ config.endpoint = @session_service_stub.endpoint
182
+ config.universe_domain = @session_service_stub.universe_domain
183
+ config.bindings_override = @config.bindings_override
184
+ config.logger = @session_service_stub.logger if config.respond_to? :logger=
185
+ end
186
+ end
187
+
188
+ ##
189
+ # Get the associated client for mix-in of the Locations.
190
+ #
191
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
192
+ #
193
+ attr_reader :location_client
194
+
195
+ ##
196
+ # The logger used for request/response debug logging.
197
+ #
198
+ # @return [Logger]
199
+ #
200
+ def logger
201
+ @session_service_stub.logger
202
+ end
203
+
204
+ # Service calls
205
+
206
+ ##
207
+ # Initiates a single-turn interaction with the CES agent within a session.
208
+ #
209
+ # @overload run_session(request, options = nil)
210
+ # Pass arguments to `run_session` via a request object, either of type
211
+ # {::Google::Cloud::Ces::V1::RunSessionRequest} or an equivalent Hash.
212
+ #
213
+ # @param request [::Google::Cloud::Ces::V1::RunSessionRequest, ::Hash]
214
+ # A request object representing the call parameters. Required. To specify no
215
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
216
+ # @param options [::Gapic::CallOptions, ::Hash]
217
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
218
+ #
219
+ # @overload run_session(config: nil, inputs: nil)
220
+ # Pass arguments to `run_session` via keyword arguments. Note that at
221
+ # least one keyword argument is required. To specify no parameters, or to keep all
222
+ # the default parameter values, pass an empty Hash as a request object (see above).
223
+ #
224
+ # @param config [::Google::Cloud::Ces::V1::SessionConfig, ::Hash]
225
+ # Required. The configuration for the session.
226
+ # @param inputs [::Array<::Google::Cloud::Ces::V1::SessionInput, ::Hash>]
227
+ # Required. Inputs for the session.
228
+ # @yield [result, operation] Access the result along with the TransportOperation object
229
+ # @yieldparam result [::Google::Cloud::Ces::V1::RunSessionResponse]
230
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
231
+ #
232
+ # @return [::Google::Cloud::Ces::V1::RunSessionResponse]
233
+ #
234
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
235
+ #
236
+ # @example Basic example
237
+ # require "google/cloud/ces/v1"
238
+ #
239
+ # # Create a client object. The client can be reused for multiple calls.
240
+ # client = Google::Cloud::Ces::V1::SessionService::Rest::Client.new
241
+ #
242
+ # # Create a request. To set request fields, pass in keyword arguments.
243
+ # request = Google::Cloud::Ces::V1::RunSessionRequest.new
244
+ #
245
+ # # Call the run_session method.
246
+ # result = client.run_session request
247
+ #
248
+ # # The returned object is of type Google::Cloud::Ces::V1::RunSessionResponse.
249
+ # p result
250
+ #
251
+ def run_session request, options = nil
252
+ raise ::ArgumentError, "request must be provided" if request.nil?
253
+
254
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Ces::V1::RunSessionRequest
255
+
256
+ # Converts hash and nil to an options object
257
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
258
+
259
+ # Customize the options with defaults
260
+ call_metadata = @config.rpcs.run_session.metadata.to_h
261
+
262
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
263
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
264
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
265
+ gapic_version: ::Google::Cloud::Ces::V1::VERSION,
266
+ transports_version_send: [:rest]
267
+
268
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
269
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
270
+
271
+ options.apply_defaults timeout: @config.rpcs.run_session.timeout,
272
+ metadata: call_metadata,
273
+ retry_policy: @config.rpcs.run_session.retry_policy
274
+
275
+ options.apply_defaults timeout: @config.timeout,
276
+ metadata: @config.metadata,
277
+ retry_policy: @config.retry_policy
278
+
279
+ @session_service_stub.run_session request, options do |result, operation|
280
+ yield result, operation if block_given?
281
+ end
282
+ rescue ::Gapic::Rest::Error => e
283
+ raise ::Google::Cloud::Error.from_error(e)
284
+ end
285
+
286
+ ##
287
+ # Initiates a single-turn interaction with the CES agent. Uses server-side
288
+ # streaming to deliver incremental results and partial responses as they are
289
+ # generated.
290
+ #
291
+ # By default, complete responses (e.g., messages from callbacks or full LLM
292
+ # responses) are sent to the client as soon as they are available. To enable
293
+ # streaming individual text chunks directly from the model, set
294
+ # {::Google::Cloud::Ces::V1::SessionConfig#enable_text_streaming enable_text_streaming}
295
+ # to true.
296
+ #
297
+ # @overload stream_run_session(request, options = nil)
298
+ # Pass arguments to `stream_run_session` via a request object, either of type
299
+ # {::Google::Cloud::Ces::V1::RunSessionRequest} or an equivalent Hash.
300
+ #
301
+ # @param request [::Google::Cloud::Ces::V1::RunSessionRequest, ::Hash]
302
+ # A request object representing the call parameters. Required. To specify no
303
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
304
+ # @param options [::Gapic::CallOptions, ::Hash]
305
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
306
+ #
307
+ # @overload stream_run_session(config: nil, inputs: nil)
308
+ # Pass arguments to `stream_run_session` via keyword arguments. Note that at
309
+ # least one keyword argument is required. To specify no parameters, or to keep all
310
+ # the default parameter values, pass an empty Hash as a request object (see above).
311
+ #
312
+ # @param config [::Google::Cloud::Ces::V1::SessionConfig, ::Hash]
313
+ # Required. The configuration for the session.
314
+ # @param inputs [::Array<::Google::Cloud::Ces::V1::SessionInput, ::Hash>]
315
+ # Required. Inputs for the session.
316
+ # @return [::Enumerable<::Google::Cloud::Ces::V1::RunSessionResponse>]
317
+ #
318
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
319
+ #
320
+ # @example Basic example
321
+ # require "google/cloud/ces/v1"
322
+ #
323
+ # # Create a client object. The client can be reused for multiple calls.
324
+ # client = Google::Cloud::Ces::V1::SessionService::Rest::Client.new
325
+ #
326
+ # # Create a request. To set request fields, pass in keyword arguments.
327
+ # request = Google::Cloud::Ces::V1::RunSessionRequest.new
328
+ #
329
+ # # Call the stream_run_session method to start streaming.
330
+ # output = client.stream_run_session request
331
+ #
332
+ # # The returned object is a streamed enumerable yielding elements of type
333
+ # # ::Google::Cloud::Ces::V1::RunSessionResponse
334
+ # output.each do |current_response|
335
+ # p current_response
336
+ # end
337
+ #
338
+ def stream_run_session request, options = nil
339
+ raise ::ArgumentError, "request must be provided" if request.nil?
340
+
341
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Ces::V1::RunSessionRequest
342
+
343
+ # Converts hash and nil to an options object
344
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
345
+
346
+ # Customize the options with defaults
347
+ call_metadata = @config.rpcs.stream_run_session.metadata.to_h
348
+
349
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
350
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
351
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
352
+ gapic_version: ::Google::Cloud::Ces::V1::VERSION,
353
+ transports_version_send: [:rest]
354
+
355
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
356
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
357
+
358
+ options.apply_defaults timeout: @config.rpcs.stream_run_session.timeout,
359
+ metadata: call_metadata,
360
+ retry_policy: @config.rpcs.stream_run_session.retry_policy
361
+
362
+ options.apply_defaults timeout: @config.timeout,
363
+ metadata: @config.metadata,
364
+ retry_policy: @config.retry_policy
365
+
366
+ ::Gapic::Rest::ServerStream.new(
367
+ ::Google::Cloud::Ces::V1::RunSessionResponse,
368
+ ::Gapic::Rest::ThreadedEnumerator.new do |in_q, out_q|
369
+ @session_service_stub.stream_run_session request, options do |chunk|
370
+ in_q.deq
371
+ out_q.enq chunk
372
+ end
373
+ end
374
+ )
375
+ rescue ::Gapic::Rest::Error => e
376
+ raise ::Google::Cloud::Error.from_error(e)
377
+ end
378
+
379
+ ##
380
+ # Configuration class for the SessionService REST API.
381
+ #
382
+ # This class represents the configuration for SessionService REST,
383
+ # providing control over timeouts, retry behavior, logging, transport
384
+ # parameters, and other low-level controls. Certain parameters can also be
385
+ # applied individually to specific RPCs. See
386
+ # {::Google::Cloud::Ces::V1::SessionService::Rest::Client::Configuration::Rpcs}
387
+ # for a list of RPCs that can be configured independently.
388
+ #
389
+ # Configuration can be applied globally to all clients, or to a single client
390
+ # on construction.
391
+ #
392
+ # @example
393
+ #
394
+ # # Modify the global config, setting the timeout for
395
+ # # run_session to 20 seconds,
396
+ # # and all remaining timeouts to 10 seconds.
397
+ # ::Google::Cloud::Ces::V1::SessionService::Rest::Client.configure do |config|
398
+ # config.timeout = 10.0
399
+ # config.rpcs.run_session.timeout = 20.0
400
+ # end
401
+ #
402
+ # # Apply the above configuration only to a new client.
403
+ # client = ::Google::Cloud::Ces::V1::SessionService::Rest::Client.new do |config|
404
+ # config.timeout = 10.0
405
+ # config.rpcs.run_session.timeout = 20.0
406
+ # end
407
+ #
408
+ # @!attribute [rw] endpoint
409
+ # A custom service endpoint, as a hostname or hostname:port. The default is
410
+ # nil, indicating to use the default endpoint in the current universe domain.
411
+ # @return [::String,nil]
412
+ # @!attribute [rw] credentials
413
+ # Credentials to send with calls. You may provide any of the following types:
414
+ # * (`String`) The path to a service account key file in JSON format
415
+ # * (`Hash`) A service account key as a Hash
416
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
417
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
418
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
419
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
420
+ # * (`nil`) indicating no credentials
421
+ #
422
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
423
+ # external source for authentication to Google Cloud, you must validate it before
424
+ # providing it to a Google API client library. Providing an unvalidated credential
425
+ # configuration to Google APIs can compromise the security of your systems and data.
426
+ # For more information, refer to [Validate credential configurations from external
427
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
428
+ # @return [::Object]
429
+ # @!attribute [rw] scope
430
+ # The OAuth scopes
431
+ # @return [::Array<::String>]
432
+ # @!attribute [rw] lib_name
433
+ # The library name as recorded in instrumentation and logging
434
+ # @return [::String]
435
+ # @!attribute [rw] lib_version
436
+ # The library version as recorded in instrumentation and logging
437
+ # @return [::String]
438
+ # @!attribute [rw] timeout
439
+ # The call timeout in seconds.
440
+ # @return [::Numeric]
441
+ # @!attribute [rw] metadata
442
+ # Additional headers to be sent with the call.
443
+ # @return [::Hash{::Symbol=>::String}]
444
+ # @!attribute [rw] retry_policy
445
+ # The retry policy. The value is a hash with the following keys:
446
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
447
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
448
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
449
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
450
+ # trigger a retry.
451
+ # @return [::Hash]
452
+ # @!attribute [rw] quota_project
453
+ # A separate project against which to charge quota.
454
+ # @return [::String]
455
+ # @!attribute [rw] universe_domain
456
+ # The universe domain within which to make requests. This determines the
457
+ # default endpoint URL. The default value of nil uses the environment
458
+ # universe (usually the default "googleapis.com" universe).
459
+ # @return [::String,nil]
460
+ # @!attribute [rw] logger
461
+ # A custom logger to use for request/response debug logging, or the value
462
+ # `:default` (the default) to construct a default logger, or `nil` to
463
+ # explicitly disable logging.
464
+ # @return [::Logger,:default,nil]
465
+ #
466
+ class Configuration
467
+ extend ::Gapic::Config
468
+
469
+ # @private
470
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
471
+ DEFAULT_ENDPOINT = "ces.googleapis.com"
472
+
473
+ config_attr :endpoint, nil, ::String, nil
474
+ config_attr :credentials, nil do |value|
475
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
476
+ allowed.any? { |klass| klass === value }
477
+ end
478
+ config_attr :scope, nil, ::String, ::Array, nil
479
+ config_attr :lib_name, nil, ::String, nil
480
+ config_attr :lib_version, nil, ::String, nil
481
+ config_attr :timeout, nil, ::Numeric, nil
482
+ config_attr :metadata, nil, ::Hash, nil
483
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
484
+ config_attr :quota_project, nil, ::String, nil
485
+ config_attr :universe_domain, nil, ::String, nil
486
+
487
+ # @private
488
+ # Overrides for http bindings for the RPCs of this service
489
+ # are only used when this service is used as mixin, and only
490
+ # by the host service.
491
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
492
+ config_attr :bindings_override, {}, ::Hash, nil
493
+ config_attr :logger, :default, ::Logger, nil, :default
494
+
495
+ # @private
496
+ def initialize parent_config = nil
497
+ @parent_config = parent_config unless parent_config.nil?
498
+
499
+ yield self if block_given?
500
+ end
501
+
502
+ ##
503
+ # Configurations for individual RPCs
504
+ # @return [Rpcs]
505
+ #
506
+ def rpcs
507
+ @rpcs ||= begin
508
+ parent_rpcs = nil
509
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
510
+ Rpcs.new parent_rpcs
511
+ end
512
+ end
513
+
514
+ ##
515
+ # Configuration RPC class for the SessionService API.
516
+ #
517
+ # Includes fields providing the configuration for each RPC in this service.
518
+ # Each configuration object is of type `Gapic::Config::Method` and includes
519
+ # the following configuration fields:
520
+ #
521
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
522
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
523
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
524
+ # include the following keys:
525
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
526
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
527
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
528
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
529
+ # trigger a retry.
530
+ #
531
+ class Rpcs
532
+ ##
533
+ # RPC-specific configuration for `run_session`
534
+ # @return [::Gapic::Config::Method]
535
+ #
536
+ attr_reader :run_session
537
+ ##
538
+ # RPC-specific configuration for `stream_run_session`
539
+ # @return [::Gapic::Config::Method]
540
+ #
541
+ attr_reader :stream_run_session
542
+
543
+ # @private
544
+ def initialize parent_rpcs = nil
545
+ run_session_config = parent_rpcs.run_session if parent_rpcs.respond_to? :run_session
546
+ @run_session = ::Gapic::Config::Method.new run_session_config
547
+ stream_run_session_config = parent_rpcs.stream_run_session if parent_rpcs.respond_to? :stream_run_session
548
+ @stream_run_session = ::Gapic::Config::Method.new stream_run_session_config
549
+
550
+ yield self if block_given?
551
+ end
552
+ end
553
+ end
554
+ end
555
+ end
556
+ end
557
+ end
558
+ end
559
+ end
560
+ end