Compare commits

..

No commits in common. "6fce8086939e91a7c4898d51240a51d7630c4fb6" and "723eb19090527c1e1f4bb957f863b957bed76cfb" have entirely different histories.

3 changed files with 3 additions and 27 deletions

View file

@ -1,7 +1,6 @@
using System.Data;
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using Nyanbyte.PPCheck.Lib.Models;
@ -59,28 +58,6 @@ public class ApiClient : IDisposable
return resp;
}
public async Task<byte[]?> GetImage(Guid identityId)
{
var request = new HttpRequestMessage(HttpMethod.Get, $"Persone/ImageGet/{identityId}");
request.Headers.Add("User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:122.0) Gecko/20100101 Firefox/122.0");
request.Headers.Add("Referer", "https://rps.ms.gov.pl/pl-PL/Public");
request.Headers.Add("Accept", "application/json, text/plain, */*");
request.Headers.Add("Accept-Language", "en-US,en;q=0.5");
var httpResponse = await _http.SendAsync(request);
httpResponse.EnsureSuccessStatusCode();
string resp = (await httpResponse.Content.ReadAsStringAsync()).Trim('"');
if (resp == null)
{
return null;
}
byte[] img = Convert.FromBase64String(resp);
return img;
}
public void Dispose()
{
GC.SuppressFinalize(this);

View file

@ -20,7 +20,7 @@ public record OffenderPersona
public string LastName { get; set; } = string.Empty;
public string CityOfBirth { get; set; } = string.Empty;
public DateTime DateOfBirth { get; set; }
public string Sex { get; set; } = string.Empty;
public char Sex { get; set; }
public string FamilyName { get; set; } = string.Empty;
public string? FathersName { get; set; }
public string? MothersName { get; set; }
@ -29,5 +29,5 @@ public record OffenderPersona
public string DwellingPlace { get; set; } = string.Empty;
[JsonIgnore]
public Sex OffenderSex => string.IsNullOrWhiteSpace(Sex) ? Models.Sex.Unknown : (Sex)Sex[0];
public Sex OffenderSex => (Sex)Sex;
}

View file

@ -3,6 +3,5 @@ namespace Nyanbyte.PPCheck.Lib.Models;
public enum Sex : byte
{
Male = (byte)'M',
Female = (byte)'F',
Unknown = 0,
Female = (byte)'F'
}