lib_discord 0.1.0.pre2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/lib/lib_discord/application.rb +43 -0
  3. data/lib/lib_discord/application_command.rb +341 -0
  4. data/lib/lib_discord/application_role_connection_metadata.rb +52 -0
  5. data/lib/lib_discord/audit_log.rb +36 -0
  6. data/lib/lib_discord/auto_moderation.rb +106 -0
  7. data/lib/lib_discord/channel.rb +716 -0
  8. data/lib/lib_discord/client.rb +124 -14
  9. data/lib/lib_discord/emoji.rb +106 -0
  10. data/lib/lib_discord/errors.rb +24 -0
  11. data/lib/lib_discord/guild.rb +830 -0
  12. data/lib/lib_discord/guild_scheduled_event.rb +133 -0
  13. data/lib/lib_discord/guild_template.rb +128 -0
  14. data/lib/lib_discord/interaction.rb +163 -0
  15. data/lib/lib_discord/invite.rb +47 -0
  16. data/lib/lib_discord/mappers/application_command_option_types.rb +22 -0
  17. data/lib/lib_discord/mappers/application_command_permission_types.rb +14 -0
  18. data/lib/lib_discord/mappers/application_command_types.rb +14 -0
  19. data/lib/lib_discord/mappers/application_integration_types.rb +13 -0
  20. data/lib/lib_discord/mappers/application_role_connection_metadata_types.rb +19 -0
  21. data/lib/lib_discord/mappers/audit_log_events.rb +67 -0
  22. data/lib/lib_discord/mappers/auto_moderation_action_types.rb +14 -0
  23. data/lib/lib_discord/mappers/auto_moderation_event_types.rb +12 -0
  24. data/lib/lib_discord/mappers/auto_moderation_keyword_preset_types.rb +14 -0
  25. data/lib/lib_discord/mappers/auto_moderation_trigger_types.rb +15 -0
  26. data/lib/lib_discord/mappers/channel_forum_layout_types.rb +14 -0
  27. data/lib/lib_discord/mappers/channel_message_activity_types.rb +15 -0
  28. data/lib/lib_discord/mappers/channel_message_types.rb +42 -0
  29. data/lib/lib_discord/mappers/channel_sort_order_types.rb +13 -0
  30. data/lib/lib_discord/mappers/channel_types.rb +24 -0
  31. data/lib/lib_discord/mappers/channel_video_quality_modes.rb +13 -0
  32. data/lib/lib_discord/mappers/guild_default_message_notification_levels.rb +13 -0
  33. data/lib/lib_discord/mappers/guild_explicit_content_filter_levels.rb +14 -0
  34. data/lib/lib_discord/mappers/guild_integration_expire_behaviors.rb +13 -0
  35. data/lib/lib_discord/mappers/guild_mfa_levels.rb +13 -0
  36. data/lib/lib_discord/mappers/guild_nsfw_levels.rb +15 -0
  37. data/lib/lib_discord/mappers/guild_onboarding_modes.rb +13 -0
  38. data/lib/lib_discord/mappers/guild_premium_tiers.rb +15 -0
  39. data/lib/lib_discord/mappers/guild_prompt_types.rb +13 -0
  40. data/lib/lib_discord/mappers/guild_scheduled_event_entity_types.rb +14 -0
  41. data/lib/lib_discord/mappers/guild_scheduled_event_privacy_levels.rb +12 -0
  42. data/lib/lib_discord/mappers/guild_scheduled_event_statuses.rb +15 -0
  43. data/lib/lib_discord/mappers/guild_verification_levels.rb +16 -0
  44. data/lib/lib_discord/mappers/interaction_callback_types.rb +19 -0
  45. data/lib/lib_discord/mappers/interaction_context_types.rb +14 -0
  46. data/lib/lib_discord/mappers/interaction_types.rb +16 -0
  47. data/lib/lib_discord/mappers/invite_target_types.rb +13 -0
  48. data/lib/lib_discord/mappers/message_component_button_styles.rb +16 -0
  49. data/lib/lib_discord/mappers/message_component_text_input_styles.rb +13 -0
  50. data/lib/lib_discord/mappers/message_component_types.rb +19 -0
  51. data/lib/lib_discord/mappers/poll_layout_types.rb +12 -0
  52. data/lib/lib_discord/mappers/stage_instance_privacy_levels.rb +13 -0
  53. data/lib/lib_discord/mappers/sticker_format_types.rb +15 -0
  54. data/lib/lib_discord/mappers/sticker_types.rb +13 -0
  55. data/lib/lib_discord/mappers/user_premium_types.rb +15 -0
  56. data/lib/lib_discord/mappers/user_visibility_types.rb +13 -0
  57. data/lib/lib_discord/mappers/webhooks_types.rb +14 -0
  58. data/lib/lib_discord/mappers.rb +87 -0
  59. data/lib/lib_discord/poll.rb +62 -0
  60. data/lib/lib_discord/resource.rb +91 -21
  61. data/lib/lib_discord/response.rb +39 -7
  62. data/lib/lib_discord/stage_instance.rb +79 -0
  63. data/lib/lib_discord/sticker.rb +132 -0
  64. data/lib/lib_discord/types.rb +35 -11
  65. data/lib/lib_discord/urls.rb +20 -12
  66. data/lib/lib_discord/user.rb +174 -0
  67. data/lib/lib_discord/version.rb +5 -1
  68. data/lib/lib_discord/voice.rb +29 -0
  69. data/lib/lib_discord/webhook.rb +299 -0
  70. data/lib/lib_discord.rb +5 -0
  71. metadata +77 -20
  72. data/lib/lib_discord/resources/application.rb +0 -15
  73. data/lib/lib_discord/resources/application_command.rb +0 -71
  74. data/lib/lib_discord/resources/application_role_connection_metadata.rb +0 -15
  75. data/lib/lib_discord/resources/audit_log.rb +0 -11
  76. data/lib/lib_discord/resources/auto_moderation.rb +0 -27
  77. data/lib/lib_discord/resources/channel.rb +0 -168
  78. data/lib/lib_discord/resources/emoji.rb +0 -27
  79. data/lib/lib_discord/resources/guild.rb +0 -196
  80. data/lib/lib_discord/resources/guild_scheduled_event.rb +0 -31
  81. data/lib/lib_discord/resources/guild_template.rb +0 -35
  82. data/lib/lib_discord/resources/interaction.rb +0 -39
  83. data/lib/lib_discord/resources/invite.rb +0 -15
  84. data/lib/lib_discord/resources/stage_instance.rb +0 -23
  85. data/lib/lib_discord/resources/sticker.rb +0 -35
  86. data/lib/lib_discord/resources/user.rb +0 -51
  87. data/lib/lib_discord/resources/voice.rb +0 -11
  88. data/lib/lib_discord/resources/webhook.rb +0 -67
  89. data/lib/lib_discord/resources.rb +0 -19
@@ -0,0 +1,716 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lib_discord/resource"
4
+
5
+ module LibDiscord
6
+ ##
7
+ # Channels Resource
8
+ #
9
+ # Do not instantiate a {Channel} directly. Instead request one from an
10
+ # instance of {Client}.
11
+ #
12
+ # client = LibDiscord::Client.new("Bot auth.token")
13
+ # c = client["channel"]
14
+ #
15
+ # @see https://discord.com/developers/docs/resources/channel Discord
16
+ # documentation "Channels Resource"
17
+ class Channel < Resource
18
+ ##
19
+ # @param channel_id [#to_s]
20
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
21
+ # documentation "Snowflakes"}
22
+ #
23
+ # @return [Response]
24
+ #
25
+ # @raise [TimeoutError] if the HTTP request times out
26
+ #
27
+ # @see https://discord.com/developers/docs/resources/channel#get-channel
28
+ # Discord documentation "Get Channel"
29
+ def get_channel(channel_id:)
30
+ send_request(:get, "/channels/#{channel_id}")
31
+ end
32
+
33
+ ##
34
+ # @param channel_id [#to_s]
35
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
36
+ # documentation "Snowflakes"}
37
+ # @param json [Hash] JSON serializable payload
38
+ #
39
+ # @return [Response]
40
+ #
41
+ # @raise [TimeoutError] if the HTTP request times out
42
+ # @raise [ConstraintError] if +json+ cannot be serialized to JSON
43
+ #
44
+ # @see https://discord.com/developers/docs/resources/channel#modify-channel
45
+ # Discord documentation "Modify Channel"
46
+ def modify_channel(channel_id:, json:)
47
+ send_request(:patch, "/channels/#{channel_id}", json:)
48
+ end
49
+
50
+ ##
51
+ # @param channel_id [#to_s]
52
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
53
+ # documentation "Snowflakes"}
54
+ #
55
+ # @return [Response]
56
+ #
57
+ # @raise [TimeoutError] if the HTTP request times out
58
+ #
59
+ # @see https://discord.com/developers/docs/resources/channel#deleteclose-channel
60
+ # Discord documentation "Delete/Close Channel"
61
+ def delete_channel(channel_id:)
62
+ send_request(:delete, "/channels/#{channel_id}")
63
+ end
64
+
65
+ alias_method :close_channel, :delete_channel
66
+
67
+ ##
68
+ # @param channel_id [#to_s]
69
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
70
+ # documentation "Snowflakes"}
71
+ # @param params [Hash] optional HTTP query parameters
72
+ #
73
+ # @return [Response]
74
+ #
75
+ # @raise [TimeoutError] if the HTTP request times out
76
+ # @raise [ConstraintError] if +params+ cannot be coerced into a valid query
77
+ # parameters string
78
+ #
79
+ # @see https://discord.com/developers/docs/resources/channel#get-channel-messages
80
+ # Discord documentation "Get Channel Messages"
81
+ def get_channel_messages(channel_id:, params: {})
82
+ send_request(:get, "/channels/#{channel_id}/messages", params:)
83
+ end
84
+
85
+ ##
86
+ # @param channel_id [#to_s]
87
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
88
+ # documentation "Snowflakes"}
89
+ # @param message_id [#to_s]
90
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
91
+ # documentation "Snowflakes"}
92
+ #
93
+ # @return [Response]
94
+ #
95
+ # @raise [TimeoutError] if the HTTP request times out
96
+ #
97
+ # @see https://discord.com/developers/docs/resources/channel#get-channel-message
98
+ # Discord documentation "Get Channel Message"
99
+ def get_channel_message(channel_id:, message_id:)
100
+ send_request(:get, "/channels/#{channel_id}/messages/#{message_id}")
101
+ end
102
+
103
+ ##
104
+ # @param channel_id [#to_s]
105
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
106
+ # documentation "Snowflakes"}
107
+ # @param json [Hash] JSON serializable payload
108
+ #
109
+ # @return [Response]
110
+ #
111
+ # @raise [TimeoutError] if the HTTP request times out
112
+ # @raise [ConstraintError] if +json+ cannot be serialized to JSON
113
+ #
114
+ # @see https://discord.com/developers/docs/resources/channel#create-message
115
+ # Discord documentation "Create Message"
116
+ def create_message(channel_id:, json:)
117
+ send_request(:post, "/channels/#{channel_id}/messages", json:)
118
+ end
119
+
120
+ ##
121
+ # @param channel_id [#to_s]
122
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
123
+ # documentation "Snowflakes"}
124
+ # @param message_id [#to_s]
125
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
126
+ # documentation "Snowflakes"}
127
+ #
128
+ # @return [Response]
129
+ #
130
+ # @raise [TimeoutError] if the HTTP request times out
131
+ #
132
+ # @see https://discord.com/developers/docs/resources/channel#crosspost-message
133
+ # Discord documentation "Crosspost Message"
134
+ def crosspost_message(channel_id:, message_id:)
135
+ send_request(:post, "/channels/#{channel_id}/messages/#{message_id}/crosspost")
136
+ end
137
+
138
+ ##
139
+ # @param channel_id [#to_s]
140
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
141
+ # documentation "Snowflakes"}
142
+ # @param message_id [#to_s]
143
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
144
+ # documentation "Snowflakes"}
145
+ # @param emoji [#to_s]
146
+ #
147
+ # @return [Response]
148
+ #
149
+ # @raise [TimeoutError] if the HTTP request times out
150
+ #
151
+ # @see https://discord.com/developers/docs/resources/channel#create-reaction
152
+ # Discord documentation "Create Reaction"
153
+ def create_reaction(channel_id:, message_id:, emoji:)
154
+ send_request(:put, "/channels/#{channel_id}/messages/#{message_id}/reactions/#{emoji}/@me")
155
+ end
156
+
157
+ ##
158
+ # @param channel_id [#to_s]
159
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
160
+ # documentation "Snowflakes"}
161
+ # @param message_id [#to_s]
162
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
163
+ # documentation "Snowflakes"}
164
+ # @param emoji [#to_s]
165
+ #
166
+ # @return [Response]
167
+ #
168
+ # @raise [TimeoutError] if the HTTP request times out
169
+ #
170
+ # @see https://discord.com/developers/docs/resources/channel#delete-own-reaction
171
+ # Discord documentation "Delete Own Reaction"
172
+ def delete_own_reaction(channel_id:, message_id:, emoji:)
173
+ send_request(:delete, "/channels/#{channel_id}/messages/#{message_id}/reactions/#{emoji}/@me")
174
+ end
175
+
176
+ ##
177
+ # @param channel_id [#to_s]
178
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
179
+ # documentation "Snowflakes"}
180
+ # @param message_id [#to_s]
181
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
182
+ # documentation "Snowflakes"}
183
+ # @param emoji [#to_s]
184
+ # @param user_id [#to_s]
185
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
186
+ # documentation "Snowflakes"}
187
+ #
188
+ # @return [Response]
189
+ #
190
+ # @raise [TimeoutError] if the HTTP request times out
191
+ #
192
+ # @see https://discord.com/developers/docs/resources/channel#delete-user-reaction
193
+ # Discord documentation "Delete User Reaction"
194
+ def delete_user_reaction(channel_id:, message_id:, emoji:, user_id:)
195
+ send_request(:delete, "/channels/#{channel_id}/messages/#{message_id}/reactions/#{emoji}/#{user_id}")
196
+ end
197
+
198
+ ##
199
+ # @param channel_id [#to_s]
200
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
201
+ # documentation "Snowflakes"}
202
+ # @param message_id [#to_s]
203
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
204
+ # documentation "Snowflakes"}
205
+ # @param emoji [#to_s]
206
+ # @param params [Hash] optional HTTP query parameters
207
+ #
208
+ # @return [Response]
209
+ #
210
+ # @raise [TimeoutError] if the HTTP request times out
211
+ # @raise [ConstraintError] if +params+ cannot be coerced into a valid query
212
+ # parameters string
213
+ #
214
+ # @see https://discord.com/developers/docs/resources/channel#get-reactions
215
+ # Discord documentation "Get Reactions"
216
+ def get_reactions(channel_id:, message_id:, emoji:, params: {})
217
+ send_request(:get, "/channels/#{channel_id}/messages/#{message_id}/reactions/#{emoji}", params:)
218
+ end
219
+
220
+ ##
221
+ # @param channel_id [#to_s]
222
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
223
+ # documentation "Snowflakes"}
224
+ # @param message_id [#to_s]
225
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
226
+ # documentation "Snowflakes"}
227
+ #
228
+ # @return [Response]
229
+ #
230
+ # @raise [TimeoutError] if the HTTP request times out
231
+ #
232
+ # @see https://discord.com/developers/docs/resources/channel#delete-all-reactions
233
+ # Discord documentation "Delete All Reactions"
234
+ def delete_all_reactions(channel_id:, message_id:)
235
+ send_request(:delete, "/channels/#{channel_id}/messages/#{message_id}/reactions")
236
+ end
237
+
238
+ ##
239
+ # @param channel_id [#to_s]
240
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
241
+ # documentation "Snowflakes"}
242
+ # @param message_id [#to_s]
243
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
244
+ # documentation "Snowflakes"}
245
+ # @param emoji [#to_s]
246
+ #
247
+ # @return [Response]
248
+ #
249
+ # @raise [TimeoutError] if the HTTP request times out
250
+ #
251
+ # @see https://discord.com/developers/docs/resources/channel#delete-all-reactions-for-emoji
252
+ # Discord documentation "Delete All Reactions for Emoji"
253
+ def delete_all_reactions_for_emoji(channel_id:, message_id:, emoji:)
254
+ send_request(:delete, "/channels/#{channel_id}/messages/#{message_id}/reactions/#{emoji}")
255
+ end
256
+
257
+ ##
258
+ # @param channel_id [#to_s]
259
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
260
+ # documentation "Snowflakes"}
261
+ # @param message_id [#to_s]
262
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
263
+ # documentation "Snowflakes"}
264
+ # @param json [Hash] JSON serializable payload
265
+ #
266
+ # @return [Response]
267
+ #
268
+ # @raise [TimeoutError] if the HTTP request times out
269
+ # @raise [ConstraintError] if +json+ cannot be serialized to JSON
270
+ #
271
+ # @see https://discord.com/developers/docs/resources/channel#edit-message
272
+ # Discord documentation "Edit Message"
273
+ def edit_message(channel_id:, message_id:, json:)
274
+ send_request(:patch, "/channels/#{channel_id}/messages/#{message_id}", json:)
275
+ end
276
+
277
+ ##
278
+ # @param channel_id [#to_s]
279
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
280
+ # documentation "Snowflakes"}
281
+ # @param message_id [#to_s]
282
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
283
+ # documentation "Snowflakes"}
284
+ #
285
+ # @return [Response]
286
+ #
287
+ # @raise [TimeoutError] if the HTTP request times out
288
+ #
289
+ # @see https://discord.com/developers/docs/resources/channel#delete-message
290
+ # Discord documentation "Delete Message"
291
+ def delete_message(channel_id:, message_id:)
292
+ send_request(:delete, "/channels/#{channel_id}/messages/#{message_id}")
293
+ end
294
+
295
+ ##
296
+ # @param channel_id [#to_s]
297
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
298
+ # documentation "Snowflakes"}
299
+ # @param json [Hash] JSON serializable payload
300
+ #
301
+ # @return [Response]
302
+ #
303
+ # @raise [TimeoutError] if the HTTP request times out
304
+ # @raise [ConstraintError] if +json+ cannot be serialized to JSON
305
+ #
306
+ # @see https://discord.com/developers/docs/resources/channel#bulk-delete-messages
307
+ # Discord documentation "Bulk Delete Messages"
308
+ def bulk_delete_messages(channel_id:, json:)
309
+ send_request(:post, "/channels/#{channel_id}/messages/bulk-delete", json:)
310
+ end
311
+
312
+ ##
313
+ # @param channel_id [#to_s]
314
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
315
+ # documentation "Snowflakes"}
316
+ # @param overwrite_id [#to_s]
317
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
318
+ # documentation "Snowflakes"}
319
+ # @param json [Hash] JSON serializable payload
320
+ #
321
+ # @return [Response]
322
+ #
323
+ # @raise [TimeoutError] if the HTTP request times out
324
+ # @raise [ConstraintError] if +json+ cannot be serialized to JSON
325
+ #
326
+ # @see https://discord.com/developers/docs/resources/channel#edit-channel-permissions
327
+ # Discord documentation "Edit Channel Permissions"
328
+ def edit_channel_permissions(channel_id:, overwrite_id:, json:)
329
+ send_request(:put, "/channels/#{channel_id}/permissions/#{overwrite_id}", json:)
330
+ end
331
+
332
+ ##
333
+ # @param channel_id [#to_s]
334
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
335
+ # documentation "Snowflakes"}
336
+ #
337
+ # @return [Response]
338
+ #
339
+ # @raise [TimeoutError] if the HTTP request times out
340
+ #
341
+ # @see https://discord.com/developers/docs/resources/channel#get-channel-invites
342
+ # Discord documentation "Get Channel Invites"
343
+ def get_channel_invites(channel_id:)
344
+ send_request(:get, "/channels/#{channel_id}/invites")
345
+ end
346
+
347
+ ##
348
+ # @param channel_id [#to_s]
349
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
350
+ # documentation "Snowflakes"}
351
+ # @param json [Hash] JSON serializable payload
352
+ #
353
+ # @return [Response]
354
+ #
355
+ # @raise [TimeoutError] if the HTTP request times out
356
+ # @raise [ConstraintError] if +json+ cannot be serialized to JSON
357
+ #
358
+ # @see https://discord.com/developers/docs/resources/channel#create-channel-invite
359
+ # Discord documentation "Create Channel Invite"
360
+ def create_channel_invite(channel_id:, json:)
361
+ send_request(:post, "/channels/#{channel_id}/invites", json:)
362
+ end
363
+
364
+ ##
365
+ # @param channel_id [#to_s]
366
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
367
+ # documentation "Snowflakes"}
368
+ # @param overwrite_id [#to_s]
369
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
370
+ # documentation "Snowflakes"}
371
+ #
372
+ # @return [Response]
373
+ #
374
+ # @raise [TimeoutError] if the HTTP request times out
375
+ #
376
+ # @see https://discord.com/developers/docs/resources/channel#delete-channel-permission
377
+ # Discord documentation "Delete Channel Permission"
378
+ def delete_channel_permission(channel_id:, overwrite_id:)
379
+ send_request(:delete, "/channels/#{channel_id}/permissions/#{overwrite_id}")
380
+ end
381
+
382
+ ##
383
+ # @param channel_id [#to_s]
384
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
385
+ # documentation "Snowflakes"}
386
+ # @param json [Hash] JSON serializable payload
387
+ #
388
+ # @return [Response]
389
+ #
390
+ # @raise [TimeoutError] if the HTTP request times out
391
+ # @raise [ConstraintError] if +json+ cannot be serialized to JSON
392
+ #
393
+ # @see https://discord.com/developers/docs/resources/channel#follow-announcement-channel
394
+ # Discord documentation "Follow Announcement Channel"
395
+ def follow_announcement_channel(channel_id:, json:)
396
+ send_request(:post, "/channels/#{channel_id}/followers", json:)
397
+ end
398
+
399
+ ##
400
+ # @param channel_id [#to_s]
401
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
402
+ # documentation "Snowflakes"}
403
+ #
404
+ # @return [Response]
405
+ #
406
+ # @raise [TimeoutError] if the HTTP request times out
407
+ #
408
+ # @see https://discord.com/developers/docs/resources/channel#trigger-typing-indicator
409
+ # Discord documentation "Trigger Typing Indicator"
410
+ def trigger_typing_indicator(channel_id:)
411
+ send_request(:post, "/channels/#{channel_id}/typing")
412
+ end
413
+
414
+ ##
415
+ # @param channel_id [#to_s]
416
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
417
+ # documentation "Snowflakes"}
418
+ #
419
+ # @return [Response]
420
+ #
421
+ # @raise [TimeoutError] if the HTTP request times out
422
+ #
423
+ # @see https://discord.com/developers/docs/resources/channel#get-pinned-messages
424
+ # Discord documentation "Get Pinned Messages"
425
+ def get_pinned_messages(channel_id:)
426
+ send_request(:get, "/channels/#{channel_id}/pins")
427
+ end
428
+
429
+ ##
430
+ # @param channel_id [#to_s]
431
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
432
+ # documentation "Snowflakes"}
433
+ # @param message_id [#to_s]
434
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
435
+ # documentation "Snowflakes"}
436
+ #
437
+ # @return [Response]
438
+ #
439
+ # @raise [TimeoutError] if the HTTP request times out
440
+ #
441
+ # @see https://discord.com/developers/docs/resources/channel#pin-message
442
+ # Discord documentation "Pin Message"
443
+ def pin_message(channel_id:, message_id:)
444
+ send_request(:put, "/channels/#{channel_id}/pins/#{message_id}")
445
+ end
446
+
447
+ ##
448
+ # @param channel_id [#to_s]
449
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
450
+ # documentation "Snowflakes"}
451
+ # @param message_id [#to_s]
452
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
453
+ # documentation "Snowflakes"}
454
+ #
455
+ # @return [Response]
456
+ #
457
+ # @raise [TimeoutError] if the HTTP request times out
458
+ #
459
+ # @see https://discord.com/developers/docs/resources/channel#unpin-message
460
+ # Discord documentation "Unpin Message"
461
+ def unpin_message(channel_id:, message_id:)
462
+ send_request(:delete, "/channels/#{channel_id}/pins/#{message_id}")
463
+ end
464
+
465
+ ##
466
+ # @param channel_id [#to_s]
467
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
468
+ # documentation "Snowflakes"}
469
+ # @param user_id [#to_s]
470
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
471
+ # documentation "Snowflakes"}
472
+ # @param json [Hash] JSON serializable payload
473
+ #
474
+ # @return [Response]
475
+ #
476
+ # @raise [TimeoutError] if the HTTP request times out
477
+ # @raise [ConstraintError] if +json+ cannot be serialized to JSON
478
+ #
479
+ # @see https://discord.com/developers/docs/resources/channel#group-dm-add-recipient
480
+ # Discord documentation "Group DM Add Recipient"
481
+ def group_dm_add_recipient(channel_id:, user_id:, json:)
482
+ send_request(:put, "/channels/#{channel_id}/recipients/#{user_id}", json:)
483
+ end
484
+
485
+ ##
486
+ # @param channel_id [#to_s]
487
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
488
+ # documentation "Snowflakes"}
489
+ # @param user_id [#to_s]
490
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
491
+ # documentation "Snowflakes"}
492
+ #
493
+ # @return [Response]
494
+ #
495
+ # @raise [TimeoutError] if the HTTP request times out
496
+ #
497
+ # @see https://discord.com/developers/docs/resources/channel#group-dm-remove-recipient
498
+ # Discord documentation "Group DM Remove Recipient"
499
+ def group_dm_remove_recipient(channel_id:, user_id:)
500
+ send_request(:delete, "/channels/#{channel_id}/recipients/#{user_id}")
501
+ end
502
+
503
+ ##
504
+ # @param channel_id [#to_s]
505
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
506
+ # documentation "Snowflakes"}
507
+ # @param message_id [#to_s]
508
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
509
+ # documentation "Snowflakes"}
510
+ # @param json [Hash] JSON serializable payload
511
+ #
512
+ # @return [Response]
513
+ #
514
+ # @raise [TimeoutError] if the HTTP request times out
515
+ # @raise [ConstraintError] if +json+ cannot be serialized to JSON
516
+ #
517
+ # @see https://discord.com/developers/docs/resources/channel#start-thread-from-message
518
+ # Discord documentation "Start Thread from Message"
519
+ def start_thread_from_message(channel_id:, message_id:, json:)
520
+ send_request(:post, "/channels/#{channel_id}/messages/#{message_id}/threads", json:)
521
+ end
522
+
523
+ ##
524
+ # @param channel_id [#to_s]
525
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
526
+ # documentation "Snowflakes"}
527
+ # @param json [Hash] JSON serializable payload
528
+ #
529
+ # @return [Response]
530
+ #
531
+ # @raise [TimeoutError] if the HTTP request times out
532
+ # @raise [ConstraintError] if +json+ cannot be serialized to JSON
533
+ #
534
+ # @see https://discord.com/developers/docs/resources/channel#start-thread-without-message
535
+ # Discord documentation "Start Thread without Message"
536
+ def start_thread_without_message(channel_id:, json:)
537
+ send_request(:post, "/channels/#{channel_id}/threads", json:)
538
+ end
539
+
540
+ ##
541
+ # @param channel_id [#to_s]
542
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
543
+ # documentation "Snowflakes"}
544
+ # @param json [Hash] JSON serializable payload
545
+ #
546
+ # @return [Response]
547
+ #
548
+ # @raise [TimeoutError] if the HTTP request times out
549
+ # @raise [ConstraintError] if +json+ cannot be serialized to JSON
550
+ #
551
+ # @see https://discord.com/developers/docs/resources/channel#start-thread-in-forum-or-media-channel
552
+ # Discord documentation "Start Thread in Forum or Media Channel"
553
+ def start_thread_in_forum_or_media_channel(channel_id:, json:)
554
+ send_request(:post, "/channels/#{channel_id}/threads", json:)
555
+ end
556
+
557
+ ##
558
+ # @param channel_id [#to_s]
559
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
560
+ # documentation "Snowflakes"}
561
+ #
562
+ # @return [Response]
563
+ #
564
+ # @raise [TimeoutError] if the HTTP request times out
565
+ #
566
+ # @see https://discord.com/developers/docs/resources/channel#join-thread
567
+ # Discord documentation "Join Thread"
568
+ def join_thread(channel_id:)
569
+ send_request(:put, "/channels/#{channel_id}/thread-members/@me")
570
+ end
571
+
572
+ ##
573
+ # @param channel_id [#to_s]
574
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
575
+ # documentation "Snowflakes"}
576
+ # @param user_id [#to_s]
577
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
578
+ # documentation "Snowflakes"}
579
+ #
580
+ # @return [Response]
581
+ #
582
+ # @raise [TimeoutError] if the HTTP request times outs
583
+ #
584
+ # @see https://discord.com/developers/docs/resources/channel#add-thread-member
585
+ # Discord documentation "Add Thread Member"
586
+ def add_thread_member(channel_id:, user_id:)
587
+ send_request(:put, "/channels/#{channel_id}/thread-members/#{user_id}")
588
+ end
589
+
590
+ ##
591
+ # @param channel_id [#to_s]
592
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
593
+ # documentation "Snowflakes"}
594
+ #
595
+ # @return [Response]
596
+ #
597
+ # @raise [TimeoutError] if the HTTP request times out
598
+ #
599
+ # @see https://discord.com/developers/docs/resources/channel#leave-thread
600
+ # Discord documentation "Leave Thread"
601
+ def leave_thread(channel_id:)
602
+ send_request(:delete, "/channels/#{channel_id}/thread-members/@me")
603
+ end
604
+
605
+ ##
606
+ # @param channel_id [#to_s]
607
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
608
+ # documentation "Snowflakes"}
609
+ # @param user_id [#to_s]
610
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
611
+ # documentation "Snowflakes"}
612
+ #
613
+ # @return [Response]
614
+ #
615
+ # @raise [TimeoutError] if the HTTP request times outs
616
+ #
617
+ # @see https://discord.com/developers/docs/resources/channel#remove-thread-member
618
+ # Discord documentation "Remove Thread Member"
619
+ def remove_thread_member(channel_id:, user_id:)
620
+ send_request(:delete, "/channels/#{channel_id}/thread-members/#{user_id}")
621
+ end
622
+
623
+ ##
624
+ # @param channel_id [#to_s]
625
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
626
+ # documentation "Snowflakes"}
627
+ # @param user_id [#to_s]
628
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
629
+ # documentation "Snowflakes"}
630
+ # @param params [Hash] optional HTTP query parameters
631
+ #
632
+ # @return [Response]
633
+ #
634
+ # @raise [TimeoutError] if the HTTP request times out
635
+ # @raise [ConstraintError] if +params+ cannot be coerced into a valid query
636
+ # parameters string
637
+ #
638
+ # @see https://discord.com/developers/docs/resources/channel#get-thread-member
639
+ # Discord documentation "Get Thread Member"
640
+ def get_thread_member(channel_id:, user_id:, params: {})
641
+ send_request(:get, "/channels/#{channel_id}/thread-members/#{user_id}", params:)
642
+ end
643
+
644
+ ##
645
+ # @param channel_id [#to_s]
646
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
647
+ # documentation "Snowflakes"}
648
+ # @param params [Hash] optional HTTP query parameters
649
+ #
650
+ # @return [Response]
651
+ #
652
+ # @raise [TimeoutError] if the HTTP request times out
653
+ # @raise [ConstraintError] if +params+ cannot be coerced into a valid query
654
+ # parameters string
655
+ #
656
+ # @see https://discord.com/developers/docs/resources/channel#list-thread-members
657
+ # Discord documentation "List Thread Members"
658
+ def list_thread_members(channel_id:, params: {})
659
+ send_request(:get, "/channels/#{channel_id}/thread-members", params:)
660
+ end
661
+
662
+ ##
663
+ # @param channel_id [#to_s]
664
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
665
+ # documentation "Snowflakes"}
666
+ # @param params [Hash] optional HTTP query parameters
667
+ #
668
+ # @return [Response]
669
+ #
670
+ # @raise [TimeoutError] if the HTTP request times out
671
+ # @raise [ConstraintError] if +params+ cannot be coerced into a valid query
672
+ # parameters string
673
+ #
674
+ # @see https://discord.com/developers/docs/resources/channel#list-public-archived-threads
675
+ # Discord documentation "List Public Archived Threads"
676
+ def list_public_archived_threads(channel_id:, params: {})
677
+ send_request(:get, "/channels/#{channel_id}/threads/archived/public", params:)
678
+ end
679
+
680
+ ##
681
+ # @param channel_id [#to_s]
682
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
683
+ # documentation "Snowflakes"}
684
+ # @param params [Hash] optional HTTP query parameters
685
+ #
686
+ # @return [Response]
687
+ #
688
+ # @raise [TimeoutError] if the HTTP request times out
689
+ # @raise [ConstraintError] if +params+ cannot be coerced into a valid query
690
+ # parameters string
691
+ #
692
+ # @see https://discord.com/developers/docs/resources/channel#list-private-archived-threads
693
+ # Discord documentation "List Private Archived Threads"
694
+ def list_private_archived_threads(channel_id:, params: {})
695
+ send_request(:get, "/channels/#{channel_id}/threads/archived/private", params:)
696
+ end
697
+
698
+ ##
699
+ # @param channel_id [#to_s]
700
+ # {https://discord.com/developers/docs/reference#snowflakes Discord
701
+ # documentation "Snowflakes"}
702
+ # @param params [Hash] optional HTTP query parameters
703
+ #
704
+ # @return [Response]
705
+ #
706
+ # @raise [TimeoutError] if the HTTP request times out
707
+ # @raise [ConstraintError] if +params+ cannot be coerced into a valid query
708
+ # parameters string
709
+ #
710
+ # @see https://discord.com/developers/docs/resources/channel#list-joined-private-archived-threads
711
+ # Discord documentation "List Joined Private Archived Threads"
712
+ def list_joined_private_archived_threads(channel_id:, params: {})
713
+ send_request(:get, "/channels/#{channel_id}/users/@me/threads/archived/private", params:)
714
+ end
715
+ end
716
+ end