Made API models internal. Removed Discord.Net.API.

This commit is contained in:
RogueException
2017-01-01 23:28:42 -04:00
parent dac51db299
commit e2934abe29
244 changed files with 641 additions and 473 deletions

View File

@@ -0,0 +1,11 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Rpc
{
internal class AuthenticateParams
{
[JsonProperty("access_token")]
public string AccessToken { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
using System;
namespace Discord.API.Rpc
{
internal class AuthenticateResponse
{
[JsonProperty("application")]
public Application Application { get; set; }
[JsonProperty("expires")]
public DateTimeOffset Expires { get; set; }
[JsonProperty("user")]
public User User { get; set; }
[JsonProperty("scopes")]
public string[] Scopes { get; set; }
}
}

View File

@@ -0,0 +1,16 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
using System.Collections.Generic;
namespace Discord.API.Rpc
{
internal class AuthorizeParams
{
[JsonProperty("client_id")]
public string ClientId { get; set; }
[JsonProperty("scopes")]
public IReadOnlyCollection<string> Scopes { get; set; }
[JsonProperty("rpc_token")]
public Optional<string> RpcToken { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Rpc
{
internal class AuthorizeResponse
{
[JsonProperty("code")]
public string Code { get; set; }
}
}

View File

@@ -0,0 +1,34 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Rpc
{
internal class Channel
{
//Shared
[JsonProperty("id")]
public ulong Id { get; set; }
[JsonProperty("type")]
public ChannelType Type { get; set; }
//GuildChannel
[JsonProperty("guild_id")]
public Optional<ulong> GuildId { get; set; }
[JsonProperty("name")]
public Optional<string> Name { get; set; }
[JsonProperty("position")]
public Optional<int> Position { get; set; }
//IMessageChannel
[JsonProperty("messages")]
public Message[] Messages { get; set; }
//VoiceChannel
[JsonProperty("bitrate")]
public Optional<int> Bitrate { get; set; }
[JsonProperty("user_limit")]
public Optional<int> UserLimit { get; set; }
[JsonProperty("voice_states")]
public ExtendedVoiceState[] VoiceStates { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Rpc
{
internal class ChannelSubscriptionParams
{
[JsonProperty("channel_id")]
public ulong ChannelId { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
using Newtonsoft.Json;
namespace Discord.API.Rpc
{
internal class ChannelSummary
{
[JsonProperty("id")]
public ulong Id { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("type")]
public ChannelType Type { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Rpc
{
internal class ErrorEvent
{
[JsonProperty("code")]
public int Code { get; set; }
[JsonProperty("message")]
public string Message { get; set; }
}
}

View File

@@ -0,0 +1,21 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Rpc
{
internal class ExtendedVoiceState
{
[JsonProperty("user")]
public User User { get; set; }
[JsonProperty("voice_state")]
public Optional<VoiceState> VoiceState { get; set; }
[JsonProperty("nick")]
public Optional<string> Nickname { get; set; }
[JsonProperty("volume")]
public Optional<int> Volume { get; set; }
[JsonProperty("mute")]
public Optional<bool> Mute { get; set; }
[JsonProperty("pan")]
public Optional<Pan> Pan { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Rpc
{
internal class GetChannelParams
{
[JsonProperty("channel_id")]
public ulong ChannelId { get; set; }
}
}

View File

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

View File

@@ -0,0 +1,12 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
using System.Collections.Generic;
namespace Discord.API.Rpc
{
internal class GetChannelsResponse
{
[JsonProperty("channels")]
public IReadOnlyCollection<ChannelSummary> Channels { get; set; }
}
}

View File

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

View File

@@ -0,0 +1,8 @@
#pragma warning disable CS1591
namespace Discord.API.Rpc
{
internal class GetGuildsParams
{
}
}

View File

@@ -0,0 +1,11 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Rpc
{
internal class GetGuildsResponse
{
[JsonProperty("guilds")]
public GuildSummary[] Guilds { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
using System.Collections.Generic;
namespace Discord.API.Rpc
{
internal class Guild
{
[JsonProperty("id")]
public ulong Id { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("icon_url")]
public string IconUrl { get; set; }
[JsonProperty("members")]
public IEnumerable<GuildMember> Members { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Rpc
{
internal class GuildMember
{
[JsonProperty("user")]
public User User { get; set; }
[JsonProperty("status")]
public UserStatus Status { get; set; }
/*[JsonProperty("activity")]
public object Activity { get; set; }*/
}
}

View File

@@ -0,0 +1,13 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Rpc
{
internal class GuildStatusEvent
{
[JsonProperty("guild")]
public Guild Guild { get; set; }
[JsonProperty("online")]
public int Online { get; set; }
}
}

View File

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

View File

@@ -0,0 +1,12 @@
using Newtonsoft.Json;
namespace Discord.API.Rpc
{
internal class GuildSummary
{
[JsonProperty("id")]
public ulong Id { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
}
}

View File

@@ -0,0 +1,17 @@
using Newtonsoft.Json;
namespace Discord.API.Rpc
{
internal class Message : Discord.API.Message
{
[JsonProperty("blocked")]
public Optional<bool> IsBlocked { get; }
[JsonProperty("content_parsed")]
public Optional<object[]> ContentParsed { get; }
[JsonProperty("author_color")]
public Optional<string> AuthorColor { get; } //#Hex
[JsonProperty("mentions")]
public new Optional<ulong[]> UserMentions { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Rpc
{
internal class MessageEvent
{
[JsonProperty("channel_id")]
public ulong ChannelId { get; set; }
[JsonProperty("message")]
public Message Message { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
using Newtonsoft.Json;
namespace Discord.API.Rpc
{
internal class Pan
{
[JsonProperty("left")]
public float Left { get; set; }
[JsonProperty("right")]
public float Right { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Rpc
{
internal class ReadyEvent
{
[JsonProperty("v")]
public int Version { get; set; }
[JsonProperty("config")]
public RpcConfig Config { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Rpc
{
internal class RpcConfig
{
[JsonProperty("cdn_host")]
public string CdnHost { get; set; }
[JsonProperty("api_endpoint")]
public string ApiEndpoint { get; set; }
[JsonProperty("environment")]
public string Environment { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Rpc
{
internal class SelectChannelParams
{
[JsonProperty("channel_id")]
public ulong? ChannelId { get; set; }
[JsonProperty("force")]
public Optional<bool> Force { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Rpc
{
internal class SetLocalVolumeParams
{
[JsonProperty("volume")]
public int Volume { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Rpc
{
internal class SetLocalVolumeResponse
{
[JsonProperty("user_id")]
public ulong UserId { get; set; }
[JsonProperty("volume")]
public int Volume { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Rpc
{
internal class SpeakingEvent
{
[JsonProperty("user_id")]
public ulong UserId { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Rpc
{
internal class SubscriptionResponse
{
[JsonProperty("evt")]
public string Event { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Rpc
{
internal class UserVoiceSettings
{
[JsonProperty("userId")]
internal ulong UserId { get; set; }
[JsonProperty("pan")]
public Optional<Pan> Pan { get; set; }
[JsonProperty("volume")]
public Optional<int> Volume { get; set; }
[JsonProperty("mute")]
public Optional<bool> Mute { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
using Newtonsoft.Json;
namespace Discord.API.Rpc
{
internal class VoiceDevice
{
[JsonProperty("id")]
public string Id { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
using Newtonsoft.Json;
namespace Discord.API.Rpc
{
internal class VoiceDeviceSettings
{
[JsonProperty("device_id")]
public Optional<string> DeviceId { get; set; }
[JsonProperty("volume")]
public Optional<float> Volume { get; set; }
[JsonProperty("available_devices")]
public Optional<VoiceDevice[]> AvailableDevices { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
using Newtonsoft.Json;
namespace Discord.API.Rpc
{
internal class VoiceMode
{
[JsonProperty("type")]
public Optional<string> Type { get; set; }
[JsonProperty("auto_threshold")]
public Optional<bool> AutoThreshold { get; set; }
[JsonProperty("threshold")]
public Optional<float> Threshold { get; set; }
[JsonProperty("shortcut")]
public Optional<VoiceShortcut[]> Shortcut { get; set; }
[JsonProperty("delay")]
public Optional<float> Delay { get; set; }
}
}

View File

@@ -0,0 +1,26 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Rpc
{
internal class VoiceSettings
{
[JsonProperty("input")]
public VoiceDeviceSettings Input { get; set; }
[JsonProperty("output")]
public VoiceDeviceSettings Output { get; set; }
[JsonProperty("mode")]
public VoiceMode Mode { get; set; }
[JsonProperty("automatic_gain_control")]
public Optional<bool> AutomaticGainControl { get; set; }
[JsonProperty("echo_cancellation")]
public Optional<bool> EchoCancellation { get; set; }
[JsonProperty("noise_suppression")]
public Optional<bool> NoiseSuppression { get; set; }
[JsonProperty("qos")]
public Optional<bool> QualityOfService { get; set; }
[JsonProperty("silence_warning")]
public Optional<bool> SilenceWarning { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
using Discord.Rpc;
using Newtonsoft.Json;
namespace Discord.API.Rpc
{
internal class VoiceShortcut
{
[JsonProperty("type")]
public Optional<VoiceShortcutType> Type { get; set; }
[JsonProperty("code")]
public Optional<int> Code { get; set; }
[JsonProperty("name")]
public Optional<string> Name { get; set; }
}
}

View File

@@ -21,7 +21,6 @@
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Discord.Net.API\Discord.Net.API.csproj" />
<ProjectReference Include="..\Discord.Net.Core\Discord.Net.Core.csproj" />
<ProjectReference Include="..\Discord.Net.Rest\Discord.Net.Rest.csproj" />
</ItemGroup>

View File

@@ -17,7 +17,7 @@ using System.Threading.Tasks;
namespace Discord.API
{
public class DiscordRpcApiClient : DiscordRestApiClient, IDisposable
internal class DiscordRpcApiClient : DiscordRestApiClient, IDisposable
{
private abstract class RpcRequest
{

View File

@@ -1,7 +1,6 @@
using Discord.API.Rpc;
using Discord.Logging;
using Discord.Net.Converters;
using Discord.Net.Queue;
using Discord.Rest;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
@@ -31,7 +30,7 @@ namespace Discord.Rpc
//From DiscordRpcConfig
internal int ConnectionTimeout { get; private set; }
public new API.DiscordRpcApiClient ApiClient => base.ApiClient as API.DiscordRpcApiClient;
internal new API.DiscordRpcApiClient ApiClient => base.ApiClient as API.DiscordRpcApiClient;
public new RestSelfUser CurrentUser { get { return base.CurrentUser as RestSelfUser; } private set { base.CurrentUser = value; } }
public RestApplication ApplicationInfo { get; private set; }
@@ -308,20 +307,67 @@ namespace Discord.Rpc
var model = await ApiClient.GetVoiceSettingsAsync(options).ConfigureAwait(false);
return VoiceSettings.Create(model);
}
public async Task SetVoiceSettingsAsync(Action<API.Rpc.VoiceSettings> func, RequestOptions options = null)
public async Task SetVoiceSettingsAsync(Action<VoiceProperties> func, RequestOptions options = null)
{
var settings = new API.Rpc.VoiceSettings();
settings.Input = new VoiceDeviceSettings();
settings.Output = new VoiceDeviceSettings();
settings.Mode = new VoiceMode();
if (func == null) throw new NullReferenceException(nameof(func));
var settings = new VoiceProperties();
settings.Input = new VoiceDeviceProperties();
settings.Output = new VoiceDeviceProperties();
settings.Mode = new VoiceModeProperties();
func(settings);
await ApiClient.SetVoiceSettingsAsync(settings, options).ConfigureAwait(false);
var model = new API.Rpc.VoiceSettings
{
AutomaticGainControl = settings.AutomaticGainControl,
EchoCancellation = settings.EchoCancellation,
NoiseSuppression = settings.NoiseSuppression,
QualityOfService = settings.QualityOfService,
SilenceWarning = settings.SilenceWarning
};
model.Input = new API.Rpc.VoiceDeviceSettings
{
DeviceId = settings.Input.DeviceId,
Volume = settings.Input.Volume
};
model.Output = new API.Rpc.VoiceDeviceSettings
{
DeviceId = settings.Output.DeviceId,
Volume = settings.Output.Volume
};
model.Mode = new API.Rpc.VoiceMode
{
AutoThreshold = settings.Mode.AutoThreshold,
Delay = settings.Mode.Delay,
Threshold = settings.Mode.Threshold,
Type = settings.Mode.Type
};
if (settings.Input.AvailableDevices.IsSpecified)
model.Input.AvailableDevices = settings.Input.AvailableDevices.Value.Select(x => x.ToModel()).ToArray();
if (settings.Output.AvailableDevices.IsSpecified)
model.Output.AvailableDevices = settings.Output.AvailableDevices.Value.Select(x => x.ToModel()).ToArray();
if (settings.Mode.Shortcut.IsSpecified)
model.Mode.Shortcut = settings.Mode.Shortcut.Value.Select(x => x.ToModel()).ToArray();
await ApiClient.SetVoiceSettingsAsync(model, options).ConfigureAwait(false);
}
public async Task SetUserVoiceSettingsAsync(ulong userId, Action<API.Rpc.UserVoiceSettings> func, RequestOptions options = null)
public async Task SetUserVoiceSettingsAsync(ulong userId, Action<UserVoiceProperties> func, RequestOptions options = null)
{
var settings = new API.Rpc.UserVoiceSettings();
if (func == null) throw new NullReferenceException(nameof(func));
var settings = new UserVoiceProperties();
func(settings);
await ApiClient.SetUserVoiceSettingsAsync(userId, settings, options).ConfigureAwait(false);
var model = new API.Rpc.UserVoiceSettings
{
Mute = settings.Mute,
UserId = settings.UserId,
Volume = settings.Volume
};
if (settings.Pan.IsSpecified)
model.Pan = settings.Pan.Value.ToModel();
await ApiClient.SetUserVoiceSettingsAsync(userId, model, options).ConfigureAwait(false);
}
private static string GetEventName(RpcGlobalEvent rpcEvent)

View File

@@ -44,7 +44,7 @@ namespace Discord.Rpc
public Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null)
=> ChannelHelper.GetPinnedMessagesAsync(this, Discord, options);
public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, EmbedBuilder embed = null, RequestOptions options = null)
public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null)
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, options);
#if NETSTANDARD1_3
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, RequestOptions options = null)
@@ -108,7 +108,7 @@ namespace Discord.Rpc
#endif
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, RequestOptions options)
=> await SendFileAsync(stream, filename, text, isTTS, options).ConfigureAwait(false);
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, EmbedBuilder embed, RequestOptions options)
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options)
=> await SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false);
IDisposable IMessageChannel.EnterTypingState(RequestOptions options)
=> EnterTypingState(options);

View File

@@ -46,7 +46,7 @@ namespace Discord.Rpc
public Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null)
=> ChannelHelper.GetPinnedMessagesAsync(this, Discord, options);
public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, EmbedBuilder embed = null, RequestOptions options = null)
public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null)
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, options);
#if NETSTANDARD1_3
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, RequestOptions options = null)
@@ -107,7 +107,7 @@ namespace Discord.Rpc
#endif
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, RequestOptions options)
=> await SendFileAsync(stream, filename, text, isTTS, options).ConfigureAwait(false);
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, EmbedBuilder embed, RequestOptions options)
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options)
=> await SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false);
IDisposable IMessageChannel.EnterTypingState(RequestOptions options)
=> EnterTypingState(options);

View File

@@ -49,7 +49,7 @@ namespace Discord.Rpc
public Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null)
=> ChannelHelper.GetPinnedMessagesAsync(this, Discord, options);
public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, EmbedBuilder embed = null, RequestOptions options = null)
public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null)
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, options);
#if NETSTANDARD1_3
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, RequestOptions options = null)
@@ -109,7 +109,7 @@ namespace Discord.Rpc
#endif
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, RequestOptions options)
=> await SendFileAsync(stream, filename, text, isTTS, options).ConfigureAwait(false);
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, EmbedBuilder embed, RequestOptions options)
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options)
=> await SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false);
IDisposable IMessageChannel.EnterTypingState(RequestOptions options)
=> EnterTypingState(options);

View File

@@ -84,7 +84,7 @@ namespace Discord.Rpc
{
var embeds = ImmutableArray.CreateBuilder<Embed>(value.Length);
for (int i = 0; i < value.Length; i++)
embeds.Add(Embed.Create(value[i]));
embeds.Add(value[i].ToEntity());
_embeds = embeds.ToImmutable();
}
else

View File

@@ -0,0 +1,18 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.Rpc
{
public class UserVoiceProperties
{
[JsonProperty("userId")]
internal ulong UserId { get; set; }
[JsonProperty("pan")]
public Optional<Pan> Pan { get; set; }
[JsonProperty("volume")]
public Optional<int> Volume { get; set; }
[JsonProperty("mute")]
public Optional<bool> Mute { get; set; }
}
}

View File

@@ -47,7 +47,7 @@ namespace Discord.Rpc
=> UserHelper.CreateDMChannelAsync(this, Discord, options);
public override string ToString() => $"{Username}#{Discriminator}";
internal string DebuggerDisplay => $"{Username}#{Discriminator} ({Id}{(IsBot ? ", Bot" : "")})";
private string DebuggerDisplay => $"{Username}#{Discriminator} ({Id}{(IsBot ? ", Bot" : "")})";
//IUser
Task<IDMChannel> IUser.GetDMChannelAsync(CacheMode mode, RequestOptions options)

View File

@@ -71,7 +71,7 @@ namespace Discord.Rpc
}
public override string ToString() => User.ToString();
internal string DebuggerDisplay => $"{User} ({_voiceStates})";
private string DebuggerDisplay => $"{User} ({_voiceStates})";
string IVoiceState.VoiceSessionId { get { throw new NotSupportedException(); } }
IVoiceChannel IVoiceState.VoiceChannel { get { throw new NotSupportedException(); } }

View File

@@ -0,0 +1,10 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Discord.Rpc.Entities.Users
{
class UserVoiceProperties
{
}
}

View File

@@ -20,6 +20,6 @@ namespace Discord.Rpc
}
public override string ToString() => $"{Name}";
internal string DebuggerDisplay => $"{Name} ({Id})";
private string DebuggerDisplay => $"{Name} ({Id})";
}
}

View File

@@ -0,0 +1,9 @@
namespace Discord.Rpc
{
public class VoiceDeviceProperties
{
public Optional<string> DeviceId { get; set; }
public Optional<float> Volume { get; set; }
public Optional<VoiceDevice[]> AvailableDevices { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
namespace Discord.Rpc
{
public class VoiceModeProperties
{
public Optional<string> Type { get; set; }
public Optional<bool> AutoThreshold { get; set; }
public Optional<float> Threshold { get; set; }
public Optional<VoiceShortcut[]> Shortcut { get; set; }
public Optional<float> Delay { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
namespace Discord.Rpc
{
public class VoiceProperties
{
public VoiceDeviceProperties Input { get; set; }
public VoiceDeviceProperties Output { get; set; }
public VoiceModeProperties Mode { get; set; }
public Optional<bool> AutomaticGainControl { get; set; }
public Optional<bool> EchoCancellation { get; set; }
public Optional<bool> NoiseSuppression { get; set; }
public Optional<bool> QualityOfService { get; set; }
public Optional<bool> SilenceWarning { get; set; }
}
}

View File

@@ -22,6 +22,6 @@ namespace Discord.Rpc
}
public override string ToString() => $"{Name}";
internal string DebuggerDisplay => $"{Name} ({Code}, {Type})";
private string DebuggerDisplay => $"{Name} ({Code}, {Type})";
}
}

View File

@@ -0,0 +1,10 @@
namespace Discord.Rpc
{
public enum VoiceShortcutType
{
KeyboardKey = 0,
MouseButton = 1,
KeyboardModifierKey = 2,
GamepadButton = 3
}
}

View File

@@ -0,0 +1,31 @@
namespace Discord.Rpc
{
internal static class EntityExtensions
{
public static API.Rpc.Pan ToModel(this Pan entity)
{
return new API.Rpc.Pan
{
Left = entity.Left,
Right = entity.Right
};
}
public static API.Rpc.VoiceDevice ToModel(this VoiceDevice entity)
{
return new API.Rpc.VoiceDevice
{
Id = entity.Id,
Name = entity.Name
};
}
public static API.Rpc.VoiceShortcut ToModel(this VoiceShortcut entity)
{
return new API.Rpc.VoiceShortcut
{
Code = entity.Code,
Name = entity.Name,
Type = entity.Type
};
}
}
}