Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added some miscellaneous missing xmldocs #8

Merged
merged 21 commits into from
Aug 10, 2018
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
8dc6f2e
Added minimal descriptions from the API documentation for Integration…
Jul 31, 2018
6c3f85d
Added obsolete mention to the ReadMessages flag.
Jul 31, 2018
d64f670
Added remarks about 2FA requirement for guild permissions
Jul 31, 2018
677e715
Added xmldoc for GuildPermission methods
Jul 31, 2018
14b645a
Added xml doc for ToAllowList and ToDenyList
Jul 31, 2018
e8b3b49
Added specification of how the bits of the color raw value are packed
Jul 31, 2018
c572a98
Added discord API documentation to IConnection interface
Jul 31, 2018
981e2eb
I can spell :^)
Jul 31, 2018
9fcea88
Fix whitespace in ChannelPermission
Chris-Johnston Jul 31, 2018
a46910c
fix spacing of values in guildpermission
Jul 31, 2018
3d8e082
Made changes to get field descriptions from feedback, added returns t…
Jul 31, 2018
9185853
Added property get standard for IntegrationAccount
Jul 31, 2018
9bbf580
Added property get pattern to xml docs and identical returns tag.
Jul 31, 2018
c8bc452
Rewrote the returns tags in IGuildIntegration, removed the ones I was…
Aug 1, 2018
1d20132
Rewrote the rest of the returns tags
Aug 1, 2018
d9e1864
Added types to <returns> tags where missing
Chris-Johnston Aug 2, 2018
e41136c
restored the removed line break
Chris-Johnston Aug 10, 2018
25c208c
Removed unnecessary see tag
Chris-Johnston Aug 10, 2018
cee1522
Use consistent quotation marks around subscribers, the name for these…
Chris-Johnston Aug 10, 2018
6e80cef
Add <remarks> tag to the IGuildIntegration xmldocs
Chris-Johnston Aug 10, 2018
3ad948d
Fix grammar issue
Chris-Johnston Aug 10, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion src/Discord.Net.Core/Entities/Guilds/IGuildIntegration.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,39 @@
using System;
using System;

namespace Discord
{
public interface IGuildIntegration
{
/// <summary> Gets the integration ID. </summary>
/// <returns> Gets the integration ID. </returns>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pardon, but you might have misunderstood what I meant by the last request. summary and returns should not state the same thing. summary summarizes the member's purpose and what it does. returns explains what object is being returned and what for.

For example:

        /// <summary> Gets the darker grey color value. </summary>
        /// <returns> A color struct with the hex value of <see href="http://www.color-hex.com/color/607D8B">607D8B</see>.</returns>
        public static readonly Color DarkerGrey = new Color(0x546E7A);

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clarification and the example.

ulong Id { get; }
/// <summary> Gets the integration name. </summary>
/// <returns> Gets the integration name. </returns>
string Name { get; }
/// <summary> Gets the integration type (twitch, youtube, etc). </summary>
/// <returns> Gets the integration type (twitch, youtube, etc). </returns>
string Type { get; }
/// <summary> Gets if this integration is enabled or not. </summary>
/// <summary> Gets if this integration is enabled or not. </returns>
bool IsEnabled { get; }
/// <summary> Gets if this integration is syncing or not. </summary>
/// <returns> Gets if this integration is syncing or not. </returns>
bool IsSyncing { get; }
/// <summary> Gets the ID that this integration uses for "subscribers". </summary>
/// <returns> Gets the ID that this integration uses for "subscribers". </returns>
ulong ExpireBehavior { get; }
/// <summary> Gets the grace period before expiring subscribers. </summary>
/// <returns> Gets the grace period before expiring subscribers. </returns>
ulong ExpireGracePeriod { get; }
/// <summary> Gets when this integration was last synced. </summary>
/// <returns> Gets when this integration was last synced. </returns>
DateTimeOffset SyncedAt { get; }
/// <summary>
/// Gets integration account information. See <see cref="IntegrationAccount"/>.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<see> tag is unnecessary as it will be linked in the compiled doc, and object browser can lead the user to the type anyways.

/// </summary>
/// <returns>
/// Gets integration account information. See <see cref="IntegrationAccount"/>.
/// </returns>
IntegrationAccount Account { get; }

IGuild Guild { get; }
Expand Down
6 changes: 5 additions & 1 deletion src/Discord.Net.Core/Entities/Guilds/IntegrationAccount.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
using System.Diagnostics;
using System.Diagnostics;

namespace Discord
{
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public struct IntegrationAccount
{
/// <summary> Gets the ID of the account. </summary>
/// <returns> Gets the ID of the account. </returns>
public string Id { get; }
/// <summary> Gets the name of the account. </summary>
/// <returns> Gets the name of the account. </returns>
public string Name { get; private set; }

public override string ToString() => Name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public enum ChannelPermission : ulong
/// </summary>
AddReactions = 0x00_00_00_40,
/// <summary>
/// Allows for reading of message.
/// Allows for reading of messages. This flag is obsolete, use <see cref = "ViewChannel" /> instead.
/// </summary>
[Obsolete("Use ViewChannel instead.")]
ReadMessages = ViewChannel,
Expand Down
44 changes: 40 additions & 4 deletions src/Discord.Net.Core/Entities/Permissions/GuildPermission.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,43 @@ public enum GuildPermission : ulong
/// <summary>
/// Allows kicking members.
/// </summary>
/// <remarks>
/// This permission requires the owner account to use two-factor
/// authentication when used on a guild that has server-wide 2FA enabled.
/// </remarks>
KickMembers = 0x00_00_00_02,
/// <summary>
/// Allows banning members.
/// </summary>
/// <remarks>
/// This permission requires the owner account to use two-factor
/// authentication when used on a guild that has server-wide 2FA enabled.
/// </remarks>
BanMembers = 0x00_00_00_04,
/// <summary>
/// Allows all permissions and bypasses channel permission overwrites.
/// </summary>
Administrator = 0x00_00_00_08,
/// <remarks>
/// This permission requires the owner account to use two-factor
/// authentication when used on a guild that has server-wide 2FA enabled.
/// </remarks>
Administrator = 0x00_00_00_08,
/// <summary>
/// Allows management and editing of channels.
/// </summary>
ManageChannels = 0x00_00_00_10,
/// <remarks>
/// This permission requires the owner account to use two-factor
/// authentication when used on a guild that has server-wide 2FA enabled.
/// </remarks>
ManageChannels = 0x00_00_00_10,
/// <summary>
/// Allows management and editing of the guild.
/// </summary>
ManageGuild = 0x00_00_00_20,
/// <remarks>
/// This permission requires the owner account to use two-factor
/// authentication when used on a guild that has server-wide 2FA enabled.
/// </remarks>
ManageGuild = 0x00_00_00_20,

// Text
/// <summary>
Expand All @@ -52,7 +72,11 @@ public enum GuildPermission : ulong
/// <summary>
/// Allows for deletion of other users messages.
/// </summary>
ManageMessages = 0x00_00_20_00,
/// <remarks>
/// This permission requires the owner account to use two-factor
/// authentication when used on a guild that has server-wide 2FA enabled.
/// </remarks>
ManageMessages = 0x00_00_20_00,
/// <summary>
/// Allows links sent by users with this permission will be auto-embedded.
/// </summary>
Expand Down Expand Up @@ -114,14 +138,26 @@ public enum GuildPermission : ulong
/// <summary>
/// Allows management and editing of roles.
/// </summary>
/// <remarks>
/// This permission requires the owner account to use two-factor
/// authentication when used on a guild that has server-wide 2FA enabled.
/// </remarks>
ManageRoles = 0x10_00_00_00,
/// <summary>
/// Allows management and editing of webhooks.
/// </summary>
/// <remarks>
/// This permission requires the owner account to use two-factor
/// authentication when used on a guild that has server-wide 2FA enabled.
/// </remarks>
ManageWebhooks = 0x20_00_00_00,
/// <summary>
/// Allows management and editing of emojis.
/// </summary>
/// <remarks>
/// This permission requires the owner account to use two-factor
/// authentication when used on a guild that has server-wide 2FA enabled.
/// </remarks>
ManageEmojis = 0x40_00_00_00
}
}
11 changes: 11 additions & 0 deletions src/Discord.Net.Core/Entities/Permissions/GuildPermissions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,19 @@ public GuildPermissions Modify(
readMessageHistory, mentionEveryone, useExternalEmojis, connect, speak, muteMembers, deafenMembers, moveMembers,
useVoiceActivation, changeNickname, manageNicknames, manageRoles, manageWebhooks, manageEmojis);

/// <summary>
/// Returns a value that indicates if a specific <see cref="GuildPermission"/> is enabled
/// in these permissions.
/// </summary>
/// <param name="permission">The permission value to check for.</param>
/// <returns><c>true</c> if the permission is enabled, <c>false</c> otherwise.</returns>
public bool Has(GuildPermission permission) => Permissions.GetValue(RawValue, permission);

/// <summary>
/// Returns a <see cref="List{T}"/> containing all of the <see cref="GuildPermission"/>
/// flags that are enabled.
/// </summary>
/// <returns>A <see cref="List{T}"/> containing <see cref="GuildPermission"/> flags. Empty if none are enabled.</returns>
public List<GuildPermission> ToList()
{
var perms = new List<GuildPermission>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@ public OverwritePermissions Modify(
embedLinks, attachFiles, readMessageHistory, mentionEveryone, useExternalEmojis, connect, speak, muteMembers, deafenMembers,
moveMembers, useVoiceActivation, manageRoles, manageWebhooks);

/// <summary>
/// Creates a <see cref="List{T}"/> of all the <see cref="ChannelPermission"/> values that are allowed.
/// </summary>
/// <returns>A <see cref="List{T}"/> of all allowed <see cref="ChannelPermission"/> flags. If none, the list will be empty.</returns>
public List<ChannelPermission> ToAllowList()
{
var perms = new List<ChannelPermission>();
Expand All @@ -205,6 +209,11 @@ public List<ChannelPermission> ToAllowList()
}
return perms;
}

/// <summary>
/// Creates a <see cref="List{T}"/> of all the <see cref="ChannelPermission"/> values that are denied.
/// </summary>
/// <returns>A <see cref="List{T}"/> of all denied <see cref="ChannelPermission"/> flags. If none, the list will be empty.</returns>
public List<ChannelPermission> ToDenyList()
{
var perms = new List<ChannelPermission>();
Expand Down
4 changes: 4 additions & 0 deletions src/Discord.Net.Core/Entities/Roles/Color.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ public struct Color
public static readonly Color DarkerGrey = new Color(0x546E7A);

/// <summary> Gets the encoded value for this color. </summary>
/// <remarks>
/// This value is encoded as an unsigned integer value. The most-significant 8 bits contain the red value,
/// the middle 8 bits contain the green value, and the least-significant 8 bits contain the blue value.
/// </remarks>
public uint RawValue { get; }

/// <summary> Gets the red component for this color. </summary>
Expand Down
13 changes: 11 additions & 2 deletions src/Discord.Net.Core/Entities/Users/IConnection.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
using System.Collections.Generic;
using System.Collections.Generic;

namespace Discord
{
public interface IConnection
{
/// <summary> Gets the ID of the connection account. </summary>
/// <returns> Gets the ID of the connection account. </returns>
string Id { get; }
/// <summary> Gets the service of the connection (twitch, youtube). </summary>
/// <returns> Gets the service of the connection (twitch, youtube). </returns>
string Type { get; }
/// <summary> Gets the username of the connection account. </summary>
/// <returns> Gets the username of the connection account. </returns>
string Name { get; }
/// <summary> Gets whether the connection is revoked. </summary>
/// <returns> Gets whether the connection is revoked. </returns>
bool IsRevoked { get; }

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep the line-break as is.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, bad habit of mine.

/// <summary> Gets a <see cref="IReadOnlyCollection{T}"/> of integration IDs. </summary>
/// <returns> Gets a <see cref="IReadOnlyCollection{T}"/> of integration IDs. </returns>
IReadOnlyCollection<ulong> IntegrationIds { get; }
}
}