xdk 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +123 -0
  4. data/lib/xdk/client.rb +410 -0
  5. data/lib/xdk/clients/account_activity_client.rb +109 -0
  6. data/lib/xdk/clients/account_client.rb +53 -0
  7. data/lib/xdk/clients/activity_client.rb +119 -0
  8. data/lib/xdk/clients/articles_client.rb +54 -0
  9. data/lib/xdk/clients/bots_client.rb +138 -0
  10. data/lib/xdk/clients/broadcasts_client.rb +854 -0
  11. data/lib/xdk/clients/calls_client.rb +255 -0
  12. data/lib/xdk/clients/chat_client.rb +1017 -0
  13. data/lib/xdk/clients/communities_client.rb +69 -0
  14. data/lib/xdk/clients/community_notes_client.rb +147 -0
  15. data/lib/xdk/clients/compliance_client.rb +157 -0
  16. data/lib/xdk/clients/connections_client.rb +102 -0
  17. data/lib/xdk/clients/direct_messages_client.rb +269 -0
  18. data/lib/xdk/clients/general_client.rb +34 -0
  19. data/lib/xdk/clients/lists_client.rb +245 -0
  20. data/lib/xdk/clients/media_client.rb +400 -0
  21. data/lib/xdk/clients/news_client.rb +67 -0
  22. data/lib/xdk/clients/posts_client.rb +596 -0
  23. data/lib/xdk/clients/spaces_client.rb +222 -0
  24. data/lib/xdk/clients/stream_client.rb +690 -0
  25. data/lib/xdk/clients/trends_client.rb +81 -0
  26. data/lib/xdk/clients/usage_client.rb +57 -0
  27. data/lib/xdk/clients/users_client.rb +1280 -0
  28. data/lib/xdk/clients/webhooks_client.rb +164 -0
  29. data/lib/xdk/errors.rb +69 -0
  30. data/lib/xdk/http_client.rb +126 -0
  31. data/lib/xdk/oauth1.rb +183 -0
  32. data/lib/xdk/oauth2_pkce.rb +156 -0
  33. data/lib/xdk/paginator.rb +41 -0
  34. data/lib/xdk/streaming.rb +294 -0
  35. data/lib/xdk/version.rb +9 -0
  36. data/lib/xdk.rb +62 -0
  37. metadata +84 -0
@@ -0,0 +1,1017 @@
1
+ # AUTO-GENERATED FILE - DO NOT EDIT
2
+ # This file was automatically generated by the XDK build tool.
3
+ # Any manual changes will be overwritten on the next generation.
4
+ # frozen_string_literal: true
5
+
6
+ require "uri"
7
+
8
+ module Xdk
9
+ module Clients
10
+ # Auto-generated chat client for the X API v2.
11
+ class ChatClient
12
+ def initialize(client)
13
+ @client = client
14
+ end
15
+
16
+ # Turn On Disappearing Messages in a Chat Conversation
17
+ def update_conversation_message_ttl(id:, body:)
18
+ path = +"/2/chat/conversations/{id}/message_ttl"
19
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
20
+
21
+ query = {}
22
+
23
+ headers = {}
24
+ @client.execute_request(
25
+ method: "PUT",
26
+ path: path,
27
+ schemes: ["OAuth2UserToken", "UserToken"],
28
+ query: query,
29
+ headers: headers,
30
+ body: body,
31
+ binary_request: false,
32
+ binary_response: false
33
+ )
34
+ end
35
+
36
+ # Finalize Chat Media Upload
37
+ def media_upload_finalize(id:, body:)
38
+ path = +"/2/chat/media/upload/{id}/finalize"
39
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
40
+
41
+ query = {}
42
+
43
+ headers = {}
44
+ @client.execute_request(
45
+ method: "POST",
46
+ path: path,
47
+ schemes: ["OAuth2UserToken", "UserToken"],
48
+ query: query,
49
+ headers: headers,
50
+ body: body,
51
+ binary_request: false,
52
+ binary_response: false
53
+ )
54
+ end
55
+
56
+ # Mark Conversation as Read
57
+ def mark_conversation_read(id:, body:)
58
+ path = +"/2/chat/conversations/{id}/read"
59
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
60
+
61
+ query = {}
62
+
63
+ headers = {}
64
+ @client.execute_request(
65
+ method: "POST",
66
+ path: path,
67
+ schemes: ["OAuth2UserToken", "UserToken"],
68
+ query: query,
69
+ headers: headers,
70
+ body: body,
71
+ binary_request: false,
72
+ binary_response: false
73
+ )
74
+ end
75
+
76
+ # Enable a Chat Group Invite Link
77
+ def enable_group_invite(id:, body:)
78
+ path = +"/2/chat/conversations/{id}/invite"
79
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
80
+
81
+ query = {}
82
+
83
+ headers = {}
84
+ @client.execute_request(
85
+ method: "POST",
86
+ path: path,
87
+ schemes: ["OAuth2UserToken", "UserToken"],
88
+ query: query,
89
+ headers: headers,
90
+ body: body,
91
+ binary_request: false,
92
+ binary_response: false
93
+ )
94
+ end
95
+
96
+ # Get Chat Conversation
97
+ def get_conversation(id:, chat_conversation_fields: nil, expansions: nil, user_fields: nil)
98
+ path = +"/2/chat/conversations/{id}"
99
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
100
+
101
+ query = {}
102
+ unless chat_conversation_fields.nil?
103
+ query["chat_conversation.fields"] = chat_conversation_fields.is_a?(Array) ? chat_conversation_fields.map(&:to_s).join(",") : chat_conversation_fields.to_s
104
+ end
105
+ unless expansions.nil?
106
+ query["expansions"] = expansions.is_a?(Array) ? expansions.map(&:to_s).join(",") : expansions.to_s
107
+ end
108
+ unless user_fields.nil?
109
+ query["user.fields"] = user_fields.is_a?(Array) ? user_fields.map(&:to_s).join(",") : user_fields.to_s
110
+ end
111
+
112
+ headers = {}
113
+ @client.execute_request(
114
+ method: "GET",
115
+ path: path,
116
+ schemes: ["OAuth2UserToken", "UserToken"],
117
+ query: query,
118
+ headers: headers,
119
+ binary_response: false
120
+ )
121
+ end
122
+
123
+ # Update a Chat Group Conversation
124
+ def update_group(id:, body:)
125
+ path = +"/2/chat/conversations/{id}"
126
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
127
+
128
+ query = {}
129
+
130
+ headers = {}
131
+ @client.execute_request(
132
+ method: "PUT",
133
+ path: path,
134
+ schemes: ["OAuth2UserToken", "UserToken"],
135
+ query: query,
136
+ headers: headers,
137
+ body: body,
138
+ binary_request: false,
139
+ binary_response: false
140
+ )
141
+ end
142
+
143
+ # Delete a Chat Conversation Using the Legacy Route
144
+ def delete_conversation_legacy(id:, body:)
145
+ path = +"/2/chat/conversations/{id}"
146
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
147
+
148
+ query = {}
149
+
150
+ headers = {}
151
+ @client.execute_request(
152
+ method: "DELETE",
153
+ path: path,
154
+ schemes: ["OAuth2UserToken", "UserToken"],
155
+ query: query,
156
+ headers: headers,
157
+ body: body,
158
+ binary_request: false,
159
+ binary_response: false
160
+ )
161
+ end
162
+
163
+ # Get Chat Conversations
164
+ def get_conversations(max_results: nil, pagination_token: nil, unread_only: nil, type: nil, is_archived: nil, is_muted: nil, participant_ids: nil, participant_query: nil, start_time: nil, end_time: nil, chat_conversation_fields: nil, expansions: nil, user_fields: nil, &block)
165
+ path = +"/2/chat/conversations"
166
+
167
+ query = {}
168
+ unless max_results.nil?
169
+ query["max_results"] = max_results.to_s
170
+ end
171
+ unless unread_only.nil?
172
+ query["unread_only"] = unread_only.to_s.downcase
173
+ end
174
+ unless type.nil?
175
+ query["type"] = type.to_s
176
+ end
177
+ unless is_archived.nil?
178
+ query["is_archived"] = is_archived.to_s.downcase
179
+ end
180
+ unless is_muted.nil?
181
+ query["is_muted"] = is_muted.to_s.downcase
182
+ end
183
+ unless participant_ids.nil?
184
+ query["participant_ids"] = participant_ids.is_a?(Array) ? participant_ids.map(&:to_s).join(",") : participant_ids.to_s
185
+ end
186
+ unless participant_query.nil?
187
+ query["participant_query"] = participant_query.to_s
188
+ end
189
+ unless start_time.nil?
190
+ query["start_time"] = start_time.to_s
191
+ end
192
+ unless end_time.nil?
193
+ query["end_time"] = end_time.to_s
194
+ end
195
+ unless chat_conversation_fields.nil?
196
+ query["chat_conversation.fields"] = chat_conversation_fields.is_a?(Array) ? chat_conversation_fields.map(&:to_s).join(",") : chat_conversation_fields.to_s
197
+ end
198
+ unless expansions.nil?
199
+ query["expansions"] = expansions.is_a?(Array) ? expansions.map(&:to_s).join(",") : expansions.to_s
200
+ end
201
+ unless user_fields.nil?
202
+ query["user.fields"] = user_fields.is_a?(Array) ? user_fields.map(&:to_s).join(",") : user_fields.to_s
203
+ end
204
+
205
+ headers = {}
206
+ enum = @client.execute_paginated(
207
+ method: "GET",
208
+ path: path,
209
+ schemes: ["OAuth2UserToken", "UserToken"],
210
+ pagination_param: "pagination_token",
211
+ initial_token: pagination_token,
212
+ base_query: query,
213
+ headers: headers
214
+ )
215
+ block ? enum.each(&block) : enum
216
+ end
217
+
218
+ # Add Public Key
219
+ def add_user_public_key(id:, body:)
220
+ path = +"/2/users/{id}/public_keys"
221
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
222
+
223
+ query = {}
224
+
225
+ headers = {}
226
+ @client.execute_request(
227
+ method: "POST",
228
+ path: path,
229
+ schemes: ["OAuth2UserToken", "UserToken"],
230
+ query: query,
231
+ headers: headers,
232
+ body: body,
233
+ binary_request: false,
234
+ binary_response: false
235
+ )
236
+ end
237
+
238
+ # Get Chat Settings
239
+ def get_settings(chat_settings_fields: nil)
240
+ path = +"/2/chat/settings"
241
+
242
+ query = {}
243
+ unless chat_settings_fields.nil?
244
+ query["chat_settings.fields"] = chat_settings_fields.is_a?(Array) ? chat_settings_fields.map(&:to_s).join(",") : chat_settings_fields.to_s
245
+ end
246
+
247
+ headers = {}
248
+ @client.execute_request(
249
+ method: "GET",
250
+ path: path,
251
+ schemes: ["OAuth2UserToken", "UserToken"],
252
+ query: query,
253
+ headers: headers,
254
+ binary_response: false
255
+ )
256
+ end
257
+
258
+ # Update Chat Settings
259
+ def update_settings(body:)
260
+ path = +"/2/chat/settings"
261
+
262
+ query = {}
263
+
264
+ headers = {}
265
+ @client.execute_request(
266
+ method: "PUT",
267
+ path: path,
268
+ schemes: ["OAuth2UserToken", "UserToken"],
269
+ query: query,
270
+ headers: headers,
271
+ body: body,
272
+ binary_request: false,
273
+ binary_response: false
274
+ )
275
+ end
276
+
277
+ # Add Members to a Chat Group Conversation
278
+ def add_group_members(id:, body:)
279
+ path = +"/2/chat/conversations/{id}/members"
280
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
281
+
282
+ query = {}
283
+
284
+ headers = {}
285
+ @client.execute_request(
286
+ method: "POST",
287
+ path: path,
288
+ schemes: ["OAuth2UserToken", "UserToken"],
289
+ query: query,
290
+ headers: headers,
291
+ body: body,
292
+ binary_request: false,
293
+ binary_response: false
294
+ )
295
+ end
296
+
297
+ # Disable a Chat Group Invite Link
298
+ def disable_group_invite(id:, body:)
299
+ path = +"/2/chat/conversations/{id}/invite/disable"
300
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
301
+
302
+ query = {}
303
+
304
+ headers = {}
305
+ @client.execute_request(
306
+ method: "POST",
307
+ path: path,
308
+ schemes: ["OAuth2UserToken", "UserToken"],
309
+ query: query,
310
+ headers: headers,
311
+ body: body,
312
+ binary_request: false,
313
+ binary_response: false
314
+ )
315
+ end
316
+
317
+ # Get a Chat Group Invite Link
318
+ def get_group_invite(id:, token:, chat_group_invite_fields: nil)
319
+ path = +"/2/chat/conversations/{id}/invites/{token}"
320
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
321
+ path.gsub!("{token}", URI.encode_www_form_component(token.to_s))
322
+
323
+ query = {}
324
+ unless chat_group_invite_fields.nil?
325
+ query["chat_group_invite.fields"] = chat_group_invite_fields.is_a?(Array) ? chat_group_invite_fields.map(&:to_s).join(",") : chat_group_invite_fields.to_s
326
+ end
327
+
328
+ headers = {}
329
+ @client.execute_request(
330
+ method: "GET",
331
+ path: path,
332
+ schemes: ["OAuth2UserToken", "UserToken"],
333
+ query: query,
334
+ headers: headers,
335
+ binary_response: false
336
+ )
337
+ end
338
+
339
+ # Add Admins to a Chat Group Conversation
340
+ def add_group_admins(id:, body:)
341
+ path = +"/2/chat/conversations/{id}/admins"
342
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
343
+
344
+ query = {}
345
+
346
+ headers = {}
347
+ @client.execute_request(
348
+ method: "POST",
349
+ path: path,
350
+ schemes: ["OAuth2UserToken", "UserToken"],
351
+ query: query,
352
+ headers: headers,
353
+ body: body,
354
+ binary_request: false,
355
+ binary_response: false
356
+ )
357
+ end
358
+
359
+ # Approve an Admin Request in a Chat Group Conversation
360
+ def approve_group_admin_request(id:, user_id:, body:)
361
+ path = +"/2/chat/conversations/{id}/admin_requests/{user_id}/approve"
362
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
363
+ path.gsub!("{user_id}", URI.encode_www_form_component(user_id.to_s))
364
+
365
+ query = {}
366
+
367
+ headers = {}
368
+ @client.execute_request(
369
+ method: "POST",
370
+ path: path,
371
+ schemes: ["OAuth2UserToken", "UserToken"],
372
+ query: query,
373
+ headers: headers,
374
+ body: body,
375
+ binary_request: false,
376
+ binary_response: false
377
+ )
378
+ end
379
+
380
+ # Get Chat Conversation Pinned Messages
381
+ def get_conversation_pinned_messages(id:, pagination_token: nil, chat_pinned_message_fields: nil, &block)
382
+ path = +"/2/chat/conversations/{id}/pinned_messages"
383
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
384
+
385
+ query = {}
386
+ unless chat_pinned_message_fields.nil?
387
+ query["chat_pinned_message.fields"] = chat_pinned_message_fields.is_a?(Array) ? chat_pinned_message_fields.map(&:to_s).join(",") : chat_pinned_message_fields.to_s
388
+ end
389
+
390
+ headers = {}
391
+ enum = @client.execute_paginated(
392
+ method: "GET",
393
+ path: path,
394
+ schemes: ["OAuth2UserToken", "UserToken"],
395
+ pagination_param: "pagination_token",
396
+ initial_token: pagination_token,
397
+ base_query: query,
398
+ headers: headers
399
+ )
400
+ block ? enum.each(&block) : enum
401
+ end
402
+
403
+ # Reject Join Requests for a Chat Group Conversation
404
+ def reject_group_join_requests(id:, body:)
405
+ path = +"/2/chat/conversations/{id}/join_requests/reject"
406
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
407
+
408
+ query = {}
409
+
410
+ headers = {}
411
+ @client.execute_request(
412
+ method: "POST",
413
+ path: path,
414
+ schemes: ["OAuth2UserToken", "UserToken"],
415
+ query: query,
416
+ headers: headers,
417
+ body: body,
418
+ binary_request: false,
419
+ binary_response: false
420
+ )
421
+ end
422
+
423
+ # Turn Off Disappearing Messages in a Chat Conversation
424
+ def delete_conversation_message_ttl(id:, body:)
425
+ path = +"/2/chat/conversations/{id}/message_ttl/remove"
426
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
427
+
428
+ query = {}
429
+
430
+ headers = {}
431
+ @client.execute_request(
432
+ method: "POST",
433
+ path: path,
434
+ schemes: ["OAuth2UserToken", "UserToken"],
435
+ query: query,
436
+ headers: headers,
437
+ body: body,
438
+ binary_request: false,
439
+ binary_response: false
440
+ )
441
+ end
442
+
443
+ # Mark Conversation as Unread
444
+ def mark_conversation_unread(id:)
445
+ path = +"/2/chat/conversations/{id}/unread"
446
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
447
+
448
+ query = {}
449
+
450
+ headers = {}
451
+ @client.execute_request(
452
+ method: "POST",
453
+ path: path,
454
+ schemes: ["OAuth2UserToken", "UserToken"],
455
+ query: query,
456
+ headers: headers,
457
+ binary_response: false
458
+ )
459
+ end
460
+
461
+ # Update the Admin-Only Settings of a Chat Group Conversation
462
+ def update_group_admin_settings(id:, body:)
463
+ path = +"/2/chat/conversations/{id}/admin_settings"
464
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
465
+
466
+ query = {}
467
+
468
+ headers = {}
469
+ @client.execute_request(
470
+ method: "PUT",
471
+ path: path,
472
+ schemes: ["OAuth2UserToken", "UserToken"],
473
+ query: query,
474
+ headers: headers,
475
+ body: body,
476
+ binary_request: false,
477
+ binary_response: false
478
+ )
479
+ end
480
+
481
+ # Reject an Admin Request in a Chat Group Conversation
482
+ def reject_group_admin_request(id:, user_id:, body:)
483
+ path = +"/2/chat/conversations/{id}/admin_requests/{user_id}/reject"
484
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
485
+ path.gsub!("{user_id}", URI.encode_www_form_component(user_id.to_s))
486
+
487
+ query = {}
488
+
489
+ headers = {}
490
+ @client.execute_request(
491
+ method: "POST",
492
+ path: path,
493
+ schemes: ["OAuth2UserToken", "UserToken"],
494
+ query: query,
495
+ headers: headers,
496
+ body: body,
497
+ binary_request: false,
498
+ binary_response: false
499
+ )
500
+ end
501
+
502
+ # Get Chat Message Requests
503
+ def get_message_requests(inbox_type: nil, max_results: nil, pagination_token: nil, chat_message_request_fields: nil, &block)
504
+ path = +"/2/chat/message_requests"
505
+
506
+ query = {}
507
+ unless inbox_type.nil?
508
+ query["inbox_type"] = inbox_type.to_s
509
+ end
510
+ unless max_results.nil?
511
+ query["max_results"] = max_results.to_s
512
+ end
513
+ unless chat_message_request_fields.nil?
514
+ query["chat_message_request.fields"] = chat_message_request_fields.is_a?(Array) ? chat_message_request_fields.map(&:to_s).join(",") : chat_message_request_fields.to_s
515
+ end
516
+
517
+ headers = {}
518
+ enum = @client.execute_paginated(
519
+ method: "GET",
520
+ path: path,
521
+ schemes: ["OAuth2UserToken", "UserToken"],
522
+ pagination_param: "pagination_token",
523
+ initial_token: pagination_token,
524
+ base_query: query,
525
+ headers: headers
526
+ )
527
+ block ? enum.each(&block) : enum
528
+ end
529
+
530
+ # Send Chat Message
531
+ def send_message(id:, body:)
532
+ path = +"/2/chat/conversations/{id}/messages"
533
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
534
+
535
+ query = {}
536
+
537
+ headers = {}
538
+ @client.execute_request(
539
+ method: "POST",
540
+ path: path,
541
+ schemes: ["OAuth2UserToken", "UserToken"],
542
+ query: query,
543
+ headers: headers,
544
+ body: body,
545
+ binary_request: false,
546
+ binary_response: false
547
+ )
548
+ end
549
+
550
+ # Request to Join a Chat Group
551
+ def create_group_join_request(id:, body:)
552
+ path = +"/2/chat/conversations/{id}/join_requests"
553
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
554
+
555
+ query = {}
556
+
557
+ headers = {}
558
+ @client.execute_request(
559
+ method: "POST",
560
+ path: path,
561
+ schemes: ["OAuth2UserToken", "UserToken"],
562
+ query: query,
563
+ headers: headers,
564
+ body: body,
565
+ binary_request: false,
566
+ binary_response: false
567
+ )
568
+ end
569
+
570
+ # Get Chat Message Request
571
+ def get_message_request(id:, chat_message_request_detail_fields: nil)
572
+ path = +"/2/chat/message_requests/{id}"
573
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
574
+
575
+ query = {}
576
+ unless chat_message_request_detail_fields.nil?
577
+ query["chat_message_request_detail.fields"] = chat_message_request_detail_fields.is_a?(Array) ? chat_message_request_detail_fields.map(&:to_s).join(",") : chat_message_request_detail_fields.to_s
578
+ end
579
+
580
+ headers = {}
581
+ @client.execute_request(
582
+ method: "GET",
583
+ path: path,
584
+ schemes: ["OAuth2UserToken", "UserToken"],
585
+ query: query,
586
+ headers: headers,
587
+ binary_response: false
588
+ )
589
+ end
590
+
591
+ # Get Chat Conversation Events
592
+ def get_conversation_events(id:, max_results: nil, pagination_token: nil, chat_message_event_fields: nil, &block)
593
+ path = +"/2/chat/conversations/{id}/events"
594
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
595
+
596
+ query = {}
597
+ unless max_results.nil?
598
+ query["max_results"] = max_results.to_s
599
+ end
600
+ unless chat_message_event_fields.nil?
601
+ query["chat_message_event.fields"] = chat_message_event_fields.is_a?(Array) ? chat_message_event_fields.map(&:to_s).join(",") : chat_message_event_fields.to_s
602
+ end
603
+
604
+ headers = {}
605
+ enum = @client.execute_paginated(
606
+ method: "GET",
607
+ path: path,
608
+ schemes: ["OAuth2UserToken", "UserToken"],
609
+ pagination_param: "pagination_token",
610
+ initial_token: pagination_token,
611
+ base_query: query,
612
+ headers: headers
613
+ )
614
+ block ? enum.each(&block) : enum
615
+ end
616
+
617
+ # Delete Chat Messages
618
+ def delete_messages(id:, body:)
619
+ path = +"/2/chat/conversations/{id}/messages/delete"
620
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
621
+
622
+ query = {}
623
+
624
+ headers = {}
625
+ @client.execute_request(
626
+ method: "POST",
627
+ path: path,
628
+ schemes: ["OAuth2UserToken", "UserToken"],
629
+ query: query,
630
+ headers: headers,
631
+ body: body,
632
+ binary_request: false,
633
+ binary_response: false
634
+ )
635
+ end
636
+
637
+ # Mute a Chat Conversation
638
+ def mute_conversation(id:, body:)
639
+ path = +"/2/chat/conversations/{id}/mute"
640
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
641
+
642
+ query = {}
643
+
644
+ headers = {}
645
+ @client.execute_request(
646
+ method: "POST",
647
+ path: path,
648
+ schemes: ["OAuth2UserToken", "UserToken"],
649
+ query: query,
650
+ headers: headers,
651
+ body: body,
652
+ binary_request: false,
653
+ binary_response: false
654
+ )
655
+ end
656
+
657
+ # Remove Members from a Chat Group Conversation
658
+ def remove_group_members(id:, body:)
659
+ path = +"/2/chat/conversations/{id}/members/remove"
660
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
661
+
662
+ query = {}
663
+
664
+ headers = {}
665
+ @client.execute_request(
666
+ method: "POST",
667
+ path: path,
668
+ schemes: ["OAuth2UserToken", "UserToken"],
669
+ query: query,
670
+ headers: headers,
671
+ body: body,
672
+ binary_request: false,
673
+ binary_response: false
674
+ )
675
+ end
676
+
677
+ # Get Pending Admin Requests for a Chat Group Conversation
678
+ def get_group_admin_requests(id:, pagination_token: nil, user_fields: nil, expansions: nil, post_fields: nil, &block)
679
+ path = +"/2/chat/conversations/{id}/admin_requests"
680
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
681
+
682
+ query = {}
683
+ unless user_fields.nil?
684
+ query["user.fields"] = user_fields.is_a?(Array) ? user_fields.map(&:to_s).join(",") : user_fields.to_s
685
+ end
686
+ unless expansions.nil?
687
+ query["expansions"] = expansions.is_a?(Array) ? expansions.map(&:to_s).join(",") : expansions.to_s
688
+ end
689
+ unless post_fields.nil?
690
+ query["post.fields"] = post_fields.is_a?(Array) ? post_fields.map(&:to_s).join(",") : post_fields.to_s
691
+ end
692
+
693
+ headers = {}
694
+ enum = @client.execute_paginated(
695
+ method: "GET",
696
+ path: path,
697
+ schemes: ["OAuth2UserToken", "UserToken"],
698
+ pagination_param: "pagination_token",
699
+ initial_token: pagination_token,
700
+ base_query: query,
701
+ headers: headers
702
+ )
703
+ block ? enum.each(&block) : enum
704
+ end
705
+
706
+ # Request Admin Permissions in a Chat Group Conversation
707
+ def create_group_admin_request(id:, body:)
708
+ path = +"/2/chat/conversations/{id}/admin_requests"
709
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
710
+
711
+ query = {}
712
+
713
+ headers = {}
714
+ @client.execute_request(
715
+ method: "POST",
716
+ path: path,
717
+ schemes: ["OAuth2UserToken", "UserToken"],
718
+ query: query,
719
+ headers: headers,
720
+ body: body,
721
+ binary_request: false,
722
+ binary_response: false
723
+ )
724
+ end
725
+
726
+ # Initialize Chat Media Upload
727
+ def media_upload_initialize(body:)
728
+ path = +"/2/chat/media/upload/initialize"
729
+
730
+ query = {}
731
+
732
+ headers = {}
733
+ @client.execute_request(
734
+ method: "POST",
735
+ path: path,
736
+ schemes: ["OAuth2UserToken", "UserToken"],
737
+ query: query,
738
+ headers: headers,
739
+ body: body,
740
+ binary_request: false,
741
+ binary_response: false
742
+ )
743
+ end
744
+
745
+ # Add Conversation Keys
746
+ def add_conversation_keys(id:, body:)
747
+ path = +"/2/chat/conversations/{id}/keys"
748
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
749
+
750
+ query = {}
751
+
752
+ headers = {}
753
+ @client.execute_request(
754
+ method: "POST",
755
+ path: path,
756
+ schemes: ["OAuth2UserToken", "UserToken"],
757
+ query: query,
758
+ headers: headers,
759
+ body: body,
760
+ binary_request: false,
761
+ binary_response: false
762
+ )
763
+ end
764
+
765
+ # Create Chat Group Conversation
766
+ def create_conversation(body:)
767
+ path = +"/2/chat/conversations/group"
768
+
769
+ query = {}
770
+
771
+ headers = {}
772
+ @client.execute_request(
773
+ method: "POST",
774
+ path: path,
775
+ schemes: ["OAuth2UserToken", "UserToken"],
776
+ query: query,
777
+ headers: headers,
778
+ body: body,
779
+ binary_request: false,
780
+ binary_response: false
781
+ )
782
+ end
783
+
784
+ # Unarchive a Chat Conversation
785
+ def unarchive_conversation(id:, body:)
786
+ path = +"/2/chat/conversations/{id}/unarchive"
787
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
788
+
789
+ query = {}
790
+
791
+ headers = {}
792
+ @client.execute_request(
793
+ method: "POST",
794
+ path: path,
795
+ schemes: ["OAuth2UserToken", "UserToken"],
796
+ query: query,
797
+ headers: headers,
798
+ body: body,
799
+ binary_request: false,
800
+ binary_response: false
801
+ )
802
+ end
803
+
804
+ # Remove Admins from a Chat Group Conversation
805
+ def remove_group_admins(id:, body:)
806
+ path = +"/2/chat/conversations/{id}/admins/remove"
807
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
808
+
809
+ query = {}
810
+
811
+ headers = {}
812
+ @client.execute_request(
813
+ method: "POST",
814
+ path: path,
815
+ schemes: ["OAuth2UserToken", "UserToken"],
816
+ query: query,
817
+ headers: headers,
818
+ body: body,
819
+ binary_request: false,
820
+ binary_response: false
821
+ )
822
+ end
823
+
824
+ # Append Chat Media Upload
825
+ def media_upload_append(id:, body:)
826
+ path = +"/2/chat/media/upload/{id}/append"
827
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
828
+
829
+ query = {}
830
+
831
+ headers = {}
832
+ @client.execute_request(
833
+ method: "POST",
834
+ path: path,
835
+ schemes: ["OAuth2UserToken", "UserToken"],
836
+ query: query,
837
+ headers: headers,
838
+ body: body,
839
+ binary_request: false,
840
+ binary_response: false
841
+ )
842
+ end
843
+
844
+ # Update Screen Capture Settings for a Chat Conversation
845
+ def update_conversation_screen_capture(id:, body:)
846
+ path = +"/2/chat/conversations/{id}/screen_capture"
847
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
848
+
849
+ query = {}
850
+
851
+ headers = {}
852
+ @client.execute_request(
853
+ method: "PUT",
854
+ path: path,
855
+ schemes: ["OAuth2UserToken", "UserToken"],
856
+ query: query,
857
+ headers: headers,
858
+ body: body,
859
+ binary_request: false,
860
+ binary_response: false
861
+ )
862
+ end
863
+
864
+ # Delete a Chat Conversation
865
+ def delete_conversation(id:, body:)
866
+ path = +"/2/chat/conversations/{id}/delete"
867
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
868
+
869
+ query = {}
870
+
871
+ headers = {}
872
+ @client.execute_request(
873
+ method: "POST",
874
+ path: path,
875
+ schemes: ["OAuth2UserToken", "UserToken"],
876
+ query: query,
877
+ headers: headers,
878
+ body: body,
879
+ binary_request: false,
880
+ binary_response: false
881
+ )
882
+ end
883
+
884
+ # Download Chat Media
885
+ def media_download(id:, media_hash_key:)
886
+ path = +"/2/chat/media/{id}/{media_hash_key}"
887
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
888
+ path.gsub!("{media_hash_key}", URI.encode_www_form_component(media_hash_key.to_s))
889
+
890
+ query = {}
891
+
892
+ headers = {}
893
+ @client.execute_request(
894
+ method: "GET",
895
+ path: path,
896
+ schemes: ["OAuth2UserToken", "UserToken"],
897
+ query: query,
898
+ headers: headers,
899
+ binary_response: true
900
+ )
901
+ end
902
+
903
+ # Accept a Chat Message Request
904
+ def accept_message_request(id:)
905
+ path = +"/2/chat/message_requests/{id}/accept"
906
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
907
+
908
+ query = {}
909
+
910
+ headers = {}
911
+ @client.execute_request(
912
+ method: "POST",
913
+ path: path,
914
+ schemes: ["OAuth2UserToken", "UserToken"],
915
+ query: query,
916
+ headers: headers,
917
+ binary_response: false
918
+ )
919
+ end
920
+
921
+ # Initialize Chat Group
922
+ def initialize_group()
923
+ path = +"/2/chat/conversations/group/initialize"
924
+
925
+ query = {}
926
+
927
+ headers = {}
928
+ @client.execute_request(
929
+ method: "POST",
930
+ path: path,
931
+ schemes: ["OAuth2UserToken", "UserToken"],
932
+ query: query,
933
+ headers: headers,
934
+ binary_response: false
935
+ )
936
+ end
937
+
938
+ # Archive a Chat Conversation
939
+ def archive_conversation(id:, body:)
940
+ path = +"/2/chat/conversations/{id}/archive"
941
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
942
+
943
+ query = {}
944
+
945
+ headers = {}
946
+ @client.execute_request(
947
+ method: "POST",
948
+ path: path,
949
+ schemes: ["OAuth2UserToken", "UserToken"],
950
+ query: query,
951
+ headers: headers,
952
+ body: body,
953
+ binary_request: false,
954
+ binary_response: false
955
+ )
956
+ end
957
+
958
+ # Unarchive a Chat Conversation Using the Legacy Route
959
+ def unarchive_conversation_legacy(id:, body:)
960
+ path = +"/2/chat/conversations/{id}/archive"
961
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
962
+
963
+ query = {}
964
+
965
+ headers = {}
966
+ @client.execute_request(
967
+ method: "DELETE",
968
+ path: path,
969
+ schemes: ["OAuth2UserToken", "UserToken"],
970
+ query: query,
971
+ headers: headers,
972
+ body: body,
973
+ binary_request: false,
974
+ binary_response: false
975
+ )
976
+ end
977
+
978
+ # Send Typing Indicator
979
+ def send_typing_indicator(id:)
980
+ path = +"/2/chat/conversations/{id}/typing"
981
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
982
+
983
+ query = {}
984
+
985
+ headers = {}
986
+ @client.execute_request(
987
+ method: "POST",
988
+ path: path,
989
+ schemes: ["OAuth2UserToken", "UserToken"],
990
+ query: query,
991
+ headers: headers,
992
+ binary_response: false
993
+ )
994
+ end
995
+
996
+ # Unmute a Chat Conversation
997
+ def unmute_conversation(id:, body:)
998
+ path = +"/2/chat/conversations/{id}/unmute"
999
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
1000
+
1001
+ query = {}
1002
+
1003
+ headers = {}
1004
+ @client.execute_request(
1005
+ method: "POST",
1006
+ path: path,
1007
+ schemes: ["OAuth2UserToken", "UserToken"],
1008
+ query: query,
1009
+ headers: headers,
1010
+ body: body,
1011
+ binary_request: false,
1012
+ binary_response: false
1013
+ )
1014
+ end
1015
+ end
1016
+ end
1017
+ end