Concrete class prototype

This commit is contained in:
RogueException
2016-09-22 21:15:37 -03:00
parent ab42129eb9
commit 6319933ed0
394 changed files with 3648 additions and 3224 deletions

View File

@@ -0,0 +1,25 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
using System;
namespace Discord.API.Gateway
{
public class ExtendedGuild : Guild
{
[JsonProperty("unavailable")]
public bool? Unavailable { get; set; }
[JsonProperty("member_count")]
public int MemberCount { get; set; }
[JsonProperty("large")]
public bool Large { get; set; }
[JsonProperty("presences")]
public Presence[] Presences { get; set; }
[JsonProperty("members")]
public GuildMember[] Members { get; set; }
[JsonProperty("channels")]
public Channel[] Channels { get; set; }
[JsonProperty("joined_at")]
public DateTimeOffset JoinedAt { get; set; }
}
}

View File

@@ -0,0 +1,33 @@
#pragma warning disable CS1591
namespace Discord.API.Gateway
{
public enum GatewayOpCode : byte
{
/// <summary> C←S - Used to send most events. </summary>
Dispatch = 0,
/// <summary> C↔S - Used to keep the connection alive and measure latency. </summary>
Heartbeat = 1,
/// <summary> C→S - Used to associate a connection with a token and specify configuration. </summary>
Identify = 2,
/// <summary> C→S - Used to update client's status and current game id. </summary>
StatusUpdate = 3,
/// <summary> C→S - Used to join a particular voice channel. </summary>
VoiceStateUpdate = 4,
/// <summary> C→S - Used to ensure the guild's voice server is alive. </summary>
VoiceServerPing = 5,
/// <summary> C→S - Used to resume a connection after a redirect occurs. </summary>
Resume = 6,
/// <summary> C←S - Used to notify a client that they must reconnect to another gateway. </summary>
Reconnect = 7,
/// <summary> C→S - Used to request members that were withheld by large_threshold </summary>
RequestGuildMembers = 8,
/// <summary> C←S - Used to notify the client that their session has expired and cannot be resumed. </summary>
InvalidSession = 9,
/// <summary> C←S - Used to provide information to the client immediately on connection. </summary>
Hello = 10,
/// <summary> C←S - Used to reply to a client's heartbeat. </summary>
HeartbeatAck = 11,
/// <summary> C→S - Used to request presence updates from particular guilds. </summary>
GuildSync = 12
}
}

View File

@@ -0,0 +1,13 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Gateway
{
public class GuildBanEvent
{
[JsonProperty("guild_id")]
public ulong GuildId { get; set; }
[JsonProperty("user")]
public User User { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Gateway
{
public class GuildEmojiUpdateEvent
{
[JsonProperty("guild_id")]
public ulong GuildId { get; set; }
[JsonProperty("emojis")]
public Emoji[] Emojis { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Gateway
{
public class GuildMemberAddEvent : GuildMember
{
[JsonProperty("guild_id")]
public ulong GuildId { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Gateway
{
public class GuildMemberRemoveEvent
{
[JsonProperty("guild_id")]
public ulong GuildId { get; set; }
[JsonProperty("user")]
public User User { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Gateway
{
public class GuildMemberUpdateEvent : GuildMember
{
[JsonProperty("guild_id")]
public ulong GuildId { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Gateway
{
public class GuildMembersChunkEvent
{
[JsonProperty("guild_id")]
public ulong GuildId { get; set; }
[JsonProperty("members")]
public GuildMember[] Members { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Gateway
{
public class GuildRoleCreateEvent
{
[JsonProperty("guild_id")]
public ulong GuildId { get; set; }
[JsonProperty("role")]
public Role Role { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Gateway
{
public class GuildRoleDeleteEvent
{
[JsonProperty("guild_id")]
public ulong GuildId { get; set; }
[JsonProperty("role_id")]
public ulong RoleId { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Gateway
{
public class GuildRoleUpdateEvent
{
[JsonProperty("guild_id")]
public ulong GuildId { get; set; }
[JsonProperty("role")]
public Role Role { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Gateway
{
public class GuildSyncEvent
{
[JsonProperty("id")]
public ulong Id { get; set; }
[JsonProperty("large")]
public bool Large { get; set; }
[JsonProperty("presences")]
public Presence[] Presences { get; set; }
[JsonProperty("members")]
public GuildMember[] Members { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Gateway
{
public class HelloEvent
{
[JsonProperty("heartbeat_interval")]
public int HeartbeatInterval { get; set; }
}
}

View File

@@ -0,0 +1,21 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
using System.Collections.Generic;
namespace Discord.API.Gateway
{
[JsonObject(MemberSerialization = MemberSerialization.OptIn)]
public class IdentifyParams
{
[JsonProperty("token")]
public string Token { get; set; }
[JsonProperty("properties")]
public IDictionary<string, string> Properties { get; set; }
[JsonProperty("large_threshold")]
public int LargeThreshold { get; set; }
[JsonProperty("compress")]
public bool UseCompression { get; set; }
[JsonProperty("shard")]
public Optional<int[]> ShardingParams { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
using System.Collections.Generic;
namespace Discord.API.Gateway
{
public class MessageDeleteBulkEvent
{
[JsonProperty("channel_id")]
public ulong ChannelId { get; set; }
[JsonProperty("ids")]
public IEnumerable<ulong> Ids { get; set; }
}
}

View File

@@ -0,0 +1,38 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Gateway
{
public class ReadyEvent
{
public class ReadState
{
[JsonProperty("id")]
public string ChannelId { get; set; }
[JsonProperty("mention_count")]
public int MentionCount { get; set; }
[JsonProperty("last_message_id")]
public string LastMessageId { get; set; }
}
[JsonProperty("v")]
public int Version { get; set; }
[JsonProperty("user")]
public User User { get; set; }
[JsonProperty("session_id")]
public string SessionId { get; set; }
[JsonProperty("read_state")]
public ReadState[] ReadStates { get; set; }
[JsonProperty("guilds")]
public ExtendedGuild[] Guilds { get; set; }
[JsonProperty("private_channels")]
public Channel[] PrivateChannels { get; set; }
[JsonProperty("relationships")]
public Relationship[] Relationships { get; set; }
//Ignored
/*[JsonProperty("user_settings")]
[JsonProperty("user_guild_settings")]
[JsonProperty("tutorial")]*/
}
}

View File

@@ -0,0 +1,13 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Gateway
{
public class RecipientEvent
{
[JsonProperty("user")]
public User User { get; set; }
[JsonProperty("channel_id")]
public ulong ChannelId { get; set; }
}
}

View File

@@ -0,0 +1,21 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
using System.Collections.Generic;
using System.Linq;
namespace Discord.API.Gateway
{
[JsonObject(MemberSerialization = MemberSerialization.OptIn)]
public class RequestMembersParams
{
[JsonProperty("query")]
public string Query { get; set; }
[JsonProperty("limit")]
public int Limit { get; set; }
[JsonProperty("guild_id")]
private ulong[] _guildIds { get; set; }
public IEnumerable<ulong> GuildIds { set { _guildIds = value.ToArray(); } }
public IEnumerable<IGuild> Guilds { set { _guildIds = value.Select(x => x.Id).ToArray(); } }
}
}

View File

@@ -0,0 +1,16 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Gateway
{
[JsonObject(MemberSerialization = MemberSerialization.OptIn)]
public class ResumeParams
{
[JsonProperty("token")]
public string Token { get; set; }
[JsonProperty("session_id")]
public string SessionId { get; set; }
[JsonProperty("seq")]
public int Sequence { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Gateway
{
public class ResumedEvent
{
[JsonProperty("heartbeat_interval")]
public int HeartbeatInterval { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Gateway
{
[JsonObject(MemberSerialization = MemberSerialization.OptIn)]
public class StatusUpdateParams
{
[JsonProperty("idle_since"), Int53]
public long? IdleSince { get; set; }
[JsonProperty("game")]
public Game Game { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Gateway
{
public class TypingStartEvent
{
[JsonProperty("user_id")]
public ulong UserId { get; set; }
[JsonProperty("channel_id")]
public ulong ChannelId { get; set; }
[JsonProperty("timestamp")]
public int Timestamp { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Gateway
{
[JsonObject(MemberSerialization = MemberSerialization.OptIn)]
public class UpdateStatusParams
{
[JsonProperty("idle_since")]
public long? IdleSince { get; set; }
[JsonProperty("game")]
public Game Game { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Gateway
{
public class VoiceServerUpdateEvent
{
[JsonProperty("guild_id")]
public ulong GuildId { get; set; }
[JsonProperty("endpoint")]
public string Endpoint { get; set; }
[JsonProperty("token")]
public string Token { get; set; }
}
}

View File

@@ -0,0 +1,22 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Gateway
{
[JsonObject(MemberSerialization = MemberSerialization.OptIn)]
public class VoiceStateUpdateParams
{
[JsonProperty("self_mute")]
public bool SelfMute { get; set; }
[JsonProperty("self_deaf")]
public bool SelfDeaf { get; set; }
[JsonProperty("guild_id")]
public ulong? GuildId { get; set; }
public IGuild Guild { set { GuildId = value?.Id; } }
[JsonProperty("channel_id")]
public ulong? ChannelId { get; set; }
public IChannel Channel { set { ChannelId = value?.Id; } }
}
}