Moved Frame models, added default providers
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
#pragma warning disable CS1591
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
|
||||
namespace Discord.API.Rpc
|
||||
{
|
||||
internal class RpcFrame
|
||||
{
|
||||
[JsonProperty("cmd")]
|
||||
public string Cmd { get; set; }
|
||||
[JsonProperty("nonce")]
|
||||
public Optional<Guid?> Nonce { get; set; }
|
||||
[JsonProperty("evt")]
|
||||
public Optional<string> Event { get; set; }
|
||||
[JsonProperty("data")]
|
||||
public Optional<object> Data { get; set; }
|
||||
[JsonProperty("args")]
|
||||
public object Args { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
#pragma warning disable CS1591
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Discord.API
|
||||
{
|
||||
internal class SocketFrame
|
||||
{
|
||||
[JsonProperty("op")]
|
||||
public int Operation { get; set; }
|
||||
[JsonProperty("t", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Type { get; set; }
|
||||
[JsonProperty("s", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public int? Sequence { get; set; }
|
||||
[JsonProperty("d")]
|
||||
public object Payload { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,6 @@ namespace Discord.Rest
|
||||
internal const int WebSocketQueueInterval = 100;
|
||||
|
||||
/// <summary> Gets or sets the provider used to generate new REST connections. </summary>
|
||||
public RestClientProvider RestClientProvider { get; set; } = url => new DefaultRestClient(url);
|
||||
public RestClientProvider RestClientProvider { get; set; } = DefaultRestClientProvider.Instance;
|
||||
}
|
||||
}
|
||||
|
||||
19
src/Discord.Net.Rest/Net/DefaultRestClientProvider.cs
Normal file
19
src/Discord.Net.Rest/Net/DefaultRestClientProvider.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
|
||||
namespace Discord.Net.Rest
|
||||
{
|
||||
public static class DefaultRestClientProvider
|
||||
{
|
||||
public static readonly RestClientProvider Instance = url =>
|
||||
{
|
||||
try
|
||||
{
|
||||
return new DefaultRestClient(url);
|
||||
}
|
||||
catch (PlatformNotSupportedException ex)
|
||||
{
|
||||
throw new PlatformNotSupportedException("The default RestClientProvider is not supported on this platform.", ex);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user