2022-08-30 15:21:00 +00:00
|
|
|
|
using System;
|
2022-08-30 15:00:58 +00:00
|
|
|
|
using System.Collections.Generic;
|
2022-08-30 15:21:00 +00:00
|
|
|
|
using System.Net.Http;
|
2022-08-30 15:00:58 +00:00
|
|
|
|
using System.Text.Json;
|
|
|
|
|
using System.Text.Json.Serialization;
|
2022-08-30 15:21:00 +00:00
|
|
|
|
using System.Threading.Tasks;
|
2022-08-30 15:00:58 +00:00
|
|
|
|
|
|
|
|
|
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; }
|
|
|
|
|
|
2023-02-06 20:14:50 +00:00
|
|
|
|
public static async Task<IEnumerable<FlashiiBan>> GetListAsync(HttpClient httpClient) {
|
2022-08-30 15:21:00 +00:00
|
|
|
|
if(httpClient == null)
|
|
|
|
|
throw new ArgumentNullException(nameof(httpClient));
|
|
|
|
|
|
2023-02-06 20:14:50 +00:00
|
|
|
|
HttpRequestMessage request = new(HttpMethod.Get, FlashiiUrls.BansURL) {
|
2022-08-30 15:21:00 +00:00
|
|
|
|
Headers = {
|
|
|
|
|
{ @"X-SharpChat-Signature", STRING.GetSignedHash() },
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
using HttpResponseMessage response = await httpClient.SendAsync(request);
|
|
|
|
|
|
|
|
|
|
return JsonSerializer.Deserialize<IEnumerable<FlashiiBan>>(await response.Content.ReadAsByteArrayAsync());
|
2022-08-30 15:00:58 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|