diff --git a/OF DL.Core/Services/ApiService.cs b/OF DL.Core/Services/ApiService.cs index c6126bd..ada4c76 100644 --- a/OF DL.Core/Services/ApiService.cs +++ b/OF DL.Core/Services/ApiService.cs @@ -43,7 +43,7 @@ public class ApiService(IAuthService authService, IConfigService configService, { private const int MaxAttempts = 30; private const int DelayBetweenAttempts = 3000; - private static readonly JsonSerializerSettings s_mJsonSerializerSettings; + protected static readonly JsonSerializerSettings s_mJsonSerializerSettings; private static DateTime? s_cachedDynamicRulesExpiration; private static DynamicRules? s_cachedDynamicRules; @@ -147,7 +147,7 @@ public class ApiService(IAuthService authService, IConfigService configService, return headers; } - private bool HasSignedRequestAuth() + protected bool HasSignedRequestAuth() { Auth? currentAuth = authService.CurrentAuth; return currentAuth is { UserId: not null, Cookie: not null, UserAgent: not null, XBc: not null }; @@ -2772,12 +2772,12 @@ public class ApiService(IAuthService authService, IConfigService configService, } - private async Task BuildHeaderAndExecuteRequests(Dictionary getParams, string endpoint, + protected async Task BuildHeaderAndExecuteRequests(Dictionary getParams, string endpoint, HttpClient client) { Log.Debug("Calling BuildHeaderAndExecuteRequests"); - HttpRequestMessage request = await BuildHttpRequestMessage(getParams, endpoint); + HttpRequestMessage request = await BuildHttpRequestMessage(getParams, endpoint, method); using HttpResponseMessage response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); string body = await response.Content.ReadAsStringAsync(); @@ -2788,7 +2788,7 @@ public class ApiService(IAuthService authService, IConfigService configService, } - private Task BuildHttpRequestMessage(Dictionary getParams, + protected Task BuildHttpRequestMessage(Dictionary getParams, string endpoint) { Log.Debug("Calling BuildHttpRequestMessage"); @@ -2821,7 +2821,7 @@ public class ApiService(IAuthService authService, IConfigService configService, private static bool IsStringOnlyDigits(string input) => input.All(char.IsDigit); - private HttpClient GetHttpClient() + protected HttpClient GetHttpClient() { HttpClient client = new(); if (configService.CurrentConfig.Timeout is > 0) @@ -2832,7 +2832,7 @@ public class ApiService(IAuthService authService, IConfigService configService, return client; } - private static T? DeserializeJson(string? body, JsonSerializerSettings? settings = null) + protected static T? DeserializeJson(string? body, JsonSerializerSettings? settings = null) { if (string.IsNullOrWhiteSpace(body)) { diff --git a/OF DL/OF DL.csproj b/OF DL/OF DL.csproj index f4c4eb8..412e354 100644 --- a/OF DL/OF DL.csproj +++ b/OF DL/OF DL.csproj @@ -51,4 +51,8 @@ + + + +