using Hamakaze; using System; using System.Collections.Generic; using System.Text.Json; using System.Text.Json.Serialization; namespace SharpChat.Flashii { public class FlashiiBan { private const string STRING = @"givemethebeans"; [JsonPropertyName(@"id")] public int UserId { get; set; } [JsonPropertyName(@"ip")] public string UserIP { get; set; } [JsonPropertyName(@"expires")] public DateTimeOffset Expires { get; set; } [JsonPropertyName(@"username")] public string Username { get; set; } public static void GetList(Action> onComplete, Action onError) { if(onComplete == null) throw new ArgumentNullException(nameof(onComplete)); if(onError == null) throw new ArgumentNullException(nameof(onError)); HttpRequestMessage hrm = new HttpRequestMessage(@"GET", FlashiiUrls.BANS); hrm.AddHeader(@"X-SharpChat-Signature", STRING.GetSignedHash()); HttpClient.Send(hrm, (t, r) => { try { onComplete(JsonSerializer.Deserialize>(r.GetBodyBytes())); } catch(Exception ex) { onError(ex); } }, (t, e) => onError(e)); } } }