forked from sim0n00ps/OF-DL
OFDL: Enabled inheritance access to ApiService methods
This commit is contained in:
parent
7a4b145641
commit
baddcfda4e
@ -44,7 +44,7 @@ public class ApiService(IAuthService authService, IConfigService configService,
|
|||||||
{
|
{
|
||||||
private const int MaxAttempts = 30;
|
private const int MaxAttempts = 30;
|
||||||
private const int DelayBetweenAttempts = 3000;
|
private const int DelayBetweenAttempts = 3000;
|
||||||
private static readonly JsonSerializerSettings s_mJsonSerializerSettings;
|
protected static readonly JsonSerializerSettings s_mJsonSerializerSettings;
|
||||||
private static DateTime? s_cachedDynamicRulesExpiration;
|
private static DateTime? s_cachedDynamicRulesExpiration;
|
||||||
private static DynamicRules? s_cachedDynamicRules;
|
private static DynamicRules? s_cachedDynamicRules;
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ public class ApiService(IAuthService authService, IConfigService configService,
|
|||||||
return headers;
|
return headers;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool HasSignedRequestAuth()
|
protected bool HasSignedRequestAuth()
|
||||||
{
|
{
|
||||||
Auth? currentAuth = authService.CurrentAuth;
|
Auth? currentAuth = authService.CurrentAuth;
|
||||||
return currentAuth is { UserId: not null, Cookie: not null, UserAgent: not null, XBc: not null };
|
return currentAuth is { UserId: not null, Cookie: not null, UserAgent: not null, XBc: not null };
|
||||||
@ -2754,12 +2754,12 @@ public class ApiService(IAuthService authService, IConfigService configService,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private async Task<string?> BuildHeaderAndExecuteRequests(Dictionary<string, string> getParams, string endpoint,
|
protected async Task<string?> BuildHeaderAndExecuteRequests(Dictionary<string, string> getParams, string endpoint,
|
||||||
HttpClient client)
|
HttpClient client)
|
||||||
{
|
{
|
||||||
Log.Debug("Calling BuildHeaderAndExecuteRequests");
|
Log.Debug("Calling BuildHeaderAndExecuteRequests");
|
||||||
|
|
||||||
HttpRequestMessage request = await BuildHttpRequestMessage(getParams, endpoint);
|
HttpRequestMessage request = await BuildHttpRequestMessage(getParams, endpoint, method);
|
||||||
using HttpResponseMessage response = await client.SendAsync(request);
|
using HttpResponseMessage response = await client.SendAsync(request);
|
||||||
response.EnsureSuccessStatusCode();
|
response.EnsureSuccessStatusCode();
|
||||||
string body = await response.Content.ReadAsStringAsync();
|
string body = await response.Content.ReadAsStringAsync();
|
||||||
@ -2770,7 +2770,7 @@ public class ApiService(IAuthService authService, IConfigService configService,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private Task<HttpRequestMessage> BuildHttpRequestMessage(Dictionary<string, string> getParams,
|
protected Task<HttpRequestMessage> BuildHttpRequestMessage(Dictionary<string, string> getParams,
|
||||||
string endpoint)
|
string endpoint)
|
||||||
{
|
{
|
||||||
Log.Debug("Calling BuildHttpRequestMessage");
|
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 static bool IsStringOnlyDigits(string input) => input.All(char.IsDigit);
|
||||||
|
|
||||||
|
|
||||||
private HttpClient GetHttpClient()
|
protected HttpClient GetHttpClient()
|
||||||
{
|
{
|
||||||
HttpClient client = new();
|
HttpClient client = new();
|
||||||
if (configService.CurrentConfig.Timeout is > 0)
|
if (configService.CurrentConfig.Timeout is > 0)
|
||||||
@ -2832,7 +2832,7 @@ public class ApiService(IAuthService authService, IConfigService configService,
|
|||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static T? DeserializeJson<T>(string? body, JsonSerializerSettings? settings = null)
|
protected static T? DeserializeJson<T>(string? body, JsonSerializerSettings? settings = null)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(body))
|
if (string.IsNullOrWhiteSpace(body))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -54,4 +54,8 @@
|
|||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<InternalsVisibleTo Include="Cajetan.OF-DL" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user