Added reference project

This commit is contained in:
RogueException
2016-02-24 19:36:18 -04:00
parent 27d7e9915b
commit 36ea8b8c3a
68 changed files with 1515 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Discord
{
public abstract class Channel : IChannel
{
public ulong Id { get; }
public abstract DiscordClient Client { get; }
public abstract ChannelType Type { get; }
public bool IsText { get; }
public bool IsVoice { get; }
public bool IsPrivate { get; }
public bool IsPublic { get; }
public abstract User CurrentUser { get; }
public abstract IEnumerable<User> Users { get; }
public abstract Task Save();
}
}

View File

@@ -0,0 +1,17 @@
using System.Collections.Generic;
namespace Discord
{
public interface IChannel : IModel<ulong>
{
DiscordClient Client { get; }
ChannelType Type { get; }
bool IsText { get; }
bool IsVoice { get; }
bool IsPrivate { get; }
bool IsPublic { get; }
IEnumerable<User> Users { get; }
}
}

View File

@@ -0,0 +1,7 @@
namespace Discord
{
public interface IPrivateChannel : IChannel
{
User Recipient { get; }
}
}

View File

@@ -0,0 +1,30 @@
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Discord
{
public interface IPublicChannel : IChannel
{
Server Server { get; }
string Name { get; set; }
int Position { get; set; }
IEnumerable<PermissionOverwrite> PermissionOverwrites { get; }
PermissionOverwrite? GetPermissionsRule(User user);
PermissionOverwrite? GetPermissionsRule(Role role);
Task<IEnumerable<Invite>> DownloadInvites();
Task Delete();
Task<Invite> CreateInvite(int? maxAge = 1800, int? maxUses = null, bool tempMembership = false, bool withXkcd = false);
Task AddPermissionsRule(User user, ChannelPermissions allow, ChannelPermissions deny);
Task AddPermissionsRule(User user, TriStateChannelPermissions permissions);
Task AddPermissionsRule(Role role, ChannelPermissions allow, ChannelPermissions deny);
Task AddPermissionsRule(Role role, TriStateChannelPermissions permissions);
Task RemovePermissionsRule(User user);
Task RemovePermissionsRule(Role role);
}
}

View File

@@ -0,0 +1,18 @@
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
namespace Discord
{
public interface ITextChannel : IChannel
{
Message GetMessage(ulong id);
Task<IEnumerable<Message>> DownloadMessages(int limit = 100, ulong? relativeMessageId = null, Relative relativeDir = Relative.Before);
Task<Message> SendMessage(string text, bool isTTS = false);
Task<Message> SendFile(string filePath, string text = null, bool isTTS = false);
Task<Message> SendFile(Stream stream, string filename, string text = null, bool isTTS = false);
Task SendIsTyping();
}
}

View File

@@ -0,0 +1,7 @@
namespace Discord
{
public interface IVoiceChannel : IChannel
{
int Bitrate { get; set; }
}
}

View File

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
namespace Discord
{
public class PrivateChannel : Channel, ITextChannel, IPrivateChannel
{
public User Recipient { get; }
public IEnumerable<Message> Messages { get; }
public override DiscordClient Client => null;
public override ChannelType Type => default(ChannelType);
public override User CurrentUser => null;
public override IEnumerable<User> Users => null;
public Message GetMessage(ulong id) => null;
public Task<IEnumerable<Message>> DownloadMessages(int limit) => null;
public Task<IEnumerable<Message>> DownloadMessages(int limit, ulong? relativeMessageId, Relative relativeDir) => null;
public Task<Message> SendMessage(string text, bool isTTS = false) => null;
public Task<Message> SendFile(string path, string text = null, bool isTTS = false) => null;
public Task<Message> SendFile(Stream stream, string filename, string text = null, bool isTTS = false) => null;
public Task SendIsTyping() => null;
public override Task Save() => null;
}
}

View File

@@ -0,0 +1,50 @@
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
namespace Discord
{
public class TextChannel : Channel, ITextChannel, IPublicChannel, IMentionable
{
public Server Server { get; }
public string Mention { get; }
public IEnumerable<PermissionOverwrite> PermissionOverwrites { get; }
public IEnumerable<Message> Messages { get; }
public string Topic { get; set; }
public bool IsTyping { get; set; }
public string Name { get; set; }
public int Position { get; set; }
public override DiscordClient Client => null;
public override ChannelType Type => default(ChannelType);
public override User CurrentUser => null;
public override IEnumerable<User> Users => null;
public Message GetMessage(ulong id) => null;
public PermissionOverwrite? GetPermissionsRule(User user) => null;
public PermissionOverwrite? GetPermissionsRule(Role role) => null;
public Task<IEnumerable<Message>> DownloadMessages(int limit) => null;
public Task<IEnumerable<Message>> DownloadMessages(int limit, ulong? relativeMessageId, Relative relativeDir) => null;
public Task<IEnumerable<Invite>> DownloadInvites() => null;
public Task<Message> SendMessage(string text, bool isTTS = false) => null;
public Task<Message> SendFile(string path, string text = null, bool isTTS = false) => null;
public Task<Message> SendFile(Stream stream, string filename, string text = null, bool isTTS = false) => null;
public Task SendIsTyping() => null;
public Task<Invite> CreateInvite(int? maxAge = 1800, int? maxUses = default(int?), bool tempMembership = false, bool withXkcd = false) => null;
public Task AddPermissionsRule(User user, ChannelPermissions allow, ChannelPermissions deny) => null;
public Task AddPermissionsRule(User user, TriStateChannelPermissions permissions) => null;
public Task AddPermissionsRule(Role role, ChannelPermissions allow, ChannelPermissions deny) => null;
public Task AddPermissionsRule(Role role, TriStateChannelPermissions permissions) => null;
public Task RemovePermissionsRule(User user) => null;
public Task RemovePermissionsRule(Role role) => null;
public Task Delete() => null;
public override Task Save() => null;
}
}

View File

@@ -0,0 +1,49 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
namespace Discord
{
public class VoiceChannel : IPublicChannel, IVoiceChannel
{
public ulong Id { get; }
public DiscordClient Client { get; }
public Server Server { get; }
public ChannelType Type { get; }
public bool IsText { get; }
public bool IsVoice { get; }
public bool IsPrivate { get; }
public bool IsPublic { get; }
public IEnumerable<PermissionOverwrite> PermissionOverwrites { get; }
public IEnumerable<User> Users { get; }
public string Name { get; set; }
public int Position { get; set; }
public int Bitrate { get; set; }
public Message GetMessage(ulong id) => null;
public PermissionOverwrite? GetPermissionsRule(User user) => null;
public PermissionOverwrite? GetPermissionsRule(Role role) => null;
public Task<IEnumerable<Message>> DownloadMessages(int limit) => null;
public Task<IEnumerable<Message>> DownloadMessages(int limit, ulong? relativeMessageId, Relative relativeDir) => null;
public Task<IEnumerable<Invite>> DownloadInvites() => null;
public Task<Message> SendMessage(string text, bool isTTS = false) => null;
public Task<Message> SendFile(string path, string text = null, bool isTTS = false) => null;
public Task<Message> SendFile(Stream stream, string filename, string text = null, bool isTTS = false) => null;
public Task<Invite> CreateInvite(int? maxAge = 1800, int? maxUses = default(int?), bool tempMembership = false, bool withXkcd = false) => null;
public Task AddPermissionsRule(User user, ChannelPermissions allow, ChannelPermissions deny) => null;
public Task AddPermissionsRule(User user, TriStateChannelPermissions permissions) => null;
public Task AddPermissionsRule(Role role, ChannelPermissions allow, ChannelPermissions deny) => null;
public Task AddPermissionsRule(Role role, TriStateChannelPermissions permissions) => null;
public Task RemovePermissionsRule(User user) => null;
public Task RemovePermissionsRule(Role role) => null;
public Task Delete() => null;
public Task Save() => null;
}
}

17
ref/Entities/Color.cs Normal file
View File

@@ -0,0 +1,17 @@
namespace Discord
{
public class Color
{
public static readonly Color Default = new Color(0);
public uint RawValue { get; }
public Color(uint rawValue) { }
public Color(byte r, byte g, byte b) { }
public Color(float r, float g, float b) { }
public byte R { get; }
public byte G { get; }
public byte B { get; }
}
}

View File

@@ -0,0 +1,7 @@
namespace Discord
{
public interface IMentionable
{
string Mention { get; }
}
}

13
ref/Entities/IModel.cs Normal file
View File

@@ -0,0 +1,13 @@
using System.Threading.Tasks;
namespace Discord
{
public interface IModel<TId> : IModel
{
TId Id { get; }
}
public interface IModel
{
Task Save();
}
}

48
ref/Entities/Invite.cs Normal file
View File

@@ -0,0 +1,48 @@
using System;
using System.Threading.Tasks;
namespace Discord
{
public class Invite : IModel<string>
{
public class ServerInfo
{
public ulong Id { get; }
public string Name { get; }
}
public class ChannelInfo
{
public ulong Id { get; }
public string Name { get; }
}
public class InviterInfo
{
public ulong Id { get; }
public string Name { get; }
public ushort Discriminator { get; }
public string AvatarId { get; }
public string AvatarUrl { get; }
}
public DiscordClient Client { get; }
string IModel<string>.Id => Code;
public string Code { get; }
public string XkcdCode { get; }
public ServerInfo Server { get; }
public ChannelInfo Channel { get; }
public int? MaxAge { get; }
public int Uses { get; }
public int? MaxUses { get; }
public bool IsRevoked { get; }
public bool IsTemporary { get; }
public DateTime CreatedAt { get; }
public string Url { get; }
public Task Delete() => null;
public Task Accept() => null;
public Task Save() => null;
}
}

68
ref/Entities/Message.cs Normal file
View File

@@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Discord
{
public class Message : IModel<ulong>
{
public class Attachment : File
{
public string Id { get; }
public int Size { get; }
public string Filename { get; }
}
public class Embed
{
public string Url { get; }
public string Type { get; }
public string Title { get; }
public string Description { get; }
public EmbedLink Author { get; }
public EmbedLink Provider { get; }
public File Thumbnail { get; }
public File Video { get; }
}
public class EmbedLink
{
public string Url { get; }
public string Name { get; }
}
public class File
{
public string Url { get; }
public string ProxyUrl { get; }
public int? Width { get; }
public int? Height { get; }
}
public DiscordClient Client { get; }
public ulong Id { get; }
public ITextChannel Channel { get; }
public User User { get; }
public bool IsTTS { get; }
public MessageState State { get; }
public string RawText { get; }
public string Text { get; }
public DateTime Timestamp { get; }
public DateTime? EditedTimestamp { get; }
public Attachment[] Attachments { get; }
public Embed[] Embeds { get; }
public IEnumerable<User> MentionedUsers { get; }
public IEnumerable<IPublicChannel> MentionedChannels { get; }
public IEnumerable<Role> MentionedRoles { get; }
public Server Server => null;
public bool IsAuthor => false;
public Task Delete() => null;
public Task Save() => null;
public bool IsMentioningMe(bool includeRoles = false) => false;
}
}

View File

@@ -0,0 +1,54 @@
namespace Discord
{
public struct ChannelPermissions
{
public static ChannelPermissions None { get; }
public static ChannelPermissions TextOnly { get; }
public static ChannelPermissions PrivateOnly { get; }
public static ChannelPermissions VoiceOnly { get; }
public static ChannelPermissions All(Channel channel) => default(ChannelPermissions);
public static ChannelPermissions All(ChannelType channelType, bool isPrivate) => default(ChannelPermissions);
public uint RawValue { get; }
public bool CreateInstantInvit { get; }
public bool ManagePermission { get; }
public bool ManageChannel { get; }
public bool ReadMessages { get; }
public bool SendMessages { get; }
public bool SendTTSMessages { get; }
public bool ManageMessages { get; }
public bool EmbedLinks { get; }
public bool AttachFiles { get; }
public bool ReadMessageHistory { get; }
public bool MentionEveryone { get; }
public bool Connect { get; }
public bool Speak { get; }
public bool MuteMembers { get; }
public bool DeafenMembers { get; }
public bool MoveMembers { get; }
public bool UseVoiceActivation { get; }
public ChannelPermissions(bool? createInstantInvite = null, bool? managePermissions = null,
bool? manageChannel = null, bool? readMessages = null, bool? sendMessages = null, bool? sendTTSMessages = null,
bool? manageMessages = null, bool? embedLinks = null, bool? attachFiles = null, bool? readMessageHistory = null,
bool? mentionEveryone = null, bool? connect = null, bool? speak = null, bool? muteMembers = null, bool? deafenMembers = null,
bool? moveMembers = null, bool? useVoiceActivation = null)
: this()
{
}
public ChannelPermissions(uint rawValue)
: this()
{
}
public ChannelPermissions Modify(ChannelPermissions basePerms, bool? createInstantInvite = null, bool? managePermissions = null,
bool? manageChannel = null, bool? readMessages = null, bool? sendMessages = null, bool? sendTTSMessages = null,
bool? manageMessages = null, bool? embedLinks = null, bool? attachFiles = null, bool? readMessageHistory = null,
bool? mentionEveryone = null, bool? connect = null, bool? speak = null, bool? muteMembers = null, bool? deafenMembers = null,
bool? moveMembers = null, bool? useVoiceActivation = null)
=> default(ChannelPermissions);
}
}

View File

@@ -0,0 +1,9 @@
namespace Discord
{
public struct PermissionOverwrite
{
public PermissionTarget TargetType { get; }
public ulong TargetId { get; }
public TriStateChannelPermissions Permissions { get; }
}
}

View File

@@ -0,0 +1,55 @@
namespace Discord
{
public struct ServerPermissions
{
public static ServerPermissions None { get; }
public static ServerPermissions All { get; }
public uint RawValue { get; }
public bool CreateInstantInvite { get; }
public bool BanMembers { get; }
public bool KickMembers { get; }
public bool ManageRoles { get; }
public bool ManageChannels { get; }
public bool ManageServer { get; }
public bool ReadMessages { get; }
public bool SendMessages { get; }
public bool SendTTSMessages { get; }
public bool ManageMessages { get; }
public bool EmbedLinks { get; }
public bool AttachFiles { get; }
public bool ReadMessageHistory { get; }
public bool MentionEveryone { get; }
public bool Connect { get; }
public bool Speak { get; }
public bool MuteMembers { get; }
public bool DeafenMembers { get; }
public bool MoveMembers { get; }
public bool UseVoiceActivation { get; }
public ServerPermissions(bool? createInstantInvite = null, bool? manageRoles = null,
bool? kickMembers = null, bool? banMembers = null, bool? manageChannel = null, bool? manageServer = null,
bool? readMessages = null, bool? sendMessages = null, bool? sendTTSMessages = null, bool? manageMessages = null,
bool? embedLinks = null, bool? attachFiles = null, bool? readMessageHistory = null, bool? mentionEveryone = null,
bool? connect = null, bool? speak = null, bool? muteMembers = null, bool? deafenMembers = null,
bool? moveMembers = null, bool? useVoiceActivation = null)
: this()
{
}
public ServerPermissions(uint rawValue)
: this()
{
}
public ServerPermissions Modify(ServerPermissions basePerms, bool? createInstantInvite = null, bool? manageRoles = null,
bool? kickMembers = null, bool? banMembers = null, bool? manageChannel = null, bool? manageServer = null,
bool? readMessages = null, bool? sendMessages = null, bool? sendTTSMessages = null, bool? manageMessages = null,
bool? embedLinks = null, bool? attachFiles = null, bool? readMessageHistory = null, bool? mentionEveryone = null,
bool? connect = null, bool? speak = null, bool? muteMembers = null, bool? deafenMembers = null,
bool? moveMembers = null, bool? useVoiceActivation = null)
=> default(ServerPermissions);
}
}

View File

@@ -0,0 +1,50 @@
namespace Discord
{
public struct TriStateChannelPermissions
{
public static TriStateChannelPermissions InheritAll { get; }
public uint AllowValue { get; }
public uint DenyValue { get; }
public PermValue CreateInstantInvite { get; }
public PermValue ManagePermissions { get; }
public PermValue ManageChannel { get; }
public PermValue ReadMessages { get; }
public PermValue SendMessages { get; }
public PermValue SendTTSMessages { get; }
public PermValue ManageMessages { get; }
public PermValue EmbedLinks { get; }
public PermValue AttachFiles { get; }
public PermValue ReadMessageHistory { get; }
public PermValue MentionEveryone { get; }
public PermValue Connect { get; }
public PermValue Speak { get; }
public PermValue MuteMembers { get; }
public PermValue DeafenMembers { get; }
public PermValue MoveMembers { get; }
public PermValue UseVoiceActivation { get; }
public TriStateChannelPermissions(PermValue? createInstantInvite = null, PermValue? managePermissions = null,
PermValue? manageChannel = null, PermValue? readMessages = null, PermValue? sendMessages = null, PermValue? sendTTSMessages = null,
PermValue? manageMessages = null, PermValue? embedLinks = null, PermValue? attachFiles = null, PermValue? readMessageHistory = null,
PermValue? mentionEveryone = null, PermValue? connect = null, PermValue? speak = null, PermValue? muteMembers = null, PermValue? deafenMembers = null,
PermValue? moveMembers = null, PermValue? useVoiceActivation = null)
: this()
{
}
public TriStateChannelPermissions(uint allow = 0, uint deny = 0)
: this()
{
}
public TriStateChannelPermissions Modify(PermValue? createInstantInvite = null, PermValue? managePermissions = null,
PermValue? manageChannel = null, PermValue? readMessages = null, PermValue? sendMessages = null, PermValue? sendTTSMessages = null,
PermValue? manageMessages = null, PermValue? embedLinks = null, PermValue? attachFiles = null, PermValue? readMessageHistory = null,
PermValue? mentionEveryone = null, PermValue? connect = null, PermValue? speak = null, PermValue? muteMembers = null, PermValue? deafenMembers = null,
PermValue? moveMembers = null, PermValue? useVoiceActivation = null)
=> default(TriStateChannelPermissions);
}
}

23
ref/Entities/Profile.cs Normal file
View File

@@ -0,0 +1,23 @@
using System.Threading.Tasks;
namespace Discord
{
public class Profile : IModel<ulong>
{
public DiscordClient Client { get; }
public ulong Id { get; }
public string AvatarId { get; }
public string AvatarUrl { get; }
public ushort Discriminator { get; }
public string CurrentGame { get; }
public UserStatus Status { get; }
public string Mention { get; }
public string Email { get; }
public bool? IsVerified { get; }
public string Name { get; set; }
public Task Save() => null;
}
}

20
ref/Entities/Region.cs Normal file
View File

@@ -0,0 +1,20 @@
namespace Discord
{
public class Region
{
public string Id { get; }
public string Name { get; }
public string Hostname { get; }
public int Port { get; }
public bool Vip { get; }
internal Region(string id, string name, string hostname, int port, bool vip)
{
Id = id;
Name = name;
Hostname = hostname;
Port = port;
Vip = vip;
}
}
}

29
ref/Entities/Role.cs Normal file
View File

@@ -0,0 +1,29 @@
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Discord
{
public class Role : IModel<ulong>, IMentionable
{
public DiscordClient Client { get; }
public ulong Id { get; }
public Server Server { get; }
public string Name { get; }
public bool IsHoisted { get; }
public int Position { get; }
public bool IsManaged { get; }
public ServerPermissions Permissions { get; }
public Color Color { get; }
public bool IsEveryone { get; }
public IEnumerable<User> Members { get; }
public string Mention { get; }
public Task Delete() => null;
public Task Save() => null;
}
}

70
ref/Entities/Server.cs Normal file
View File

@@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Discord
{
public class Server : IModel<ulong>
{
public class Emoji
{
public string Id { get; }
public string Name { get; }
public bool IsManaged { get; }
public bool RequireColons { get; }
public IEnumerable<Role> Roles { get; }
}
public ulong Id { get; }
public User CurrentUser { get; }
public string IconId { get; }
public string SplashId { get; }
public string IconUrl { get; }
public string SplashUrl { get; }
public int ChannelCount { get; }
public int UserCount { get; }
public int RoleCount { get; }
public TextChannel DefaultChannel { get; }
public Role EveryoneRole { get; }
public IEnumerable<string> Features { get; }
public IEnumerable<Emoji> CustomEmojis { get; }
public IEnumerable<Channel> Channels { get; }
public IEnumerable<TextChannel> TextChannels { get; }
public IEnumerable<VoiceChannel> VoiceChannels { get; }
public IEnumerable<User> Users { get; }
public IEnumerable<Role> Roles { get; }
public string Name { get; set; }
public Region Region { get; set; }
public int AFKTimeout { get; set; }
public DateTime JoinedAt { get; set; }
public User Owner { get; set; }
public VoiceChannel AFKChannel { get; set; }
public IPublicChannel GetChannel(ulong id) => null;
public IPublicChannel GetChannel(string mention) => null;
public Role GetRole(ulong id) => null;
public User GetUser(ulong id) => null;
public User GetUser(string name, ushort discriminator) => null;
public User GetUser(string mention) => null;
public Task<IEnumerable<User>> DownloadBans() => null;
public Task<IEnumerable<Invite>> DownloadInvites() => null;
public Task Leave() => null;
public Task Delete() => null;
public Task Save() => null;
public Task<Channel> CreateChannel(string name, ChannelType type) => null;
public Task<Invite> CreateInvite(int? maxAge = 1800, int? maxUses = null, bool tempMembership = false, bool withXkcd = false) => null;
public Task<Role> CreateRole(string name, ServerPermissions? permissions = null, Color color = null, bool isHoisted = false) => null;
public Task Ban(User user, int pruneDays = 0) => null;
public Task Unban(User user) => null;
public Task Unban(ulong userId) => null;
public Task ReorderChannels(IEnumerable<Channel> channels) => null;
public Task ReorderRoles(IEnumerable<Role> roles, Role after = null) => null;
public Task<int> PruneUsers(int days = 30, bool simulate = false) => null;
}
}

55
ref/Entities/User.cs Normal file
View File

@@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
namespace Discord
{
public class User : IModel<ulong>
{
public DiscordClient Client { get; }
public ulong Id { get; }
public Server Server { get; }
public string Name { get; }
public ushort Discriminator { get; }
public string AvatarId { get; }
public string CurrentGame { get; }
public UserStatus Status { get; }
public DateTime JoinedAt { get; }
public DateTime? LastActivityAt { get; }
public Channel PrivateChannel => null;
public string Mention => null;
public bool IsSelfMuted => false;
public bool IsSelfDeafened => false;
public bool IsServerMuted => false;
public bool IsServerDeafened => false;
public bool IsServerSuppressed => false;
public DateTime? LastOnlineAt => null;
public Channel VoiceChannel => null;
public string AvatarUrl => null;
public IEnumerable<Role> Roles => null;
public IEnumerable<Channel> Channels => null;
public Task Kick() => null;
public ServerPermissions ServerPermissions => default(ServerPermissions);
public ChannelPermissions GetPermissions(Channel channel) => default(ChannelPermissions);
public Task<Channel> CreatePMChannel() => null;
public Task<Message> SendMessage(string text) => null;
public Task<Message> SendFile(string filePath) => null;
public Task<Message> SendFile(string filename, Stream stream) => null;
public bool HasRole(Role role) => false;
public Task AddRoles(params Role[] roles) => null;
public Task RemoveRoles(params Role[] roles) => null;
public Task Save() => null;
}
}