google-apis-chat_v1 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,716 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'google/apis/core/base_service'
16
+ require 'google/apis/core/json_representation'
17
+ require 'google/apis/core/hashable'
18
+ require 'google/apis/errors'
19
+
20
+ module Google
21
+ module Apis
22
+ module ChatV1
23
+ # Hangouts Chat API
24
+ #
25
+ # Enables bots to fetch information and perform actions in Hangouts Chat.
26
+ #
27
+ # @example
28
+ # require 'google/apis/chat_v1'
29
+ #
30
+ # Chat = Google::Apis::ChatV1 # Alias the module
31
+ # service = Chat::HangoutsChatService.new
32
+ #
33
+ # @see https://developers.google.com/hangouts/chat
34
+ class HangoutsChatService < Google::Apis::Core::BaseService
35
+ # @return [String]
36
+ # API key. Your API key identifies your project and provides you with API access,
37
+ # quota, and reports. Required unless you provide an OAuth 2.0 token.
38
+ attr_accessor :key
39
+
40
+ # @return [String]
41
+ # Available to use for quota purposes for server-side applications. Can be any
42
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
43
+ attr_accessor :quota_user
44
+
45
+ def initialize
46
+ super('https://chat.googleapis.com/', '',
47
+ client_name: 'google-apis-chat_v1',
48
+ client_version: Google::Apis::ChatV1::GEM_VERSION)
49
+ @batch_path = 'batch'
50
+ end
51
+
52
+ # Legacy path for creating message. Calling these will result in a BadRequest
53
+ # response.
54
+ # @param [String] parent
55
+ # Required. Space resource name, in the form "spaces/*". Example: spaces/
56
+ # AAAAMpdlehY
57
+ # @param [Google::Apis::ChatV1::Message] message_object
58
+ # @param [String] thread_key
59
+ # Opaque thread identifier string that can be specified to group messages into a
60
+ # single thread. If this is the first message with a given thread identifier, a
61
+ # new thread is created. Subsequent messages with the same thread identifier
62
+ # will be posted into the same thread. This relieves bots and webhooks from
63
+ # having to store the Hangouts Chat thread ID of a thread (created earlier by
64
+ # them) to post further updates to it. Has no effect if thread field,
65
+ # corresponding to an existing thread, is set in message.
66
+ # @param [String] fields
67
+ # Selector specifying which fields to include in a partial response.
68
+ # @param [String] quota_user
69
+ # Available to use for quota purposes for server-side applications. Can be any
70
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
71
+ # @param [Google::Apis::RequestOptions] options
72
+ # Request-specific options
73
+ #
74
+ # @yield [result, err] Result & error if block supplied
75
+ # @yieldparam result [Google::Apis::ChatV1::Message] parsed result object
76
+ # @yieldparam err [StandardError] error object if request failed
77
+ #
78
+ # @return [Google::Apis::ChatV1::Message]
79
+ #
80
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
81
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
82
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
83
+ def messages_dm(parent, message_object = nil, thread_key: nil, fields: nil, quota_user: nil, options: nil, &block)
84
+ command = make_simple_command(:post, 'v1/{+parent}/messages', options)
85
+ command.request_representation = Google::Apis::ChatV1::Message::Representation
86
+ command.request_object = message_object
87
+ command.response_representation = Google::Apis::ChatV1::Message::Representation
88
+ command.response_class = Google::Apis::ChatV1::Message
89
+ command.params['parent'] = parent unless parent.nil?
90
+ command.query['threadKey'] = thread_key unless thread_key.nil?
91
+ command.query['fields'] = fields unless fields.nil?
92
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
93
+ execute_or_queue_command(command, &block)
94
+ end
95
+
96
+ # Legacy path for creating message. Calling these will result in a BadRequest
97
+ # response.
98
+ # @param [String] parent
99
+ # Required. Space resource name, in the form "spaces/*". Example: spaces/
100
+ # AAAAMpdlehY
101
+ # @param [Google::Apis::ChatV1::Message] message_object
102
+ # @param [String] thread_key
103
+ # Opaque thread identifier string that can be specified to group messages into a
104
+ # single thread. If this is the first message with a given thread identifier, a
105
+ # new thread is created. Subsequent messages with the same thread identifier
106
+ # will be posted into the same thread. This relieves bots and webhooks from
107
+ # having to store the Hangouts Chat thread ID of a thread (created earlier by
108
+ # them) to post further updates to it. Has no effect if thread field,
109
+ # corresponding to an existing thread, is set in message.
110
+ # @param [String] fields
111
+ # Selector specifying which fields to include in a partial response.
112
+ # @param [String] quota_user
113
+ # Available to use for quota purposes for server-side applications. Can be any
114
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
115
+ # @param [Google::Apis::RequestOptions] options
116
+ # Request-specific options
117
+ #
118
+ # @yield [result, err] Result & error if block supplied
119
+ # @yieldparam result [Google::Apis::ChatV1::Message] parsed result object
120
+ # @yieldparam err [StandardError] error object if request failed
121
+ #
122
+ # @return [Google::Apis::ChatV1::Message]
123
+ #
124
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
125
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
126
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
127
+ def webhooks_dm(parent, message_object = nil, thread_key: nil, fields: nil, quota_user: nil, options: nil, &block)
128
+ command = make_simple_command(:post, 'v1/{+parent}/webhooks', options)
129
+ command.request_representation = Google::Apis::ChatV1::Message::Representation
130
+ command.request_object = message_object
131
+ command.response_representation = Google::Apis::ChatV1::Message::Representation
132
+ command.response_class = Google::Apis::ChatV1::Message
133
+ command.params['parent'] = parent unless parent.nil?
134
+ command.query['threadKey'] = thread_key unless thread_key.nil?
135
+ command.query['fields'] = fields unless fields.nil?
136
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
137
+ execute_or_queue_command(command, &block)
138
+ end
139
+
140
+ # Legacy path for creating message. Calling these will result in a BadRequest
141
+ # response.
142
+ # @param [String] parent
143
+ # Required. Space resource name, in the form "spaces/*". Example: spaces/
144
+ # AAAAMpdlehY
145
+ # @param [Google::Apis::ChatV1::Message] message_object
146
+ # @param [String] thread_key
147
+ # Opaque thread identifier string that can be specified to group messages into a
148
+ # single thread. If this is the first message with a given thread identifier, a
149
+ # new thread is created. Subsequent messages with the same thread identifier
150
+ # will be posted into the same thread. This relieves bots and webhooks from
151
+ # having to store the Hangouts Chat thread ID of a thread (created earlier by
152
+ # them) to post further updates to it. Has no effect if thread field,
153
+ # corresponding to an existing thread, is set in message.
154
+ # @param [String] fields
155
+ # Selector specifying which fields to include in a partial response.
156
+ # @param [String] quota_user
157
+ # Available to use for quota purposes for server-side applications. Can be any
158
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
159
+ # @param [Google::Apis::RequestOptions] options
160
+ # Request-specific options
161
+ #
162
+ # @yield [result, err] Result & error if block supplied
163
+ # @yieldparam result [Google::Apis::ChatV1::Message] parsed result object
164
+ # @yieldparam err [StandardError] error object if request failed
165
+ #
166
+ # @return [Google::Apis::ChatV1::Message]
167
+ #
168
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
169
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
170
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
171
+ def messages_dm_conversation(parent, message_object = nil, thread_key: nil, fields: nil, quota_user: nil, options: nil, &block)
172
+ command = make_simple_command(:post, 'v1/{+parent}/messages', options)
173
+ command.request_representation = Google::Apis::ChatV1::Message::Representation
174
+ command.request_object = message_object
175
+ command.response_representation = Google::Apis::ChatV1::Message::Representation
176
+ command.response_class = Google::Apis::ChatV1::Message
177
+ command.params['parent'] = parent unless parent.nil?
178
+ command.query['threadKey'] = thread_key unless thread_key.nil?
179
+ command.query['fields'] = fields unless fields.nil?
180
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
181
+ execute_or_queue_command(command, &block)
182
+ end
183
+
184
+ # Downloads media. Download is supported on the URI `/v1/media/`+name`?alt=media`
185
+ # .
186
+ # @param [String] resource_name
187
+ # Name of the media that is being downloaded. See ReadRequest.resource_name.
188
+ # @param [String] fields
189
+ # Selector specifying which fields to include in a partial response.
190
+ # @param [String] quota_user
191
+ # Available to use for quota purposes for server-side applications. Can be any
192
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
193
+ # @param [IO, String] download_dest
194
+ # IO stream or filename to receive content download
195
+ # @param [Google::Apis::RequestOptions] options
196
+ # Request-specific options
197
+ #
198
+ # @yield [result, err] Result & error if block supplied
199
+ # @yieldparam result [Google::Apis::ChatV1::Media] parsed result object
200
+ # @yieldparam err [StandardError] error object if request failed
201
+ #
202
+ # @return [Google::Apis::ChatV1::Media]
203
+ #
204
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
205
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
206
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
207
+ def download_medium(resource_name, fields: nil, quota_user: nil, download_dest: nil, options: nil, &block)
208
+ if download_dest.nil?
209
+ command = make_simple_command(:get, 'v1/media/{+resourceName}', options)
210
+ else
211
+ command = make_download_command(:get, 'v1/media/{+resourceName}', options)
212
+ command.download_dest = download_dest
213
+ end
214
+ command.response_representation = Google::Apis::ChatV1::Media::Representation
215
+ command.response_class = Google::Apis::ChatV1::Media
216
+ command.params['resourceName'] = resource_name unless resource_name.nil?
217
+ command.query['fields'] = fields unless fields.nil?
218
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
219
+ execute_or_queue_command(command, &block)
220
+ end
221
+
222
+ # Legacy path for creating message. Calling these will result in a BadRequest
223
+ # response.
224
+ # @param [String] parent
225
+ # Required. Space resource name, in the form "spaces/*". Example: spaces/
226
+ # AAAAMpdlehY
227
+ # @param [Google::Apis::ChatV1::Message] message_object
228
+ # @param [String] thread_key
229
+ # Opaque thread identifier string that can be specified to group messages into a
230
+ # single thread. If this is the first message with a given thread identifier, a
231
+ # new thread is created. Subsequent messages with the same thread identifier
232
+ # will be posted into the same thread. This relieves bots and webhooks from
233
+ # having to store the Hangouts Chat thread ID of a thread (created earlier by
234
+ # them) to post further updates to it. Has no effect if thread field,
235
+ # corresponding to an existing thread, is set in message.
236
+ # @param [String] fields
237
+ # Selector specifying which fields to include in a partial response.
238
+ # @param [String] quota_user
239
+ # Available to use for quota purposes for server-side applications. Can be any
240
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
241
+ # @param [Google::Apis::RequestOptions] options
242
+ # Request-specific options
243
+ #
244
+ # @yield [result, err] Result & error if block supplied
245
+ # @yieldparam result [Google::Apis::ChatV1::Message] parsed result object
246
+ # @yieldparam err [StandardError] error object if request failed
247
+ #
248
+ # @return [Google::Apis::ChatV1::Message]
249
+ #
250
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
251
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
252
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
253
+ def messages_room(parent, message_object = nil, thread_key: nil, fields: nil, quota_user: nil, options: nil, &block)
254
+ command = make_simple_command(:post, 'v1/{+parent}/messages', options)
255
+ command.request_representation = Google::Apis::ChatV1::Message::Representation
256
+ command.request_object = message_object
257
+ command.response_representation = Google::Apis::ChatV1::Message::Representation
258
+ command.response_class = Google::Apis::ChatV1::Message
259
+ command.params['parent'] = parent unless parent.nil?
260
+ command.query['threadKey'] = thread_key unless thread_key.nil?
261
+ command.query['fields'] = fields unless fields.nil?
262
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
263
+ execute_or_queue_command(command, &block)
264
+ end
265
+
266
+ # Legacy path for creating message. Calling these will result in a BadRequest
267
+ # response.
268
+ # @param [String] parent
269
+ # Required. Space resource name, in the form "spaces/*". Example: spaces/
270
+ # AAAAMpdlehY
271
+ # @param [Google::Apis::ChatV1::Message] message_object
272
+ # @param [String] thread_key
273
+ # Opaque thread identifier string that can be specified to group messages into a
274
+ # single thread. If this is the first message with a given thread identifier, a
275
+ # new thread is created. Subsequent messages with the same thread identifier
276
+ # will be posted into the same thread. This relieves bots and webhooks from
277
+ # having to store the Hangouts Chat thread ID of a thread (created earlier by
278
+ # them) to post further updates to it. Has no effect if thread field,
279
+ # corresponding to an existing thread, is set in message.
280
+ # @param [String] fields
281
+ # Selector specifying which fields to include in a partial response.
282
+ # @param [String] quota_user
283
+ # Available to use for quota purposes for server-side applications. Can be any
284
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
285
+ # @param [Google::Apis::RequestOptions] options
286
+ # Request-specific options
287
+ #
288
+ # @yield [result, err] Result & error if block supplied
289
+ # @yieldparam result [Google::Apis::ChatV1::Message] parsed result object
290
+ # @yieldparam err [StandardError] error object if request failed
291
+ #
292
+ # @return [Google::Apis::ChatV1::Message]
293
+ #
294
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
295
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
296
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
297
+ def webhooks_room(parent, message_object = nil, thread_key: nil, fields: nil, quota_user: nil, options: nil, &block)
298
+ command = make_simple_command(:post, 'v1/{+parent}/webhooks', options)
299
+ command.request_representation = Google::Apis::ChatV1::Message::Representation
300
+ command.request_object = message_object
301
+ command.response_representation = Google::Apis::ChatV1::Message::Representation
302
+ command.response_class = Google::Apis::ChatV1::Message
303
+ command.params['parent'] = parent unless parent.nil?
304
+ command.query['threadKey'] = thread_key unless thread_key.nil?
305
+ command.query['fields'] = fields unless fields.nil?
306
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
307
+ execute_or_queue_command(command, &block)
308
+ end
309
+
310
+ # Legacy path for creating message. Calling these will result in a BadRequest
311
+ # response.
312
+ # @param [String] parent
313
+ # Required. Space resource name, in the form "spaces/*". Example: spaces/
314
+ # AAAAMpdlehY
315
+ # @param [Google::Apis::ChatV1::Message] message_object
316
+ # @param [String] thread_key
317
+ # Opaque thread identifier string that can be specified to group messages into a
318
+ # single thread. If this is the first message with a given thread identifier, a
319
+ # new thread is created. Subsequent messages with the same thread identifier
320
+ # will be posted into the same thread. This relieves bots and webhooks from
321
+ # having to store the Hangouts Chat thread ID of a thread (created earlier by
322
+ # them) to post further updates to it. Has no effect if thread field,
323
+ # corresponding to an existing thread, is set in message.
324
+ # @param [String] fields
325
+ # Selector specifying which fields to include in a partial response.
326
+ # @param [String] quota_user
327
+ # Available to use for quota purposes for server-side applications. Can be any
328
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
329
+ # @param [Google::Apis::RequestOptions] options
330
+ # Request-specific options
331
+ #
332
+ # @yield [result, err] Result & error if block supplied
333
+ # @yieldparam result [Google::Apis::ChatV1::Message] parsed result object
334
+ # @yieldparam err [StandardError] error object if request failed
335
+ #
336
+ # @return [Google::Apis::ChatV1::Message]
337
+ #
338
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
339
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
340
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
341
+ def messages_room_conversation(parent, message_object = nil, thread_key: nil, fields: nil, quota_user: nil, options: nil, &block)
342
+ command = make_simple_command(:post, 'v1/{+parent}/messages', options)
343
+ command.request_representation = Google::Apis::ChatV1::Message::Representation
344
+ command.request_object = message_object
345
+ command.response_representation = Google::Apis::ChatV1::Message::Representation
346
+ command.response_class = Google::Apis::ChatV1::Message
347
+ command.params['parent'] = parent unless parent.nil?
348
+ command.query['threadKey'] = thread_key unless thread_key.nil?
349
+ command.query['fields'] = fields unless fields.nil?
350
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
351
+ execute_or_queue_command(command, &block)
352
+ end
353
+
354
+ # Returns a space.
355
+ # @param [String] name
356
+ # Required. Resource name of the space, in the form "spaces/*". Example: spaces/
357
+ # AAAAMpdlehY
358
+ # @param [String] fields
359
+ # Selector specifying which fields to include in a partial response.
360
+ # @param [String] quota_user
361
+ # Available to use for quota purposes for server-side applications. Can be any
362
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
363
+ # @param [Google::Apis::RequestOptions] options
364
+ # Request-specific options
365
+ #
366
+ # @yield [result, err] Result & error if block supplied
367
+ # @yieldparam result [Google::Apis::ChatV1::Space] parsed result object
368
+ # @yieldparam err [StandardError] error object if request failed
369
+ #
370
+ # @return [Google::Apis::ChatV1::Space]
371
+ #
372
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
373
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
374
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
375
+ def get_space(name, fields: nil, quota_user: nil, options: nil, &block)
376
+ command = make_simple_command(:get, 'v1/{+name}', options)
377
+ command.response_representation = Google::Apis::ChatV1::Space::Representation
378
+ command.response_class = Google::Apis::ChatV1::Space
379
+ command.params['name'] = name unless name.nil?
380
+ command.query['fields'] = fields unless fields.nil?
381
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
382
+ execute_or_queue_command(command, &block)
383
+ end
384
+
385
+ # Lists spaces the caller is a member of.
386
+ # @param [Fixnum] page_size
387
+ # Requested page size. The value is capped at 1000. Server may return fewer
388
+ # results than requested. If unspecified, server will default to 100.
389
+ # @param [String] page_token
390
+ # A token identifying a page of results the server should return.
391
+ # @param [String] fields
392
+ # Selector specifying which fields to include in a partial response.
393
+ # @param [String] quota_user
394
+ # Available to use for quota purposes for server-side applications. Can be any
395
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
396
+ # @param [Google::Apis::RequestOptions] options
397
+ # Request-specific options
398
+ #
399
+ # @yield [result, err] Result & error if block supplied
400
+ # @yieldparam result [Google::Apis::ChatV1::ListSpacesResponse] parsed result object
401
+ # @yieldparam err [StandardError] error object if request failed
402
+ #
403
+ # @return [Google::Apis::ChatV1::ListSpacesResponse]
404
+ #
405
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
406
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
407
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
408
+ def list_spaces(page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
409
+ command = make_simple_command(:get, 'v1/spaces', options)
410
+ command.response_representation = Google::Apis::ChatV1::ListSpacesResponse::Representation
411
+ command.response_class = Google::Apis::ChatV1::ListSpacesResponse
412
+ command.query['pageSize'] = page_size unless page_size.nil?
413
+ command.query['pageToken'] = page_token unless page_token.nil?
414
+ command.query['fields'] = fields unless fields.nil?
415
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
416
+ execute_or_queue_command(command, &block)
417
+ end
418
+
419
+ # Legacy path for creating message. Calling these will result in a BadRequest
420
+ # response.
421
+ # @param [String] parent
422
+ # Required. Space resource name, in the form "spaces/*". Example: spaces/
423
+ # AAAAMpdlehY
424
+ # @param [Google::Apis::ChatV1::Message] message_object
425
+ # @param [String] thread_key
426
+ # Opaque thread identifier string that can be specified to group messages into a
427
+ # single thread. If this is the first message with a given thread identifier, a
428
+ # new thread is created. Subsequent messages with the same thread identifier
429
+ # will be posted into the same thread. This relieves bots and webhooks from
430
+ # having to store the Hangouts Chat thread ID of a thread (created earlier by
431
+ # them) to post further updates to it. Has no effect if thread field,
432
+ # corresponding to an existing thread, is set in message.
433
+ # @param [String] fields
434
+ # Selector specifying which fields to include in a partial response.
435
+ # @param [String] quota_user
436
+ # Available to use for quota purposes for server-side applications. Can be any
437
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
438
+ # @param [Google::Apis::RequestOptions] options
439
+ # Request-specific options
440
+ #
441
+ # @yield [result, err] Result & error if block supplied
442
+ # @yieldparam result [Google::Apis::ChatV1::Message] parsed result object
443
+ # @yieldparam err [StandardError] error object if request failed
444
+ #
445
+ # @return [Google::Apis::ChatV1::Message]
446
+ #
447
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
448
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
449
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
450
+ def webhooks_space(parent, message_object = nil, thread_key: nil, fields: nil, quota_user: nil, options: nil, &block)
451
+ command = make_simple_command(:post, 'v1/{+parent}/webhooks', options)
452
+ command.request_representation = Google::Apis::ChatV1::Message::Representation
453
+ command.request_object = message_object
454
+ command.response_representation = Google::Apis::ChatV1::Message::Representation
455
+ command.response_class = Google::Apis::ChatV1::Message
456
+ command.params['parent'] = parent unless parent.nil?
457
+ command.query['threadKey'] = thread_key unless thread_key.nil?
458
+ command.query['fields'] = fields unless fields.nil?
459
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
460
+ execute_or_queue_command(command, &block)
461
+ end
462
+
463
+ # Returns a membership.
464
+ # @param [String] name
465
+ # Required. Resource name of the membership to be retrieved, in the form "spaces/
466
+ # */members/*". Example: spaces/AAAAMpdlehY/members/105115627578887013105
467
+ # @param [String] fields
468
+ # Selector specifying which fields to include in a partial response.
469
+ # @param [String] quota_user
470
+ # Available to use for quota purposes for server-side applications. Can be any
471
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
472
+ # @param [Google::Apis::RequestOptions] options
473
+ # Request-specific options
474
+ #
475
+ # @yield [result, err] Result & error if block supplied
476
+ # @yieldparam result [Google::Apis::ChatV1::Membership] parsed result object
477
+ # @yieldparam err [StandardError] error object if request failed
478
+ #
479
+ # @return [Google::Apis::ChatV1::Membership]
480
+ #
481
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
482
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
483
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
484
+ def get_space_member(name, fields: nil, quota_user: nil, options: nil, &block)
485
+ command = make_simple_command(:get, 'v1/{+name}', options)
486
+ command.response_representation = Google::Apis::ChatV1::Membership::Representation
487
+ command.response_class = Google::Apis::ChatV1::Membership
488
+ command.params['name'] = name unless name.nil?
489
+ command.query['fields'] = fields unless fields.nil?
490
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
491
+ execute_or_queue_command(command, &block)
492
+ end
493
+
494
+ # Lists human memberships in a space.
495
+ # @param [String] parent
496
+ # Required. The resource name of the space for which membership list is to be
497
+ # fetched, in the form "spaces/*". Example: spaces/AAAAMpdlehY
498
+ # @param [Fixnum] page_size
499
+ # Requested page size. The value is capped at 1000. Server may return fewer
500
+ # results than requested. If unspecified, server will default to 100.
501
+ # @param [String] page_token
502
+ # A token identifying a page of results the server should return.
503
+ # @param [String] fields
504
+ # Selector specifying which fields to include in a partial response.
505
+ # @param [String] quota_user
506
+ # Available to use for quota purposes for server-side applications. Can be any
507
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
508
+ # @param [Google::Apis::RequestOptions] options
509
+ # Request-specific options
510
+ #
511
+ # @yield [result, err] Result & error if block supplied
512
+ # @yieldparam result [Google::Apis::ChatV1::ListMembershipsResponse] parsed result object
513
+ # @yieldparam err [StandardError] error object if request failed
514
+ #
515
+ # @return [Google::Apis::ChatV1::ListMembershipsResponse]
516
+ #
517
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
518
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
519
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
520
+ def list_space_members(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
521
+ command = make_simple_command(:get, 'v1/{+parent}/members', options)
522
+ command.response_representation = Google::Apis::ChatV1::ListMembershipsResponse::Representation
523
+ command.response_class = Google::Apis::ChatV1::ListMembershipsResponse
524
+ command.params['parent'] = parent unless parent.nil?
525
+ command.query['pageSize'] = page_size unless page_size.nil?
526
+ command.query['pageToken'] = page_token unless page_token.nil?
527
+ command.query['fields'] = fields unless fields.nil?
528
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
529
+ execute_or_queue_command(command, &block)
530
+ end
531
+
532
+ # Creates a message.
533
+ # @param [String] parent
534
+ # Required. Space resource name, in the form "spaces/*". Example: spaces/
535
+ # AAAAMpdlehY
536
+ # @param [Google::Apis::ChatV1::Message] message_object
537
+ # @param [String] thread_key
538
+ # Opaque thread identifier string that can be specified to group messages into a
539
+ # single thread. If this is the first message with a given thread identifier, a
540
+ # new thread is created. Subsequent messages with the same thread identifier
541
+ # will be posted into the same thread. This relieves bots and webhooks from
542
+ # having to store the Hangouts Chat thread ID of a thread (created earlier by
543
+ # them) to post further updates to it. Has no effect if thread field,
544
+ # corresponding to an existing thread, is set in message.
545
+ # @param [String] fields
546
+ # Selector specifying which fields to include in a partial response.
547
+ # @param [String] quota_user
548
+ # Available to use for quota purposes for server-side applications. Can be any
549
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
550
+ # @param [Google::Apis::RequestOptions] options
551
+ # Request-specific options
552
+ #
553
+ # @yield [result, err] Result & error if block supplied
554
+ # @yieldparam result [Google::Apis::ChatV1::Message] parsed result object
555
+ # @yieldparam err [StandardError] error object if request failed
556
+ #
557
+ # @return [Google::Apis::ChatV1::Message]
558
+ #
559
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
560
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
561
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
562
+ def create_space_message(parent, message_object = nil, thread_key: nil, fields: nil, quota_user: nil, options: nil, &block)
563
+ command = make_simple_command(:post, 'v1/{+parent}/messages', options)
564
+ command.request_representation = Google::Apis::ChatV1::Message::Representation
565
+ command.request_object = message_object
566
+ command.response_representation = Google::Apis::ChatV1::Message::Representation
567
+ command.response_class = Google::Apis::ChatV1::Message
568
+ command.params['parent'] = parent unless parent.nil?
569
+ command.query['threadKey'] = thread_key unless thread_key.nil?
570
+ command.query['fields'] = fields unless fields.nil?
571
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
572
+ execute_or_queue_command(command, &block)
573
+ end
574
+
575
+ # Deletes a message.
576
+ # @param [String] name
577
+ # Required. Resource name of the message to be deleted, in the form "spaces/*/
578
+ # messages/*" Example: spaces/AAAAMpdlehY/messages/UMxbHmzDlr4.UMxbHmzDlr4
579
+ # @param [String] fields
580
+ # Selector specifying which fields to include in a partial response.
581
+ # @param [String] quota_user
582
+ # Available to use for quota purposes for server-side applications. Can be any
583
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
584
+ # @param [Google::Apis::RequestOptions] options
585
+ # Request-specific options
586
+ #
587
+ # @yield [result, err] Result & error if block supplied
588
+ # @yieldparam result [Google::Apis::ChatV1::Empty] parsed result object
589
+ # @yieldparam err [StandardError] error object if request failed
590
+ #
591
+ # @return [Google::Apis::ChatV1::Empty]
592
+ #
593
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
594
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
595
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
596
+ def delete_space_message(name, fields: nil, quota_user: nil, options: nil, &block)
597
+ command = make_simple_command(:delete, 'v1/{+name}', options)
598
+ command.response_representation = Google::Apis::ChatV1::Empty::Representation
599
+ command.response_class = Google::Apis::ChatV1::Empty
600
+ command.params['name'] = name unless name.nil?
601
+ command.query['fields'] = fields unless fields.nil?
602
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
603
+ execute_or_queue_command(command, &block)
604
+ end
605
+
606
+ # Returns a message.
607
+ # @param [String] name
608
+ # Required. Resource name of the message to be retrieved, in the form "spaces/*/
609
+ # messages/*". Example: spaces/AAAAMpdlehY/messages/UMxbHmzDlr4.UMxbHmzDlr4
610
+ # @param [String] fields
611
+ # Selector specifying which fields to include in a partial response.
612
+ # @param [String] quota_user
613
+ # Available to use for quota purposes for server-side applications. Can be any
614
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
615
+ # @param [Google::Apis::RequestOptions] options
616
+ # Request-specific options
617
+ #
618
+ # @yield [result, err] Result & error if block supplied
619
+ # @yieldparam result [Google::Apis::ChatV1::Message] parsed result object
620
+ # @yieldparam err [StandardError] error object if request failed
621
+ #
622
+ # @return [Google::Apis::ChatV1::Message]
623
+ #
624
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
625
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
626
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
627
+ def get_space_message(name, fields: nil, quota_user: nil, options: nil, &block)
628
+ command = make_simple_command(:get, 'v1/{+name}', options)
629
+ command.response_representation = Google::Apis::ChatV1::Message::Representation
630
+ command.response_class = Google::Apis::ChatV1::Message
631
+ command.params['name'] = name unless name.nil?
632
+ command.query['fields'] = fields unless fields.nil?
633
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
634
+ execute_or_queue_command(command, &block)
635
+ end
636
+
637
+ # Updates a message.
638
+ # @param [String] name
639
+ # Resource name, in the form "spaces/*/messages/*". Example: spaces/AAAAMpdlehY/
640
+ # messages/UMxbHmzDlr4.UMxbHmzDlr4
641
+ # @param [Google::Apis::ChatV1::Message] message_object
642
+ # @param [String] update_mask
643
+ # Required. The field paths to be updated, comma separated if there are multiple.
644
+ # Currently supported field paths: * text * cards
645
+ # @param [String] fields
646
+ # Selector specifying which fields to include in a partial response.
647
+ # @param [String] quota_user
648
+ # Available to use for quota purposes for server-side applications. Can be any
649
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
650
+ # @param [Google::Apis::RequestOptions] options
651
+ # Request-specific options
652
+ #
653
+ # @yield [result, err] Result & error if block supplied
654
+ # @yieldparam result [Google::Apis::ChatV1::Message] parsed result object
655
+ # @yieldparam err [StandardError] error object if request failed
656
+ #
657
+ # @return [Google::Apis::ChatV1::Message]
658
+ #
659
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
660
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
661
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
662
+ def update_space_message(name, message_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
663
+ command = make_simple_command(:put, 'v1/{+name}', options)
664
+ command.request_representation = Google::Apis::ChatV1::Message::Representation
665
+ command.request_object = message_object
666
+ command.response_representation = Google::Apis::ChatV1::Message::Representation
667
+ command.response_class = Google::Apis::ChatV1::Message
668
+ command.params['name'] = name unless name.nil?
669
+ command.query['updateMask'] = update_mask unless update_mask.nil?
670
+ command.query['fields'] = fields unless fields.nil?
671
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
672
+ execute_or_queue_command(command, &block)
673
+ end
674
+
675
+ # Gets the metadata of a message attachment. The attachment data is fetched
676
+ # using the media API.
677
+ # @param [String] name
678
+ # Resource name of the attachment, in the form "spaces/*/messages/*/attachments/*
679
+ # ".
680
+ # @param [String] fields
681
+ # Selector specifying which fields to include in a partial response.
682
+ # @param [String] quota_user
683
+ # Available to use for quota purposes for server-side applications. Can be any
684
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
685
+ # @param [Google::Apis::RequestOptions] options
686
+ # Request-specific options
687
+ #
688
+ # @yield [result, err] Result & error if block supplied
689
+ # @yieldparam result [Google::Apis::ChatV1::Attachment] parsed result object
690
+ # @yieldparam err [StandardError] error object if request failed
691
+ #
692
+ # @return [Google::Apis::ChatV1::Attachment]
693
+ #
694
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
695
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
696
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
697
+ def get_space_message_attachment(name, fields: nil, quota_user: nil, options: nil, &block)
698
+ command = make_simple_command(:get, 'v1/{+name}', options)
699
+ command.response_representation = Google::Apis::ChatV1::Attachment::Representation
700
+ command.response_class = Google::Apis::ChatV1::Attachment
701
+ command.params['name'] = name unless name.nil?
702
+ command.query['fields'] = fields unless fields.nil?
703
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
704
+ execute_or_queue_command(command, &block)
705
+ end
706
+
707
+ protected
708
+
709
+ def apply_command_defaults(command)
710
+ command.query['key'] = key unless key.nil?
711
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
712
+ end
713
+ end
714
+ end
715
+ end
716
+ end