diff --git a/NetCord/Account.cs b/NetCord/Account.cs index 1781c4d14..05492e202 100644 --- a/NetCord/Account.cs +++ b/NetCord/Account.cs @@ -1,13 +1,20 @@ namespace NetCord; +/// +/// Represents an account as part of an object. +/// +/// The JSON model to create an object from. public class Account(JsonModels.JsonAccount jsonModel) : Entity, IJsonModel { JsonModels.JsonAccount IJsonModel.JsonModel => jsonModel; + /// + /// The ID of the account. + /// public override ulong Id => jsonModel.Id; /// - /// Name of the account. + /// The name of the account. /// public string Name => jsonModel.Name; } diff --git a/NetCord/Application.cs b/NetCord/Application.cs index 433335358..cb247a562 100644 --- a/NetCord/Application.cs +++ b/NetCord/Application.cs @@ -2,40 +2,19 @@ namespace NetCord; +/// +/// Applications or 'apps', are containers for developer platform features, and can be installed to guilds and/or user accounts. +/// public partial class Application : ClientEntity, IJsonModel { JsonModels.JsonApplication IJsonModel.JsonModel => _jsonModel; private readonly JsonModels.JsonApplication _jsonModel; - public override ulong Id => _jsonModel.Id; - public string Name => _jsonModel.Name; - public string? IconHash => _jsonModel.IconHash; - public string Description => _jsonModel.Description; - public IReadOnlyList RpcOrigins => _jsonModel.RpcOrigins; - public bool? BotPublic => _jsonModel.BotPublic; - public bool? BotRequireCodeGrant => _jsonModel.BotRequireCodeGrant; - public User? Bot { get; } - public string? TermsOfServiceUrl => _jsonModel.TermsOfServiceUrl; - public string? PrivacyPolicyUrl => _jsonModel.PrivacyPolicyUrl; - public User? Owner { get; } - public string VerifyKey => _jsonModel.VerifyKey; - public Team? Team { get; } - public ulong? GuildId => _jsonModel.GuildId; - public RestGuild? Guild { get; } - public ulong? PrimarySkuId => _jsonModel.PrimarySkuId; - public string? Slug => _jsonModel.Slug; - public string? CoverImageHash => _jsonModel.CoverImageHash; - public ApplicationFlags? Flags => _jsonModel.Flags; - public int? ApproximateGuildCount => _jsonModel.ApproximateGuildCount; - public int? ApproximateUserInstallCount => _jsonModel.ApproximateUserInstallCount; - public IReadOnlyList? RedirectUris => _jsonModel.RedirectUris; - public string? InteractionsEndpointUrl => _jsonModel.InteractionsEndpointUrl; - public string? RoleConnectionsVerificationUrl => _jsonModel.RoleConnectionsVerificationUrl; - public IReadOnlyList? Tags => _jsonModel.Tags; - public ApplicationInstallParams? InstallParams { get; } - public IReadOnlyDictionary? IntegrationTypesConfiguration { get; } - public string? CustomInstallUrl => _jsonModel.CustomInstallUrl; - + /// + /// Constructs an using a JSON Model and . + /// + /// The JSON model to create an from. + /// The to use for construction. public Application(JsonModels.JsonApplication jsonModel, RestClient client) : base(client) { _jsonModel = jsonModel; @@ -65,13 +44,177 @@ public Application(JsonModels.JsonApplication jsonModel, RestClient client) : ba IntegrationTypesConfiguration = integrationTypesConfiguration.ToDictionary(i => i.Key, i => new ApplicationIntegrationTypeConfiguration(i.Value)); } + /// + /// The ID of the application. + /// + public override ulong Id => _jsonModel.Id; + + /// + /// The name of the application. + /// + public string Name => _jsonModel.Name; + + /// + /// The icon hash of the application. + /// + public string? IconHash => _jsonModel.IconHash; + + /// + /// The description of the application. + /// + public string Description => _jsonModel.Description; + + /// + /// The application's RPC origin URL list, where T is of type . if RPC is disabled. + /// + public IReadOnlyList RpcOrigins => _jsonModel.RpcOrigins; + + /// + /// When , only the application owner can add the application to guilds. + /// + public bool? BotPublic => _jsonModel.BotPublic; + + /// + /// When , the application's bot will only join upon completion of the full OAuth2 code grant flow. + /// + public bool? BotRequireCodeGrant => _jsonModel.BotRequireCodeGrant; + + /// + /// The partial object of the application's bot. + /// + public User? Bot { get; } + + /// + /// The application's Terms of Service URL. + /// + public string? TermsOfServiceUrl => _jsonModel.TermsOfServiceUrl; + + /// + /// The application's Privacy Policy URL. + /// + public string? PrivacyPolicyUrl => _jsonModel.PrivacyPolicyUrl; + + /// + /// The partial object of the application's owner. + /// + public User? Owner { get; } + + /// + /// The hex-encoded verification key used for interactions and the GameSDK's GetTicket. + /// + public string VerifyKey => _jsonModel.VerifyKey; + + /// + /// The team the application belongs to. Is if the application does not belong to a team. + /// + public Team? Team { get; } + + /// + /// The ID of the guild associated with the application. For example, a developer support server. + /// + public ulong? GuildId => _jsonModel.GuildId; + + /// + /// The partial object of the application's associated guild. + /// + public RestGuild? Guild { get; } + + /// + /// The ID of the Game SKU created, if one exists. Is if the application is not a game sold on Discord. + /// + public ulong? PrimarySkuId => _jsonModel.PrimarySkuId; + + /// + /// The URL slug that links to an application's store page. Is if the application is not a game sold on Discord. + /// + public string? Slug => _jsonModel.Slug; + + /// + /// The cover image hash of the application's default rich presence invite. + /// + public string? CoverImageHash => _jsonModel.CoverImageHash; + + /// + /// The application's public flags. + /// + public ApplicationFlags? Flags => _jsonModel.Flags; + + /// + /// The approximate number of guilds the application has been added to. + /// + public int? ApproximateGuildCount => _jsonModel.ApproximateGuildCount; + + /// + /// The approximate number of users that have installed the application. + /// + public int? ApproximateUserInstallCount => _jsonModel.ApproximateUserInstallCount; + + /// + /// The application's redirect URI list. + /// + public IReadOnlyList? RedirectUris => _jsonModel.RedirectUris; + + /// + /// The application's interactions endpoint URL. + /// + public string? InteractionsEndpointUrl => _jsonModel.InteractionsEndpointUrl; + + /// + /// The application's role connection verification URL. + /// + public string? RoleConnectionsVerificationUrl => _jsonModel.RoleConnectionsVerificationUrl; + + /// + /// The application's tag list, describing its content and functionality. Max of 5 tags. + /// + public IReadOnlyList? Tags => _jsonModel.Tags; + + /// + /// The application's default in-app authorization URL. Is if disabled. + /// + public ApplicationInstallParams? InstallParams { get; } + + /// + /// The default scopes and permissions for each supported installation context. + /// + public IReadOnlyDictionary? IntegrationTypesConfiguration { get; } + + /// + /// The application's default customization URL. Is if disabled. + /// + public string? CustomInstallUrl => _jsonModel.CustomInstallUrl; + + /// + /// Gets the of the application's icon. + /// + /// The format of the returned . Defaults to . public ImageUrl? GetIconUrl(ImageFormat format) => IconHash is string hash ? ImageUrl.ApplicationIcon(Id, hash, format) : null; + /// + /// Gets the of the application's cover. + /// + /// The format of the returned . Defaults to . public ImageUrl? GetCoverUrl(ImageFormat format) => CoverImageHash is string hash ? ImageUrl.ApplicationCover(Id, hash, format) : null; + /// + /// Gets the of the an asset associated with the application. + /// + /// The ID of the asset to get an for. + /// The format of the returned . Defaults to . public ImageUrl? GetAssetUrl(ulong assetId, ImageFormat format) => ImageUrl.ApplicationAsset(Id, assetId, format); + /// + /// Gets the of an achievement associated with the application. + /// + /// The ID of the achievement to get an for. + /// The hash of the achievement's icon. + /// The format of the returned . Defaults to . public ImageUrl? GetAchievementIconUrl(ulong achievementId, string iconHash, ImageFormat format) => ImageUrl.AchievementIcon(Id, achievementId, iconHash, format); + /// + /// Gets the of a store page asset associated with the application. + /// + /// The ID of the asset to get an for. + /// The format of the returned . Defaults to . public ImageUrl? GetStorePageAssetUrl(ulong assetId, ImageFormat format) => ImageUrl.StorePageAsset(Id, assetId, format); } diff --git a/NetCord/ChannelType.cs b/NetCord/ChannelType.cs index 16010fb73..65ab960de 100644 --- a/NetCord/ChannelType.cs +++ b/NetCord/ChannelType.cs @@ -1,18 +1,77 @@ namespace NetCord; +/// +/// The type of a channel, dictating its features. +/// public enum ChannelType { + /// + /// A text channel within a guild. + /// TextGuildChannel = 0, + + /// + /// A text channel for direct messages between two users. + /// DMChannel = 1, + + /// + /// A voice channel within a guild. + /// VoiceGuildChannel = 2, + + /// + /// A text channel for direct messages between multiple users. + /// GroupDMChannel = 3, + + /// + /// An organizational category that contains up to 50 channels. + /// CategoryChannel = 4, + + /// + /// A channel that users can follow and crosspost into their own guild (formerly news channels). + /// AnnouncementGuildChannel = 5, + + /// + /// A channel that allows users to purchase subscriptions, roles or downloadables for real-life currency in guilds. + /// + StoreGuildChannel = 6, + + /// + /// A temporary sub-channel within an . + /// AnnouncementGuildThread = 10, + + /// + /// A temporary sub-channel within a or . + /// PublicGuildThread = 11, + + /// + /// A temporary sub-channel within a that is only viewable by those invited and/or those with the permission. + /// PrivateGuildThread = 12, + + /// + /// A voice channel for hosting events with an audience. + /// StageGuildChannel = 13, + + /// + /// The channel in a hub containing the listed guilds. + /// DirectoryGuildChannel = 14, + + /// + /// A channel that can only contain threads. + /// ForumGuildChannel = 15, + + /// + /// Channels that can only contain threads, similar to a , but still in active development. + /// MediaForumGuildChannel = 16, }