google-apps-chat-v1 0.a → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +122 -0
  4. data/README.md +144 -8
  5. data/lib/google/apps/chat/v1/chat_service/client.rb +3673 -0
  6. data/lib/google/apps/chat/v1/chat_service/credentials.rb +63 -0
  7. data/lib/google/apps/chat/v1/chat_service/paths.rb +191 -0
  8. data/lib/google/apps/chat/v1/chat_service/rest/client.rb +3497 -0
  9. data/lib/google/apps/chat/v1/chat_service/rest/service_stub.rb +1614 -0
  10. data/lib/google/apps/chat/v1/chat_service/rest.rb +53 -0
  11. data/lib/google/apps/chat/v1/chat_service.rb +56 -0
  12. data/lib/google/apps/chat/v1/rest.rb +37 -0
  13. data/lib/google/apps/chat/v1/version.rb +7 -2
  14. data/lib/google/apps/chat/v1.rb +45 -0
  15. data/lib/google/chat/v1/action_status_pb.rb +44 -0
  16. data/lib/google/chat/v1/annotation_pb.rb +56 -0
  17. data/lib/google/chat/v1/attachment_pb.rb +51 -0
  18. data/lib/google/chat/v1/chat_service_pb.rb +53 -0
  19. data/lib/google/chat/v1/chat_service_services_pb.rb +369 -0
  20. data/lib/google/chat/v1/contextual_addon_pb.rb +50 -0
  21. data/lib/google/chat/v1/deletion_metadata_pb.rb +43 -0
  22. data/lib/google/chat/v1/group_pb.rb +42 -0
  23. data/lib/google/chat/v1/history_state_pb.rb +42 -0
  24. data/lib/google/chat/v1/matched_url_pb.rb +44 -0
  25. data/lib/google/chat/v1/membership_pb.rb +61 -0
  26. data/lib/google/chat/v1/message_pb.rb +89 -0
  27. data/lib/google/chat/v1/reaction_pb.rb +54 -0
  28. data/lib/google/chat/v1/slash_command_pb.rb +42 -0
  29. data/lib/google/chat/v1/space_pb.rb +63 -0
  30. data/lib/google/chat/v1/space_read_state_pb.rb +51 -0
  31. data/lib/google/chat/v1/space_setup_pb.rb +48 -0
  32. data/lib/google/chat/v1/thread_read_state_pb.rb +48 -0
  33. data/lib/google/chat/v1/user_pb.rb +46 -0
  34. data/lib/google/chat/v1/widgets_pb.rb +53 -0
  35. data/lib/google-apps-chat-v1.rb +21 -0
  36. data/proto_docs/README.md +4 -0
  37. data/proto_docs/google/api/client.rb +399 -0
  38. data/proto_docs/google/api/field_behavior.rb +85 -0
  39. data/proto_docs/google/api/launch_stage.rb +71 -0
  40. data/proto_docs/google/api/resource.rb +222 -0
  41. data/proto_docs/google/apps/card/v1/card.rb +2076 -0
  42. data/proto_docs/google/chat/v1/action_status.rb +40 -0
  43. data/proto_docs/google/chat/v1/annotation.rb +186 -0
  44. data/proto_docs/google/chat/v1/attachment.rb +131 -0
  45. data/proto_docs/google/chat/v1/contextual_addon.rb +120 -0
  46. data/proto_docs/google/chat/v1/deletion_metadata.rb +60 -0
  47. data/proto_docs/google/chat/v1/group.rb +41 -0
  48. data/proto_docs/google/chat/v1/history_state.rb +42 -0
  49. data/proto_docs/google/chat/v1/matched_url.rb +37 -0
  50. data/proto_docs/google/chat/v1/membership.rb +295 -0
  51. data/proto_docs/google/chat/v1/message.rb +657 -0
  52. data/proto_docs/google/chat/v1/reaction.rb +185 -0
  53. data/proto_docs/google/chat/v1/slash_command.rb +37 -0
  54. data/proto_docs/google/chat/v1/space.rb +381 -0
  55. data/proto_docs/google/chat/v1/space_read_state.rb +104 -0
  56. data/proto_docs/google/chat/v1/space_setup.rb +92 -0
  57. data/proto_docs/google/chat/v1/thread_read_state.rb +66 -0
  58. data/proto_docs/google/chat/v1/user.rb +84 -0
  59. data/proto_docs/google/chat/v1/widgets.rb +293 -0
  60. data/proto_docs/google/protobuf/duration.rb +98 -0
  61. data/proto_docs/google/protobuf/empty.rb +34 -0
  62. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  63. data/proto_docs/google/protobuf/timestamp.rb +127 -0
  64. data/proto_docs/google/protobuf/wrappers.rb +121 -0
  65. data/proto_docs/google/rpc/code.rb +185 -0
  66. data/proto_docs/google/type/color.rb +173 -0
  67. metadata +128 -10
@@ -0,0 +1,3673 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2024 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/chat/v1/chat_service_pb"
21
+
22
+ module Google
23
+ module Apps
24
+ module Chat
25
+ module V1
26
+ module ChatService
27
+ ##
28
+ # Client for the ChatService service.
29
+ #
30
+ # Enables developers to build Chat apps and
31
+ # integrations on Google Chat Platform.
32
+ #
33
+ class Client
34
+ # @private
35
+ DEFAULT_ENDPOINT_TEMPLATE = "chat.$UNIVERSE_DOMAIN$"
36
+
37
+ include Paths
38
+
39
+ # @private
40
+ attr_reader :chat_service_stub
41
+
42
+ ##
43
+ # Configure the ChatService Client class.
44
+ #
45
+ # See {::Google::Apps::Chat::V1::ChatService::Client::Configuration}
46
+ # for a description of the configuration fields.
47
+ #
48
+ # @example
49
+ #
50
+ # # Modify the configuration for all ChatService clients
51
+ # ::Google::Apps::Chat::V1::ChatService::Client.configure do |config|
52
+ # config.timeout = 10.0
53
+ # end
54
+ #
55
+ # @yield [config] Configure the Client client.
56
+ # @yieldparam config [Client::Configuration]
57
+ #
58
+ # @return [Client::Configuration]
59
+ #
60
+ def self.configure
61
+ @configure ||= begin
62
+ namespace = ["Google", "Apps", "Chat", "V1"]
63
+ parent_config = while namespace.any?
64
+ parent_name = namespace.join "::"
65
+ parent_const = const_get parent_name
66
+ break parent_const.configure if parent_const.respond_to? :configure
67
+ namespace.pop
68
+ end
69
+ default_config = Client::Configuration.new parent_config
70
+
71
+ default_config.rpcs.create_message.timeout = 30.0
72
+ default_config.rpcs.create_message.retry_policy = {
73
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
74
+ }
75
+
76
+ default_config.rpcs.list_messages.timeout = 30.0
77
+ default_config.rpcs.list_messages.retry_policy = {
78
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
79
+ }
80
+
81
+ default_config.rpcs.list_memberships.timeout = 30.0
82
+ default_config.rpcs.list_memberships.retry_policy = {
83
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
84
+ }
85
+
86
+ default_config.rpcs.get_membership.timeout = 30.0
87
+ default_config.rpcs.get_membership.retry_policy = {
88
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
89
+ }
90
+
91
+ default_config.rpcs.get_message.timeout = 30.0
92
+ default_config.rpcs.get_message.retry_policy = {
93
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
94
+ }
95
+
96
+ default_config.rpcs.update_message.timeout = 30.0
97
+ default_config.rpcs.update_message.retry_policy = {
98
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
99
+ }
100
+
101
+ default_config.rpcs.delete_message.timeout = 30.0
102
+ default_config.rpcs.delete_message.retry_policy = {
103
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
104
+ }
105
+
106
+ default_config.rpcs.get_attachment.timeout = 30.0
107
+ default_config.rpcs.get_attachment.retry_policy = {
108
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
109
+ }
110
+
111
+ default_config.rpcs.upload_attachment.timeout = 30.0
112
+ default_config.rpcs.upload_attachment.retry_policy = {
113
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
114
+ }
115
+
116
+ default_config.rpcs.list_spaces.timeout = 30.0
117
+ default_config.rpcs.list_spaces.retry_policy = {
118
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
119
+ }
120
+
121
+ default_config.rpcs.get_space.timeout = 30.0
122
+ default_config.rpcs.get_space.retry_policy = {
123
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
124
+ }
125
+
126
+ default_config.rpcs.create_space.timeout = 30.0
127
+ default_config.rpcs.create_space.retry_policy = {
128
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
129
+ }
130
+
131
+ default_config.rpcs.set_up_space.timeout = 30.0
132
+ default_config.rpcs.set_up_space.retry_policy = {
133
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
134
+ }
135
+
136
+ default_config.rpcs.update_space.timeout = 30.0
137
+ default_config.rpcs.update_space.retry_policy = {
138
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
139
+ }
140
+
141
+ default_config.rpcs.delete_space.timeout = 30.0
142
+ default_config.rpcs.delete_space.retry_policy = {
143
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
144
+ }
145
+
146
+ default_config.rpcs.complete_import_space.timeout = 30.0
147
+ default_config.rpcs.complete_import_space.retry_policy = {
148
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
149
+ }
150
+
151
+ default_config.rpcs.find_direct_message.timeout = 30.0
152
+ default_config.rpcs.find_direct_message.retry_policy = {
153
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
154
+ }
155
+
156
+ default_config.rpcs.create_membership.timeout = 30.0
157
+ default_config.rpcs.create_membership.retry_policy = {
158
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
159
+ }
160
+
161
+ default_config.rpcs.update_membership.timeout = 30.0
162
+ default_config.rpcs.update_membership.retry_policy = {
163
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
164
+ }
165
+
166
+ default_config.rpcs.delete_membership.timeout = 30.0
167
+ default_config.rpcs.delete_membership.retry_policy = {
168
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
169
+ }
170
+
171
+ default_config.rpcs.create_reaction.timeout = 30.0
172
+ default_config.rpcs.create_reaction.retry_policy = {
173
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
174
+ }
175
+
176
+ default_config.rpcs.list_reactions.timeout = 30.0
177
+ default_config.rpcs.list_reactions.retry_policy = {
178
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
179
+ }
180
+
181
+ default_config.rpcs.delete_reaction.timeout = 30.0
182
+ default_config.rpcs.delete_reaction.retry_policy = {
183
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
184
+ }
185
+
186
+ default_config.rpcs.get_space_read_state.timeout = 30.0
187
+ default_config.rpcs.get_space_read_state.retry_policy = {
188
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
189
+ }
190
+
191
+ default_config.rpcs.update_space_read_state.timeout = 30.0
192
+ default_config.rpcs.update_space_read_state.retry_policy = {
193
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
194
+ }
195
+
196
+ default_config.rpcs.get_thread_read_state.timeout = 30.0
197
+ default_config.rpcs.get_thread_read_state.retry_policy = {
198
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
199
+ }
200
+
201
+ default_config
202
+ end
203
+ yield @configure if block_given?
204
+ @configure
205
+ end
206
+
207
+ ##
208
+ # Configure the ChatService Client instance.
209
+ #
210
+ # The configuration is set to the derived mode, meaning that values can be changed,
211
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
212
+ # should be made on {Client.configure}.
213
+ #
214
+ # See {::Google::Apps::Chat::V1::ChatService::Client::Configuration}
215
+ # for a description of the configuration fields.
216
+ #
217
+ # @yield [config] Configure the Client client.
218
+ # @yieldparam config [Client::Configuration]
219
+ #
220
+ # @return [Client::Configuration]
221
+ #
222
+ def configure
223
+ yield @config if block_given?
224
+ @config
225
+ end
226
+
227
+ ##
228
+ # The effective universe domain
229
+ #
230
+ # @return [String]
231
+ #
232
+ def universe_domain
233
+ @chat_service_stub.universe_domain
234
+ end
235
+
236
+ ##
237
+ # Create a new ChatService client object.
238
+ #
239
+ # @example
240
+ #
241
+ # # Create a client using the default configuration
242
+ # client = ::Google::Apps::Chat::V1::ChatService::Client.new
243
+ #
244
+ # # Create a client using a custom configuration
245
+ # client = ::Google::Apps::Chat::V1::ChatService::Client.new do |config|
246
+ # config.timeout = 10.0
247
+ # end
248
+ #
249
+ # @yield [config] Configure the ChatService client.
250
+ # @yieldparam config [Client::Configuration]
251
+ #
252
+ def initialize
253
+ # These require statements are intentionally placed here to initialize
254
+ # the gRPC module only when it's required.
255
+ # See https://github.com/googleapis/toolkit/issues/446
256
+ require "gapic/grpc"
257
+ require "google/chat/v1/chat_service_services_pb"
258
+
259
+ # Create the configuration object
260
+ @config = Configuration.new Client.configure
261
+
262
+ # Yield the configuration if needed
263
+ yield @config if block_given?
264
+
265
+ # Create credentials
266
+ credentials = @config.credentials
267
+ # Use self-signed JWT if the endpoint is unchanged from default,
268
+ # but only if the default endpoint does not have a region prefix.
269
+ enable_self_signed_jwt = @config.endpoint.nil? ||
270
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
271
+ !@config.endpoint.split(".").first.include?("-"))
272
+ credentials ||= Credentials.default scope: @config.scope,
273
+ enable_self_signed_jwt: enable_self_signed_jwt
274
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
275
+ credentials = Credentials.new credentials, scope: @config.scope
276
+ end
277
+ @quota_project_id = @config.quota_project
278
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
279
+
280
+ @chat_service_stub = ::Gapic::ServiceStub.new(
281
+ ::Google::Apps::Chat::V1::ChatService::Stub,
282
+ credentials: credentials,
283
+ endpoint: @config.endpoint,
284
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
285
+ universe_domain: @config.universe_domain,
286
+ channel_args: @config.channel_args,
287
+ interceptors: @config.interceptors,
288
+ channel_pool_config: @config.channel_pool
289
+ )
290
+ end
291
+
292
+ # Service calls
293
+
294
+ ##
295
+ # Creates a message in a Google Chat space. The maximum message size,
296
+ # including text and cards, is 32,000 bytes. For an example, see [Send a
297
+ # message](https://developers.google.com/workspace/chat/create-messages).
298
+ #
299
+ # Calling this method requires
300
+ # [authentication](https://developers.google.com/workspace/chat/authenticate-authorize)
301
+ # and supports the following authentication types:
302
+ #
303
+ # - For text messages, user authentication or app authentication are
304
+ # supported.
305
+ # - For card messages, only app authentication is supported. (Only Chat apps
306
+ # can create card messages.)
307
+ #
308
+ # @overload create_message(request, options = nil)
309
+ # Pass arguments to `create_message` via a request object, either of type
310
+ # {::Google::Apps::Chat::V1::CreateMessageRequest} or an equivalent Hash.
311
+ #
312
+ # @param request [::Google::Apps::Chat::V1::CreateMessageRequest, ::Hash]
313
+ # A request object representing the call parameters. Required. To specify no
314
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
315
+ # @param options [::Gapic::CallOptions, ::Hash]
316
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
317
+ #
318
+ # @overload create_message(parent: nil, message: nil, thread_key: nil, request_id: nil, message_reply_option: nil, message_id: nil)
319
+ # Pass arguments to `create_message` via keyword arguments. Note that at
320
+ # least one keyword argument is required. To specify no parameters, or to keep all
321
+ # the default parameter values, pass an empty Hash as a request object (see above).
322
+ #
323
+ # @param parent [::String]
324
+ # Required. The resource name of the space in which to create a message.
325
+ #
326
+ # Format: `spaces/{space}`
327
+ # @param message [::Google::Apps::Chat::V1::Message, ::Hash]
328
+ # Required. Message body.
329
+ # @param thread_key [::String]
330
+ # Optional. Deprecated: Use
331
+ # {::Google::Apps::Chat::V1::Thread#thread_key thread.thread_key} instead. ID for the
332
+ # thread. Supports up to 4000 characters. To start or add to a thread, create
333
+ # a message and specify a `threadKey` or the
334
+ # {::Google::Apps::Chat::V1::Thread#name thread.name}. For example usage, see [Start or
335
+ # reply to a message
336
+ # thread](https://developers.google.com/workspace/chat/create-messages#create-message-thread).
337
+ # @param request_id [::String]
338
+ # Optional. A unique request ID for this message. Specifying an existing
339
+ # request ID returns the message created with that ID instead of creating a
340
+ # new message.
341
+ # @param message_reply_option [::Google::Apps::Chat::V1::CreateMessageRequest::MessageReplyOption]
342
+ # Optional. Specifies whether a message starts a thread or replies to one.
343
+ # Only supported in named spaces.
344
+ # @param message_id [::String]
345
+ # Optional. A custom ID for a message. Lets Chat apps get, update, or delete
346
+ # a message without needing to store the system-assigned ID in the message's
347
+ # resource name (represented in the message `name` field).
348
+ #
349
+ # The value for this field must meet the following requirements:
350
+ #
351
+ # * Begins with `client-`. For example, `client-custom-name` is a valid
352
+ # custom ID, but `custom-name` is not.
353
+ # * Contains up to 63 characters and only lowercase letters, numbers, and
354
+ # hyphens.
355
+ # * Is unique within a space. A Chat app can't use the same custom ID for
356
+ # different messages.
357
+ #
358
+ # For details, see [Name a
359
+ # message](https://developers.google.com/workspace/chat/create-messages#name_a_created_message).
360
+ #
361
+ # @yield [response, operation] Access the result along with the RPC operation
362
+ # @yieldparam response [::Google::Apps::Chat::V1::Message]
363
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
364
+ #
365
+ # @return [::Google::Apps::Chat::V1::Message]
366
+ #
367
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
368
+ #
369
+ # @example Basic example
370
+ # require "google/apps/chat/v1"
371
+ #
372
+ # # Create a client object. The client can be reused for multiple calls.
373
+ # client = Google::Apps::Chat::V1::ChatService::Client.new
374
+ #
375
+ # # Create a request. To set request fields, pass in keyword arguments.
376
+ # request = Google::Apps::Chat::V1::CreateMessageRequest.new
377
+ #
378
+ # # Call the create_message method.
379
+ # result = client.create_message request
380
+ #
381
+ # # The returned object is of type Google::Apps::Chat::V1::Message.
382
+ # p result
383
+ #
384
+ def create_message request, options = nil
385
+ raise ::ArgumentError, "request must be provided" if request.nil?
386
+
387
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::CreateMessageRequest
388
+
389
+ # Converts hash and nil to an options object
390
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
391
+
392
+ # Customize the options with defaults
393
+ metadata = @config.rpcs.create_message.metadata.to_h
394
+
395
+ # Set x-goog-api-client and x-goog-user-project headers
396
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
397
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
398
+ gapic_version: ::Google::Apps::Chat::V1::VERSION
399
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
400
+
401
+ header_params = {}
402
+ if request.parent
403
+ header_params["parent"] = request.parent
404
+ end
405
+
406
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
407
+ metadata[:"x-goog-request-params"] ||= request_params_header
408
+
409
+ options.apply_defaults timeout: @config.rpcs.create_message.timeout,
410
+ metadata: metadata,
411
+ retry_policy: @config.rpcs.create_message.retry_policy
412
+
413
+ options.apply_defaults timeout: @config.timeout,
414
+ metadata: @config.metadata,
415
+ retry_policy: @config.retry_policy
416
+
417
+ @chat_service_stub.call_rpc :create_message, request, options: options do |response, operation|
418
+ yield response, operation if block_given?
419
+ return response
420
+ end
421
+ rescue ::GRPC::BadStatus => e
422
+ raise ::Google::Cloud::Error.from_error(e)
423
+ end
424
+
425
+ ##
426
+ # Lists messages in a space that the caller is a member of, including
427
+ # messages from blocked members and spaces. For an example, see
428
+ # [List messages](/chat/api/guides/v1/messages/list).
429
+ # Requires [user
430
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
431
+ #
432
+ # @overload list_messages(request, options = nil)
433
+ # Pass arguments to `list_messages` via a request object, either of type
434
+ # {::Google::Apps::Chat::V1::ListMessagesRequest} or an equivalent Hash.
435
+ #
436
+ # @param request [::Google::Apps::Chat::V1::ListMessagesRequest, ::Hash]
437
+ # A request object representing the call parameters. Required. To specify no
438
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
439
+ # @param options [::Gapic::CallOptions, ::Hash]
440
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
441
+ #
442
+ # @overload list_messages(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil, show_deleted: nil)
443
+ # Pass arguments to `list_messages` via keyword arguments. Note that at
444
+ # least one keyword argument is required. To specify no parameters, or to keep all
445
+ # the default parameter values, pass an empty Hash as a request object (see above).
446
+ #
447
+ # @param parent [::String]
448
+ # Required. The resource name of the space to list messages from.
449
+ #
450
+ # Format: `spaces/{space}`
451
+ # @param page_size [::Integer]
452
+ # The maximum number of messages returned. The service might return fewer
453
+ # messages than this value.
454
+ #
455
+ # If unspecified, at most 25 are returned.
456
+ #
457
+ # The maximum value is 1000. If you use a value more than 1000, it's
458
+ # automatically changed to 1000.
459
+ #
460
+ # Negative values return an `INVALID_ARGUMENT` error.
461
+ # @param page_token [::String]
462
+ # Optional, if resuming from a previous query.
463
+ #
464
+ # A page token received from a previous list messages call. Provide this
465
+ # parameter to retrieve the subsequent page.
466
+ #
467
+ # When paginating, all other parameters provided should match the call that
468
+ # provided the page token. Passing different values to the other parameters
469
+ # might lead to unexpected results.
470
+ # @param filter [::String]
471
+ # A query filter.
472
+ #
473
+ # You can filter messages by date (`create_time`) and thread (`thread.name`).
474
+ #
475
+ # To filter messages by the date they were created, specify the `create_time`
476
+ # with a timestamp in [RFC-3339](https://www.rfc-editor.org/rfc/rfc3339)
477
+ # format and double quotation marks. For example,
478
+ # `"2023-04-21T11:30:00-04:00"`. You can use the greater than operator `>` to
479
+ # list messages that were created after a timestamp, or the less than
480
+ # operator `<` to list messages that were created before a timestamp. To
481
+ # filter messages within a time interval, use the `AND` operator between two
482
+ # timestamps.
483
+ #
484
+ # To filter by thread, specify the `thread.name`, formatted as
485
+ # `spaces/{space}/threads/{thread}`. You can only specify one
486
+ # `thread.name` per query.
487
+ #
488
+ # To filter by both thread and date, use the `AND` operator in your query.
489
+ #
490
+ # For example, the following queries are valid:
491
+ #
492
+ # ```
493
+ # create_time > "2012-04-21T11:30:00-04:00"
494
+ #
495
+ # create_time > "2012-04-21T11:30:00-04:00" AND
496
+ # thread.name = spaces/AAAAAAAAAAA/threads/123
497
+ #
498
+ # create_time > "2012-04-21T11:30:00+00:00" AND
499
+ #
500
+ # create_time < "2013-01-01T00:00:00+00:00" AND
501
+ # thread.name = spaces/AAAAAAAAAAA/threads/123
502
+ #
503
+ # thread.name = spaces/AAAAAAAAAAA/threads/123
504
+ # ```
505
+ #
506
+ # Invalid queries are rejected by the server with an `INVALID_ARGUMENT`
507
+ # error.
508
+ # @param order_by [::String]
509
+ # Optional, if resuming from a previous query.
510
+ #
511
+ # How the list of messages is ordered. Specify a value to order by an
512
+ # ordering operation. Valid ordering operation values are as follows:
513
+ #
514
+ # - `ASC` for ascending.
515
+ #
516
+ # - `DESC` for descending.
517
+ #
518
+ # The default ordering is `create_time ASC`.
519
+ # @param show_deleted [::Boolean]
520
+ # Whether to include deleted messages. Deleted messages include deleted time
521
+ # and metadata about their deletion, but message content is unavailable.
522
+ #
523
+ # @yield [response, operation] Access the result along with the RPC operation
524
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Apps::Chat::V1::Message>]
525
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
526
+ #
527
+ # @return [::Gapic::PagedEnumerable<::Google::Apps::Chat::V1::Message>]
528
+ #
529
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
530
+ #
531
+ # @example Basic example
532
+ # require "google/apps/chat/v1"
533
+ #
534
+ # # Create a client object. The client can be reused for multiple calls.
535
+ # client = Google::Apps::Chat::V1::ChatService::Client.new
536
+ #
537
+ # # Create a request. To set request fields, pass in keyword arguments.
538
+ # request = Google::Apps::Chat::V1::ListMessagesRequest.new
539
+ #
540
+ # # Call the list_messages method.
541
+ # result = client.list_messages request
542
+ #
543
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
544
+ # # over elements, and API calls will be issued to fetch pages as needed.
545
+ # result.each do |item|
546
+ # # Each element is of type ::Google::Apps::Chat::V1::Message.
547
+ # p item
548
+ # end
549
+ #
550
+ def list_messages request, options = nil
551
+ raise ::ArgumentError, "request must be provided" if request.nil?
552
+
553
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::ListMessagesRequest
554
+
555
+ # Converts hash and nil to an options object
556
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
557
+
558
+ # Customize the options with defaults
559
+ metadata = @config.rpcs.list_messages.metadata.to_h
560
+
561
+ # Set x-goog-api-client and x-goog-user-project headers
562
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
563
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
564
+ gapic_version: ::Google::Apps::Chat::V1::VERSION
565
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
566
+
567
+ header_params = {}
568
+ if request.parent
569
+ header_params["parent"] = request.parent
570
+ end
571
+
572
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
573
+ metadata[:"x-goog-request-params"] ||= request_params_header
574
+
575
+ options.apply_defaults timeout: @config.rpcs.list_messages.timeout,
576
+ metadata: metadata,
577
+ retry_policy: @config.rpcs.list_messages.retry_policy
578
+
579
+ options.apply_defaults timeout: @config.timeout,
580
+ metadata: @config.metadata,
581
+ retry_policy: @config.retry_policy
582
+
583
+ @chat_service_stub.call_rpc :list_messages, request, options: options do |response, operation|
584
+ response = ::Gapic::PagedEnumerable.new @chat_service_stub, :list_messages, request, response, operation, options
585
+ yield response, operation if block_given?
586
+ return response
587
+ end
588
+ rescue ::GRPC::BadStatus => e
589
+ raise ::Google::Cloud::Error.from_error(e)
590
+ end
591
+
592
+ ##
593
+ # Lists memberships in a space. For an example, see [List users and Google
594
+ # Chat apps in a
595
+ # space](https://developers.google.com/workspace/chat/list-members). Listing
596
+ # memberships with [app
597
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app)
598
+ # lists memberships in spaces that the Chat app has
599
+ # access to, but excludes Chat app memberships,
600
+ # including its own. Listing memberships with
601
+ # [User
602
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
603
+ # lists memberships in spaces that the authenticated user has access to.
604
+ #
605
+ # Requires
606
+ # [authentication](https://developers.google.com/workspace/chat/authenticate-authorize).
607
+ # Supports
608
+ # [app
609
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app)
610
+ # and [user
611
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
612
+ #
613
+ # @overload list_memberships(request, options = nil)
614
+ # Pass arguments to `list_memberships` via a request object, either of type
615
+ # {::Google::Apps::Chat::V1::ListMembershipsRequest} or an equivalent Hash.
616
+ #
617
+ # @param request [::Google::Apps::Chat::V1::ListMembershipsRequest, ::Hash]
618
+ # A request object representing the call parameters. Required. To specify no
619
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
620
+ # @param options [::Gapic::CallOptions, ::Hash]
621
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
622
+ #
623
+ # @overload list_memberships(parent: nil, page_size: nil, page_token: nil, filter: nil, show_groups: nil, show_invited: nil)
624
+ # Pass arguments to `list_memberships` via keyword arguments. Note that at
625
+ # least one keyword argument is required. To specify no parameters, or to keep all
626
+ # the default parameter values, pass an empty Hash as a request object (see above).
627
+ #
628
+ # @param parent [::String]
629
+ # Required. The resource name of the space for which to fetch a membership
630
+ # list.
631
+ #
632
+ # Format: spaces/\\{space}
633
+ # @param page_size [::Integer]
634
+ # Optional. The maximum number of memberships to return. The service might
635
+ # return fewer than this value.
636
+ #
637
+ # If unspecified, at most 100 memberships are returned.
638
+ #
639
+ # The maximum value is 1000. If you use a value more than 1000, it's
640
+ # automatically changed to 1000.
641
+ #
642
+ # Negative values return an `INVALID_ARGUMENT` error.
643
+ # @param page_token [::String]
644
+ # Optional. A page token, received from a previous call to list memberships.
645
+ # Provide this parameter to retrieve the subsequent page.
646
+ #
647
+ # When paginating, all other parameters provided should match the call that
648
+ # provided the page token. Passing different values to the other parameters
649
+ # might lead to unexpected results.
650
+ # @param filter [::String]
651
+ # Optional. A query filter.
652
+ #
653
+ # You can filter memberships by a member's role
654
+ # ([`role`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.members#membershiprole))
655
+ # and type
656
+ # ([`member.type`](https://developers.google.com/workspace/chat/api/reference/rest/v1/User#type)).
657
+ #
658
+ # To filter by role, set `role` to `ROLE_MEMBER` or `ROLE_MANAGER`.
659
+ #
660
+ # To filter by type, set `member.type` to `HUMAN` or `BOT`.
661
+ #
662
+ # To filter by both role and type, use the `AND` operator. To filter by
663
+ # either role or type, use the `OR` operator.
664
+ #
665
+ # For example, the following queries are valid:
666
+ #
667
+ # ```
668
+ # role = "ROLE_MANAGER" OR role = "ROLE_MEMBER"
669
+ # member.type = "HUMAN" AND role = "ROLE_MANAGER"
670
+ # ```
671
+ #
672
+ # The following queries are invalid:
673
+ #
674
+ # ```
675
+ # member.type = "HUMAN" AND member.type = "BOT"
676
+ # role = "ROLE_MANAGER" AND role = "ROLE_MEMBER"
677
+ # ```
678
+ #
679
+ #
680
+ # Invalid queries are rejected by the server with an `INVALID_ARGUMENT`
681
+ # error.
682
+ # @param show_groups [::Boolean]
683
+ # Optional. When `true`, also returns memberships associated with a
684
+ # {::Google::Apps::Chat::V1::Membership#group_member Google Group}, in
685
+ # addition to other types of memberships. If a
686
+ # {::Google::Apps::Chat::V1::ListMembershipsRequest#filter filter} is set,
687
+ # {::Google::Apps::Chat::V1::Membership#group_member Google Group}
688
+ # memberships that don't match the filter criteria aren't returned.
689
+ # @param show_invited [::Boolean]
690
+ # Optional. When `true`, also returns memberships associated with
691
+ # {::Google::Apps::Chat::V1::Membership::MembershipState::INVITED invited} members, in
692
+ # addition to other types of memberships. If a
693
+ # filter is set,
694
+ # {::Google::Apps::Chat::V1::Membership::MembershipState::INVITED invited} memberships
695
+ # that don't match the filter criteria aren't returned.
696
+ #
697
+ # Currently requires [user
698
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
699
+ #
700
+ # @yield [response, operation] Access the result along with the RPC operation
701
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Apps::Chat::V1::Membership>]
702
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
703
+ #
704
+ # @return [::Gapic::PagedEnumerable<::Google::Apps::Chat::V1::Membership>]
705
+ #
706
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
707
+ #
708
+ # @example Basic example
709
+ # require "google/apps/chat/v1"
710
+ #
711
+ # # Create a client object. The client can be reused for multiple calls.
712
+ # client = Google::Apps::Chat::V1::ChatService::Client.new
713
+ #
714
+ # # Create a request. To set request fields, pass in keyword arguments.
715
+ # request = Google::Apps::Chat::V1::ListMembershipsRequest.new
716
+ #
717
+ # # Call the list_memberships method.
718
+ # result = client.list_memberships request
719
+ #
720
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
721
+ # # over elements, and API calls will be issued to fetch pages as needed.
722
+ # result.each do |item|
723
+ # # Each element is of type ::Google::Apps::Chat::V1::Membership.
724
+ # p item
725
+ # end
726
+ #
727
+ def list_memberships request, options = nil
728
+ raise ::ArgumentError, "request must be provided" if request.nil?
729
+
730
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::ListMembershipsRequest
731
+
732
+ # Converts hash and nil to an options object
733
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
734
+
735
+ # Customize the options with defaults
736
+ metadata = @config.rpcs.list_memberships.metadata.to_h
737
+
738
+ # Set x-goog-api-client and x-goog-user-project headers
739
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
740
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
741
+ gapic_version: ::Google::Apps::Chat::V1::VERSION
742
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
743
+
744
+ header_params = {}
745
+ if request.parent
746
+ header_params["parent"] = request.parent
747
+ end
748
+
749
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
750
+ metadata[:"x-goog-request-params"] ||= request_params_header
751
+
752
+ options.apply_defaults timeout: @config.rpcs.list_memberships.timeout,
753
+ metadata: metadata,
754
+ retry_policy: @config.rpcs.list_memberships.retry_policy
755
+
756
+ options.apply_defaults timeout: @config.timeout,
757
+ metadata: @config.metadata,
758
+ retry_policy: @config.retry_policy
759
+
760
+ @chat_service_stub.call_rpc :list_memberships, request, options: options do |response, operation|
761
+ response = ::Gapic::PagedEnumerable.new @chat_service_stub, :list_memberships, request, response, operation, options
762
+ yield response, operation if block_given?
763
+ return response
764
+ end
765
+ rescue ::GRPC::BadStatus => e
766
+ raise ::Google::Cloud::Error.from_error(e)
767
+ end
768
+
769
+ ##
770
+ # Returns details about a membership. For an example, see
771
+ # [Get details about a user's or Google Chat app's
772
+ # membership](https://developers.google.com/workspace/chat/get-members).
773
+ #
774
+ # Requires
775
+ # [authentication](https://developers.google.com/workspace/chat/authenticate-authorize).
776
+ # Supports
777
+ # [app
778
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app)
779
+ # and [user
780
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
781
+ #
782
+ # @overload get_membership(request, options = nil)
783
+ # Pass arguments to `get_membership` via a request object, either of type
784
+ # {::Google::Apps::Chat::V1::GetMembershipRequest} or an equivalent Hash.
785
+ #
786
+ # @param request [::Google::Apps::Chat::V1::GetMembershipRequest, ::Hash]
787
+ # A request object representing the call parameters. Required. To specify no
788
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
789
+ # @param options [::Gapic::CallOptions, ::Hash]
790
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
791
+ #
792
+ # @overload get_membership(name: nil)
793
+ # Pass arguments to `get_membership` via keyword arguments. Note that at
794
+ # least one keyword argument is required. To specify no parameters, or to keep all
795
+ # the default parameter values, pass an empty Hash as a request object (see above).
796
+ #
797
+ # @param name [::String]
798
+ # Required. Resource name of the membership to retrieve.
799
+ #
800
+ # To get the app's own membership [by using user
801
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user),
802
+ # you can optionally use `spaces/{space}/members/app`.
803
+ #
804
+ # Format: `spaces/{space}/members/{member}` or `spaces/{space}/members/app`
805
+ #
806
+ # When [authenticated as a
807
+ # user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user),
808
+ # you can use the user's email as an alias for `{member}`. For example,
809
+ # `spaces/{space}/members/example@gmail.com` where `example@gmail.com` is the
810
+ # email of the Google Chat user.
811
+ #
812
+ # @yield [response, operation] Access the result along with the RPC operation
813
+ # @yieldparam response [::Google::Apps::Chat::V1::Membership]
814
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
815
+ #
816
+ # @return [::Google::Apps::Chat::V1::Membership]
817
+ #
818
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
819
+ #
820
+ # @example Basic example
821
+ # require "google/apps/chat/v1"
822
+ #
823
+ # # Create a client object. The client can be reused for multiple calls.
824
+ # client = Google::Apps::Chat::V1::ChatService::Client.new
825
+ #
826
+ # # Create a request. To set request fields, pass in keyword arguments.
827
+ # request = Google::Apps::Chat::V1::GetMembershipRequest.new
828
+ #
829
+ # # Call the get_membership method.
830
+ # result = client.get_membership request
831
+ #
832
+ # # The returned object is of type Google::Apps::Chat::V1::Membership.
833
+ # p result
834
+ #
835
+ def get_membership request, options = nil
836
+ raise ::ArgumentError, "request must be provided" if request.nil?
837
+
838
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::GetMembershipRequest
839
+
840
+ # Converts hash and nil to an options object
841
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
842
+
843
+ # Customize the options with defaults
844
+ metadata = @config.rpcs.get_membership.metadata.to_h
845
+
846
+ # Set x-goog-api-client and x-goog-user-project headers
847
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
848
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
849
+ gapic_version: ::Google::Apps::Chat::V1::VERSION
850
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
851
+
852
+ header_params = {}
853
+ if request.name
854
+ header_params["name"] = request.name
855
+ end
856
+
857
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
858
+ metadata[:"x-goog-request-params"] ||= request_params_header
859
+
860
+ options.apply_defaults timeout: @config.rpcs.get_membership.timeout,
861
+ metadata: metadata,
862
+ retry_policy: @config.rpcs.get_membership.retry_policy
863
+
864
+ options.apply_defaults timeout: @config.timeout,
865
+ metadata: @config.metadata,
866
+ retry_policy: @config.retry_policy
867
+
868
+ @chat_service_stub.call_rpc :get_membership, request, options: options do |response, operation|
869
+ yield response, operation if block_given?
870
+ return response
871
+ end
872
+ rescue ::GRPC::BadStatus => e
873
+ raise ::Google::Cloud::Error.from_error(e)
874
+ end
875
+
876
+ ##
877
+ # Returns details about a message.
878
+ # For an example, see [Get details about a
879
+ # message](https://developers.google.com/workspace/chat/get-messages).
880
+ #
881
+ # Requires
882
+ # [authentication](https://developers.google.com/workspace/chat/authenticate-authorize).
883
+ # Supports
884
+ # [app
885
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app)
886
+ # and [user
887
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
888
+ #
889
+ # Note: Might return a message from a blocked member or space.
890
+ #
891
+ # @overload get_message(request, options = nil)
892
+ # Pass arguments to `get_message` via a request object, either of type
893
+ # {::Google::Apps::Chat::V1::GetMessageRequest} or an equivalent Hash.
894
+ #
895
+ # @param request [::Google::Apps::Chat::V1::GetMessageRequest, ::Hash]
896
+ # A request object representing the call parameters. Required. To specify no
897
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
898
+ # @param options [::Gapic::CallOptions, ::Hash]
899
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
900
+ #
901
+ # @overload get_message(name: nil)
902
+ # Pass arguments to `get_message` via keyword arguments. Note that at
903
+ # least one keyword argument is required. To specify no parameters, or to keep all
904
+ # the default parameter values, pass an empty Hash as a request object (see above).
905
+ #
906
+ # @param name [::String]
907
+ # Required. Resource name of the message.
908
+ #
909
+ # Format: `spaces/{space}/messages/{message}`
910
+ #
911
+ # If you've set a custom ID for your message, you can use the value from the
912
+ # `clientAssignedMessageId` field for `{message}`. For details, see [Name a
913
+ # message]
914
+ # (https://developers.google.com/workspace/chat/create-messages#name_a_created_message).
915
+ #
916
+ # @yield [response, operation] Access the result along with the RPC operation
917
+ # @yieldparam response [::Google::Apps::Chat::V1::Message]
918
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
919
+ #
920
+ # @return [::Google::Apps::Chat::V1::Message]
921
+ #
922
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
923
+ #
924
+ # @example Basic example
925
+ # require "google/apps/chat/v1"
926
+ #
927
+ # # Create a client object. The client can be reused for multiple calls.
928
+ # client = Google::Apps::Chat::V1::ChatService::Client.new
929
+ #
930
+ # # Create a request. To set request fields, pass in keyword arguments.
931
+ # request = Google::Apps::Chat::V1::GetMessageRequest.new
932
+ #
933
+ # # Call the get_message method.
934
+ # result = client.get_message request
935
+ #
936
+ # # The returned object is of type Google::Apps::Chat::V1::Message.
937
+ # p result
938
+ #
939
+ def get_message request, options = nil
940
+ raise ::ArgumentError, "request must be provided" if request.nil?
941
+
942
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::GetMessageRequest
943
+
944
+ # Converts hash and nil to an options object
945
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
946
+
947
+ # Customize the options with defaults
948
+ metadata = @config.rpcs.get_message.metadata.to_h
949
+
950
+ # Set x-goog-api-client and x-goog-user-project headers
951
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
952
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
953
+ gapic_version: ::Google::Apps::Chat::V1::VERSION
954
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
955
+
956
+ header_params = {}
957
+ if request.name
958
+ header_params["name"] = request.name
959
+ end
960
+
961
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
962
+ metadata[:"x-goog-request-params"] ||= request_params_header
963
+
964
+ options.apply_defaults timeout: @config.rpcs.get_message.timeout,
965
+ metadata: metadata,
966
+ retry_policy: @config.rpcs.get_message.retry_policy
967
+
968
+ options.apply_defaults timeout: @config.timeout,
969
+ metadata: @config.metadata,
970
+ retry_policy: @config.retry_policy
971
+
972
+ @chat_service_stub.call_rpc :get_message, request, options: options do |response, operation|
973
+ yield response, operation if block_given?
974
+ return response
975
+ end
976
+ rescue ::GRPC::BadStatus => e
977
+ raise ::Google::Cloud::Error.from_error(e)
978
+ end
979
+
980
+ ##
981
+ # Updates a message. There's a difference between the `patch` and `update`
982
+ # methods. The `patch`
983
+ # method uses a `patch` request while the `update` method uses a `put`
984
+ # request. We recommend using the `patch` method. For an example, see
985
+ # [Update a
986
+ # message](https://developers.google.com/workspace/chat/update-messages).
987
+ #
988
+ # Requires
989
+ # [authentication](https://developers.google.com/workspace/chat/authenticate-authorize).
990
+ # Supports
991
+ # [app
992
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app)
993
+ # and [user
994
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
995
+ # When using app authentication, requests can only update messages
996
+ # created by the calling Chat app.
997
+ #
998
+ # @overload update_message(request, options = nil)
999
+ # Pass arguments to `update_message` via a request object, either of type
1000
+ # {::Google::Apps::Chat::V1::UpdateMessageRequest} or an equivalent Hash.
1001
+ #
1002
+ # @param request [::Google::Apps::Chat::V1::UpdateMessageRequest, ::Hash]
1003
+ # A request object representing the call parameters. Required. To specify no
1004
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1005
+ # @param options [::Gapic::CallOptions, ::Hash]
1006
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1007
+ #
1008
+ # @overload update_message(message: nil, update_mask: nil, allow_missing: nil)
1009
+ # Pass arguments to `update_message` via keyword arguments. Note that at
1010
+ # least one keyword argument is required. To specify no parameters, or to keep all
1011
+ # the default parameter values, pass an empty Hash as a request object (see above).
1012
+ #
1013
+ # @param message [::Google::Apps::Chat::V1::Message, ::Hash]
1014
+ # Required. Message with fields updated.
1015
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
1016
+ # Required. The field paths to update. Separate multiple values with commas
1017
+ # or use `*` to update all field paths.
1018
+ #
1019
+ # Currently supported field paths:
1020
+ #
1021
+ # - `text`
1022
+ #
1023
+ # - `attachment`
1024
+ #
1025
+ # - `cards` (Requires [app
1026
+ # authentication](/chat/api/guides/auth/service-accounts).)
1027
+ #
1028
+ # - `cards_v2` (Requires [app
1029
+ # authentication](/chat/api/guides/auth/service-accounts).)
1030
+ #
1031
+ # - `accessory_widgets` (Requires [app
1032
+ # authentication](/chat/api/guides/auth/service-accounts).)
1033
+ # @param allow_missing [::Boolean]
1034
+ # Optional. If `true` and the message isn't found, a new message is created
1035
+ # and `updateMask` is ignored. The specified message ID must be
1036
+ # [client-assigned](https://developers.google.com/workspace/chat/create-messages#name_a_created_message)
1037
+ # or the request fails.
1038
+ #
1039
+ # @yield [response, operation] Access the result along with the RPC operation
1040
+ # @yieldparam response [::Google::Apps::Chat::V1::Message]
1041
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1042
+ #
1043
+ # @return [::Google::Apps::Chat::V1::Message]
1044
+ #
1045
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1046
+ #
1047
+ # @example Basic example
1048
+ # require "google/apps/chat/v1"
1049
+ #
1050
+ # # Create a client object. The client can be reused for multiple calls.
1051
+ # client = Google::Apps::Chat::V1::ChatService::Client.new
1052
+ #
1053
+ # # Create a request. To set request fields, pass in keyword arguments.
1054
+ # request = Google::Apps::Chat::V1::UpdateMessageRequest.new
1055
+ #
1056
+ # # Call the update_message method.
1057
+ # result = client.update_message request
1058
+ #
1059
+ # # The returned object is of type Google::Apps::Chat::V1::Message.
1060
+ # p result
1061
+ #
1062
+ def update_message request, options = nil
1063
+ raise ::ArgumentError, "request must be provided" if request.nil?
1064
+
1065
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::UpdateMessageRequest
1066
+
1067
+ # Converts hash and nil to an options object
1068
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1069
+
1070
+ # Customize the options with defaults
1071
+ metadata = @config.rpcs.update_message.metadata.to_h
1072
+
1073
+ # Set x-goog-api-client and x-goog-user-project headers
1074
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1075
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1076
+ gapic_version: ::Google::Apps::Chat::V1::VERSION
1077
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1078
+
1079
+ header_params = {}
1080
+ if request.message&.name
1081
+ header_params["message.name"] = request.message.name
1082
+ end
1083
+
1084
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1085
+ metadata[:"x-goog-request-params"] ||= request_params_header
1086
+
1087
+ options.apply_defaults timeout: @config.rpcs.update_message.timeout,
1088
+ metadata: metadata,
1089
+ retry_policy: @config.rpcs.update_message.retry_policy
1090
+
1091
+ options.apply_defaults timeout: @config.timeout,
1092
+ metadata: @config.metadata,
1093
+ retry_policy: @config.retry_policy
1094
+
1095
+ @chat_service_stub.call_rpc :update_message, request, options: options do |response, operation|
1096
+ yield response, operation if block_given?
1097
+ return response
1098
+ end
1099
+ rescue ::GRPC::BadStatus => e
1100
+ raise ::Google::Cloud::Error.from_error(e)
1101
+ end
1102
+
1103
+ ##
1104
+ # Deletes a message.
1105
+ # For an example, see [Delete a
1106
+ # message](https://developers.google.com/workspace/chat/delete-messages).
1107
+ #
1108
+ # Requires
1109
+ # [authentication](https://developers.google.com/workspace/chat/authenticate-authorize).
1110
+ # Supports
1111
+ # [app
1112
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app)
1113
+ # and [user
1114
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
1115
+ # When using app authentication, requests can only delete messages
1116
+ # created by the calling Chat app.
1117
+ #
1118
+ # @overload delete_message(request, options = nil)
1119
+ # Pass arguments to `delete_message` via a request object, either of type
1120
+ # {::Google::Apps::Chat::V1::DeleteMessageRequest} or an equivalent Hash.
1121
+ #
1122
+ # @param request [::Google::Apps::Chat::V1::DeleteMessageRequest, ::Hash]
1123
+ # A request object representing the call parameters. Required. To specify no
1124
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1125
+ # @param options [::Gapic::CallOptions, ::Hash]
1126
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1127
+ #
1128
+ # @overload delete_message(name: nil, force: nil)
1129
+ # Pass arguments to `delete_message` via keyword arguments. Note that at
1130
+ # least one keyword argument is required. To specify no parameters, or to keep all
1131
+ # the default parameter values, pass an empty Hash as a request object (see above).
1132
+ #
1133
+ # @param name [::String]
1134
+ # Required. Resource name of the message.
1135
+ #
1136
+ # Format: `spaces/{space}/messages/{message}`
1137
+ #
1138
+ # If you've set a custom ID for your message, you can use the value from the
1139
+ # `clientAssignedMessageId` field for `{message}`. For details, see [Name a
1140
+ # message]
1141
+ # (https://developers.google.com/workspace/chat/create-messages#name_a_created_message).
1142
+ # @param force [::Boolean]
1143
+ # When `true`, deleting a message also deletes its threaded replies. When
1144
+ # `false`, if a message has threaded replies, deletion fails.
1145
+ #
1146
+ # Only applies when [authenticating as a
1147
+ # user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
1148
+ # Has no effect when [authenticating as a Chat app]
1149
+ # (https://developers.google.com/workspace/chat/authenticate-authorize-chat-app).
1150
+ #
1151
+ # @yield [response, operation] Access the result along with the RPC operation
1152
+ # @yieldparam response [::Google::Protobuf::Empty]
1153
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1154
+ #
1155
+ # @return [::Google::Protobuf::Empty]
1156
+ #
1157
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1158
+ #
1159
+ # @example Basic example
1160
+ # require "google/apps/chat/v1"
1161
+ #
1162
+ # # Create a client object. The client can be reused for multiple calls.
1163
+ # client = Google::Apps::Chat::V1::ChatService::Client.new
1164
+ #
1165
+ # # Create a request. To set request fields, pass in keyword arguments.
1166
+ # request = Google::Apps::Chat::V1::DeleteMessageRequest.new
1167
+ #
1168
+ # # Call the delete_message method.
1169
+ # result = client.delete_message request
1170
+ #
1171
+ # # The returned object is of type Google::Protobuf::Empty.
1172
+ # p result
1173
+ #
1174
+ def delete_message request, options = nil
1175
+ raise ::ArgumentError, "request must be provided" if request.nil?
1176
+
1177
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::DeleteMessageRequest
1178
+
1179
+ # Converts hash and nil to an options object
1180
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1181
+
1182
+ # Customize the options with defaults
1183
+ metadata = @config.rpcs.delete_message.metadata.to_h
1184
+
1185
+ # Set x-goog-api-client and x-goog-user-project headers
1186
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1187
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1188
+ gapic_version: ::Google::Apps::Chat::V1::VERSION
1189
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1190
+
1191
+ header_params = {}
1192
+ if request.name
1193
+ header_params["name"] = request.name
1194
+ end
1195
+
1196
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1197
+ metadata[:"x-goog-request-params"] ||= request_params_header
1198
+
1199
+ options.apply_defaults timeout: @config.rpcs.delete_message.timeout,
1200
+ metadata: metadata,
1201
+ retry_policy: @config.rpcs.delete_message.retry_policy
1202
+
1203
+ options.apply_defaults timeout: @config.timeout,
1204
+ metadata: @config.metadata,
1205
+ retry_policy: @config.retry_policy
1206
+
1207
+ @chat_service_stub.call_rpc :delete_message, request, options: options do |response, operation|
1208
+ yield response, operation if block_given?
1209
+ return response
1210
+ end
1211
+ rescue ::GRPC::BadStatus => e
1212
+ raise ::Google::Cloud::Error.from_error(e)
1213
+ end
1214
+
1215
+ ##
1216
+ # Gets the metadata of a message attachment. The attachment data is fetched
1217
+ # using the [media
1218
+ # API](https://developers.google.com/workspace/chat/api/reference/rest/v1/media/download).
1219
+ # For an example, see
1220
+ # [Get metadata about a message
1221
+ # attachment](https://developers.google.com/workspace/chat/get-media-attachments).
1222
+ # Requires [app
1223
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app).
1224
+ #
1225
+ # @overload get_attachment(request, options = nil)
1226
+ # Pass arguments to `get_attachment` via a request object, either of type
1227
+ # {::Google::Apps::Chat::V1::GetAttachmentRequest} or an equivalent Hash.
1228
+ #
1229
+ # @param request [::Google::Apps::Chat::V1::GetAttachmentRequest, ::Hash]
1230
+ # A request object representing the call parameters. Required. To specify no
1231
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1232
+ # @param options [::Gapic::CallOptions, ::Hash]
1233
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1234
+ #
1235
+ # @overload get_attachment(name: nil)
1236
+ # Pass arguments to `get_attachment` via keyword arguments. Note that at
1237
+ # least one keyword argument is required. To specify no parameters, or to keep all
1238
+ # the default parameter values, pass an empty Hash as a request object (see above).
1239
+ #
1240
+ # @param name [::String]
1241
+ # Required. Resource name of the attachment, in the form
1242
+ # `spaces/*/messages/*/attachments/*`.
1243
+ #
1244
+ # @yield [response, operation] Access the result along with the RPC operation
1245
+ # @yieldparam response [::Google::Apps::Chat::V1::Attachment]
1246
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1247
+ #
1248
+ # @return [::Google::Apps::Chat::V1::Attachment]
1249
+ #
1250
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1251
+ #
1252
+ # @example Basic example
1253
+ # require "google/apps/chat/v1"
1254
+ #
1255
+ # # Create a client object. The client can be reused for multiple calls.
1256
+ # client = Google::Apps::Chat::V1::ChatService::Client.new
1257
+ #
1258
+ # # Create a request. To set request fields, pass in keyword arguments.
1259
+ # request = Google::Apps::Chat::V1::GetAttachmentRequest.new
1260
+ #
1261
+ # # Call the get_attachment method.
1262
+ # result = client.get_attachment request
1263
+ #
1264
+ # # The returned object is of type Google::Apps::Chat::V1::Attachment.
1265
+ # p result
1266
+ #
1267
+ def get_attachment request, options = nil
1268
+ raise ::ArgumentError, "request must be provided" if request.nil?
1269
+
1270
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::GetAttachmentRequest
1271
+
1272
+ # Converts hash and nil to an options object
1273
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1274
+
1275
+ # Customize the options with defaults
1276
+ metadata = @config.rpcs.get_attachment.metadata.to_h
1277
+
1278
+ # Set x-goog-api-client and x-goog-user-project headers
1279
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1280
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1281
+ gapic_version: ::Google::Apps::Chat::V1::VERSION
1282
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1283
+
1284
+ header_params = {}
1285
+ if request.name
1286
+ header_params["name"] = request.name
1287
+ end
1288
+
1289
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1290
+ metadata[:"x-goog-request-params"] ||= request_params_header
1291
+
1292
+ options.apply_defaults timeout: @config.rpcs.get_attachment.timeout,
1293
+ metadata: metadata,
1294
+ retry_policy: @config.rpcs.get_attachment.retry_policy
1295
+
1296
+ options.apply_defaults timeout: @config.timeout,
1297
+ metadata: @config.metadata,
1298
+ retry_policy: @config.retry_policy
1299
+
1300
+ @chat_service_stub.call_rpc :get_attachment, request, options: options do |response, operation|
1301
+ yield response, operation if block_given?
1302
+ return response
1303
+ end
1304
+ rescue ::GRPC::BadStatus => e
1305
+ raise ::Google::Cloud::Error.from_error(e)
1306
+ end
1307
+
1308
+ ##
1309
+ # Uploads an attachment. For an example, see
1310
+ # [Upload media as a file
1311
+ # attachment](https://developers.google.com/workspace/chat/upload-media-attachments).
1312
+ # Requires user
1313
+ # [authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
1314
+ #
1315
+ # You can upload attachments up to 200 MB. Certain file types aren't
1316
+ # supported. For details, see [File types blocked by Google
1317
+ # Chat](https://support.google.com/chat/answer/7651457?&co=GENIE.Platform%3DDesktop#File%20types%20blocked%20in%20Google%20Chat).
1318
+ #
1319
+ # @overload upload_attachment(request, options = nil)
1320
+ # Pass arguments to `upload_attachment` via a request object, either of type
1321
+ # {::Google::Apps::Chat::V1::UploadAttachmentRequest} or an equivalent Hash.
1322
+ #
1323
+ # @param request [::Google::Apps::Chat::V1::UploadAttachmentRequest, ::Hash]
1324
+ # A request object representing the call parameters. Required. To specify no
1325
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1326
+ # @param options [::Gapic::CallOptions, ::Hash]
1327
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1328
+ #
1329
+ # @overload upload_attachment(parent: nil, filename: nil)
1330
+ # Pass arguments to `upload_attachment` via keyword arguments. Note that at
1331
+ # least one keyword argument is required. To specify no parameters, or to keep all
1332
+ # the default parameter values, pass an empty Hash as a request object (see above).
1333
+ #
1334
+ # @param parent [::String]
1335
+ # Required. Resource name of the Chat space in which the attachment is
1336
+ # uploaded. Format "spaces/\\{space}".
1337
+ # @param filename [::String]
1338
+ # Required. The filename of the attachment, including the file extension.
1339
+ #
1340
+ # @yield [response, operation] Access the result along with the RPC operation
1341
+ # @yieldparam response [::Google::Apps::Chat::V1::UploadAttachmentResponse]
1342
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1343
+ #
1344
+ # @return [::Google::Apps::Chat::V1::UploadAttachmentResponse]
1345
+ #
1346
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1347
+ #
1348
+ # @example Basic example
1349
+ # require "google/apps/chat/v1"
1350
+ #
1351
+ # # Create a client object. The client can be reused for multiple calls.
1352
+ # client = Google::Apps::Chat::V1::ChatService::Client.new
1353
+ #
1354
+ # # Create a request. To set request fields, pass in keyword arguments.
1355
+ # request = Google::Apps::Chat::V1::UploadAttachmentRequest.new
1356
+ #
1357
+ # # Call the upload_attachment method.
1358
+ # result = client.upload_attachment request
1359
+ #
1360
+ # # The returned object is of type Google::Apps::Chat::V1::UploadAttachmentResponse.
1361
+ # p result
1362
+ #
1363
+ def upload_attachment request, options = nil
1364
+ raise ::ArgumentError, "request must be provided" if request.nil?
1365
+
1366
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::UploadAttachmentRequest
1367
+
1368
+ # Converts hash and nil to an options object
1369
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1370
+
1371
+ # Customize the options with defaults
1372
+ metadata = @config.rpcs.upload_attachment.metadata.to_h
1373
+
1374
+ # Set x-goog-api-client and x-goog-user-project headers
1375
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1376
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1377
+ gapic_version: ::Google::Apps::Chat::V1::VERSION
1378
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1379
+
1380
+ header_params = {}
1381
+ if request.parent
1382
+ header_params["parent"] = request.parent
1383
+ end
1384
+
1385
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1386
+ metadata[:"x-goog-request-params"] ||= request_params_header
1387
+
1388
+ options.apply_defaults timeout: @config.rpcs.upload_attachment.timeout,
1389
+ metadata: metadata,
1390
+ retry_policy: @config.rpcs.upload_attachment.retry_policy
1391
+
1392
+ options.apply_defaults timeout: @config.timeout,
1393
+ metadata: @config.metadata,
1394
+ retry_policy: @config.retry_policy
1395
+
1396
+ @chat_service_stub.call_rpc :upload_attachment, request, options: options do |response, operation|
1397
+ yield response, operation if block_given?
1398
+ return response
1399
+ end
1400
+ rescue ::GRPC::BadStatus => e
1401
+ raise ::Google::Cloud::Error.from_error(e)
1402
+ end
1403
+
1404
+ ##
1405
+ # Lists spaces the caller is a member of. Group chats and DMs aren't listed
1406
+ # until the first message is sent. For an example, see
1407
+ # [List
1408
+ # spaces](https://developers.google.com/workspace/chat/list-spaces).
1409
+ #
1410
+ # Requires
1411
+ # [authentication](https://developers.google.com/workspace/chat/authenticate-authorize).
1412
+ # Supports
1413
+ # [app
1414
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app)
1415
+ # and [user
1416
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
1417
+ #
1418
+ # Lists spaces visible to the caller or authenticated user. Group chats
1419
+ # and DMs aren't listed until the first message is sent.
1420
+ #
1421
+ # @overload list_spaces(request, options = nil)
1422
+ # Pass arguments to `list_spaces` via a request object, either of type
1423
+ # {::Google::Apps::Chat::V1::ListSpacesRequest} or an equivalent Hash.
1424
+ #
1425
+ # @param request [::Google::Apps::Chat::V1::ListSpacesRequest, ::Hash]
1426
+ # A request object representing the call parameters. Required. To specify no
1427
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1428
+ # @param options [::Gapic::CallOptions, ::Hash]
1429
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1430
+ #
1431
+ # @overload list_spaces(page_size: nil, page_token: nil, filter: nil)
1432
+ # Pass arguments to `list_spaces` via keyword arguments. Note that at
1433
+ # least one keyword argument is required. To specify no parameters, or to keep all
1434
+ # the default parameter values, pass an empty Hash as a request object (see above).
1435
+ #
1436
+ # @param page_size [::Integer]
1437
+ # Optional. The maximum number of spaces to return. The service might return
1438
+ # fewer than this value.
1439
+ #
1440
+ # If unspecified, at most 100 spaces are returned.
1441
+ #
1442
+ # The maximum value is 1000. If you use a value more than 1000, it's
1443
+ # automatically changed to 1000.
1444
+ #
1445
+ # Negative values return an `INVALID_ARGUMENT` error.
1446
+ # @param page_token [::String]
1447
+ # Optional. A page token, received from a previous list spaces call.
1448
+ # Provide this parameter to retrieve the subsequent page.
1449
+ #
1450
+ # When paginating, the filter value should match the call that provided the
1451
+ # page token. Passing a different value may lead to unexpected results.
1452
+ # @param filter [::String]
1453
+ # Optional. A query filter.
1454
+ #
1455
+ # You can filter spaces by the space type
1456
+ # ([`space_type`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces#spacetype)).
1457
+ #
1458
+ # To filter by space type, you must specify valid enum value, such as
1459
+ # `SPACE` or `GROUP_CHAT` (the `space_type` can't be
1460
+ # `SPACE_TYPE_UNSPECIFIED`). To query for multiple space types, use the `OR`
1461
+ # operator.
1462
+ #
1463
+ # For example, the following queries are valid:
1464
+ #
1465
+ # ```
1466
+ # space_type = "SPACE"
1467
+ # spaceType = "GROUP_CHAT" OR spaceType = "DIRECT_MESSAGE"
1468
+ # ```
1469
+ #
1470
+ # Invalid queries are rejected by the server with an `INVALID_ARGUMENT`
1471
+ # error.
1472
+ #
1473
+ # @yield [response, operation] Access the result along with the RPC operation
1474
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Apps::Chat::V1::Space>]
1475
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1476
+ #
1477
+ # @return [::Gapic::PagedEnumerable<::Google::Apps::Chat::V1::Space>]
1478
+ #
1479
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1480
+ #
1481
+ # @example Basic example
1482
+ # require "google/apps/chat/v1"
1483
+ #
1484
+ # # Create a client object. The client can be reused for multiple calls.
1485
+ # client = Google::Apps::Chat::V1::ChatService::Client.new
1486
+ #
1487
+ # # Create a request. To set request fields, pass in keyword arguments.
1488
+ # request = Google::Apps::Chat::V1::ListSpacesRequest.new
1489
+ #
1490
+ # # Call the list_spaces method.
1491
+ # result = client.list_spaces request
1492
+ #
1493
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
1494
+ # # over elements, and API calls will be issued to fetch pages as needed.
1495
+ # result.each do |item|
1496
+ # # Each element is of type ::Google::Apps::Chat::V1::Space.
1497
+ # p item
1498
+ # end
1499
+ #
1500
+ def list_spaces request, options = nil
1501
+ raise ::ArgumentError, "request must be provided" if request.nil?
1502
+
1503
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::ListSpacesRequest
1504
+
1505
+ # Converts hash and nil to an options object
1506
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1507
+
1508
+ # Customize the options with defaults
1509
+ metadata = @config.rpcs.list_spaces.metadata.to_h
1510
+
1511
+ # Set x-goog-api-client and x-goog-user-project headers
1512
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1513
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1514
+ gapic_version: ::Google::Apps::Chat::V1::VERSION
1515
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1516
+
1517
+ options.apply_defaults timeout: @config.rpcs.list_spaces.timeout,
1518
+ metadata: metadata,
1519
+ retry_policy: @config.rpcs.list_spaces.retry_policy
1520
+
1521
+ options.apply_defaults timeout: @config.timeout,
1522
+ metadata: @config.metadata,
1523
+ retry_policy: @config.retry_policy
1524
+
1525
+ @chat_service_stub.call_rpc :list_spaces, request, options: options do |response, operation|
1526
+ response = ::Gapic::PagedEnumerable.new @chat_service_stub, :list_spaces, request, response, operation, options
1527
+ yield response, operation if block_given?
1528
+ return response
1529
+ end
1530
+ rescue ::GRPC::BadStatus => e
1531
+ raise ::Google::Cloud::Error.from_error(e)
1532
+ end
1533
+
1534
+ ##
1535
+ # Returns details about a space. For an example, see
1536
+ # [Get details about a
1537
+ # space](https://developers.google.com/workspace/chat/get-spaces).
1538
+ #
1539
+ # Requires
1540
+ # [authentication](https://developers.google.com/workspace/chat/authenticate-authorize).
1541
+ # Supports
1542
+ # [app
1543
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app)
1544
+ # and [user
1545
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
1546
+ #
1547
+ # @overload get_space(request, options = nil)
1548
+ # Pass arguments to `get_space` via a request object, either of type
1549
+ # {::Google::Apps::Chat::V1::GetSpaceRequest} or an equivalent Hash.
1550
+ #
1551
+ # @param request [::Google::Apps::Chat::V1::GetSpaceRequest, ::Hash]
1552
+ # A request object representing the call parameters. Required. To specify no
1553
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1554
+ # @param options [::Gapic::CallOptions, ::Hash]
1555
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1556
+ #
1557
+ # @overload get_space(name: nil)
1558
+ # Pass arguments to `get_space` via keyword arguments. Note that at
1559
+ # least one keyword argument is required. To specify no parameters, or to keep all
1560
+ # the default parameter values, pass an empty Hash as a request object (see above).
1561
+ #
1562
+ # @param name [::String]
1563
+ # Required. Resource name of the space, in the form "spaces/*".
1564
+ #
1565
+ # Format: `spaces/{space}`
1566
+ #
1567
+ # @yield [response, operation] Access the result along with the RPC operation
1568
+ # @yieldparam response [::Google::Apps::Chat::V1::Space]
1569
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1570
+ #
1571
+ # @return [::Google::Apps::Chat::V1::Space]
1572
+ #
1573
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1574
+ #
1575
+ # @example Basic example
1576
+ # require "google/apps/chat/v1"
1577
+ #
1578
+ # # Create a client object. The client can be reused for multiple calls.
1579
+ # client = Google::Apps::Chat::V1::ChatService::Client.new
1580
+ #
1581
+ # # Create a request. To set request fields, pass in keyword arguments.
1582
+ # request = Google::Apps::Chat::V1::GetSpaceRequest.new
1583
+ #
1584
+ # # Call the get_space method.
1585
+ # result = client.get_space request
1586
+ #
1587
+ # # The returned object is of type Google::Apps::Chat::V1::Space.
1588
+ # p result
1589
+ #
1590
+ def get_space request, options = nil
1591
+ raise ::ArgumentError, "request must be provided" if request.nil?
1592
+
1593
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::GetSpaceRequest
1594
+
1595
+ # Converts hash and nil to an options object
1596
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1597
+
1598
+ # Customize the options with defaults
1599
+ metadata = @config.rpcs.get_space.metadata.to_h
1600
+
1601
+ # Set x-goog-api-client and x-goog-user-project headers
1602
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1603
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1604
+ gapic_version: ::Google::Apps::Chat::V1::VERSION
1605
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1606
+
1607
+ header_params = {}
1608
+ if request.name
1609
+ header_params["name"] = request.name
1610
+ end
1611
+
1612
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1613
+ metadata[:"x-goog-request-params"] ||= request_params_header
1614
+
1615
+ options.apply_defaults timeout: @config.rpcs.get_space.timeout,
1616
+ metadata: metadata,
1617
+ retry_policy: @config.rpcs.get_space.retry_policy
1618
+
1619
+ options.apply_defaults timeout: @config.timeout,
1620
+ metadata: @config.metadata,
1621
+ retry_policy: @config.retry_policy
1622
+
1623
+ @chat_service_stub.call_rpc :get_space, request, options: options do |response, operation|
1624
+ yield response, operation if block_given?
1625
+ return response
1626
+ end
1627
+ rescue ::GRPC::BadStatus => e
1628
+ raise ::Google::Cloud::Error.from_error(e)
1629
+ end
1630
+
1631
+ ##
1632
+ # Creates a named space. Spaces grouped by topics aren't supported. For an
1633
+ # example, see [Create a
1634
+ # space](https://developers.google.com/workspace/chat/create-spaces).
1635
+ #
1636
+ # If you receive the error message `ALREADY_EXISTS` when creating
1637
+ # a space, try a different `displayName`. An existing space within
1638
+ # the Google Workspace organization might already use this display name.
1639
+ #
1640
+ # Requires [user
1641
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
1642
+ #
1643
+ # @overload create_space(request, options = nil)
1644
+ # Pass arguments to `create_space` via a request object, either of type
1645
+ # {::Google::Apps::Chat::V1::CreateSpaceRequest} or an equivalent Hash.
1646
+ #
1647
+ # @param request [::Google::Apps::Chat::V1::CreateSpaceRequest, ::Hash]
1648
+ # A request object representing the call parameters. Required. To specify no
1649
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1650
+ # @param options [::Gapic::CallOptions, ::Hash]
1651
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1652
+ #
1653
+ # @overload create_space(space: nil, request_id: nil)
1654
+ # Pass arguments to `create_space` via keyword arguments. Note that at
1655
+ # least one keyword argument is required. To specify no parameters, or to keep all
1656
+ # the default parameter values, pass an empty Hash as a request object (see above).
1657
+ #
1658
+ # @param space [::Google::Apps::Chat::V1::Space, ::Hash]
1659
+ # Required. The `displayName` and `spaceType` fields must be populated. Only
1660
+ # `SpaceType.SPACE` is supported.
1661
+ #
1662
+ # If you receive the error message `ALREADY_EXISTS` when creating a space,
1663
+ # try a different `displayName`. An existing space within the Google
1664
+ # Workspace organization might already use this display name.
1665
+ #
1666
+ # The space `name` is assigned on the server so anything specified in this
1667
+ # field will be ignored.
1668
+ # @param request_id [::String]
1669
+ # Optional. A unique identifier for this request.
1670
+ # A random UUID is recommended.
1671
+ # Specifying an existing request ID returns the space created with that ID
1672
+ # instead of creating a new space.
1673
+ # Specifying an existing request ID from the same Chat app with a different
1674
+ # authenticated user returns an error.
1675
+ #
1676
+ # @yield [response, operation] Access the result along with the RPC operation
1677
+ # @yieldparam response [::Google::Apps::Chat::V1::Space]
1678
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1679
+ #
1680
+ # @return [::Google::Apps::Chat::V1::Space]
1681
+ #
1682
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1683
+ #
1684
+ # @example Basic example
1685
+ # require "google/apps/chat/v1"
1686
+ #
1687
+ # # Create a client object. The client can be reused for multiple calls.
1688
+ # client = Google::Apps::Chat::V1::ChatService::Client.new
1689
+ #
1690
+ # # Create a request. To set request fields, pass in keyword arguments.
1691
+ # request = Google::Apps::Chat::V1::CreateSpaceRequest.new
1692
+ #
1693
+ # # Call the create_space method.
1694
+ # result = client.create_space request
1695
+ #
1696
+ # # The returned object is of type Google::Apps::Chat::V1::Space.
1697
+ # p result
1698
+ #
1699
+ def create_space request, options = nil
1700
+ raise ::ArgumentError, "request must be provided" if request.nil?
1701
+
1702
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::CreateSpaceRequest
1703
+
1704
+ # Converts hash and nil to an options object
1705
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1706
+
1707
+ # Customize the options with defaults
1708
+ metadata = @config.rpcs.create_space.metadata.to_h
1709
+
1710
+ # Set x-goog-api-client and x-goog-user-project headers
1711
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1712
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1713
+ gapic_version: ::Google::Apps::Chat::V1::VERSION
1714
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1715
+
1716
+ options.apply_defaults timeout: @config.rpcs.create_space.timeout,
1717
+ metadata: metadata,
1718
+ retry_policy: @config.rpcs.create_space.retry_policy
1719
+
1720
+ options.apply_defaults timeout: @config.timeout,
1721
+ metadata: @config.metadata,
1722
+ retry_policy: @config.retry_policy
1723
+
1724
+ @chat_service_stub.call_rpc :create_space, request, options: options do |response, operation|
1725
+ yield response, operation if block_given?
1726
+ return response
1727
+ end
1728
+ rescue ::GRPC::BadStatus => e
1729
+ raise ::Google::Cloud::Error.from_error(e)
1730
+ end
1731
+
1732
+ ##
1733
+ # Creates a space and adds specified users to it. The calling user is
1734
+ # automatically added to the space, and shouldn't be specified as a
1735
+ # membership in the request. For an example, see
1736
+ # [Set up a space with initial
1737
+ # members](https://developers.google.com/workspace/chat/set-up-spaces).
1738
+ #
1739
+ # To specify the human members to add, add memberships with the appropriate
1740
+ # `membership.member.name`. To add a human user, use `users/{user}`, where
1741
+ # `{user}` can be the email address for the user. For users in the same
1742
+ # Workspace organization `{user}` can also be the `id` for the person from
1743
+ # the People API, or the `id` for the user in the Directory API. For example,
1744
+ # if the People API Person profile ID for `user@example.com` is `123456789`,
1745
+ # you can add the user to the space by setting the `membership.member.name`
1746
+ # to `users/user@example.com` or `users/123456789`.
1747
+ #
1748
+ # For a named space or group chat, if the caller blocks, or is blocked
1749
+ # by some members, or doesn't have permission to add some members, then
1750
+ # those members aren't added to the created space.
1751
+ #
1752
+ # To create a direct message (DM) between the calling user and another human
1753
+ # user, specify exactly one membership to represent the human user. If
1754
+ # one user blocks the other, the request fails and the DM isn't created.
1755
+ #
1756
+ # To create a DM between the calling user and the calling app, set
1757
+ # `Space.singleUserBotDm` to `true` and don't specify any memberships. You
1758
+ # can only use this method to set up a DM with the calling app. To add the
1759
+ # calling app as a member of a space or an existing DM between two human
1760
+ # users, see
1761
+ # [Invite or add a user or app to a
1762
+ # space](https://developers.google.com/workspace/chat/create-members).
1763
+ #
1764
+ # If a DM already exists between two users, even when one user blocks the
1765
+ # other at the time a request is made, then the existing DM is returned.
1766
+ #
1767
+ # Spaces with threaded replies aren't supported. If you receive the error
1768
+ # message `ALREADY_EXISTS` when setting up a space, try a different
1769
+ # `displayName`. An existing space within the Google Workspace organization
1770
+ # might already use this display name.
1771
+ #
1772
+ # Requires [user
1773
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
1774
+ #
1775
+ # @overload set_up_space(request, options = nil)
1776
+ # Pass arguments to `set_up_space` via a request object, either of type
1777
+ # {::Google::Apps::Chat::V1::SetUpSpaceRequest} or an equivalent Hash.
1778
+ #
1779
+ # @param request [::Google::Apps::Chat::V1::SetUpSpaceRequest, ::Hash]
1780
+ # A request object representing the call parameters. Required. To specify no
1781
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1782
+ # @param options [::Gapic::CallOptions, ::Hash]
1783
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1784
+ #
1785
+ # @overload set_up_space(space: nil, request_id: nil, memberships: nil)
1786
+ # Pass arguments to `set_up_space` via keyword arguments. Note that at
1787
+ # least one keyword argument is required. To specify no parameters, or to keep all
1788
+ # the default parameter values, pass an empty Hash as a request object (see above).
1789
+ #
1790
+ # @param space [::Google::Apps::Chat::V1::Space, ::Hash]
1791
+ # Required. The `Space.spaceType` field is required.
1792
+ #
1793
+ # To create a space, set `Space.spaceType` to `SPACE` and set
1794
+ # `Space.displayName`. If you receive the error message `ALREADY_EXISTS` when
1795
+ # setting up a space, try a different `displayName`. An existing space
1796
+ # within the Google Workspace organization might already use this display
1797
+ # name.
1798
+ #
1799
+ # To create a group chat, set `Space.spaceType` to
1800
+ # `GROUP_CHAT`. Don't set `Space.displayName`.
1801
+ #
1802
+ # To create a 1:1 conversation between humans,
1803
+ # set `Space.spaceType` to `DIRECT_MESSAGE` and set
1804
+ # `Space.singleUserBotDm` to `false`. Don't set `Space.displayName` or
1805
+ # `Space.spaceDetails`.
1806
+ #
1807
+ # To create an 1:1 conversation between a human and the calling Chat app, set
1808
+ # `Space.spaceType` to `DIRECT_MESSAGE` and
1809
+ # `Space.singleUserBotDm` to `true`. Don't set `Space.displayName` or
1810
+ # `Space.spaceDetails`.
1811
+ #
1812
+ # If a `DIRECT_MESSAGE` space already exists, that space is returned instead
1813
+ # of creating a new space.
1814
+ # @param request_id [::String]
1815
+ # Optional. A unique identifier for this request.
1816
+ # A random UUID is recommended.
1817
+ # Specifying an existing request ID returns the space created with that ID
1818
+ # instead of creating a new space.
1819
+ # Specifying an existing request ID from the same Chat app with a different
1820
+ # authenticated user returns an error.
1821
+ # @param memberships [::Array<::Google::Apps::Chat::V1::Membership, ::Hash>]
1822
+ # Optional. The Google Chat users to invite to join the space. Omit the
1823
+ # calling user, as they are added automatically.
1824
+ #
1825
+ # The set currently allows up to 20 memberships (in addition to the caller).
1826
+ #
1827
+ # For human membership, the `Membership.member` field must contain a `user`
1828
+ # with `name` populated (format: `users/{user}`) and `type` set to
1829
+ # `User.Type.HUMAN`. You can only add human users when setting up a space
1830
+ # (adding Chat apps is only supported for direct message setup with the
1831
+ # calling app). You can also add members using the user's email as an alias
1832
+ # for \\{user}. For example, the `user.name` can be `users/example@gmail.com`.
1833
+ # To invite Gmail users or users from external Google Workspace domains,
1834
+ # user's email must be used for `{user}`.
1835
+ #
1836
+ # Optional when setting `Space.spaceType` to `SPACE`.
1837
+ #
1838
+ # Required when setting `Space.spaceType` to `GROUP_CHAT`, along with at
1839
+ # least two memberships.
1840
+ #
1841
+ # Required when setting `Space.spaceType` to `DIRECT_MESSAGE` with a human
1842
+ # user, along with exactly one membership.
1843
+ #
1844
+ # Must be empty when creating a 1:1 conversation between a human and the
1845
+ # calling Chat app (when setting `Space.spaceType` to
1846
+ # `DIRECT_MESSAGE` and `Space.singleUserBotDm` to `true`).
1847
+ #
1848
+ # @yield [response, operation] Access the result along with the RPC operation
1849
+ # @yieldparam response [::Google::Apps::Chat::V1::Space]
1850
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1851
+ #
1852
+ # @return [::Google::Apps::Chat::V1::Space]
1853
+ #
1854
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1855
+ #
1856
+ # @example Basic example
1857
+ # require "google/apps/chat/v1"
1858
+ #
1859
+ # # Create a client object. The client can be reused for multiple calls.
1860
+ # client = Google::Apps::Chat::V1::ChatService::Client.new
1861
+ #
1862
+ # # Create a request. To set request fields, pass in keyword arguments.
1863
+ # request = Google::Apps::Chat::V1::SetUpSpaceRequest.new
1864
+ #
1865
+ # # Call the set_up_space method.
1866
+ # result = client.set_up_space request
1867
+ #
1868
+ # # The returned object is of type Google::Apps::Chat::V1::Space.
1869
+ # p result
1870
+ #
1871
+ def set_up_space request, options = nil
1872
+ raise ::ArgumentError, "request must be provided" if request.nil?
1873
+
1874
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::SetUpSpaceRequest
1875
+
1876
+ # Converts hash and nil to an options object
1877
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1878
+
1879
+ # Customize the options with defaults
1880
+ metadata = @config.rpcs.set_up_space.metadata.to_h
1881
+
1882
+ # Set x-goog-api-client and x-goog-user-project headers
1883
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1884
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1885
+ gapic_version: ::Google::Apps::Chat::V1::VERSION
1886
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1887
+
1888
+ options.apply_defaults timeout: @config.rpcs.set_up_space.timeout,
1889
+ metadata: metadata,
1890
+ retry_policy: @config.rpcs.set_up_space.retry_policy
1891
+
1892
+ options.apply_defaults timeout: @config.timeout,
1893
+ metadata: @config.metadata,
1894
+ retry_policy: @config.retry_policy
1895
+
1896
+ @chat_service_stub.call_rpc :set_up_space, request, options: options do |response, operation|
1897
+ yield response, operation if block_given?
1898
+ return response
1899
+ end
1900
+ rescue ::GRPC::BadStatus => e
1901
+ raise ::Google::Cloud::Error.from_error(e)
1902
+ end
1903
+
1904
+ ##
1905
+ # Updates a space. For an example, see
1906
+ # [Update a
1907
+ # space](https://developers.google.com/workspace/chat/update-spaces).
1908
+ #
1909
+ # If you're updating the `displayName` field and receive the error message
1910
+ # `ALREADY_EXISTS`, try a different display name.. An existing space within
1911
+ # the Google Workspace organization might already use this display name.
1912
+ #
1913
+ # Requires [user
1914
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
1915
+ #
1916
+ # @overload update_space(request, options = nil)
1917
+ # Pass arguments to `update_space` via a request object, either of type
1918
+ # {::Google::Apps::Chat::V1::UpdateSpaceRequest} or an equivalent Hash.
1919
+ #
1920
+ # @param request [::Google::Apps::Chat::V1::UpdateSpaceRequest, ::Hash]
1921
+ # A request object representing the call parameters. Required. To specify no
1922
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1923
+ # @param options [::Gapic::CallOptions, ::Hash]
1924
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1925
+ #
1926
+ # @overload update_space(space: nil, update_mask: nil)
1927
+ # Pass arguments to `update_space` via keyword arguments. Note that at
1928
+ # least one keyword argument is required. To specify no parameters, or to keep all
1929
+ # the default parameter values, pass an empty Hash as a request object (see above).
1930
+ #
1931
+ # @param space [::Google::Apps::Chat::V1::Space, ::Hash]
1932
+ # Required. Space with fields to be updated. `Space.name` must be
1933
+ # populated in the form of `spaces/{space}`. Only fields
1934
+ # specified by `update_mask` are updated.
1935
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
1936
+ # Required. The updated field paths, comma separated if there are
1937
+ # multiple.
1938
+ #
1939
+ # Currently supported field paths:
1940
+ #
1941
+ # - `display_name` (Only supports changing the display name of a space with
1942
+ # the `SPACE` type, or when also including the `space_type` mask to change a
1943
+ # `GROUP_CHAT` space type to `SPACE`. Trying to update the display name of a
1944
+ # `GROUP_CHAT` or a `DIRECT_MESSAGE` space results in an invalid argument
1945
+ # error. If you receive the error message `ALREADY_EXISTS` when updating the
1946
+ # `displayName`, try a different `displayName`. An existing space within the
1947
+ # Google Workspace organization might already use this display name.)
1948
+ #
1949
+ # - `space_type` (Only supports changing a `GROUP_CHAT` space type to
1950
+ # `SPACE`. Include `display_name` together
1951
+ # with `space_type` in the update mask and ensure that the specified space
1952
+ # has a non-empty display name and the `SPACE` space type. Including the
1953
+ # `space_type` mask and the `SPACE` type in the specified space when updating
1954
+ # the display name is optional if the existing space already has the `SPACE`
1955
+ # type. Trying to update the space type in other ways results in an invalid
1956
+ # argument error).
1957
+ #
1958
+ # - `space_details`
1959
+ #
1960
+ # - `space_history_state` (Supports [turning history on or off for the
1961
+ # space](https://support.google.com/chat/answer/7664687) if [the organization
1962
+ # allows users to change their history
1963
+ # setting](https://support.google.com/a/answer/7664184).
1964
+ # Warning: mutually exclusive with all other field paths.)
1965
+ #
1966
+ # - Developer Preview: `access_settings.audience` (Supports changing the
1967
+ # [access setting](https://support.google.com/chat/answer/11971020) of a
1968
+ # space. If no audience is specified in the access setting, the space's
1969
+ # access setting is updated to restricted. Warning: mutually exclusive with
1970
+ # all other field paths.)
1971
+ #
1972
+ # @yield [response, operation] Access the result along with the RPC operation
1973
+ # @yieldparam response [::Google::Apps::Chat::V1::Space]
1974
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1975
+ #
1976
+ # @return [::Google::Apps::Chat::V1::Space]
1977
+ #
1978
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1979
+ #
1980
+ # @example Basic example
1981
+ # require "google/apps/chat/v1"
1982
+ #
1983
+ # # Create a client object. The client can be reused for multiple calls.
1984
+ # client = Google::Apps::Chat::V1::ChatService::Client.new
1985
+ #
1986
+ # # Create a request. To set request fields, pass in keyword arguments.
1987
+ # request = Google::Apps::Chat::V1::UpdateSpaceRequest.new
1988
+ #
1989
+ # # Call the update_space method.
1990
+ # result = client.update_space request
1991
+ #
1992
+ # # The returned object is of type Google::Apps::Chat::V1::Space.
1993
+ # p result
1994
+ #
1995
+ def update_space request, options = nil
1996
+ raise ::ArgumentError, "request must be provided" if request.nil?
1997
+
1998
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::UpdateSpaceRequest
1999
+
2000
+ # Converts hash and nil to an options object
2001
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2002
+
2003
+ # Customize the options with defaults
2004
+ metadata = @config.rpcs.update_space.metadata.to_h
2005
+
2006
+ # Set x-goog-api-client and x-goog-user-project headers
2007
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2008
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2009
+ gapic_version: ::Google::Apps::Chat::V1::VERSION
2010
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2011
+
2012
+ header_params = {}
2013
+ if request.space&.name
2014
+ header_params["space.name"] = request.space.name
2015
+ end
2016
+
2017
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2018
+ metadata[:"x-goog-request-params"] ||= request_params_header
2019
+
2020
+ options.apply_defaults timeout: @config.rpcs.update_space.timeout,
2021
+ metadata: metadata,
2022
+ retry_policy: @config.rpcs.update_space.retry_policy
2023
+
2024
+ options.apply_defaults timeout: @config.timeout,
2025
+ metadata: @config.metadata,
2026
+ retry_policy: @config.retry_policy
2027
+
2028
+ @chat_service_stub.call_rpc :update_space, request, options: options do |response, operation|
2029
+ yield response, operation if block_given?
2030
+ return response
2031
+ end
2032
+ rescue ::GRPC::BadStatus => e
2033
+ raise ::Google::Cloud::Error.from_error(e)
2034
+ end
2035
+
2036
+ ##
2037
+ # Deletes a named space. Always performs a cascading delete, which means
2038
+ # that the space's child resources—like messages posted in the space and
2039
+ # memberships in the space—are also deleted. For an example, see
2040
+ # [Delete a
2041
+ # space](https://developers.google.com/workspace/chat/delete-spaces).
2042
+ # Requires [user
2043
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
2044
+ # from a user who has permission to delete the space.
2045
+ #
2046
+ # @overload delete_space(request, options = nil)
2047
+ # Pass arguments to `delete_space` via a request object, either of type
2048
+ # {::Google::Apps::Chat::V1::DeleteSpaceRequest} or an equivalent Hash.
2049
+ #
2050
+ # @param request [::Google::Apps::Chat::V1::DeleteSpaceRequest, ::Hash]
2051
+ # A request object representing the call parameters. Required. To specify no
2052
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2053
+ # @param options [::Gapic::CallOptions, ::Hash]
2054
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2055
+ #
2056
+ # @overload delete_space(name: nil)
2057
+ # Pass arguments to `delete_space` via keyword arguments. Note that at
2058
+ # least one keyword argument is required. To specify no parameters, or to keep all
2059
+ # the default parameter values, pass an empty Hash as a request object (see above).
2060
+ #
2061
+ # @param name [::String]
2062
+ # Required. Resource name of the space to delete.
2063
+ #
2064
+ # Format: `spaces/{space}`
2065
+ #
2066
+ # @yield [response, operation] Access the result along with the RPC operation
2067
+ # @yieldparam response [::Google::Protobuf::Empty]
2068
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2069
+ #
2070
+ # @return [::Google::Protobuf::Empty]
2071
+ #
2072
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2073
+ #
2074
+ # @example Basic example
2075
+ # require "google/apps/chat/v1"
2076
+ #
2077
+ # # Create a client object. The client can be reused for multiple calls.
2078
+ # client = Google::Apps::Chat::V1::ChatService::Client.new
2079
+ #
2080
+ # # Create a request. To set request fields, pass in keyword arguments.
2081
+ # request = Google::Apps::Chat::V1::DeleteSpaceRequest.new
2082
+ #
2083
+ # # Call the delete_space method.
2084
+ # result = client.delete_space request
2085
+ #
2086
+ # # The returned object is of type Google::Protobuf::Empty.
2087
+ # p result
2088
+ #
2089
+ def delete_space request, options = nil
2090
+ raise ::ArgumentError, "request must be provided" if request.nil?
2091
+
2092
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::DeleteSpaceRequest
2093
+
2094
+ # Converts hash and nil to an options object
2095
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2096
+
2097
+ # Customize the options with defaults
2098
+ metadata = @config.rpcs.delete_space.metadata.to_h
2099
+
2100
+ # Set x-goog-api-client and x-goog-user-project headers
2101
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2102
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2103
+ gapic_version: ::Google::Apps::Chat::V1::VERSION
2104
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2105
+
2106
+ header_params = {}
2107
+ if request.name
2108
+ header_params["name"] = request.name
2109
+ end
2110
+
2111
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2112
+ metadata[:"x-goog-request-params"] ||= request_params_header
2113
+
2114
+ options.apply_defaults timeout: @config.rpcs.delete_space.timeout,
2115
+ metadata: metadata,
2116
+ retry_policy: @config.rpcs.delete_space.retry_policy
2117
+
2118
+ options.apply_defaults timeout: @config.timeout,
2119
+ metadata: @config.metadata,
2120
+ retry_policy: @config.retry_policy
2121
+
2122
+ @chat_service_stub.call_rpc :delete_space, request, options: options do |response, operation|
2123
+ yield response, operation if block_given?
2124
+ return response
2125
+ end
2126
+ rescue ::GRPC::BadStatus => e
2127
+ raise ::Google::Cloud::Error.from_error(e)
2128
+ end
2129
+
2130
+ ##
2131
+ # Completes the
2132
+ # [import process](https://developers.google.com/workspace/chat/import-data)
2133
+ # for the specified space and makes it visible to users.
2134
+ # Requires app authentication and domain-wide delegation. For more
2135
+ # information, see [Authorize Google Chat apps to import
2136
+ # data](https://developers.google.com/workspace/chat/authorize-import).
2137
+ #
2138
+ # @overload complete_import_space(request, options = nil)
2139
+ # Pass arguments to `complete_import_space` via a request object, either of type
2140
+ # {::Google::Apps::Chat::V1::CompleteImportSpaceRequest} or an equivalent Hash.
2141
+ #
2142
+ # @param request [::Google::Apps::Chat::V1::CompleteImportSpaceRequest, ::Hash]
2143
+ # A request object representing the call parameters. Required. To specify no
2144
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2145
+ # @param options [::Gapic::CallOptions, ::Hash]
2146
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2147
+ #
2148
+ # @overload complete_import_space(name: nil)
2149
+ # Pass arguments to `complete_import_space` via keyword arguments. Note that at
2150
+ # least one keyword argument is required. To specify no parameters, or to keep all
2151
+ # the default parameter values, pass an empty Hash as a request object (see above).
2152
+ #
2153
+ # @param name [::String]
2154
+ # Required. Resource name of the import mode space.
2155
+ #
2156
+ # Format: `spaces/{space}`
2157
+ #
2158
+ # @yield [response, operation] Access the result along with the RPC operation
2159
+ # @yieldparam response [::Google::Apps::Chat::V1::CompleteImportSpaceResponse]
2160
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2161
+ #
2162
+ # @return [::Google::Apps::Chat::V1::CompleteImportSpaceResponse]
2163
+ #
2164
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2165
+ #
2166
+ # @example Basic example
2167
+ # require "google/apps/chat/v1"
2168
+ #
2169
+ # # Create a client object. The client can be reused for multiple calls.
2170
+ # client = Google::Apps::Chat::V1::ChatService::Client.new
2171
+ #
2172
+ # # Create a request. To set request fields, pass in keyword arguments.
2173
+ # request = Google::Apps::Chat::V1::CompleteImportSpaceRequest.new
2174
+ #
2175
+ # # Call the complete_import_space method.
2176
+ # result = client.complete_import_space request
2177
+ #
2178
+ # # The returned object is of type Google::Apps::Chat::V1::CompleteImportSpaceResponse.
2179
+ # p result
2180
+ #
2181
+ def complete_import_space request, options = nil
2182
+ raise ::ArgumentError, "request must be provided" if request.nil?
2183
+
2184
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::CompleteImportSpaceRequest
2185
+
2186
+ # Converts hash and nil to an options object
2187
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2188
+
2189
+ # Customize the options with defaults
2190
+ metadata = @config.rpcs.complete_import_space.metadata.to_h
2191
+
2192
+ # Set x-goog-api-client and x-goog-user-project headers
2193
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2194
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2195
+ gapic_version: ::Google::Apps::Chat::V1::VERSION
2196
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2197
+
2198
+ header_params = {}
2199
+ if request.name
2200
+ header_params["name"] = request.name
2201
+ end
2202
+
2203
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2204
+ metadata[:"x-goog-request-params"] ||= request_params_header
2205
+
2206
+ options.apply_defaults timeout: @config.rpcs.complete_import_space.timeout,
2207
+ metadata: metadata,
2208
+ retry_policy: @config.rpcs.complete_import_space.retry_policy
2209
+
2210
+ options.apply_defaults timeout: @config.timeout,
2211
+ metadata: @config.metadata,
2212
+ retry_policy: @config.retry_policy
2213
+
2214
+ @chat_service_stub.call_rpc :complete_import_space, request, options: options do |response, operation|
2215
+ yield response, operation if block_given?
2216
+ return response
2217
+ end
2218
+ rescue ::GRPC::BadStatus => e
2219
+ raise ::Google::Cloud::Error.from_error(e)
2220
+ end
2221
+
2222
+ ##
2223
+ # Returns the existing direct message with the specified user. If no direct
2224
+ # message space is found, returns a `404 NOT_FOUND` error. For an example,
2225
+ # see
2226
+ # [Find a direct message](/chat/api/guides/v1/spaces/find-direct-message).
2227
+ #
2228
+ # With [user
2229
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user),
2230
+ # returns the direct message space between the specified user and the
2231
+ # authenticated user.
2232
+ #
2233
+ # With [app
2234
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app),
2235
+ # returns the direct message space between the specified user and the calling
2236
+ # Chat app.
2237
+ #
2238
+ # Requires [user
2239
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
2240
+ # or [app
2241
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app).
2242
+ #
2243
+ # @overload find_direct_message(request, options = nil)
2244
+ # Pass arguments to `find_direct_message` via a request object, either of type
2245
+ # {::Google::Apps::Chat::V1::FindDirectMessageRequest} or an equivalent Hash.
2246
+ #
2247
+ # @param request [::Google::Apps::Chat::V1::FindDirectMessageRequest, ::Hash]
2248
+ # A request object representing the call parameters. Required. To specify no
2249
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2250
+ # @param options [::Gapic::CallOptions, ::Hash]
2251
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2252
+ #
2253
+ # @overload find_direct_message(name: nil)
2254
+ # Pass arguments to `find_direct_message` via keyword arguments. Note that at
2255
+ # least one keyword argument is required. To specify no parameters, or to keep all
2256
+ # the default parameter values, pass an empty Hash as a request object (see above).
2257
+ #
2258
+ # @param name [::String]
2259
+ # Required. Resource name of the user to find direct message with.
2260
+ #
2261
+ # Format: `users/{user}`, where `{user}` is either the `id` for the
2262
+ # [person](https://developers.google.com/people/api/rest/v1/people) from the
2263
+ # People API, or the `id` for the
2264
+ # [user](https://developers.google.com/admin-sdk/directory/reference/rest/v1/users)
2265
+ # in the Directory API. For example, if the People API profile ID is
2266
+ # `123456789`, you can find a direct message with that person by using
2267
+ # `users/123456789` as the `name`. When [authenticated as a
2268
+ # user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user),
2269
+ # you can use the email as an alias for `{user}`. For example,
2270
+ # `users/example@gmail.com` where `example@gmail.com` is the email of the
2271
+ # Google Chat user.
2272
+ #
2273
+ # @yield [response, operation] Access the result along with the RPC operation
2274
+ # @yieldparam response [::Google::Apps::Chat::V1::Space]
2275
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2276
+ #
2277
+ # @return [::Google::Apps::Chat::V1::Space]
2278
+ #
2279
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2280
+ #
2281
+ # @example Basic example
2282
+ # require "google/apps/chat/v1"
2283
+ #
2284
+ # # Create a client object. The client can be reused for multiple calls.
2285
+ # client = Google::Apps::Chat::V1::ChatService::Client.new
2286
+ #
2287
+ # # Create a request. To set request fields, pass in keyword arguments.
2288
+ # request = Google::Apps::Chat::V1::FindDirectMessageRequest.new
2289
+ #
2290
+ # # Call the find_direct_message method.
2291
+ # result = client.find_direct_message request
2292
+ #
2293
+ # # The returned object is of type Google::Apps::Chat::V1::Space.
2294
+ # p result
2295
+ #
2296
+ def find_direct_message request, options = nil
2297
+ raise ::ArgumentError, "request must be provided" if request.nil?
2298
+
2299
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::FindDirectMessageRequest
2300
+
2301
+ # Converts hash and nil to an options object
2302
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2303
+
2304
+ # Customize the options with defaults
2305
+ metadata = @config.rpcs.find_direct_message.metadata.to_h
2306
+
2307
+ # Set x-goog-api-client and x-goog-user-project headers
2308
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2309
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2310
+ gapic_version: ::Google::Apps::Chat::V1::VERSION
2311
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2312
+
2313
+ options.apply_defaults timeout: @config.rpcs.find_direct_message.timeout,
2314
+ metadata: metadata,
2315
+ retry_policy: @config.rpcs.find_direct_message.retry_policy
2316
+
2317
+ options.apply_defaults timeout: @config.timeout,
2318
+ metadata: @config.metadata,
2319
+ retry_policy: @config.retry_policy
2320
+
2321
+ @chat_service_stub.call_rpc :find_direct_message, request, options: options do |response, operation|
2322
+ yield response, operation if block_given?
2323
+ return response
2324
+ end
2325
+ rescue ::GRPC::BadStatus => e
2326
+ raise ::Google::Cloud::Error.from_error(e)
2327
+ end
2328
+
2329
+ ##
2330
+ # Creates a human membership or app membership for the calling app. Creating
2331
+ # memberships for other apps isn't supported. For an example, see
2332
+ # [Invite or add a user or a Google Chat app to a
2333
+ # space](https://developers.google.com/workspace/chat/create-members).
2334
+ # When creating a membership, if the specified member has their auto-accept
2335
+ # policy turned off, then they're invited, and must accept the space
2336
+ # invitation before joining. Otherwise, creating a membership adds the member
2337
+ # directly to the specified space. Requires [user
2338
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
2339
+ #
2340
+ # To specify the member to add, set the `membership.member.name` for the
2341
+ # human or app member.
2342
+ #
2343
+ # - To add the calling app to a space or a direct message between two human
2344
+ # users, use `users/app`. Unable to add other
2345
+ # apps to the space.
2346
+ #
2347
+ # - To add a human user, use `users/{user}`, where `{user}` can be the email
2348
+ # address for the user. For users in the same Workspace organization `{user}`
2349
+ # can also be the `id` for the person from the People API, or the `id` for
2350
+ # the user in the Directory API. For example, if the People API Person
2351
+ # profile ID for `user@example.com` is `123456789`, you can add the user to
2352
+ # the space by setting the `membership.member.name` to
2353
+ # `users/user@example.com` or `users/123456789`.
2354
+ #
2355
+ # @overload create_membership(request, options = nil)
2356
+ # Pass arguments to `create_membership` via a request object, either of type
2357
+ # {::Google::Apps::Chat::V1::CreateMembershipRequest} or an equivalent Hash.
2358
+ #
2359
+ # @param request [::Google::Apps::Chat::V1::CreateMembershipRequest, ::Hash]
2360
+ # A request object representing the call parameters. Required. To specify no
2361
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2362
+ # @param options [::Gapic::CallOptions, ::Hash]
2363
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2364
+ #
2365
+ # @overload create_membership(parent: nil, membership: nil)
2366
+ # Pass arguments to `create_membership` via keyword arguments. Note that at
2367
+ # least one keyword argument is required. To specify no parameters, or to keep all
2368
+ # the default parameter values, pass an empty Hash as a request object (see above).
2369
+ #
2370
+ # @param parent [::String]
2371
+ # Required. The resource name of the space for which to create the
2372
+ # membership.
2373
+ #
2374
+ # Format: spaces/\\{space}
2375
+ # @param membership [::Google::Apps::Chat::V1::Membership, ::Hash]
2376
+ # Required. The membership relation to create.
2377
+ # The `memberType` field must contain a user with the `user.name` and
2378
+ # `user.type` fields populated. The server will assign a resource name
2379
+ # and overwrite anything specified.
2380
+ # When a Chat app creates a membership relation for a human user, it must use
2381
+ # the `chat.memberships` scope, set `user.type` to `HUMAN`, and set
2382
+ # `user.name` with format `users/{user}`, where `{user}` can be the email
2383
+ # address for the user. For users in the same Workspace organization `{user}`
2384
+ # can also be the `id` of the
2385
+ # [person](https://developers.google.com/people/api/rest/v1/people) from the
2386
+ # People API, or the `id` for the user in the Directory API. For example, if
2387
+ # the People API Person profile ID for `user@example.com` is `123456789`, you
2388
+ # can add the user to the space by setting the `membership.member.name` to
2389
+ # `users/user@example.com` or `users/123456789`. When a Chat app creates a
2390
+ # membership relation for itself, it must use the `chat.memberships.app`
2391
+ # scope, set `user.type` to `BOT`, and set `user.name` to `users/app`.
2392
+ #
2393
+ # @yield [response, operation] Access the result along with the RPC operation
2394
+ # @yieldparam response [::Google::Apps::Chat::V1::Membership]
2395
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2396
+ #
2397
+ # @return [::Google::Apps::Chat::V1::Membership]
2398
+ #
2399
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2400
+ #
2401
+ # @example Basic example
2402
+ # require "google/apps/chat/v1"
2403
+ #
2404
+ # # Create a client object. The client can be reused for multiple calls.
2405
+ # client = Google::Apps::Chat::V1::ChatService::Client.new
2406
+ #
2407
+ # # Create a request. To set request fields, pass in keyword arguments.
2408
+ # request = Google::Apps::Chat::V1::CreateMembershipRequest.new
2409
+ #
2410
+ # # Call the create_membership method.
2411
+ # result = client.create_membership request
2412
+ #
2413
+ # # The returned object is of type Google::Apps::Chat::V1::Membership.
2414
+ # p result
2415
+ #
2416
+ def create_membership request, options = nil
2417
+ raise ::ArgumentError, "request must be provided" if request.nil?
2418
+
2419
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::CreateMembershipRequest
2420
+
2421
+ # Converts hash and nil to an options object
2422
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2423
+
2424
+ # Customize the options with defaults
2425
+ metadata = @config.rpcs.create_membership.metadata.to_h
2426
+
2427
+ # Set x-goog-api-client and x-goog-user-project headers
2428
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2429
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2430
+ gapic_version: ::Google::Apps::Chat::V1::VERSION
2431
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2432
+
2433
+ header_params = {}
2434
+ if request.parent
2435
+ header_params["parent"] = request.parent
2436
+ end
2437
+
2438
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2439
+ metadata[:"x-goog-request-params"] ||= request_params_header
2440
+
2441
+ options.apply_defaults timeout: @config.rpcs.create_membership.timeout,
2442
+ metadata: metadata,
2443
+ retry_policy: @config.rpcs.create_membership.retry_policy
2444
+
2445
+ options.apply_defaults timeout: @config.timeout,
2446
+ metadata: @config.metadata,
2447
+ retry_policy: @config.retry_policy
2448
+
2449
+ @chat_service_stub.call_rpc :create_membership, request, options: options do |response, operation|
2450
+ yield response, operation if block_given?
2451
+ return response
2452
+ end
2453
+ rescue ::GRPC::BadStatus => e
2454
+ raise ::Google::Cloud::Error.from_error(e)
2455
+ end
2456
+
2457
+ ##
2458
+ # Updates a membership. For an example, see [Update a user's membership in
2459
+ # a space](https://developers.google.com/workspace/chat/update-members).
2460
+ #
2461
+ # Requires [user
2462
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
2463
+ #
2464
+ # @overload update_membership(request, options = nil)
2465
+ # Pass arguments to `update_membership` via a request object, either of type
2466
+ # {::Google::Apps::Chat::V1::UpdateMembershipRequest} or an equivalent Hash.
2467
+ #
2468
+ # @param request [::Google::Apps::Chat::V1::UpdateMembershipRequest, ::Hash]
2469
+ # A request object representing the call parameters. Required. To specify no
2470
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2471
+ # @param options [::Gapic::CallOptions, ::Hash]
2472
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2473
+ #
2474
+ # @overload update_membership(membership: nil, update_mask: nil)
2475
+ # Pass arguments to `update_membership` via keyword arguments. Note that at
2476
+ # least one keyword argument is required. To specify no parameters, or to keep all
2477
+ # the default parameter values, pass an empty Hash as a request object (see above).
2478
+ #
2479
+ # @param membership [::Google::Apps::Chat::V1::Membership, ::Hash]
2480
+ # Required. The membership to update. Only fields specified by `update_mask`
2481
+ # are updated.
2482
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
2483
+ # Required. The field paths to update. Separate multiple values with commas
2484
+ # or use `*` to update all field paths.
2485
+ #
2486
+ # Currently supported field paths:
2487
+ #
2488
+ # - `role`
2489
+ #
2490
+ # @yield [response, operation] Access the result along with the RPC operation
2491
+ # @yieldparam response [::Google::Apps::Chat::V1::Membership]
2492
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2493
+ #
2494
+ # @return [::Google::Apps::Chat::V1::Membership]
2495
+ #
2496
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2497
+ #
2498
+ # @example Basic example
2499
+ # require "google/apps/chat/v1"
2500
+ #
2501
+ # # Create a client object. The client can be reused for multiple calls.
2502
+ # client = Google::Apps::Chat::V1::ChatService::Client.new
2503
+ #
2504
+ # # Create a request. To set request fields, pass in keyword arguments.
2505
+ # request = Google::Apps::Chat::V1::UpdateMembershipRequest.new
2506
+ #
2507
+ # # Call the update_membership method.
2508
+ # result = client.update_membership request
2509
+ #
2510
+ # # The returned object is of type Google::Apps::Chat::V1::Membership.
2511
+ # p result
2512
+ #
2513
+ def update_membership request, options = nil
2514
+ raise ::ArgumentError, "request must be provided" if request.nil?
2515
+
2516
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::UpdateMembershipRequest
2517
+
2518
+ # Converts hash and nil to an options object
2519
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2520
+
2521
+ # Customize the options with defaults
2522
+ metadata = @config.rpcs.update_membership.metadata.to_h
2523
+
2524
+ # Set x-goog-api-client and x-goog-user-project headers
2525
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2526
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2527
+ gapic_version: ::Google::Apps::Chat::V1::VERSION
2528
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2529
+
2530
+ header_params = {}
2531
+ if request.membership&.name
2532
+ header_params["membership.name"] = request.membership.name
2533
+ end
2534
+
2535
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2536
+ metadata[:"x-goog-request-params"] ||= request_params_header
2537
+
2538
+ options.apply_defaults timeout: @config.rpcs.update_membership.timeout,
2539
+ metadata: metadata,
2540
+ retry_policy: @config.rpcs.update_membership.retry_policy
2541
+
2542
+ options.apply_defaults timeout: @config.timeout,
2543
+ metadata: @config.metadata,
2544
+ retry_policy: @config.retry_policy
2545
+
2546
+ @chat_service_stub.call_rpc :update_membership, request, options: options do |response, operation|
2547
+ yield response, operation if block_given?
2548
+ return response
2549
+ end
2550
+ rescue ::GRPC::BadStatus => e
2551
+ raise ::Google::Cloud::Error.from_error(e)
2552
+ end
2553
+
2554
+ ##
2555
+ # Deletes a membership. For an example, see
2556
+ # [Remove a user or a Google Chat app from a
2557
+ # space](https://developers.google.com/workspace/chat/delete-members).
2558
+ #
2559
+ # Requires [user
2560
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
2561
+ #
2562
+ # @overload delete_membership(request, options = nil)
2563
+ # Pass arguments to `delete_membership` via a request object, either of type
2564
+ # {::Google::Apps::Chat::V1::DeleteMembershipRequest} or an equivalent Hash.
2565
+ #
2566
+ # @param request [::Google::Apps::Chat::V1::DeleteMembershipRequest, ::Hash]
2567
+ # A request object representing the call parameters. Required. To specify no
2568
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2569
+ # @param options [::Gapic::CallOptions, ::Hash]
2570
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2571
+ #
2572
+ # @overload delete_membership(name: nil)
2573
+ # Pass arguments to `delete_membership` via keyword arguments. Note that at
2574
+ # least one keyword argument is required. To specify no parameters, or to keep all
2575
+ # the default parameter values, pass an empty Hash as a request object (see above).
2576
+ #
2577
+ # @param name [::String]
2578
+ # Required. Resource name of the membership to delete. Chat apps can delete
2579
+ # human users' or their own memberships. Chat apps can't delete other apps'
2580
+ # memberships.
2581
+ #
2582
+ # When deleting a human membership, requires the `chat.memberships` scope and
2583
+ # `spaces/{space}/members/{member}` format. You can use the email as an
2584
+ # alias for `{member}`. For example,
2585
+ # `spaces/{space}/members/example@gmail.com` where `example@gmail.com` is the
2586
+ # email of the Google Chat user.
2587
+ #
2588
+ # When deleting an app membership, requires the `chat.memberships.app` scope
2589
+ # and `spaces/{space}/members/app` format.
2590
+ #
2591
+ # Format: `spaces/{space}/members/{member}` or `spaces/{space}/members/app`.
2592
+ #
2593
+ # @yield [response, operation] Access the result along with the RPC operation
2594
+ # @yieldparam response [::Google::Apps::Chat::V1::Membership]
2595
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2596
+ #
2597
+ # @return [::Google::Apps::Chat::V1::Membership]
2598
+ #
2599
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2600
+ #
2601
+ # @example Basic example
2602
+ # require "google/apps/chat/v1"
2603
+ #
2604
+ # # Create a client object. The client can be reused for multiple calls.
2605
+ # client = Google::Apps::Chat::V1::ChatService::Client.new
2606
+ #
2607
+ # # Create a request. To set request fields, pass in keyword arguments.
2608
+ # request = Google::Apps::Chat::V1::DeleteMembershipRequest.new
2609
+ #
2610
+ # # Call the delete_membership method.
2611
+ # result = client.delete_membership request
2612
+ #
2613
+ # # The returned object is of type Google::Apps::Chat::V1::Membership.
2614
+ # p result
2615
+ #
2616
+ def delete_membership request, options = nil
2617
+ raise ::ArgumentError, "request must be provided" if request.nil?
2618
+
2619
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::DeleteMembershipRequest
2620
+
2621
+ # Converts hash and nil to an options object
2622
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2623
+
2624
+ # Customize the options with defaults
2625
+ metadata = @config.rpcs.delete_membership.metadata.to_h
2626
+
2627
+ # Set x-goog-api-client and x-goog-user-project headers
2628
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2629
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2630
+ gapic_version: ::Google::Apps::Chat::V1::VERSION
2631
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2632
+
2633
+ header_params = {}
2634
+ if request.name
2635
+ header_params["name"] = request.name
2636
+ end
2637
+
2638
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2639
+ metadata[:"x-goog-request-params"] ||= request_params_header
2640
+
2641
+ options.apply_defaults timeout: @config.rpcs.delete_membership.timeout,
2642
+ metadata: metadata,
2643
+ retry_policy: @config.rpcs.delete_membership.retry_policy
2644
+
2645
+ options.apply_defaults timeout: @config.timeout,
2646
+ metadata: @config.metadata,
2647
+ retry_policy: @config.retry_policy
2648
+
2649
+ @chat_service_stub.call_rpc :delete_membership, request, options: options do |response, operation|
2650
+ yield response, operation if block_given?
2651
+ return response
2652
+ end
2653
+ rescue ::GRPC::BadStatus => e
2654
+ raise ::Google::Cloud::Error.from_error(e)
2655
+ end
2656
+
2657
+ ##
2658
+ # Creates a reaction and adds it to a message. Only unicode emojis are
2659
+ # supported. For an example, see
2660
+ # [Add a reaction to a
2661
+ # message](https://developers.google.com/workspace/chat/create-reactions).
2662
+ # Requires [user
2663
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
2664
+ #
2665
+ # @overload create_reaction(request, options = nil)
2666
+ # Pass arguments to `create_reaction` via a request object, either of type
2667
+ # {::Google::Apps::Chat::V1::CreateReactionRequest} or an equivalent Hash.
2668
+ #
2669
+ # @param request [::Google::Apps::Chat::V1::CreateReactionRequest, ::Hash]
2670
+ # A request object representing the call parameters. Required. To specify no
2671
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2672
+ # @param options [::Gapic::CallOptions, ::Hash]
2673
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2674
+ #
2675
+ # @overload create_reaction(parent: nil, reaction: nil)
2676
+ # Pass arguments to `create_reaction` via keyword arguments. Note that at
2677
+ # least one keyword argument is required. To specify no parameters, or to keep all
2678
+ # the default parameter values, pass an empty Hash as a request object (see above).
2679
+ #
2680
+ # @param parent [::String]
2681
+ # Required. The message where the reaction is created.
2682
+ #
2683
+ # Format: `spaces/{space}/messages/{message}`
2684
+ # @param reaction [::Google::Apps::Chat::V1::Reaction, ::Hash]
2685
+ # Required. The reaction to create.
2686
+ #
2687
+ # @yield [response, operation] Access the result along with the RPC operation
2688
+ # @yieldparam response [::Google::Apps::Chat::V1::Reaction]
2689
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2690
+ #
2691
+ # @return [::Google::Apps::Chat::V1::Reaction]
2692
+ #
2693
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2694
+ #
2695
+ # @example Basic example
2696
+ # require "google/apps/chat/v1"
2697
+ #
2698
+ # # Create a client object. The client can be reused for multiple calls.
2699
+ # client = Google::Apps::Chat::V1::ChatService::Client.new
2700
+ #
2701
+ # # Create a request. To set request fields, pass in keyword arguments.
2702
+ # request = Google::Apps::Chat::V1::CreateReactionRequest.new
2703
+ #
2704
+ # # Call the create_reaction method.
2705
+ # result = client.create_reaction request
2706
+ #
2707
+ # # The returned object is of type Google::Apps::Chat::V1::Reaction.
2708
+ # p result
2709
+ #
2710
+ def create_reaction request, options = nil
2711
+ raise ::ArgumentError, "request must be provided" if request.nil?
2712
+
2713
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::CreateReactionRequest
2714
+
2715
+ # Converts hash and nil to an options object
2716
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2717
+
2718
+ # Customize the options with defaults
2719
+ metadata = @config.rpcs.create_reaction.metadata.to_h
2720
+
2721
+ # Set x-goog-api-client and x-goog-user-project headers
2722
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2723
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2724
+ gapic_version: ::Google::Apps::Chat::V1::VERSION
2725
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2726
+
2727
+ header_params = {}
2728
+ if request.parent
2729
+ header_params["parent"] = request.parent
2730
+ end
2731
+
2732
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2733
+ metadata[:"x-goog-request-params"] ||= request_params_header
2734
+
2735
+ options.apply_defaults timeout: @config.rpcs.create_reaction.timeout,
2736
+ metadata: metadata,
2737
+ retry_policy: @config.rpcs.create_reaction.retry_policy
2738
+
2739
+ options.apply_defaults timeout: @config.timeout,
2740
+ metadata: @config.metadata,
2741
+ retry_policy: @config.retry_policy
2742
+
2743
+ @chat_service_stub.call_rpc :create_reaction, request, options: options do |response, operation|
2744
+ yield response, operation if block_given?
2745
+ return response
2746
+ end
2747
+ rescue ::GRPC::BadStatus => e
2748
+ raise ::Google::Cloud::Error.from_error(e)
2749
+ end
2750
+
2751
+ ##
2752
+ # Lists reactions to a message. For an example, see
2753
+ # [List reactions for a
2754
+ # message](https://developers.google.com/workspace/chat/list-reactions).
2755
+ # Requires [user
2756
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
2757
+ #
2758
+ # @overload list_reactions(request, options = nil)
2759
+ # Pass arguments to `list_reactions` via a request object, either of type
2760
+ # {::Google::Apps::Chat::V1::ListReactionsRequest} or an equivalent Hash.
2761
+ #
2762
+ # @param request [::Google::Apps::Chat::V1::ListReactionsRequest, ::Hash]
2763
+ # A request object representing the call parameters. Required. To specify no
2764
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2765
+ # @param options [::Gapic::CallOptions, ::Hash]
2766
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2767
+ #
2768
+ # @overload list_reactions(parent: nil, page_size: nil, page_token: nil, filter: nil)
2769
+ # Pass arguments to `list_reactions` via keyword arguments. Note that at
2770
+ # least one keyword argument is required. To specify no parameters, or to keep all
2771
+ # the default parameter values, pass an empty Hash as a request object (see above).
2772
+ #
2773
+ # @param parent [::String]
2774
+ # Required. The message users reacted to.
2775
+ #
2776
+ # Format: `spaces/{space}/messages/{message}`
2777
+ # @param page_size [::Integer]
2778
+ # Optional. The maximum number of reactions returned. The service can return
2779
+ # fewer reactions than this value. If unspecified, the default value is 25.
2780
+ # The maximum value is 200; values above 200 are changed to 200.
2781
+ # @param page_token [::String]
2782
+ # Optional. (If resuming from a previous query.)
2783
+ #
2784
+ # A page token received from a previous list reactions call. Provide this
2785
+ # to retrieve the subsequent page.
2786
+ #
2787
+ # When paginating, the filter value should match the call that provided the
2788
+ # page token. Passing a different value might lead to unexpected results.
2789
+ # @param filter [::String]
2790
+ # Optional. A query filter.
2791
+ #
2792
+ # You can filter reactions by
2793
+ # [emoji](https://developers.google.com/workspace/chat/api/reference/rest/v1/Emoji)
2794
+ # (either `emoji.unicode` or `emoji.custom_emoji.uid`) and
2795
+ # [user](https://developers.google.com/workspace/chat/api/reference/rest/v1/User)
2796
+ # (`user.name`).
2797
+ #
2798
+ # To filter reactions for multiple emojis or users, join similar fields
2799
+ # with the `OR` operator, such as `emoji.unicode = "🙂" OR emoji.unicode =
2800
+ # "👍"` and `user.name = "users/AAAAAA" OR user.name = "users/BBBBBB"`.
2801
+ #
2802
+ # To filter reactions by emoji and user, use the `AND` operator, such as
2803
+ # `emoji.unicode = "🙂" AND user.name = "users/AAAAAA"`.
2804
+ #
2805
+ # If your query uses both `AND` and `OR`, group them with parentheses.
2806
+ #
2807
+ # For example, the following queries are valid:
2808
+ #
2809
+ # ```
2810
+ # user.name = "users/\\{user}"
2811
+ # emoji.unicode = "🙂"
2812
+ # emoji.custom_emoji.uid = "\\{uid}"
2813
+ # emoji.unicode = "🙂" OR emoji.unicode = "👍"
2814
+ # emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "\\{uid}"
2815
+ # emoji.unicode = "🙂" AND user.name = "users/\\{user}"
2816
+ # (emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "\\{uid}")
2817
+ # AND user.name = "users/\\{user}"
2818
+ # ```
2819
+ #
2820
+ # The following queries are invalid:
2821
+ #
2822
+ # ```
2823
+ # emoji.unicode = "🙂" AND emoji.unicode = "👍"
2824
+ # emoji.unicode = "🙂" AND emoji.custom_emoji.uid = "\\{uid}"
2825
+ # emoji.unicode = "🙂" OR user.name = "users/\\{user}"
2826
+ # emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "\\{uid}" OR
2827
+ # user.name = "users/\\{user}"
2828
+ # emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "\\{uid}"
2829
+ # AND user.name = "users/\\{user}"
2830
+ # ```
2831
+ #
2832
+ # Invalid queries are rejected by the server with an `INVALID_ARGUMENT`
2833
+ # error.
2834
+ #
2835
+ # @yield [response, operation] Access the result along with the RPC operation
2836
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Apps::Chat::V1::Reaction>]
2837
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2838
+ #
2839
+ # @return [::Gapic::PagedEnumerable<::Google::Apps::Chat::V1::Reaction>]
2840
+ #
2841
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2842
+ #
2843
+ # @example Basic example
2844
+ # require "google/apps/chat/v1"
2845
+ #
2846
+ # # Create a client object. The client can be reused for multiple calls.
2847
+ # client = Google::Apps::Chat::V1::ChatService::Client.new
2848
+ #
2849
+ # # Create a request. To set request fields, pass in keyword arguments.
2850
+ # request = Google::Apps::Chat::V1::ListReactionsRequest.new
2851
+ #
2852
+ # # Call the list_reactions method.
2853
+ # result = client.list_reactions request
2854
+ #
2855
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
2856
+ # # over elements, and API calls will be issued to fetch pages as needed.
2857
+ # result.each do |item|
2858
+ # # Each element is of type ::Google::Apps::Chat::V1::Reaction.
2859
+ # p item
2860
+ # end
2861
+ #
2862
+ def list_reactions request, options = nil
2863
+ raise ::ArgumentError, "request must be provided" if request.nil?
2864
+
2865
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::ListReactionsRequest
2866
+
2867
+ # Converts hash and nil to an options object
2868
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2869
+
2870
+ # Customize the options with defaults
2871
+ metadata = @config.rpcs.list_reactions.metadata.to_h
2872
+
2873
+ # Set x-goog-api-client and x-goog-user-project headers
2874
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2875
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2876
+ gapic_version: ::Google::Apps::Chat::V1::VERSION
2877
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2878
+
2879
+ header_params = {}
2880
+ if request.parent
2881
+ header_params["parent"] = request.parent
2882
+ end
2883
+
2884
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2885
+ metadata[:"x-goog-request-params"] ||= request_params_header
2886
+
2887
+ options.apply_defaults timeout: @config.rpcs.list_reactions.timeout,
2888
+ metadata: metadata,
2889
+ retry_policy: @config.rpcs.list_reactions.retry_policy
2890
+
2891
+ options.apply_defaults timeout: @config.timeout,
2892
+ metadata: @config.metadata,
2893
+ retry_policy: @config.retry_policy
2894
+
2895
+ @chat_service_stub.call_rpc :list_reactions, request, options: options do |response, operation|
2896
+ response = ::Gapic::PagedEnumerable.new @chat_service_stub, :list_reactions, request, response, operation, options
2897
+ yield response, operation if block_given?
2898
+ return response
2899
+ end
2900
+ rescue ::GRPC::BadStatus => e
2901
+ raise ::Google::Cloud::Error.from_error(e)
2902
+ end
2903
+
2904
+ ##
2905
+ # Deletes a reaction to a message. Only unicode emojis are supported.
2906
+ # For an example, see
2907
+ # [Delete a
2908
+ # reaction](https://developers.google.com/workspace/chat/delete-reactions).
2909
+ # Requires [user
2910
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
2911
+ #
2912
+ # @overload delete_reaction(request, options = nil)
2913
+ # Pass arguments to `delete_reaction` via a request object, either of type
2914
+ # {::Google::Apps::Chat::V1::DeleteReactionRequest} or an equivalent Hash.
2915
+ #
2916
+ # @param request [::Google::Apps::Chat::V1::DeleteReactionRequest, ::Hash]
2917
+ # A request object representing the call parameters. Required. To specify no
2918
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2919
+ # @param options [::Gapic::CallOptions, ::Hash]
2920
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2921
+ #
2922
+ # @overload delete_reaction(name: nil)
2923
+ # Pass arguments to `delete_reaction` via keyword arguments. Note that at
2924
+ # least one keyword argument is required. To specify no parameters, or to keep all
2925
+ # the default parameter values, pass an empty Hash as a request object (see above).
2926
+ #
2927
+ # @param name [::String]
2928
+ # Required. Name of the reaction to delete.
2929
+ #
2930
+ # Format: `spaces/{space}/messages/{message}/reactions/{reaction}`
2931
+ #
2932
+ # @yield [response, operation] Access the result along with the RPC operation
2933
+ # @yieldparam response [::Google::Protobuf::Empty]
2934
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2935
+ #
2936
+ # @return [::Google::Protobuf::Empty]
2937
+ #
2938
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2939
+ #
2940
+ # @example Basic example
2941
+ # require "google/apps/chat/v1"
2942
+ #
2943
+ # # Create a client object. The client can be reused for multiple calls.
2944
+ # client = Google::Apps::Chat::V1::ChatService::Client.new
2945
+ #
2946
+ # # Create a request. To set request fields, pass in keyword arguments.
2947
+ # request = Google::Apps::Chat::V1::DeleteReactionRequest.new
2948
+ #
2949
+ # # Call the delete_reaction method.
2950
+ # result = client.delete_reaction request
2951
+ #
2952
+ # # The returned object is of type Google::Protobuf::Empty.
2953
+ # p result
2954
+ #
2955
+ def delete_reaction request, options = nil
2956
+ raise ::ArgumentError, "request must be provided" if request.nil?
2957
+
2958
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::DeleteReactionRequest
2959
+
2960
+ # Converts hash and nil to an options object
2961
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2962
+
2963
+ # Customize the options with defaults
2964
+ metadata = @config.rpcs.delete_reaction.metadata.to_h
2965
+
2966
+ # Set x-goog-api-client and x-goog-user-project headers
2967
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2968
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2969
+ gapic_version: ::Google::Apps::Chat::V1::VERSION
2970
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2971
+
2972
+ header_params = {}
2973
+ if request.name
2974
+ header_params["name"] = request.name
2975
+ end
2976
+
2977
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2978
+ metadata[:"x-goog-request-params"] ||= request_params_header
2979
+
2980
+ options.apply_defaults timeout: @config.rpcs.delete_reaction.timeout,
2981
+ metadata: metadata,
2982
+ retry_policy: @config.rpcs.delete_reaction.retry_policy
2983
+
2984
+ options.apply_defaults timeout: @config.timeout,
2985
+ metadata: @config.metadata,
2986
+ retry_policy: @config.retry_policy
2987
+
2988
+ @chat_service_stub.call_rpc :delete_reaction, request, options: options do |response, operation|
2989
+ yield response, operation if block_given?
2990
+ return response
2991
+ end
2992
+ rescue ::GRPC::BadStatus => e
2993
+ raise ::Google::Cloud::Error.from_error(e)
2994
+ end
2995
+
2996
+ ##
2997
+ # Returns details about a user's read state within a space, used to identify
2998
+ # read and unread messages. For an example, see [Get details about a user's
2999
+ # space read
3000
+ # state](https://developers.google.com/workspace/chat/get-space-read-state).
3001
+ #
3002
+ # Requires [user
3003
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
3004
+ #
3005
+ # @overload get_space_read_state(request, options = nil)
3006
+ # Pass arguments to `get_space_read_state` via a request object, either of type
3007
+ # {::Google::Apps::Chat::V1::GetSpaceReadStateRequest} or an equivalent Hash.
3008
+ #
3009
+ # @param request [::Google::Apps::Chat::V1::GetSpaceReadStateRequest, ::Hash]
3010
+ # A request object representing the call parameters. Required. To specify no
3011
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
3012
+ # @param options [::Gapic::CallOptions, ::Hash]
3013
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
3014
+ #
3015
+ # @overload get_space_read_state(name: nil)
3016
+ # Pass arguments to `get_space_read_state` via keyword arguments. Note that at
3017
+ # least one keyword argument is required. To specify no parameters, or to keep all
3018
+ # the default parameter values, pass an empty Hash as a request object (see above).
3019
+ #
3020
+ # @param name [::String]
3021
+ # Required. Resource name of the space read state to retrieve.
3022
+ #
3023
+ # Only supports getting read state for the calling user.
3024
+ #
3025
+ # To refer to the calling user, set one of the following:
3026
+ #
3027
+ # - The `me` alias. For example, `users/me/spaces/{space}/spaceReadState`.
3028
+ #
3029
+ # - Their Workspace email address. For example,
3030
+ # `users/user@example.com/spaces/{space}/spaceReadState`.
3031
+ #
3032
+ # - Their user id. For example,
3033
+ # `users/123456789/spaces/{space}/spaceReadState`.
3034
+ #
3035
+ # Format: users/\\{user}/spaces/\\{space}/spaceReadState
3036
+ #
3037
+ # @yield [response, operation] Access the result along with the RPC operation
3038
+ # @yieldparam response [::Google::Apps::Chat::V1::SpaceReadState]
3039
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
3040
+ #
3041
+ # @return [::Google::Apps::Chat::V1::SpaceReadState]
3042
+ #
3043
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
3044
+ #
3045
+ # @example Basic example
3046
+ # require "google/apps/chat/v1"
3047
+ #
3048
+ # # Create a client object. The client can be reused for multiple calls.
3049
+ # client = Google::Apps::Chat::V1::ChatService::Client.new
3050
+ #
3051
+ # # Create a request. To set request fields, pass in keyword arguments.
3052
+ # request = Google::Apps::Chat::V1::GetSpaceReadStateRequest.new
3053
+ #
3054
+ # # Call the get_space_read_state method.
3055
+ # result = client.get_space_read_state request
3056
+ #
3057
+ # # The returned object is of type Google::Apps::Chat::V1::SpaceReadState.
3058
+ # p result
3059
+ #
3060
+ def get_space_read_state request, options = nil
3061
+ raise ::ArgumentError, "request must be provided" if request.nil?
3062
+
3063
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::GetSpaceReadStateRequest
3064
+
3065
+ # Converts hash and nil to an options object
3066
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
3067
+
3068
+ # Customize the options with defaults
3069
+ metadata = @config.rpcs.get_space_read_state.metadata.to_h
3070
+
3071
+ # Set x-goog-api-client and x-goog-user-project headers
3072
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
3073
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
3074
+ gapic_version: ::Google::Apps::Chat::V1::VERSION
3075
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
3076
+
3077
+ header_params = {}
3078
+ if request.name
3079
+ header_params["name"] = request.name
3080
+ end
3081
+
3082
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
3083
+ metadata[:"x-goog-request-params"] ||= request_params_header
3084
+
3085
+ options.apply_defaults timeout: @config.rpcs.get_space_read_state.timeout,
3086
+ metadata: metadata,
3087
+ retry_policy: @config.rpcs.get_space_read_state.retry_policy
3088
+
3089
+ options.apply_defaults timeout: @config.timeout,
3090
+ metadata: @config.metadata,
3091
+ retry_policy: @config.retry_policy
3092
+
3093
+ @chat_service_stub.call_rpc :get_space_read_state, request, options: options do |response, operation|
3094
+ yield response, operation if block_given?
3095
+ return response
3096
+ end
3097
+ rescue ::GRPC::BadStatus => e
3098
+ raise ::Google::Cloud::Error.from_error(e)
3099
+ end
3100
+
3101
+ ##
3102
+ # Updates a user's read state within a space, used to identify read and
3103
+ # unread messages. For an example, see [Update a user's space read
3104
+ # state](https://developers.google.com/workspace/chat/update-space-read-state).
3105
+ #
3106
+ # Requires [user
3107
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
3108
+ #
3109
+ # @overload update_space_read_state(request, options = nil)
3110
+ # Pass arguments to `update_space_read_state` via a request object, either of type
3111
+ # {::Google::Apps::Chat::V1::UpdateSpaceReadStateRequest} or an equivalent Hash.
3112
+ #
3113
+ # @param request [::Google::Apps::Chat::V1::UpdateSpaceReadStateRequest, ::Hash]
3114
+ # A request object representing the call parameters. Required. To specify no
3115
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
3116
+ # @param options [::Gapic::CallOptions, ::Hash]
3117
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
3118
+ #
3119
+ # @overload update_space_read_state(space_read_state: nil, update_mask: nil)
3120
+ # Pass arguments to `update_space_read_state` via keyword arguments. Note that at
3121
+ # least one keyword argument is required. To specify no parameters, or to keep all
3122
+ # the default parameter values, pass an empty Hash as a request object (see above).
3123
+ #
3124
+ # @param space_read_state [::Google::Apps::Chat::V1::SpaceReadState, ::Hash]
3125
+ # Required. The space read state and fields to update.
3126
+ #
3127
+ # Only supports updating read state for the calling user.
3128
+ #
3129
+ # To refer to the calling user, set one of the following:
3130
+ #
3131
+ # - The `me` alias. For example, `users/me/spaces/{space}/spaceReadState`.
3132
+ #
3133
+ # - Their Workspace email address. For example,
3134
+ # `users/user@example.com/spaces/{space}/spaceReadState`.
3135
+ #
3136
+ # - Their user id. For example,
3137
+ # `users/123456789/spaces/{space}/spaceReadState`.
3138
+ #
3139
+ # Format: users/\\{user}/spaces/\\{space}/spaceReadState
3140
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
3141
+ # Required. The field paths to update. Currently supported field paths:
3142
+ #
3143
+ # - `last_read_time`
3144
+ #
3145
+ # When the `last_read_time` is before the latest message create time, the
3146
+ # space appears as unread in the UI.
3147
+ #
3148
+ # To mark the space as read, set `last_read_time` to any value later (larger)
3149
+ # than the latest message create time. The `last_read_time` is coerced to
3150
+ # match the latest message create time. Note that the space read state only
3151
+ # affects the read state of messages that are visible in the space's
3152
+ # top-level conversation. Replies in threads are unaffected by this
3153
+ # timestamp, and instead rely on the thread read state.
3154
+ #
3155
+ # @yield [response, operation] Access the result along with the RPC operation
3156
+ # @yieldparam response [::Google::Apps::Chat::V1::SpaceReadState]
3157
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
3158
+ #
3159
+ # @return [::Google::Apps::Chat::V1::SpaceReadState]
3160
+ #
3161
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
3162
+ #
3163
+ # @example Basic example
3164
+ # require "google/apps/chat/v1"
3165
+ #
3166
+ # # Create a client object. The client can be reused for multiple calls.
3167
+ # client = Google::Apps::Chat::V1::ChatService::Client.new
3168
+ #
3169
+ # # Create a request. To set request fields, pass in keyword arguments.
3170
+ # request = Google::Apps::Chat::V1::UpdateSpaceReadStateRequest.new
3171
+ #
3172
+ # # Call the update_space_read_state method.
3173
+ # result = client.update_space_read_state request
3174
+ #
3175
+ # # The returned object is of type Google::Apps::Chat::V1::SpaceReadState.
3176
+ # p result
3177
+ #
3178
+ def update_space_read_state request, options = nil
3179
+ raise ::ArgumentError, "request must be provided" if request.nil?
3180
+
3181
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::UpdateSpaceReadStateRequest
3182
+
3183
+ # Converts hash and nil to an options object
3184
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
3185
+
3186
+ # Customize the options with defaults
3187
+ metadata = @config.rpcs.update_space_read_state.metadata.to_h
3188
+
3189
+ # Set x-goog-api-client and x-goog-user-project headers
3190
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
3191
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
3192
+ gapic_version: ::Google::Apps::Chat::V1::VERSION
3193
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
3194
+
3195
+ header_params = {}
3196
+ if request.space_read_state&.name
3197
+ header_params["space_read_state.name"] = request.space_read_state.name
3198
+ end
3199
+
3200
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
3201
+ metadata[:"x-goog-request-params"] ||= request_params_header
3202
+
3203
+ options.apply_defaults timeout: @config.rpcs.update_space_read_state.timeout,
3204
+ metadata: metadata,
3205
+ retry_policy: @config.rpcs.update_space_read_state.retry_policy
3206
+
3207
+ options.apply_defaults timeout: @config.timeout,
3208
+ metadata: @config.metadata,
3209
+ retry_policy: @config.retry_policy
3210
+
3211
+ @chat_service_stub.call_rpc :update_space_read_state, request, options: options do |response, operation|
3212
+ yield response, operation if block_given?
3213
+ return response
3214
+ end
3215
+ rescue ::GRPC::BadStatus => e
3216
+ raise ::Google::Cloud::Error.from_error(e)
3217
+ end
3218
+
3219
+ ##
3220
+ # Returns details about a user's read state within a thread, used to identify
3221
+ # read and unread messages. For an example, see [Get details about a user's
3222
+ # thread read
3223
+ # state](https://developers.google.com/workspace/chat/get-thread-read-state).
3224
+ #
3225
+ # Requires [user
3226
+ # authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
3227
+ #
3228
+ # @overload get_thread_read_state(request, options = nil)
3229
+ # Pass arguments to `get_thread_read_state` via a request object, either of type
3230
+ # {::Google::Apps::Chat::V1::GetThreadReadStateRequest} or an equivalent Hash.
3231
+ #
3232
+ # @param request [::Google::Apps::Chat::V1::GetThreadReadStateRequest, ::Hash]
3233
+ # A request object representing the call parameters. Required. To specify no
3234
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
3235
+ # @param options [::Gapic::CallOptions, ::Hash]
3236
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
3237
+ #
3238
+ # @overload get_thread_read_state(name: nil)
3239
+ # Pass arguments to `get_thread_read_state` via keyword arguments. Note that at
3240
+ # least one keyword argument is required. To specify no parameters, or to keep all
3241
+ # the default parameter values, pass an empty Hash as a request object (see above).
3242
+ #
3243
+ # @param name [::String]
3244
+ # Required. Resource name of the thread read state to retrieve.
3245
+ #
3246
+ # Only supports getting read state for the calling user.
3247
+ #
3248
+ # To refer to the calling user, set one of the following:
3249
+ #
3250
+ # - The `me` alias. For example,
3251
+ # `users/me/spaces/{space}/threads/{thread}/threadReadState`.
3252
+ #
3253
+ # - Their Workspace email address. For example,
3254
+ # `users/user@example.com/spaces/{space}/threads/{thread}/threadReadState`.
3255
+ #
3256
+ # - Their user id. For example,
3257
+ # `users/123456789/spaces/{space}/threads/{thread}/threadReadState`.
3258
+ #
3259
+ # Format: users/\\{user}/spaces/\\{space}/threads/\\{thread}/threadReadState
3260
+ #
3261
+ # @yield [response, operation] Access the result along with the RPC operation
3262
+ # @yieldparam response [::Google::Apps::Chat::V1::ThreadReadState]
3263
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
3264
+ #
3265
+ # @return [::Google::Apps::Chat::V1::ThreadReadState]
3266
+ #
3267
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
3268
+ #
3269
+ # @example Basic example
3270
+ # require "google/apps/chat/v1"
3271
+ #
3272
+ # # Create a client object. The client can be reused for multiple calls.
3273
+ # client = Google::Apps::Chat::V1::ChatService::Client.new
3274
+ #
3275
+ # # Create a request. To set request fields, pass in keyword arguments.
3276
+ # request = Google::Apps::Chat::V1::GetThreadReadStateRequest.new
3277
+ #
3278
+ # # Call the get_thread_read_state method.
3279
+ # result = client.get_thread_read_state request
3280
+ #
3281
+ # # The returned object is of type Google::Apps::Chat::V1::ThreadReadState.
3282
+ # p result
3283
+ #
3284
+ def get_thread_read_state request, options = nil
3285
+ raise ::ArgumentError, "request must be provided" if request.nil?
3286
+
3287
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Chat::V1::GetThreadReadStateRequest
3288
+
3289
+ # Converts hash and nil to an options object
3290
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
3291
+
3292
+ # Customize the options with defaults
3293
+ metadata = @config.rpcs.get_thread_read_state.metadata.to_h
3294
+
3295
+ # Set x-goog-api-client and x-goog-user-project headers
3296
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
3297
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
3298
+ gapic_version: ::Google::Apps::Chat::V1::VERSION
3299
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
3300
+
3301
+ header_params = {}
3302
+ if request.name
3303
+ header_params["name"] = request.name
3304
+ end
3305
+
3306
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
3307
+ metadata[:"x-goog-request-params"] ||= request_params_header
3308
+
3309
+ options.apply_defaults timeout: @config.rpcs.get_thread_read_state.timeout,
3310
+ metadata: metadata,
3311
+ retry_policy: @config.rpcs.get_thread_read_state.retry_policy
3312
+
3313
+ options.apply_defaults timeout: @config.timeout,
3314
+ metadata: @config.metadata,
3315
+ retry_policy: @config.retry_policy
3316
+
3317
+ @chat_service_stub.call_rpc :get_thread_read_state, request, options: options do |response, operation|
3318
+ yield response, operation if block_given?
3319
+ return response
3320
+ end
3321
+ rescue ::GRPC::BadStatus => e
3322
+ raise ::Google::Cloud::Error.from_error(e)
3323
+ end
3324
+
3325
+ ##
3326
+ # Configuration class for the ChatService API.
3327
+ #
3328
+ # This class represents the configuration for ChatService,
3329
+ # providing control over timeouts, retry behavior, logging, transport
3330
+ # parameters, and other low-level controls. Certain parameters can also be
3331
+ # applied individually to specific RPCs. See
3332
+ # {::Google::Apps::Chat::V1::ChatService::Client::Configuration::Rpcs}
3333
+ # for a list of RPCs that can be configured independently.
3334
+ #
3335
+ # Configuration can be applied globally to all clients, or to a single client
3336
+ # on construction.
3337
+ #
3338
+ # @example
3339
+ #
3340
+ # # Modify the global config, setting the timeout for
3341
+ # # create_message to 20 seconds,
3342
+ # # and all remaining timeouts to 10 seconds.
3343
+ # ::Google::Apps::Chat::V1::ChatService::Client.configure do |config|
3344
+ # config.timeout = 10.0
3345
+ # config.rpcs.create_message.timeout = 20.0
3346
+ # end
3347
+ #
3348
+ # # Apply the above configuration only to a new client.
3349
+ # client = ::Google::Apps::Chat::V1::ChatService::Client.new do |config|
3350
+ # config.timeout = 10.0
3351
+ # config.rpcs.create_message.timeout = 20.0
3352
+ # end
3353
+ #
3354
+ # @!attribute [rw] endpoint
3355
+ # A custom service endpoint, as a hostname or hostname:port. The default is
3356
+ # nil, indicating to use the default endpoint in the current universe domain.
3357
+ # @return [::String,nil]
3358
+ # @!attribute [rw] credentials
3359
+ # Credentials to send with calls. You may provide any of the following types:
3360
+ # * (`String`) The path to a service account key file in JSON format
3361
+ # * (`Hash`) A service account key as a Hash
3362
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
3363
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
3364
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
3365
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
3366
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
3367
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
3368
+ # * (`nil`) indicating no credentials
3369
+ # @return [::Object]
3370
+ # @!attribute [rw] scope
3371
+ # The OAuth scopes
3372
+ # @return [::Array<::String>]
3373
+ # @!attribute [rw] lib_name
3374
+ # The library name as recorded in instrumentation and logging
3375
+ # @return [::String]
3376
+ # @!attribute [rw] lib_version
3377
+ # The library version as recorded in instrumentation and logging
3378
+ # @return [::String]
3379
+ # @!attribute [rw] channel_args
3380
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
3381
+ # `GRPC::Core::Channel` object is provided as the credential.
3382
+ # @return [::Hash]
3383
+ # @!attribute [rw] interceptors
3384
+ # An array of interceptors that are run before calls are executed.
3385
+ # @return [::Array<::GRPC::ClientInterceptor>]
3386
+ # @!attribute [rw] timeout
3387
+ # The call timeout in seconds.
3388
+ # @return [::Numeric]
3389
+ # @!attribute [rw] metadata
3390
+ # Additional gRPC headers to be sent with the call.
3391
+ # @return [::Hash{::Symbol=>::String}]
3392
+ # @!attribute [rw] retry_policy
3393
+ # The retry policy. The value is a hash with the following keys:
3394
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
3395
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
3396
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
3397
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
3398
+ # trigger a retry.
3399
+ # @return [::Hash]
3400
+ # @!attribute [rw] quota_project
3401
+ # A separate project against which to charge quota.
3402
+ # @return [::String]
3403
+ # @!attribute [rw] universe_domain
3404
+ # The universe domain within which to make requests. This determines the
3405
+ # default endpoint URL. The default value of nil uses the environment
3406
+ # universe (usually the default "googleapis.com" universe).
3407
+ # @return [::String,nil]
3408
+ #
3409
+ class Configuration
3410
+ extend ::Gapic::Config
3411
+
3412
+ # @private
3413
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
3414
+ DEFAULT_ENDPOINT = "chat.googleapis.com"
3415
+
3416
+ config_attr :endpoint, nil, ::String, nil
3417
+ config_attr :credentials, nil do |value|
3418
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
3419
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
3420
+ allowed.any? { |klass| klass === value }
3421
+ end
3422
+ config_attr :scope, nil, ::String, ::Array, nil
3423
+ config_attr :lib_name, nil, ::String, nil
3424
+ config_attr :lib_version, nil, ::String, nil
3425
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
3426
+ config_attr :interceptors, nil, ::Array, nil
3427
+ config_attr :timeout, nil, ::Numeric, nil
3428
+ config_attr :metadata, nil, ::Hash, nil
3429
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
3430
+ config_attr :quota_project, nil, ::String, nil
3431
+ config_attr :universe_domain, nil, ::String, nil
3432
+
3433
+ # @private
3434
+ def initialize parent_config = nil
3435
+ @parent_config = parent_config unless parent_config.nil?
3436
+
3437
+ yield self if block_given?
3438
+ end
3439
+
3440
+ ##
3441
+ # Configurations for individual RPCs
3442
+ # @return [Rpcs]
3443
+ #
3444
+ def rpcs
3445
+ @rpcs ||= begin
3446
+ parent_rpcs = nil
3447
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
3448
+ Rpcs.new parent_rpcs
3449
+ end
3450
+ end
3451
+
3452
+ ##
3453
+ # Configuration for the channel pool
3454
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
3455
+ #
3456
+ def channel_pool
3457
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
3458
+ end
3459
+
3460
+ ##
3461
+ # Configuration RPC class for the ChatService API.
3462
+ #
3463
+ # Includes fields providing the configuration for each RPC in this service.
3464
+ # Each configuration object is of type `Gapic::Config::Method` and includes
3465
+ # the following configuration fields:
3466
+ #
3467
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
3468
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
3469
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
3470
+ # include the following keys:
3471
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
3472
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
3473
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
3474
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
3475
+ # trigger a retry.
3476
+ #
3477
+ class Rpcs
3478
+ ##
3479
+ # RPC-specific configuration for `create_message`
3480
+ # @return [::Gapic::Config::Method]
3481
+ #
3482
+ attr_reader :create_message
3483
+ ##
3484
+ # RPC-specific configuration for `list_messages`
3485
+ # @return [::Gapic::Config::Method]
3486
+ #
3487
+ attr_reader :list_messages
3488
+ ##
3489
+ # RPC-specific configuration for `list_memberships`
3490
+ # @return [::Gapic::Config::Method]
3491
+ #
3492
+ attr_reader :list_memberships
3493
+ ##
3494
+ # RPC-specific configuration for `get_membership`
3495
+ # @return [::Gapic::Config::Method]
3496
+ #
3497
+ attr_reader :get_membership
3498
+ ##
3499
+ # RPC-specific configuration for `get_message`
3500
+ # @return [::Gapic::Config::Method]
3501
+ #
3502
+ attr_reader :get_message
3503
+ ##
3504
+ # RPC-specific configuration for `update_message`
3505
+ # @return [::Gapic::Config::Method]
3506
+ #
3507
+ attr_reader :update_message
3508
+ ##
3509
+ # RPC-specific configuration for `delete_message`
3510
+ # @return [::Gapic::Config::Method]
3511
+ #
3512
+ attr_reader :delete_message
3513
+ ##
3514
+ # RPC-specific configuration for `get_attachment`
3515
+ # @return [::Gapic::Config::Method]
3516
+ #
3517
+ attr_reader :get_attachment
3518
+ ##
3519
+ # RPC-specific configuration for `upload_attachment`
3520
+ # @return [::Gapic::Config::Method]
3521
+ #
3522
+ attr_reader :upload_attachment
3523
+ ##
3524
+ # RPC-specific configuration for `list_spaces`
3525
+ # @return [::Gapic::Config::Method]
3526
+ #
3527
+ attr_reader :list_spaces
3528
+ ##
3529
+ # RPC-specific configuration for `get_space`
3530
+ # @return [::Gapic::Config::Method]
3531
+ #
3532
+ attr_reader :get_space
3533
+ ##
3534
+ # RPC-specific configuration for `create_space`
3535
+ # @return [::Gapic::Config::Method]
3536
+ #
3537
+ attr_reader :create_space
3538
+ ##
3539
+ # RPC-specific configuration for `set_up_space`
3540
+ # @return [::Gapic::Config::Method]
3541
+ #
3542
+ attr_reader :set_up_space
3543
+ ##
3544
+ # RPC-specific configuration for `update_space`
3545
+ # @return [::Gapic::Config::Method]
3546
+ #
3547
+ attr_reader :update_space
3548
+ ##
3549
+ # RPC-specific configuration for `delete_space`
3550
+ # @return [::Gapic::Config::Method]
3551
+ #
3552
+ attr_reader :delete_space
3553
+ ##
3554
+ # RPC-specific configuration for `complete_import_space`
3555
+ # @return [::Gapic::Config::Method]
3556
+ #
3557
+ attr_reader :complete_import_space
3558
+ ##
3559
+ # RPC-specific configuration for `find_direct_message`
3560
+ # @return [::Gapic::Config::Method]
3561
+ #
3562
+ attr_reader :find_direct_message
3563
+ ##
3564
+ # RPC-specific configuration for `create_membership`
3565
+ # @return [::Gapic::Config::Method]
3566
+ #
3567
+ attr_reader :create_membership
3568
+ ##
3569
+ # RPC-specific configuration for `update_membership`
3570
+ # @return [::Gapic::Config::Method]
3571
+ #
3572
+ attr_reader :update_membership
3573
+ ##
3574
+ # RPC-specific configuration for `delete_membership`
3575
+ # @return [::Gapic::Config::Method]
3576
+ #
3577
+ attr_reader :delete_membership
3578
+ ##
3579
+ # RPC-specific configuration for `create_reaction`
3580
+ # @return [::Gapic::Config::Method]
3581
+ #
3582
+ attr_reader :create_reaction
3583
+ ##
3584
+ # RPC-specific configuration for `list_reactions`
3585
+ # @return [::Gapic::Config::Method]
3586
+ #
3587
+ attr_reader :list_reactions
3588
+ ##
3589
+ # RPC-specific configuration for `delete_reaction`
3590
+ # @return [::Gapic::Config::Method]
3591
+ #
3592
+ attr_reader :delete_reaction
3593
+ ##
3594
+ # RPC-specific configuration for `get_space_read_state`
3595
+ # @return [::Gapic::Config::Method]
3596
+ #
3597
+ attr_reader :get_space_read_state
3598
+ ##
3599
+ # RPC-specific configuration for `update_space_read_state`
3600
+ # @return [::Gapic::Config::Method]
3601
+ #
3602
+ attr_reader :update_space_read_state
3603
+ ##
3604
+ # RPC-specific configuration for `get_thread_read_state`
3605
+ # @return [::Gapic::Config::Method]
3606
+ #
3607
+ attr_reader :get_thread_read_state
3608
+
3609
+ # @private
3610
+ def initialize parent_rpcs = nil
3611
+ create_message_config = parent_rpcs.create_message if parent_rpcs.respond_to? :create_message
3612
+ @create_message = ::Gapic::Config::Method.new create_message_config
3613
+ list_messages_config = parent_rpcs.list_messages if parent_rpcs.respond_to? :list_messages
3614
+ @list_messages = ::Gapic::Config::Method.new list_messages_config
3615
+ list_memberships_config = parent_rpcs.list_memberships if parent_rpcs.respond_to? :list_memberships
3616
+ @list_memberships = ::Gapic::Config::Method.new list_memberships_config
3617
+ get_membership_config = parent_rpcs.get_membership if parent_rpcs.respond_to? :get_membership
3618
+ @get_membership = ::Gapic::Config::Method.new get_membership_config
3619
+ get_message_config = parent_rpcs.get_message if parent_rpcs.respond_to? :get_message
3620
+ @get_message = ::Gapic::Config::Method.new get_message_config
3621
+ update_message_config = parent_rpcs.update_message if parent_rpcs.respond_to? :update_message
3622
+ @update_message = ::Gapic::Config::Method.new update_message_config
3623
+ delete_message_config = parent_rpcs.delete_message if parent_rpcs.respond_to? :delete_message
3624
+ @delete_message = ::Gapic::Config::Method.new delete_message_config
3625
+ get_attachment_config = parent_rpcs.get_attachment if parent_rpcs.respond_to? :get_attachment
3626
+ @get_attachment = ::Gapic::Config::Method.new get_attachment_config
3627
+ upload_attachment_config = parent_rpcs.upload_attachment if parent_rpcs.respond_to? :upload_attachment
3628
+ @upload_attachment = ::Gapic::Config::Method.new upload_attachment_config
3629
+ list_spaces_config = parent_rpcs.list_spaces if parent_rpcs.respond_to? :list_spaces
3630
+ @list_spaces = ::Gapic::Config::Method.new list_spaces_config
3631
+ get_space_config = parent_rpcs.get_space if parent_rpcs.respond_to? :get_space
3632
+ @get_space = ::Gapic::Config::Method.new get_space_config
3633
+ create_space_config = parent_rpcs.create_space if parent_rpcs.respond_to? :create_space
3634
+ @create_space = ::Gapic::Config::Method.new create_space_config
3635
+ set_up_space_config = parent_rpcs.set_up_space if parent_rpcs.respond_to? :set_up_space
3636
+ @set_up_space = ::Gapic::Config::Method.new set_up_space_config
3637
+ update_space_config = parent_rpcs.update_space if parent_rpcs.respond_to? :update_space
3638
+ @update_space = ::Gapic::Config::Method.new update_space_config
3639
+ delete_space_config = parent_rpcs.delete_space if parent_rpcs.respond_to? :delete_space
3640
+ @delete_space = ::Gapic::Config::Method.new delete_space_config
3641
+ complete_import_space_config = parent_rpcs.complete_import_space if parent_rpcs.respond_to? :complete_import_space
3642
+ @complete_import_space = ::Gapic::Config::Method.new complete_import_space_config
3643
+ find_direct_message_config = parent_rpcs.find_direct_message if parent_rpcs.respond_to? :find_direct_message
3644
+ @find_direct_message = ::Gapic::Config::Method.new find_direct_message_config
3645
+ create_membership_config = parent_rpcs.create_membership if parent_rpcs.respond_to? :create_membership
3646
+ @create_membership = ::Gapic::Config::Method.new create_membership_config
3647
+ update_membership_config = parent_rpcs.update_membership if parent_rpcs.respond_to? :update_membership
3648
+ @update_membership = ::Gapic::Config::Method.new update_membership_config
3649
+ delete_membership_config = parent_rpcs.delete_membership if parent_rpcs.respond_to? :delete_membership
3650
+ @delete_membership = ::Gapic::Config::Method.new delete_membership_config
3651
+ create_reaction_config = parent_rpcs.create_reaction if parent_rpcs.respond_to? :create_reaction
3652
+ @create_reaction = ::Gapic::Config::Method.new create_reaction_config
3653
+ list_reactions_config = parent_rpcs.list_reactions if parent_rpcs.respond_to? :list_reactions
3654
+ @list_reactions = ::Gapic::Config::Method.new list_reactions_config
3655
+ delete_reaction_config = parent_rpcs.delete_reaction if parent_rpcs.respond_to? :delete_reaction
3656
+ @delete_reaction = ::Gapic::Config::Method.new delete_reaction_config
3657
+ get_space_read_state_config = parent_rpcs.get_space_read_state if parent_rpcs.respond_to? :get_space_read_state
3658
+ @get_space_read_state = ::Gapic::Config::Method.new get_space_read_state_config
3659
+ update_space_read_state_config = parent_rpcs.update_space_read_state if parent_rpcs.respond_to? :update_space_read_state
3660
+ @update_space_read_state = ::Gapic::Config::Method.new update_space_read_state_config
3661
+ get_thread_read_state_config = parent_rpcs.get_thread_read_state if parent_rpcs.respond_to? :get_thread_read_state
3662
+ @get_thread_read_state = ::Gapic::Config::Method.new get_thread_read_state_config
3663
+
3664
+ yield self if block_given?
3665
+ end
3666
+ end
3667
+ end
3668
+ end
3669
+ end
3670
+ end
3671
+ end
3672
+ end
3673
+ end