forked from sim0n00ps/OF-DL
Updated to sort blocked before fetching
This commit is contained in:
parent
1083bf304d
commit
7775bd25d8
@ -52,6 +52,29 @@ public class CajetanApiService(IAuthService authService, IConfigService configSe
|
||||
return null;
|
||||
}
|
||||
|
||||
public async Task SortBlockedAsync(string endpoint, string order = "recent", string direction = "desc")
|
||||
{
|
||||
Log.Debug($"Calling SortBlocked - {endpoint}");
|
||||
|
||||
try
|
||||
{
|
||||
var reqBody = new { order, direction };
|
||||
var result = new { success = false, canAddFriends = false };
|
||||
|
||||
string? body = await BuildHeaderAndExecuteRequests([], endpoint, GetHttpClient(), HttpMethod.Post, reqBody);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(body))
|
||||
result = JsonConvert.DeserializeAnonymousType(body, result);
|
||||
|
||||
if (result?.success != true)
|
||||
_eventHandler.OnMessage($"Failed to sort blocked (order: {order}, direction; {direction})! Endpoint: {endpoint}", "yellow");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ExceptionLoggerHelper.LogException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<Dictionary<string, long>> GetUsersWithProgressAsync(string typeDisplay, string endpoint, string? typeParam, bool offsetByCount)
|
||||
{
|
||||
Dictionary<string, long> usersOfType = await _eventHandler.WithStatusAsync(
|
||||
|
||||
@ -6,4 +6,5 @@ public interface ICajetanApiService : IApiService
|
||||
Task<Dictionary<string, long>> GetUsersWithProgressAsync(string typeDisplay, string endpoint, string? typeParam, bool offsetByCount);
|
||||
Task<HashSet<long>> GetUsersWithUnreadMessagesAsync();
|
||||
Task MarkAsUnreadAsync(string endpoint);
|
||||
Task SortBlockedAsync(string endpoint, string order = "recent", string direction = "desc");
|
||||
}
|
||||
|
||||
@ -228,7 +228,9 @@ internal class Worker(IServiceProvider serviceProvider)
|
||||
const string OUTPUT_FILE_BLOCKED = "blocked-users.json";
|
||||
const string OUTPUT_FILE_EXPIRED = "expired-users.json";
|
||||
|
||||
await _apiService.SortBlockedAsync("/lists/blocked/sort");
|
||||
await GetUsersAsync("Blocked", "/users/blocked", OUTPUT_FILE_BLOCKED);
|
||||
|
||||
await GetUsersAsync("Expired", "/subscriptions/subscribes", OUTPUT_FILE_EXPIRED, typeParam: "expired", offsetByCount: false);
|
||||
|
||||
async Task GetUsersAsync(string typeDisplay, string uri, string outputFile, string? typeParam = null, bool offsetByCount = true)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user