diff --git a/NetCord/Rest/RestClient.Application.cs b/NetCord/Rest/RestClient.Application.cs index 6b81e845..54344682 100644 --- a/NetCord/Rest/RestClient.Application.cs +++ b/NetCord/Rest/RestClient.Application.cs @@ -2,10 +2,21 @@ public partial class RestClient { + /// + /// Retrieves the application associated with the current user. + /// + /// Optional properties to customize the REST request, can be . + /// A token to monitor for cancellation requests. Defaults to . [GenerateAlias([typeof(CurrentApplication)], CastType = typeof(Application), Modifiers = ["override"])] public async Task GetCurrentApplicationAsync(RestRequestProperties? properties = null, CancellationToken cancellationToken = default) => new(await (await SendRequestAsync(HttpMethod.Get, $"/applications/@me", null, null, properties, cancellationToken: cancellationToken).ConfigureAwait(false)).ToObjectAsync(Serialization.Default.JsonApplication).ConfigureAwait(false), this); + /// + /// Modifies the application associated with the current user. + /// + /// An action representing the modification to be made. + /// Optional properties to customize the REST request, can be . + /// A token to monitor for cancellation requests. Defaults to . [GenerateAlias([typeof(CurrentApplication)])] public async Task ModifyCurrentApplicationAsync(Action action, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) { diff --git a/NetCord/Rest/RestClient.ApplicationRoleConnectionMetadata.cs b/NetCord/Rest/RestClient.ApplicationRoleConnectionMetadata.cs index 86e162f4..5d6d11c6 100644 --- a/NetCord/Rest/RestClient.ApplicationRoleConnectionMetadata.cs +++ b/NetCord/Rest/RestClient.ApplicationRoleConnectionMetadata.cs @@ -2,10 +2,23 @@ public partial class RestClient { + /// + /// Returns a list of objects for the given application. + /// + /// The ID of the application to request data for. + /// Optional properties to customize the REST request, can be . + /// A token to monitor for cancellation requests. Defaults to . [GenerateAlias([typeof(CurrentApplication)], nameof(CurrentApplication.Id), TypeNameOverride = nameof(Application))] public async Task> GetApplicationRoleConnectionMetadataRecordsAsync(ulong applicationId, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) => (await (await SendRequestAsync(HttpMethod.Get, $"/applications/{applicationId}/role-connections/metadata", null, null, properties, cancellationToken: cancellationToken).ConfigureAwait(false)).ToObjectAsync(Serialization.Default.IEnumerableJsonApplicationRoleConnectionMetadata).ConfigureAwait(false)).Select(m => new ApplicationRoleConnectionMetadata(m)).ToArray(); + /// + /// Updates an application's list, replacing it with the given list instead. + /// + /// The ID of the application to modify data for. + /// The list to overwrite the target data with. + /// Optional properties to customize the REST request, can be . + /// A token to monitor for cancellation requests. Defaults to . [GenerateAlias([typeof(CurrentApplication)], nameof(CurrentApplication.Id), TypeNameOverride = nameof(Application))] public async Task> UpdateApplicationRoleConnectionMetadataRecordsAsync(ulong applicationId, IEnumerable applicationRoleConnectionMetadataProperties, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) { diff --git a/NetCord/Rest/RestClient.AuditLog.cs b/NetCord/Rest/RestClient.AuditLog.cs index 3844ade7..34a52f20 100644 --- a/NetCord/Rest/RestClient.AuditLog.cs +++ b/NetCord/Rest/RestClient.AuditLog.cs @@ -4,6 +4,12 @@ namespace NetCord.Rest; public partial class RestClient { + /// + /// Returns a collection of audit log entries for a guild, to be enumerated asynchronously. + /// + /// The ID of the guild to acquire entries for. + /// Optional properties to customize result pagination, can be . + /// Optional properties to customize the request, can be . [GenerateAlias([typeof(RestGuild)], nameof(RestGuild.Id), TypeNameOverride = nameof(Guild))] public IAsyncEnumerable GetGuildAuditLogAsync(ulong guildId, GuildAuditLogPaginationProperties? paginationProperties = null, RestRequestProperties? properties = null) { diff --git a/NetCord/Rest/RestClient.AutoModeration.cs b/NetCord/Rest/RestClient.AutoModeration.cs index f57004f6..de28c6f4 100644 --- a/NetCord/Rest/RestClient.AutoModeration.cs +++ b/NetCord/Rest/RestClient.AutoModeration.cs @@ -4,15 +4,35 @@ namespace NetCord.Rest; public partial class RestClient { + /// + /// Retrieves a read-only list of configured automod rules for a guild. + /// + /// The ID of the guild to retrieve auto-moderation rules for. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(RestGuild)], nameof(RestGuild.Id), TypeNameOverride = nameof(Guild))] public async Task> GetAutoModerationRulesAsync(ulong guildId, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) => (await (await SendRequestAsync(HttpMethod.Get, $"/guilds/{guildId}/auto-moderation/rules", null, new(guildId), properties, cancellationToken: cancellationToken).ConfigureAwait(false)).ToObjectAsync(Serialization.Default.JsonAutoModerationRuleArray).ConfigureAwait(false)).Select(r => new AutoModerationRule(r, this)).ToArray(); + /// + /// Retrieves information about a specific auto-mod's rule configuration, for a specified guild. + /// + /// The ID of the guild to retrieve auto-moderation rules for. + /// The ID of the rule to retrieve information on. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(RestGuild)], nameof(RestGuild.Id), TypeNameOverride = nameof(Guild))] [GenerateAlias([typeof(AutoModerationRule)], nameof(AutoModerationRule.GuildId), nameof(AutoModerationRule.Id))] public async Task GetAutoModerationRuleAsync(ulong guildId, ulong autoModerationRuleId, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) => new(await (await SendRequestAsync(HttpMethod.Get, $"/guilds/{guildId}/auto-moderation/rules/{autoModerationRuleId}", null, new(guildId), properties, cancellationToken: cancellationToken).ConfigureAwait(false)).ToObjectAsync(Serialization.Default.JsonAutoModerationRule).ConfigureAwait(false), this); + /// + /// Creates a new auto-moderation rule for a specified guild. + /// + /// The ID of the guild to create the rule for.. + /// The properties of the auto-moderation rule to be created, including triggers, actions, and conditions. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(RestGuild)], nameof(RestGuild.Id), TypeNameOverride = nameof(Guild))] public async Task CreateAutoModerationRuleAsync(ulong guildId, AutoModerationRuleProperties autoModerationRuleProperties, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) { @@ -20,6 +40,14 @@ public async Task CreateAutoModerationRuleAsync(ulong guildI return new(await (await SendRequestAsync(HttpMethod.Post, content, $"/guilds/{guildId}/auto-moderation/rules", null, new(guildId), properties, cancellationToken: cancellationToken).ConfigureAwait(false)).ToObjectAsync(Serialization.Default.JsonAutoModerationRule).ConfigureAwait(false), this); } + /// + /// Modifies a pre-existing auto-moderation rule for a specified guild. + /// + /// The ID of the guild to modify the rule for.. + /// The ID of the rule to modify. + /// An action, representing the modifications to make to the rule. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(RestGuild)], nameof(RestGuild.Id), TypeNameOverride = nameof(Guild))] [GenerateAlias([typeof(AutoModerationRule)], nameof(AutoModerationRule.GuildId), nameof(AutoModerationRule.Id))] public async Task ModifyAutoModerationRuleAsync(ulong guildId, ulong autoModerationRuleId, Action action, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) @@ -30,6 +58,13 @@ public async Task ModifyAutoModerationRuleAsync(ulong guildI return new(await (await SendRequestAsync(HttpMethod.Patch, content, $"/guilds/{guildId}/auto-moderation/rules/{autoModerationRuleId}", null, new(guildId), properties, cancellationToken: cancellationToken).ConfigureAwait(false)).ToObjectAsync(Serialization.Default.JsonAutoModerationRule).ConfigureAwait(false), this); } + /// + /// Deletes an auto-moderation rule for a specified guild. + /// + /// The ID of the guild to modify the rule for.. + /// The ID of the rule to modify. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(RestGuild)], nameof(RestGuild.Id), TypeNameOverride = nameof(Guild))] [GenerateAlias([typeof(AutoModerationRule)], nameof(AutoModerationRule.GuildId), nameof(AutoModerationRule.Id))] public Task DeleteAutoModerationRuleAsync(ulong guildId, ulong autoModerationRuleId, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) diff --git a/NetCord/Rest/RestClient.Channel.cs b/NetCord/Rest/RestClient.Channel.cs index 40681acf..18758627 100644 --- a/NetCord/Rest/RestClient.Channel.cs +++ b/NetCord/Rest/RestClient.Channel.cs @@ -2,10 +2,23 @@ public partial class RestClient { + /// + /// Retrieves a channel by its ID. + /// + /// The ID of the channel to retrieve. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(Channel)], nameof(Channel.Id), Cast = true)] public async Task GetChannelAsync(ulong channelId, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) => Channel.CreateFromJson(await (await SendRequestAsync(HttpMethod.Get, $"/channels/{channelId}", null, new(channelId), properties, cancellationToken: cancellationToken).ConfigureAwait(false)).ToObjectAsync(Serialization.Default.JsonChannel).ConfigureAwait(false), this); + /// + /// Modifies a group DM channel’s properties. + /// + /// The ID of the group DM channel to modify. + /// An action delegate used to configure the channel’s updated properties. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(GroupDMChannel)], nameof(GroupDMChannel.Id), Cast = true)] public async Task ModifyGroupDMChannelAsync(ulong channelId, Action action, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) { @@ -15,6 +28,13 @@ public async Task ModifyGroupDMChannelAsync(ulong channelId, Action + /// Modifies a guild channel’s configuration. + /// + /// The ID of the guild channel to modify. + /// An action delegate used to configure the updated channel options. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(IGuildChannel)], nameof(IGuildChannel.Id), Cast = true)] public async Task ModifyGuildChannelAsync(ulong channelId, Action action, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) { @@ -24,10 +44,22 @@ public async Task ModifyGuildChannelAsync(ulong channelId, Action + /// Deletes the channel corresponding to a given ID. + /// + /// The ID of the channel to delete. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(Channel)], nameof(Channel.Id), Cast = true)] public async Task DeleteChannelAsync(ulong channelId, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) => Channel.CreateFromJson(await (await SendRequestAsync(HttpMethod.Delete, $"/channels/{channelId}", null, new(channelId), properties, cancellationToken: cancellationToken).ConfigureAwait(false)).ToObjectAsync(Serialization.Default.JsonChannel).ConfigureAwait(false), this); + /// + /// Retrieves an , representing the messages of a specific channel. + /// + /// The ID of the channel to retrieve messages from. + /// Optional properties to customize result pagination, can be . + /// Optional properties to customize the request, can be . [GenerateAlias([typeof(TextChannel)], nameof(TextChannel.Id))] public IAsyncEnumerable GetMessagesAsync(ulong channelId, PaginationProperties? paginationProperties = null, RestRequestProperties? properties = null) { @@ -50,15 +82,37 @@ public IAsyncEnumerable GetMessagesAsync(ulong channelId, Paginatio properties); } + /// + /// Retrieves a list of messages around a specific message ID within a channel. + /// + /// The ID of the channel to retrieve messages from. + /// The ID of the message to center the result around. + /// The maximum number of messages to retrieve, or to use the default. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(TextChannel)], nameof(TextChannel.Id))] public async Task> GetMessagesAroundAsync(ulong channelId, ulong messageId, int? limit = null, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) => (await (await SendRequestAsync(HttpMethod.Get, $"/channels/{channelId}/messages", $"?limit={limit.GetValueOrDefault(100)}&around={messageId}", new(channelId), properties, cancellationToken: cancellationToken).ConfigureAwait(false)).ToObjectAsync(Serialization.Default.JsonMessageArray).ConfigureAwait(false)).Select(m => new RestMessage(m, this)).ToArray(); + /// + /// Retrieves a specific message from a channel by ID. + /// + /// The ID of the channel containing the message. + /// The ID of the message to retrieve. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(TextChannel)], nameof(TextChannel.Id))] [GenerateAlias([typeof(RestMessage)], nameof(RestMessage.ChannelId), nameof(RestMessage.Id), TypeNameOverride = "Message")] public async Task GetMessageAsync(ulong channelId, ulong messageId, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) => new(await (await SendRequestAsync(HttpMethod.Get, $"/channels/{channelId}/messages/{messageId}", null, new(channelId), properties, cancellationToken: cancellationToken).ConfigureAwait(false)).ToObjectAsync(Serialization.Default.JsonMessage).ConfigureAwait(false), this); + /// + /// Sends a new message to the specified text channel. + /// + /// The ID of the channel to send the message to. + /// The content and properties of the message to send. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(TextChannel)], nameof(TextChannel.Id))] [GenerateAlias([typeof(RestMessage)], nameof(RestMessage.ChannelId), TypeNameOverride = "Message")] public async Task SendMessageAsync(ulong channelId, MessageProperties message, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) @@ -67,27 +121,67 @@ public async Task SendMessageAsync(ulong channelId, MessageProperti return new(await (await SendRequestAsync(HttpMethod.Post, content, $"/channels/{channelId}/messages", null, new(channelId), properties, cancellationToken: cancellationToken).ConfigureAwait(false)).ToObjectAsync(Serialization.Default.JsonMessage).ConfigureAwait(false), this); } + /// + /// Crossposts a message from an announcement channel to subscribed channels. + /// + /// The ID of the announcement channel containing the message. + /// The ID of the message to crosspost. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(AnnouncementGuildChannel)], nameof(AnnouncementGuildChannel.Id))] [GenerateAlias([typeof(AnnouncementGuildThread)], nameof(AnnouncementGuildThread.Id))] [GenerateAlias([typeof(RestMessage)], nameof(RestMessage.ChannelId), nameof(RestMessage.Id), TypeNameOverride = "Message")] public async Task CrosspostMessageAsync(ulong channelId, ulong messageId, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) => new(await (await SendRequestAsync(HttpMethod.Post, $"/channels/{channelId}/messages/{messageId}/crosspost", null, new(channelId), properties, cancellationToken: cancellationToken).ConfigureAwait(false)).ToObjectAsync(Serialization.Default.JsonMessage).ConfigureAwait(false), this); + /// + /// Adds a reaction to a specific message. + /// + /// The ID of the channel containing the message. + /// The ID of the message to react to. + /// The emoji to use as the reaction. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(TextChannel)], nameof(TextChannel.Id))] [GenerateAlias([typeof(RestMessage)], nameof(RestMessage.ChannelId), nameof(RestMessage.Id), TypeNameOverride = "Message")] public Task AddMessageReactionAsync(ulong channelId, ulong messageId, ReactionEmojiProperties emoji, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) => SendRequestAsync(HttpMethod.Put, $"/channels/{channelId}/messages/{messageId}/reactions/{ReactionEmojiToString(emoji)}/@me", null, new(channelId), properties, cancellationToken: cancellationToken); + /// + /// Removes the current user's reaction from a specific message. + /// + /// The ID of the channel containing the message. + /// The ID of the message to remove the reaction from. + /// The emoji to remove as a reaction. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(TextChannel)], nameof(TextChannel.Id))] [GenerateAlias([typeof(RestMessage)], nameof(RestMessage.ChannelId), nameof(RestMessage.Id), TypeNameOverride = "Message")] public Task DeleteCurrentUserMessageReactionAsync(ulong channelId, ulong messageId, ReactionEmojiProperties emoji, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) => SendRequestAsync(HttpMethod.Delete, $"/channels/{channelId}/messages/{messageId}/reactions/{ReactionEmojiToString(emoji)}/@me", null, new(channelId), properties, cancellationToken: cancellationToken); + /// + /// Removes a specific user's reaction from a message. + /// + /// The ID of the channel containing the message. + /// The ID of the message to remove the reaction from. + /// The emoji to remove as a reaction. + /// The ID of the user whose reaction will be removed. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(TextChannel)], nameof(TextChannel.Id))] [GenerateAlias([typeof(RestMessage)], nameof(RestMessage.ChannelId), nameof(RestMessage.Id), TypeNameOverride = "Message")] public Task DeleteUserMessageReactionAsync(ulong channelId, ulong messageId, ReactionEmojiProperties emoji, ulong userId, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) => SendRequestAsync(HttpMethod.Delete, $"/channels/{channelId}/messages/{messageId}/reactions/{ReactionEmojiToString(emoji)}/{userId}", null, new(channelId), properties, cancellationToken: cancellationToken); + /// + /// Retrieves a paginated list of users who reacted to a message with a specific emoji. + /// + /// The ID of the channel containing the message. + /// The ID of the message to retrieve reactions for. + /// The emoji to filter reactions by. + /// Pagination options for fetching users, or to use defaults. + /// Optional properties to customize the request, can be . [GenerateAlias([typeof(TextChannel)], nameof(TextChannel.Id))] [GenerateAlias([typeof(RestMessage)], nameof(RestMessage.ChannelId), nameof(RestMessage.Id), TypeNameOverride = "Message")] public IAsyncEnumerable GetMessageReactionsAsync(ulong channelId, ulong messageId, ReactionEmojiProperties emoji, MessageReactionsPaginationProperties? paginationProperties = null, RestRequestProperties? properties = null) @@ -108,11 +202,26 @@ public IAsyncEnumerable GetMessageReactionsAsync(ulong channelId, ulong me properties); } + /// + /// Removes all reactions from a message. + /// + /// The ID of the channel containing the message. + /// The ID of the message to clear reactions from. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(TextChannel)], nameof(TextChannel.Id))] [GenerateAlias([typeof(RestMessage)], nameof(RestMessage.ChannelId), nameof(RestMessage.Id), TypeNameOverride = "Message")] public Task DeleteAllMessageReactionsAsync(ulong channelId, ulong messageId, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) => SendRequestAsync(HttpMethod.Delete, $"/channels/{channelId}/messages/{messageId}/reactions", null, new(channelId), properties, cancellationToken: cancellationToken); + /// + /// Removes all reactions of a specific emoji from a message. + /// + /// The ID of the channel containing the message. + /// The ID of the message to clear emoji reactions from. + /// The emoji to remove from all users. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(TextChannel)], nameof(TextChannel.Id))] [GenerateAlias([typeof(RestMessage)], nameof(RestMessage.ChannelId), nameof(RestMessage.Id), TypeNameOverride = "Message")] public Task DeleteAllMessageReactionsForEmojiAsync(ulong channelId, ulong messageId, ReactionEmojiProperties emoji, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) @@ -124,6 +233,14 @@ private static string ReactionEmojiToString(ReactionEmojiProperties emoji) return id.HasValue ? $"{emoji.Name}:{id.GetValueOrDefault()}" : Uri.EscapeDataString(emoji.Name); } + /// + /// Modifies the contents of a specific message. + /// + /// The ID of the channel containing the message. + /// The ID of the message to modify. + /// An action that sets the new message properties. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(TextChannel)], nameof(TextChannel.Id))] [GenerateAlias([typeof(RestMessage)], nameof(RestMessage.ChannelId), nameof(RestMessage.Id), TypeNameOverride = "Message")] public async Task ModifyMessageAsync(ulong channelId, ulong messageId, Action action, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) @@ -134,11 +251,25 @@ public async Task ModifyMessageAsync(ulong channelId, ulong message return new(await (await SendRequestAsync(HttpMethod.Patch, content, $"/channels/{channelId}/messages/{messageId}", null, new(channelId), properties, cancellationToken: cancellationToken).ConfigureAwait(false)).ToObjectAsync(Serialization.Default.JsonMessage).ConfigureAwait(false), this); } + /// + /// Deletes a message from a channel by ID. + /// + /// The ID of the channel containing the message. + /// The ID of the message to delete. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(TextChannel)], nameof(TextChannel.Id))] [GenerateAlias([typeof(RestMessage)], nameof(RestMessage.ChannelId), nameof(RestMessage.Id), TypeNameOverride = "Message")] public Task DeleteMessageAsync(ulong channelId, ulong messageId, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) => SendRequestAsync(HttpMethod.Delete, $"/channels/{channelId}/messages/{messageId}", null, new(channelId), properties, cancellationToken: cancellationToken); + /// + /// Deletes multiple messages in bulk or individually depending on batch size. + /// + /// The ID of the channel containing the messages. + /// The list of message IDs to delete. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(TextChannel)], nameof(TextChannel.Id))] public Task DeleteMessagesAsync(ulong channelId, IEnumerable messageIds, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) { @@ -163,6 +294,13 @@ public Task DeleteMessagesAsync(ulong channelId, IEnumerable messageIds, return Task.WhenAll(tasks); } + /// + /// Deletes multiple messages in bulk or individually depending on batch size (async enumerable). + /// + /// The ID of the channel containing the messages. + /// The async enumerable of message IDs to delete. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(TextChannel)], nameof(TextChannel.Id))] public async Task DeleteMessagesAsync(ulong channelId, IAsyncEnumerable messageIds, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) { @@ -193,6 +331,13 @@ private async Task BulkDeleteMessagesAsync(ulong channelId, ArraySegment await SendRequestAsync(HttpMethod.Post, content, $"/channels/{channelId}/messages/bulk-delete", null, new(channelId), properties, cancellationToken: cancellationToken).ConfigureAwait(false); } + /// + /// Modifies the permissions of a role or user in a guild channel. + /// + /// The ID of the guild channel to update permissions for. + /// The permission overwrite to apply. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(IGuildChannel)], nameof(IGuildChannel.Id))] public async Task ModifyGuildChannelPermissionsAsync(ulong channelId, PermissionOverwriteProperties permissionOverwrite, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) { @@ -200,23 +345,48 @@ public async Task ModifyGuildChannelPermissionsAsync(ulong channelId, Permission await SendRequestAsync(HttpMethod.Put, content, $"/channels/{channelId}/permissions/{permissionOverwrite.Id}", null, new(channelId), properties, cancellationToken: cancellationToken).ConfigureAwait(false); } + /// + /// Retrieves a list of active invites for a guild channel. + /// + /// The ID of the channel to retrieve invites for. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(IGuildChannel)], nameof(IGuildChannel.Id))] public async Task> GetGuildChannelInvitesAsync(ulong channelId, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) => (await (await SendRequestAsync(HttpMethod.Get, $"/channels/{channelId}/invites", null, new(channelId), properties, cancellationToken: cancellationToken).ConfigureAwait(false)).ToObjectAsync(Serialization.Default.JsonRestInviteArray).ConfigureAwait(false)).Select(r => new RestInvite(r, this)); + /// + /// Creates a new invite for a guild channel. + /// + /// The ID of the guild channel to create the invite for. + /// The properties to configure the new invite. Can be for defaults. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(IGuildChannel)], nameof(IGuildChannel.Id))] public async Task CreateGuildChannelInviteAsync(ulong channelId, InviteProperties? inviteProperties = null, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) -#pragma warning disable CS8620 // Argument cannot be used for parameter due to differences in the nullability of reference types. { using (HttpContent content = new JsonContent(inviteProperties, Serialization.Default.InviteProperties)) return new(await (await SendRequestAsync(HttpMethod.Post, content, $"/channels/{channelId}/invites", null, new(channelId), properties, cancellationToken: cancellationToken).ConfigureAwait(false)).ToObjectAsync(Serialization.Default.JsonRestInvite).ConfigureAwait(false), this); } -#pragma warning restore CS8620 // Argument cannot be used for parameter due to differences in the nullability of reference types. + /// + /// Deletes a permission overwrite for a user or role in a guild channel. + /// + /// The ID of the guild channel. + /// The ID of the role or user whose permission overwrite is to be deleted. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(IGuildChannel)], nameof(IGuildChannel.Id))] public Task DeleteGuildChannelPermissionAsync(ulong channelId, ulong overwriteId, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) => SendRequestAsync(HttpMethod.Delete, $"/channels/{channelId}/permissions/{overwriteId}", null, new(channelId), properties, cancellationToken: cancellationToken); + /// + /// Follows an announcement channel to another channel. + /// + /// The ID of the source announcement channel. + /// The ID of the channel to receive crossposted messages. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(AnnouncementGuildChannel)], nameof(AnnouncementGuildChannel.Id))] [GenerateAlias([typeof(AnnouncementGuildThread)], nameof(AnnouncementGuildThread.Id), TypeNameOverride = nameof(AnnouncementGuildChannel))] public async Task FollowAnnouncementGuildChannelAsync(ulong channelId, ulong webhookChannelId, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) @@ -225,10 +395,22 @@ public async Task FollowAnnouncementGuildChannelAsync(ulong cha return new(await (await SendRequestAsync(HttpMethod.Post, content, $"/channels/{channelId}/followers", null, new(channelId), properties, cancellationToken: cancellationToken).ConfigureAwait(false)).ToObjectAsync(Serialization.Default.JsonFollowedChannel).ConfigureAwait(false), this); } + /// + /// Sends a typing indicator to the channel. + /// + /// The ID of the channel to trigger typing in. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(TextChannel)], nameof(TextChannel.Id))] public Task TriggerTypingStateAsync(ulong channelId, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) => SendRequestAsync(HttpMethod.Post, $"/channels/{channelId}/typing", null, new(channelId), properties, cancellationToken: cancellationToken); + /// + /// Enters a persistent typing state for the current user. + /// + /// The ID of the channel to type in. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(TextChannel)], nameof(TextChannel.Id))] public async Task EnterTypingStateAsync(ulong channelId, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) { @@ -237,20 +419,48 @@ public async Task EnterTypingStateAsync(ulong channelId, RestReques return typingReminder; } + /// + /// Retrieves all pinned messages in a channel. + /// + /// The ID of the channel to get pinned messages from. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(TextChannel)], nameof(TextChannel.Id))] public async Task> GetPinnedMessagesAsync(ulong channelId, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) => (await (await SendRequestAsync(HttpMethod.Get, $"/channels/{channelId}/pins", null, new(channelId), properties, cancellationToken: cancellationToken).ConfigureAwait(false)).ToObjectAsync(Serialization.Default.JsonMessageArray).ConfigureAwait(false)).Select(m => new RestMessage(m, this)).ToArray(); + /// + /// Pins a message in a channel. + /// + /// The ID of the channel containing the message. + /// The ID of the message to pin. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(TextChannel)], nameof(TextChannel.Id))] [GenerateAlias([typeof(RestMessage)], nameof(RestMessage.ChannelId), nameof(RestMessage.Id), TypeNameOverride = "Message")] public Task PinMessageAsync(ulong channelId, ulong messageId, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) => SendRequestAsync(HttpMethod.Put, $"/channels/{channelId}/pins/{messageId}", null, new(channelId), properties, cancellationToken: cancellationToken); + /// + /// Unpins a message from a channel. + /// + /// The ID of the channel containing the message. + /// The ID of the message to unpin. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(TextChannel)], nameof(TextChannel.Id))] [GenerateAlias([typeof(RestMessage)], nameof(RestMessage.ChannelId), nameof(RestMessage.Id), TypeNameOverride = "Message")] public Task UnpinMessageAsync(ulong channelId, ulong messageId, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) => SendRequestAsync(HttpMethod.Delete, $"/channels/{channelId}/pins/{messageId}", null, new(channelId), properties, cancellationToken: cancellationToken); + /// + /// Adds a recipient to a group DM channel. + /// + /// The ID of the group DM channel. + /// The ID of the user to add. + /// Properties for adding the user, such as access tokens. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(GroupDMChannel)], nameof(GroupDMChannel.Id))] public async Task GroupDMChannelAddUserAsync(ulong channelId, ulong userId, GroupDMChannelUserAddProperties groupDMChannelUserAddProperties, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) { @@ -258,10 +468,25 @@ public async Task GroupDMChannelAddUserAsync(ulong channelId, ulong userId, Grou await SendRequestAsync(HttpMethod.Put, content, $"/channels/{channelId}/recipients/{userId}", null, new(channelId), properties, cancellationToken: cancellationToken).ConfigureAwait(false); } + /// + /// Removes a recipient from a group DM channel. + /// + /// The ID of the group DM channel. + /// The ID of the user to remove. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(GroupDMChannel)], nameof(GroupDMChannel.Id))] public Task GroupDMChannelDeleteUserAsync(ulong channelId, ulong userId, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) => SendRequestAsync(HttpMethod.Delete, $"/channels/{channelId}/recipients/{userId}", null, new(channelId), properties, cancellationToken: cancellationToken); + /// + /// Creates a thread from an existing message in a text channel. + /// + /// The ID of the text channel containing the message. + /// The ID of the message to start the thread from. + /// The properties of the thread to create. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(TextGuildChannel)], nameof(TextGuildChannel.Id))] [GenerateAlias([typeof(RestMessage)], nameof(RestMessage.ChannelId), nameof(RestMessage.Id), TypeNameOverride = "Message")] public async Task CreateGuildThreadAsync(ulong channelId, ulong messageId, GuildThreadFromMessageProperties threadFromMessageProperties, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) @@ -270,6 +495,13 @@ public async Task CreateGuildThreadAsync(ulong channelId, ulong mes return GuildThread.CreateFromJson(await (await SendRequestAsync(HttpMethod.Post, content, $"/channels/{channelId}/messages/{messageId}/threads", null, new(channelId), properties, cancellationToken: cancellationToken).ConfigureAwait(false)).ToObjectAsync(Serialization.Default.JsonChannel).ConfigureAwait(false), this); } + /// + /// Creates a standalone thread in a text channel. + /// + /// The ID of the text channel to create the thread in. + /// The properties of the thread to create. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(TextGuildChannel)], nameof(TextGuildChannel.Id))] public async Task CreateGuildThreadAsync(ulong channelId, GuildThreadProperties threadProperties, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) { @@ -277,6 +509,13 @@ public async Task CreateGuildThreadAsync(ulong channelId, GuildThre return GuildThread.CreateFromJson(await (await SendRequestAsync(HttpMethod.Post, content, $"/channels/{channelId}/threads", null, new(channelId), properties, cancellationToken: cancellationToken).ConfigureAwait(false)).ToObjectAsync(Serialization.Default.JsonChannel).ConfigureAwait(false), this); } + /// + /// Creates a new thread in a forum channel. + /// + /// The ID of the forum channel. + /// The properties of the forum thread to create. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(ForumGuildChannel)], nameof(ForumGuildChannel.Id))] public async Task CreateForumGuildThreadAsync(ulong channelId, ForumGuildThreadProperties threadProperties, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) { @@ -284,23 +523,57 @@ public async Task CreateForumGuildThreadAsync(ulong channelId, return new ForumGuildThread(await (await SendRequestAsync(HttpMethod.Post, content, $"/channels/{channelId}/threads", null, new(channelId), properties, cancellationToken: cancellationToken).ConfigureAwait(false)).ToObjectAsync(Serialization.Default.JsonChannel).ConfigureAwait(false), this); } + /// + /// Joins the current user to a thread. + /// + /// The ID of the thread to join. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(GuildThread)], nameof(GuildThread.Id))] public Task JoinGuildThreadAsync(ulong threadId, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) => SendRequestAsync(HttpMethod.Put, $"/channels/{threadId}/thread-members/@me", null, new(threadId), properties, cancellationToken: cancellationToken); + /// + /// Adds another user to a thread. + /// + /// The ID of the thread. + /// The ID of the user to add to the thread. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(GuildThread)], nameof(GuildThread.Id))] public Task AddGuildThreadUserAsync(ulong threadId, ulong userId, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) => SendRequestAsync(HttpMethod.Put, $"/channels/{threadId}/thread-members/{userId}", null, new(threadId), properties, cancellationToken: cancellationToken); + /// + /// Removes the current user from a thread. + /// + /// The ID of the thread to leave. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(GuildThread)], nameof(GuildThread.Id))] public Task LeaveGuildThreadAsync(ulong threadId, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) => SendRequestAsync(HttpMethod.Delete, $"/channels/{threadId}/thread-members/@me", null, new(threadId), properties, cancellationToken: cancellationToken); + /// + /// Removes a user from a thread. + /// + /// The ID of the thread. + /// The ID of the user to remove from the thread. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(GuildThread)], nameof(GuildThread.Id))] [GenerateAlias([typeof(GuildThreadUser)], nameof(GuildThreadUser.ThreadId), nameof(GuildThreadUser.Id))] public Task DeleteGuildThreadUserAsync(ulong threadId, ulong userId, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) => SendRequestAsync(HttpMethod.Delete, $"/channels/{threadId}/thread-members/{userId}", null, new(threadId), properties, cancellationToken: cancellationToken); + /// + /// Retrieves a thread member object for a user in the thread. + /// + /// The ID of the thread. + /// The ID of the user to fetch thread membership info for. + /// Whether to include full guild member info in the response. + /// Optional properties to customize the request, can be . + /// A token that can be used to cancel the operation before it completes. [GenerateAlias([typeof(GuildThread)], nameof(GuildThread.Id))] public async Task GetGuildThreadUserAsync(ulong threadId, ulong userId, bool withGuildUser = false, RestRequestProperties? properties = null, CancellationToken cancellationToken = default) { @@ -308,6 +581,12 @@ public async Task GetGuildThreadUserAsync(ulong threadId, ulong user return withGuildUser ? new GuildThreadUser(user, this) : new ThreadUser(user, this); } + /// + /// Retrieves a list of users participating in a thread. + /// + /// The ID of the thread. + /// Pagination options for fetching users, or to use defaults. + /// Optional properties to customize the request, can be . [GenerateAlias([typeof(GuildThread)], nameof(GuildThread.Id))] public IAsyncEnumerable GetGuildThreadUsersAsync(ulong threadId, OptionalGuildUsersPaginationProperties? paginationProperties = null, RestRequestProperties? properties = null) { @@ -329,6 +608,12 @@ public IAsyncEnumerable GetGuildThreadUsersAsync(ulong threadId, Opt properties); } + /// + /// Retrieves public archived threads in the channel. + /// + /// The ID of the text channel. + /// Pagination options for archived threads, or to use defaults. + /// Optional properties to customize the request, can be . [GenerateAlias([typeof(TextGuildChannel)], nameof(TextGuildChannel.Id))] public IAsyncEnumerable GetPublicArchivedGuildThreadsAsync(ulong channelId, PaginationProperties? paginationProperties = null, RestRequestProperties? properties = null) { @@ -350,6 +635,12 @@ public IAsyncEnumerable GetPublicArchivedGuildThreadsAsync(ulong ch properties); } + /// + /// Retrieves private archived threads in the channel. + /// + /// The ID of the text channel. + /// Pagination options for archived threads, or to use defaults. + /// Optional properties to customize the request, can be . [GenerateAlias([typeof(TextGuildChannel)], nameof(TextGuildChannel.Id))] public IAsyncEnumerable GetPrivateArchivedGuildThreadsAsync(ulong channelId, PaginationProperties? paginationProperties = null, RestRequestProperties? properties = null) { @@ -371,6 +662,12 @@ public IAsyncEnumerable GetPrivateArchivedGuildThreadsAsync(ulong c properties); } + /// + /// Retrieves private archived threads joined by the current user. + /// + /// The ID of the text channel. + /// Pagination options for archived threads, or to use defaults. + /// Optional properties to customize the request, can be . [GenerateAlias([typeof(TextGuildChannel)], nameof(TextGuildChannel.Id))] public IAsyncEnumerable GetJoinedPrivateArchivedGuildThreadsAsync(ulong channelId, PaginationProperties? paginationProperties = null, RestRequestProperties? properties = null) {