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

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