diff --git a/src/Discord.Net.Rest/Entities/Channels/RestDMChannel.cs b/src/Discord.Net.Rest/Entities/Channels/RestDMChannel.cs index 14d19bfa3..ddb4f9b10 100644 --- a/src/Discord.Net.Rest/Entities/Channels/RestDMChannel.cs +++ b/src/Discord.Net.Rest/Entities/Channels/RestDMChannel.cs @@ -47,6 +47,14 @@ namespace Discord.Rest public Task CloseAsync(RequestOptions options = null) => ChannelHelper.DeleteAsync(this, Discord, options); + + /// + /// Gets a user in this channel from the provided . + /// + /// The snowflake identifier of the user. + /// + /// A object that is a recipient of this channel; otherwise null. + /// public RestUser GetUser(ulong id) { if (id == Recipient.Id) @@ -175,10 +183,10 @@ namespace Discord.Rest /// async Task> IMessageChannel.GetPinnedMessagesAsync(RequestOptions options) => await GetPinnedMessagesAsync(options).ConfigureAwait(false); - + /// async Task IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed, RequestOptions options) => await SendFileAsync(filePath, text, isTTS, embed, options).ConfigureAwait(false); - + /// async Task IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options) => await SendFileAsync(stream, filename, text, isTTS, embed, options).ConfigureAwait(false); /// diff --git a/src/Discord.Net.Rest/Entities/Channels/RestGuildChannel.cs b/src/Discord.Net.Rest/Entities/Channels/RestGuildChannel.cs index cc52a9864..5895500bd 100644 --- a/src/Discord.Net.Rest/Entities/Channels/RestGuildChannel.cs +++ b/src/Discord.Net.Rest/Entities/Channels/RestGuildChannel.cs @@ -72,6 +72,13 @@ namespace Discord.Rest public Task DeleteAsync(RequestOptions options = null) => ChannelHelper.DeleteAsync(this, Discord, options); + /// + /// Gets the overwrite permissions of the specified . + /// + /// The user that you want to get the overwrite permissions for. + /// + /// The overwrite permissions for the requested user; otherwise null. + /// public OverwritePermissions? GetPermissionOverwrite(IUser user) { for (int i = 0; i < _overwrites.Length; i++) @@ -81,6 +88,14 @@ namespace Discord.Rest } return null; } + + /// + /// Gets the overwrite permissions of the specified . + /// + /// The role that you want to get the overwrite permissions for. + /// + /// The overwrite permissions for the requested role; otherwise null. + /// public OverwritePermissions? GetPermissionOverwrite(IRole role) { for (int i = 0; i < _overwrites.Length; i++) @@ -90,16 +105,45 @@ namespace Discord.Rest } return null; } + + /// + /// Adds an overwrite permission for the specified . + /// + /// The user you want the overwrite permission to apply to. + /// The overwrite permission you want to add. + /// The options to be used when sending the request. + /// + /// An awaitable . + /// public async Task AddPermissionOverwriteAsync(IUser user, OverwritePermissions perms, RequestOptions options = null) { await ChannelHelper.AddPermissionOverwriteAsync(this, Discord, user, perms, options).ConfigureAwait(false); _overwrites = _overwrites.Add(new Overwrite(user.Id, PermissionTarget.User, new OverwritePermissions(perms.AllowValue, perms.DenyValue))); } + + /// + /// Adds an overwrite permission for the specified . + /// + /// The role you want the overwrite permission to apply to. + /// The overwrite permission you want to add. + /// The options to be used when sending the request. + /// + /// An awaitable . + /// public async Task AddPermissionOverwriteAsync(IRole role, OverwritePermissions perms, RequestOptions options = null) { await ChannelHelper.AddPermissionOverwriteAsync(this, Discord, role, perms, options).ConfigureAwait(false); _overwrites = _overwrites.Add(new Overwrite(role.Id, PermissionTarget.Role, new OverwritePermissions(perms.AllowValue, perms.DenyValue))); } + + /// + /// Removes an overwrite permission for the specified . + /// + /// The user you want to remove the overwrite permission from. + /// The options to be used when sending the request. + /// + /// An awaitable . + /// public async Task RemovePermissionOverwriteAsync(IUser user, RequestOptions options = null) { await ChannelHelper.RemovePermissionOverwriteAsync(this, Discord, user, options).ConfigureAwait(false); @@ -113,6 +157,15 @@ namespace Discord.Rest } } } + + /// + /// Removes an overwrite permission for the specified . + /// + /// The role you want the overwrite permissions to be removed from. + /// The options to be used when sending the request. + /// + /// An awaitable . + /// public async Task RemovePermissionOverwriteAsync(IRole role, RequestOptions options = null) { await ChannelHelper.RemovePermissionOverwriteAsync(this, Discord, role, options).ConfigureAwait(false); @@ -127,11 +180,38 @@ namespace Discord.Rest } } + /// + /// Gets the invites for this channel. + /// + /// The options to be used when sending the request. + /// + /// An awaitable containing an . + /// contains information such as, the number of times the invite has + /// been used, who created the invite, and when the invite was created. + /// public async Task> GetInvitesAsync(RequestOptions options = null) => await ChannelHelper.GetInvitesAsync(this, Discord, options).ConfigureAwait(false); + + /// + /// Creates an invite for this channel. + /// + /// The number of seconds that you want the invite to be valid for. + /// The number of times this invite can be used before it expires. + /// Whether or not the invite grants temporary membership. + /// Whether to try reuse a similar invite or not. + /// The options to be used when sending the request. + /// + /// An awaitable containing a . + /// public async Task CreateInviteAsync(int? maxAge = 86400, int? maxUses = null, bool isTemporary = false, bool isUnique = false, RequestOptions options = null) => await ChannelHelper.CreateInviteAsync(this, Discord, maxAge, maxUses, isTemporary, isUnique, options).ConfigureAwait(false); + /// + /// Gets the name of this channel. + /// + /// + /// A string that is the name of this channel. + /// public override string ToString() => Name; //IGuildChannel diff --git a/src/Discord.Net.Rest/Entities/Channels/RestTextChannel.cs b/src/Discord.Net.Rest/Entities/Channels/RestTextChannel.cs index f1a282dc9..b7409c180 100644 --- a/src/Discord.Net.Rest/Entities/Channels/RestTextChannel.cs +++ b/src/Discord.Net.Rest/Entities/Channels/RestTextChannel.cs @@ -49,8 +49,25 @@ namespace Discord.Rest Update(model); } + /// + /// Gets a user that is able to view this channel from the associate . + /// + /// The snowflake identifier of the user you want to get. + /// The options to be used when sending the request. + /// + /// An awaitable containing a . + /// public Task GetUserAsync(ulong id, RequestOptions options = null) => ChannelHelper.GetUserAsync(this, Guild, Discord, id, options); + + /// + /// Gets the collection of users that can view this channel. + /// + /// The options to be used when sending the request. + /// + /// Paged collection of users. Flattening the paginated response into a collection of + /// with is required if you wish to access the users. + /// public IAsyncEnumerable> GetUsersAsync(RequestOptions options = null) => ChannelHelper.GetUsersAsync(this, Guild, Discord, null, null, options); @@ -128,7 +145,16 @@ namespace Discord.Rest /// public IDisposable EnterTypingState(RequestOptions options = null) => ChannelHelper.EnterTypingState(this, Discord, options); - + + /// + /// Creates a webhook for this channel. + /// + /// The name you want to give the webhook. + /// The avatar that you want the webook to have. + /// The options to be used when sending the request. + /// + /// An awaitable containing a . + /// public Task CreateWebhookAsync(string name, Stream avatar = null, RequestOptions options = null) => ChannelHelper.CreateWebhookAsync(this, Discord, name, avatar, options); public Task GetWebhookAsync(ulong id, RequestOptions options = null) @@ -136,6 +162,13 @@ namespace Discord.Rest public Task> GetWebhooksAsync(RequestOptions options = null) => ChannelHelper.GetWebhooksAsync(this, Discord, options); + /// + /// Gets the parent category of this channel. + /// + /// The options to be used when sending the request. + /// + /// An awaitable containing an . + /// public Task GetCategoryAsync(RequestOptions options = null) => ChannelHelper.GetCategoryAsync(this, Discord, options); diff --git a/src/Discord.Net.Rest/Entities/Channels/RestVoiceChannel.cs b/src/Discord.Net.Rest/Entities/Channels/RestVoiceChannel.cs index a2b086258..6fd068ed1 100644 --- a/src/Discord.Net.Rest/Entities/Channels/RestVoiceChannel.cs +++ b/src/Discord.Net.Rest/Entities/Channels/RestVoiceChannel.cs @@ -47,6 +47,13 @@ namespace Discord.Rest Update(model); } + /// + /// Gets the parent category of this channel. + /// + /// The options to be used when sending the request. + /// + /// An awaitable containing an . + /// public Task GetCategoryAsync(RequestOptions options = null) => ChannelHelper.GetCategoryAsync(this, Discord, options); diff --git a/src/Discord.Net.Rest/Entities/Messages/RestMessage.cs b/src/Discord.Net.Rest/Entities/Messages/RestMessage.cs index 6d18beaad..c6ca82604 100644 --- a/src/Discord.Net.Rest/Entities/Messages/RestMessage.cs +++ b/src/Discord.Net.Rest/Entities/Messages/RestMessage.cs @@ -13,6 +13,9 @@ namespace Discord.Rest /// public IMessageChannel Channel { get; } + /// + /// Gets the Author of the message. + /// public IUser Author { get; } /// public MessageSource Source { get; } @@ -28,12 +31,21 @@ namespace Discord.Rest public virtual bool IsPinned => false; /// public virtual DateTimeOffset? EditedTimestamp => null; + /// + /// Gets a collection of the 's on the message. + /// public virtual IReadOnlyCollection Attachments => ImmutableArray.Create(); + /// + /// Gets a collection of the 's on the message. + /// public virtual IReadOnlyCollection Embeds => ImmutableArray.Create(); /// public virtual IReadOnlyCollection MentionedChannelIds => ImmutableArray.Create(); /// public virtual IReadOnlyCollection MentionedRoleIds => ImmutableArray.Create(); + /// + /// Gets a collection of the mentioned users in the message. + /// public virtual IReadOnlyCollection MentionedUsers => ImmutableArray.Create(); /// public virtual IReadOnlyCollection Tags => ImmutableArray.Create(); @@ -74,6 +86,12 @@ namespace Discord.Rest public Task DeleteAsync(RequestOptions options = null) => MessageHelper.DeleteAsync(this, Discord, options); + /// + /// Gets the of the message. + /// + /// + /// A string that is the of the message. + /// public override string ToString() => Content; /// diff --git a/src/Discord.Net.Rest/Entities/Roles/RestRole.cs b/src/Discord.Net.Rest/Entities/Roles/RestRole.cs index 5ea7f4462..a12d80732 100644 --- a/src/Discord.Net.Rest/Entities/Roles/RestRole.cs +++ b/src/Discord.Net.Rest/Entities/Roles/RestRole.cs @@ -26,6 +26,9 @@ namespace Discord.Rest /// public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id); + /// + /// Gets if this role is the @everyone role of the guild or not. + /// public bool IsEveryone => Id == Guild.Id; /// public string Mention => IsEveryone ? "@everyone" : MentionUtils.MentionRole(Id); @@ -65,6 +68,12 @@ namespace Discord.Rest /// public int CompareTo(IRole role) => RoleUtils.Compare(this, role); + /// + /// Gets the name of the role. + /// + /// + /// A string that is the name of the role. + /// public override string ToString() => Name; private string DebuggerDisplay => $"{Name} ({Id})"; diff --git a/src/Discord.Net.Rest/Entities/Users/RestUser.cs b/src/Discord.Net.Rest/Entities/Users/RestUser.cs index 47c3f8b98..e08f500c4 100644 --- a/src/Discord.Net.Rest/Entities/Users/RestUser.cs +++ b/src/Discord.Net.Rest/Entities/Users/RestUser.cs @@ -76,6 +76,12 @@ namespace Discord.Rest public string GetDefaultAvatarUrl() => CDN.GetDefaultUserAvatarUrl(DiscriminatorValue); + /// + /// Gets the Username#Descriminator of the user. + /// + /// + /// A string that is the Username#Descriminator of the user. + /// public override string ToString() => $"{Username}#{Discriminator}"; private string DebuggerDisplay => $"{Username}#{Discriminator} ({Id}{(IsBot ? ", Bot" : "")})";