This commit is contained in:
2022-05-07 17:42:26 +02:00
parent d7f2348f0d
commit 23930b44a2
8 changed files with 51 additions and 22 deletions

View File

@@ -17,7 +17,7 @@ internal static class BackendComms
{
var resp = await Client.GetAsync(ApiBaseUrl + "season");
if (resp.IsSuccessStatusCode) return await resp.Content.ReadFromJsonAsync<List<Anime>>(JsonSerializerOptions);
LogBoy.AddToLog(resp.RequestMessage?.RequestUri + " " + resp.StatusCode);
await LogBoy.LogResponse(resp);
return null;
}
@@ -33,7 +33,7 @@ internal static class BackendComms
var resp = await Client.SendAsync(msg);
if (!resp.IsSuccessStatusCode)
{
LogBoy.AddToLog(resp.RequestMessage?.RequestUri + " " + resp.StatusCode);
await LogBoy.LogResponse(resp);
}
return resp.IsSuccessStatusCode;
@@ -43,7 +43,7 @@ internal static class BackendComms
{
var resp = await Client.GetAsync(ApiBaseUrl + "anime/" + animeId);
if (resp.IsSuccessStatusCode) return await resp.Content.ReadFromJsonAsync<Anime>(JsonSerializerOptions);
LogBoy.AddToLog(resp.RequestMessage?.RequestUri + " " + resp.StatusCode);
await LogBoy.LogResponse(resp);
return null;
}
@@ -51,7 +51,7 @@ internal static class BackendComms
{
var resp = await Client.GetAsync(ApiBaseUrl + "animesearch?q=" + query);
if (resp.IsSuccessStatusCode) return await resp.Content.ReadFromJsonAsync<List<Anime>>(JsonSerializerOptions);
LogBoy.AddToLog(resp.RequestMessage?.RequestUri + " " + resp.StatusCode);
await LogBoy.LogResponse(resp);
return null;
}
@@ -59,7 +59,7 @@ internal static class BackendComms
{
var resp = await Client.GetAsync(ApiBaseUrl + "user");
if (resp.IsSuccessStatusCode) return await resp.Content.ReadFromJsonAsync<List<User>>(JsonSerializerOptions);
LogBoy.AddToLog(resp.RequestMessage?.RequestUri + " " + resp.StatusCode);
await LogBoy.LogResponse(resp);
return null;
}
@@ -73,7 +73,7 @@ internal static class BackendComms
var resp = await Client.GetAsync(ApiBaseUrl + "user/" + username);
if (!resp.IsSuccessStatusCode)
{
LogBoy.AddToLog(resp.RequestMessage?.RequestUri + " " + resp.StatusCode);
await LogBoy.LogResponse(resp);
return null;
}
@@ -85,7 +85,7 @@ internal static class BackendComms
{
var resp = await Client.GetAsync(ApiBaseUrl + "watch");
if (resp.IsSuccessStatusCode) return await resp.Content.ReadFromJsonAsync<List<Watch>>(JsonSerializerOptions);
LogBoy.AddToLog(resp.RequestMessage?.RequestUri + " " + resp.StatusCode);
await LogBoy.LogResponse(resp);
return null;
}
@@ -98,7 +98,7 @@ internal static class BackendComms
var resp = await Client.GetAsync(ApiBaseUrl + "watch/" + username);
if (resp.IsSuccessStatusCode) return await resp.Content.ReadFromJsonAsync<List<Watch>>(JsonSerializerOptions);
LogBoy.AddToLog(resp.RequestMessage?.RequestUri + " " + resp.StatusCode);
await LogBoy.LogResponse(resp);
return null;
}
@@ -106,7 +106,7 @@ internal static class BackendComms
{
var resp = await Client.GetAsync(ApiBaseUrl + "watchext");
if (resp.IsSuccessStatusCode) return await resp.Content.ReadFromJsonAsync<List<WatchExtended>>(JsonSerializerOptions);
LogBoy.AddToLog(resp.RequestMessage?.RequestUri + " " + resp.StatusCode);
await LogBoy.LogResponse(resp);
return null;
}
@@ -119,7 +119,7 @@ internal static class BackendComms
var resp = await Client.GetAsync(ApiBaseUrl + "watchext/" + username);
if (resp.IsSuccessStatusCode) return await resp.Content.ReadFromJsonAsync<List<WatchExtended>>(JsonSerializerOptions);
LogBoy.AddToLog(resp.RequestMessage?.RequestUri + " " + resp.StatusCode);
await LogBoy.LogResponse(resp);
return null;
}
@@ -128,7 +128,7 @@ internal static class BackendComms
using var content = new StringContent(JsonSerializer.Serialize(register), Encoding.UTF8, MediaTypeNames.Application.Json);
using var resp = await Client.PostAsync(ApiBaseUrl + "register", content);
if (resp.IsSuccessStatusCode) return await resp.Content.ReadFromJsonAsync<Register>(JsonSerializerOptions);
LogBoy.AddToLog(resp.RequestMessage?.RequestUri + " " + resp.StatusCode);
await LogBoy.LogResponse(resp);
return null;
}
}