@@ -4,12 +4,9 @@ | |||||
{ | { | ||||
public const string BaseStatusApi = "https://status.discordapp.com/api/v2/"; | public const string BaseStatusApi = "https://status.discordapp.com/api/v2/"; | ||||
public const string BaseApi = "https://discordapp.com/api/"; | public const string BaseApi = "https://discordapp.com/api/"; | ||||
//public const string Track = "track"; | |||||
public const string Gateway = "gateway"; | public const string Gateway = "gateway"; | ||||
public const string Auth = "auth"; | public const string Auth = "auth"; | ||||
public const string AuthFingerprint = "auth/fingerprint"; | |||||
public const string AuthRegister = "auth/register"; | |||||
public const string AuthLogin = "auth/login"; | public const string AuthLogin = "auth/login"; | ||||
public const string AuthLogout = "auth/logout"; | public const string AuthLogout = "auth/logout"; | ||||
@@ -14,16 +14,6 @@ namespace Discord.API | |||||
[JsonProperty("url")] | [JsonProperty("url")] | ||||
public string Url; | public string Url; | ||||
} | } | ||||
public sealed class FingerprintResponse | |||||
{ | |||||
[JsonProperty("fingerprint")] | |||||
public string Fingerprint; | |||||
} | |||||
public sealed class RegisterResponse | |||||
{ | |||||
[JsonProperty("token")] | |||||
public string Token; | |||||
} | |||||
public sealed class LoginResponse | public sealed class LoginResponse | ||||
{ | { | ||||
[JsonProperty("token")] | [JsonProperty("token")] | ||||
@@ -34,16 +34,6 @@ namespace Discord | |||||
//Auth | //Auth | ||||
public Task<GatewayResponse> Gateway() | public Task<GatewayResponse> Gateway() | ||||
=> _rest.Get<GatewayResponse>(Endpoints.Gateway); | => _rest.Get<GatewayResponse>(Endpoints.Gateway); | ||||
public Task<FingerprintResponse> Fingerprint() | |||||
=> _rest.Post<FingerprintResponse>(Endpoints.AuthFingerprint); | |||||
public async Task<RegisterResponse> LoginAnonymous(string username, string fingerprint) | |||||
{ | |||||
if (username == null) throw new ArgumentNullException(nameof(username)); | |||||
if (fingerprint == null) throw new ArgumentNullException(nameof(fingerprint)); | |||||
var request = new RegisterRequest { Fingerprint = fingerprint, Username = username }; | |||||
return await _rest.Post<RegisterResponse>(Endpoints.AuthRegister, request).ConfigureAwait(false); | |||||
} | |||||
public async Task<LoginResponse> Login(string email, string password) | public async Task<LoginResponse> Login(string email, string password) | ||||
{ | { | ||||
if (email == null) throw new ArgumentNullException(nameof(email)); | if (email == null) throw new ArgumentNullException(nameof(email)); | ||||