Refactor Users entities into DTOs and application entities with standardized naming conventions and default values

This commit is contained in:
whimsical-c4lic0 2026-02-09 00:31:52 -06:00
parent 40ccf7aa62
commit a9b135636b
12 changed files with 364 additions and 197 deletions

View File

@ -0,0 +1,16 @@
using Newtonsoft.Json;
namespace OF_DL.Models.Dtos.Users;
public class ListsStateDto
{
[JsonProperty("id")] public string Id { get; set; } = "";
[JsonProperty("type")] public string Type { get; set; } = "";
[JsonProperty("name")] public string Name { get; set; } = "";
[JsonProperty("hasUser")] public bool HasUser { get; set; }
[JsonProperty("canAddUser")] public bool CanAddUser { get; set; }
}

View File

@ -0,0 +1,38 @@
using Newtonsoft.Json;
namespace OF_DL.Models.Dtos.Users;
public class SubscribeDto
{
[JsonProperty("id")] public long? Id { get; set; }
[JsonProperty("userId")] public long? UserId { get; set; }
[JsonProperty("subscriberId")] public int? SubscriberId { get; set; }
[JsonProperty("date")] public DateTime? Date { get; set; }
[JsonProperty("duration")] public int? Duration { get; set; }
[JsonProperty("startDate")] public DateTime? StartDate { get; set; }
[JsonProperty("expireDate")] public DateTime? ExpireDate { get; set; }
[JsonProperty("cancelDate")] public object CancelDate { get; set; } = new();
[JsonProperty("price")] public string? Price { get; set; }
[JsonProperty("regularPrice")] public string? RegularPrice { get; set; }
[JsonProperty("discount")] public int? Discount { get; set; }
[JsonProperty("action")] public string Action { get; set; } = "";
[JsonProperty("type")] public string Type { get; set; } = "";
[JsonProperty("offerStart")] public object OfferStart { get; set; } = new();
[JsonProperty("offerEnd")] public object OfferEnd { get; set; } = new();
[JsonProperty("isCurrent")] public bool? IsCurrent { get; set; }
}

View File

@ -0,0 +1,40 @@
using Newtonsoft.Json;
namespace OF_DL.Models.Dtos.Users;
public class SubscribedByDataDto
{
[JsonProperty("price")] public string? Price { get; set; }
[JsonProperty("newPrice")] public string? NewPrice { get; set; }
[JsonProperty("regularPrice")] public string? RegularPrice { get; set; }
[JsonProperty("subscribePrice")] public string? SubscribePrice { get; set; }
[JsonProperty("discountPercent")] public int? DiscountPercent { get; set; }
[JsonProperty("discountPeriod")] public int? DiscountPeriod { get; set; }
[JsonProperty("subscribeAt")] public DateTime? SubscribeAt { get; set; }
[JsonProperty("expiredAt")] public DateTime? ExpiredAt { get; set; }
[JsonProperty("renewedAt")] public object? RenewedAt { get; set; }
[JsonProperty("discountFinishedAt")] public object? DiscountFinishedAt { get; set; }
[JsonProperty("discountStartedAt")] public object? DiscountStartedAt { get; set; }
[JsonProperty("status")] public string? Status { get; set; }
[JsonProperty("isMuted")] public bool? IsMuted { get; set; }
[JsonProperty("unsubscribeReason")] public string? UnsubscribeReason { get; set; }
[JsonProperty("duration")] public string? Duration { get; set; }
[JsonProperty("showPostsInFeed")] public bool? ShowPostsInFeed { get; set; }
[JsonProperty("subscribes")] public List<SubscribeDto>? Subscribes { get; set; }
}

View File

@ -0,0 +1,50 @@
using Newtonsoft.Json;
namespace OF_DL.Models.Dtos.Users;
public class SubscribedOnDataDto
{
[JsonProperty("price")] public string? Price { get; set; }
[JsonProperty("newPrice")] public string? NewPrice { get; set; }
[JsonProperty("regularPrice")] public string? RegularPrice { get; set; }
[JsonProperty("subscribePrice")] public string? SubscribePrice { get; set; }
[JsonProperty("discountPercent")] public int? DiscountPercent { get; set; }
[JsonProperty("discountPeriod")] public int? DiscountPeriod { get; set; }
[JsonProperty("subscribeAt")] public DateTime? SubscribeAt { get; set; }
[JsonProperty("expiredAt")] public DateTime? ExpiredAt { get; set; }
[JsonProperty("renewedAt")] public DateTime? RenewedAt { get; set; }
[JsonProperty("discountFinishedAt")] public object? DiscountFinishedAt { get; set; }
[JsonProperty("discountStartedAt")] public object? DiscountStartedAt { get; set; }
[JsonProperty("status")] public object? Status { get; set; }
[JsonProperty("isMuted")] public bool? IsMuted { get; set; }
[JsonProperty("unsubscribeReason")] public string? UnsubscribeReason { get; set; }
[JsonProperty("duration")] public string? Duration { get; set; }
[JsonProperty("tipsSumm")] public string? TipsSumm { get; set; }
[JsonProperty("subscribesSumm")] public string? SubscribesSumm { get; set; }
[JsonProperty("messagesSumm")] public string? MessagesSumm { get; set; }
[JsonProperty("postsSumm")] public string? PostsSumm { get; set; }
[JsonProperty("streamsSumm")] public string? StreamsSumm { get; set; }
[JsonProperty("totalSumm")] public string? TotalSumm { get; set; }
[JsonProperty("subscribes")] public List<SubscribeDto>? Subscribes { get; set; }
}

View File

@ -0,0 +1,179 @@
using Newtonsoft.Json;
using OF_DL.Models.Dtos.Common;
namespace OF_DL.Models.Dtos.Users;
public class UserDto
{
[JsonProperty("view")] public string View { get; set; } = "";
[JsonProperty("avatar")] public string? Avatar { get; set; }
[JsonProperty("avatarThumbs")] public AvatarThumbsDto AvatarThumbs { get; set; } = new();
[JsonProperty("header")] public string? Header { get; set; }
[JsonProperty("headerSize")] public HeaderSizeDto HeaderSize { get; set; } = new();
[JsonProperty("headerThumbs")] public HeaderThumbsDto HeaderThumbs { get; set; } = new();
[JsonProperty("id")] public long? Id { get; set; }
[JsonProperty("name")] public string? Name { get; set; }
[JsonProperty("username")] public string? Username { get; set; }
[JsonProperty("canLookStory")] public bool? CanLookStory { get; set; }
[JsonProperty("canCommentStory")] public bool? CanCommentStory { get; set; }
[JsonProperty("hasNotViewedStory")] public bool? HasNotViewedStory { get; set; }
[JsonProperty("isVerified")] public bool? IsVerified { get; set; }
[JsonProperty("canPayInternal")] public bool? CanPayInternal { get; set; }
[JsonProperty("hasScheduledStream")] public bool? HasScheduledStream { get; set; }
[JsonProperty("hasStream")] public bool? HasStream { get; set; }
[JsonProperty("hasStories")] public bool? HasStories { get; set; }
[JsonProperty("tipsEnabled")] public bool? TipsEnabled { get; set; }
[JsonProperty("tipsTextEnabled")] public bool? TipsTextEnabled { get; set; }
[JsonProperty("tipsMin")] public int? TipsMin { get; set; }
[JsonProperty("tipsMinInternal")] public int? TipsMinInternal { get; set; }
[JsonProperty("tipsMax")] public int? TipsMax { get; set; }
[JsonProperty("canEarn")] public bool? CanEarn { get; set; }
[JsonProperty("canAddSubscriber")] public bool? CanAddSubscriber { get; set; }
[JsonProperty("subscribePrice")] public string? SubscribePrice { get; set; }
[JsonProperty("displayName")] public string DisplayName { get; set; } = "";
[JsonProperty("notice")] public string Notice { get; set; } = "";
[JsonProperty("isPaywallRequired")] public bool? IsPaywallRequired { get; set; }
[JsonProperty("unprofitable")] public bool? Unprofitable { get; set; }
[JsonProperty("listsStates")] public List<ListsStateDto> ListsStates { get; set; } = [];
[JsonProperty("isMuted")] public bool? IsMuted { get; set; }
[JsonProperty("isRestricted")] public bool? IsRestricted { get; set; }
[JsonProperty("canRestrict")] public bool? CanRestrict { get; set; }
[JsonProperty("subscribedBy")] public bool? SubscribedBy { get; set; }
[JsonProperty("subscribedByExpire")] public bool? SubscribedByExpire { get; set; }
[JsonProperty("subscribedByExpireDate")] public DateTime? SubscribedByExpireDate { get; set; }
[JsonProperty("subscribedByAutoprolong")] public bool? SubscribedByAutoprolong { get; set; }
[JsonProperty("subscribedIsExpiredNow")] public bool? SubscribedIsExpiredNow { get; set; }
[JsonProperty("currentSubscribePrice")] public string? CurrentSubscribePrice { get; set; }
[JsonProperty("subscribedOn")] public bool? SubscribedOn { get; set; }
[JsonProperty("subscribedOnExpiredNow")] public bool? SubscribedOnExpiredNow { get; set; }
[JsonProperty("subscribedOnDuration")] public string SubscribedOnDuration { get; set; } = "";
[JsonProperty("joinDate")] public DateTime? JoinDate { get; set; }
[JsonProperty("isReferrerAllowed")] public bool? IsReferrerAllowed { get; set; }
[JsonProperty("about")] public string About { get; set; } = "";
[JsonProperty("rawAbout")] public string RawAbout { get; set; } = "";
[JsonProperty("website")] public object Website { get; set; } = new();
[JsonProperty("wishlist")] public object Wishlist { get; set; } = new();
[JsonProperty("location")] public object Location { get; set; } = new();
[JsonProperty("postsCount")] public int? PostsCount { get; set; }
[JsonProperty("archivedPostsCount")] public int? ArchivedPostsCount { get; set; }
[JsonProperty("privateArchivedPostsCount")] public int? PrivateArchivedPostsCount { get; set; }
[JsonProperty("photosCount")] public int? PhotosCount { get; set; }
[JsonProperty("videosCount")] public int? VideosCount { get; set; }
[JsonProperty("audiosCount")] public int? AudiosCount { get; set; }
[JsonProperty("mediasCount")] public int? MediasCount { get; set; }
[JsonProperty("lastSeen")] public DateTime? LastSeen { get; set; }
[JsonProperty("favoritesCount")] public int? FavoritesCount { get; set; }
[JsonProperty("favoritedCount")] public int? FavoritedCount { get; set; }
[JsonProperty("showPostsInFeed")] public bool? ShowPostsInFeed { get; set; }
[JsonProperty("canReceiveChatMessage")] public bool? CanReceiveChatMessage { get; set; }
[JsonProperty("isPerformer")] public bool? IsPerformer { get; set; }
[JsonProperty("isRealPerformer")] public bool? IsRealPerformer { get; set; }
[JsonProperty("isSpotifyConnected")] public bool? IsSpotifyConnected { get; set; }
[JsonProperty("subscribersCount")] public int? SubscribersCount { get; set; }
[JsonProperty("hasPinnedPosts")] public bool? HasPinnedPosts { get; set; }
[JsonProperty("hasLabels")] public bool? HasLabels { get; set; }
[JsonProperty("canChat")] public bool? CanChat { get; set; }
[JsonProperty("callPrice")] public string? CallPrice { get; set; }
[JsonProperty("isPrivateRestriction")] public bool? IsPrivateRestriction { get; set; }
[JsonProperty("showSubscribersCount")] public bool? ShowSubscribersCount { get; set; }
[JsonProperty("showMediaCount")] public bool? ShowMediaCount { get; set; }
[JsonProperty("subscribedByData")] public SubscribedByDataDto SubscribedByData { get; set; } = new();
[JsonProperty("subscribedOnData")] public SubscribedOnDataDto SubscribedOnData { get; set; } = new();
[JsonProperty("canPromotion")] public bool? CanPromotion { get; set; }
[JsonProperty("canCreatePromotion")] public bool? CanCreatePromotion { get; set; }
[JsonProperty("canCreateTrial")] public bool? CanCreateTrial { get; set; }
[JsonProperty("isAdultContent")] public bool? IsAdultContent { get; set; }
[JsonProperty("canTrialSend")] public bool? CanTrialSend { get; set; }
[JsonProperty("hadEnoughLastPhotos")] public bool? HadEnoughLastPhotos { get; set; }
[JsonProperty("hasLinks")] public bool? HasLinks { get; set; }
[JsonProperty("firstPublishedPostDate")] public DateTime? FirstPublishedPostDate { get; set; }
[JsonProperty("isSpringConnected")] public bool? IsSpringConnected { get; set; }
[JsonProperty("isFriend")] public bool? IsFriend { get; set; }
[JsonProperty("isBlocked")] public bool? IsBlocked { get; set; }
[JsonProperty("canReport")] public bool? CanReport { get; set; }
}

View File

@ -0,0 +1,12 @@
namespace OF_DL.Models.Entities.Users;
public class User
{
public string? Avatar { get; set; }
public string? Header { get; set; }
public string? Name { get; set; }
public string? Username { get; set; }
}

View File

@ -0,0 +1,11 @@
using OF_DL.Models.Dtos.Users;
using OF_DL.Models.Entities.Users;
namespace OF_DL.Models.Mappers;
public static class UserMapper
{
public static User? FromDto(UserDto? dto) => dto == null
? null
: new User { Avatar = dto.Avatar, Header = dto.Header, Name = dto.Name, Username = dto.Username };
}

View File

@ -1,4 +1,4 @@
namespace OF_DL.Models; namespace OF_DL.Models.Subscriptions;
public class Subscriptions public class Subscriptions
{ {

View File

@ -1,185 +0,0 @@
namespace OF_DL.Models;
public class User
{
public string view { get; set; }
public string? avatar { get; set; }
public AvatarThumbs avatarThumbs { get; set; }
public string? header { get; set; }
public HeaderSize headerSize { get; set; }
public HeaderThumbs headerThumbs { get; set; }
public long? id { get; set; }
public string name { get; set; }
public string username { get; set; }
public bool? canLookStory { get; set; }
public bool? canCommentStory { get; set; }
public bool? hasNotViewedStory { get; set; }
public bool? isVerified { get; set; }
public bool? canPayInternal { get; set; }
public bool? hasScheduledStream { get; set; }
public bool? hasStream { get; set; }
public bool? hasStories { get; set; }
public bool? tipsEnabled { get; set; }
public bool? tipsTextEnabled { get; set; }
public int? tipsMin { get; set; }
public int? tipsMinInternal { get; set; }
public int? tipsMax { get; set; }
public bool? canEarn { get; set; }
public bool? canAddSubscriber { get; set; }
public string? subscribePrice { get; set; }
public string displayName { get; set; }
public string notice { get; set; }
public bool? isPaywallRequired { get; set; }
public bool? unprofitable { get; set; }
public List<ListsState> listsStates { get; set; }
public bool? isMuted { get; set; }
public bool? isRestricted { get; set; }
public bool? canRestrict { get; set; }
public bool? subscribedBy { get; set; }
public bool? subscribedByExpire { get; set; }
public DateTime? subscribedByExpireDate { get; set; }
public bool? subscribedByAutoprolong { get; set; }
public bool? subscribedIsExpiredNow { get; set; }
public string? currentSubscribePrice { get; set; }
public bool? subscribedOn { get; set; }
public bool? subscribedOnExpiredNow { get; set; }
public string subscribedOnDuration { get; set; }
public DateTime? joinDate { get; set; }
public bool? isReferrerAllowed { get; set; }
public string about { get; set; }
public string rawAbout { get; set; }
public object website { get; set; }
public object wishlist { get; set; }
public object location { get; set; }
public int? postsCount { get; set; }
public int? archivedPostsCount { get; set; }
public int? privateArchivedPostsCount { get; set; }
public int? photosCount { get; set; }
public int? videosCount { get; set; }
public int? audiosCount { get; set; }
public int? mediasCount { get; set; }
public DateTime? lastSeen { get; set; }
public int? favoritesCount { get; set; }
public int? favoritedCount { get; set; }
public bool? showPostsInFeed { get; set; }
public bool? canReceiveChatMessage { get; set; }
public bool? isPerformer { get; set; }
public bool? isRealPerformer { get; set; }
public bool? isSpotifyConnected { get; set; }
public int? subscribersCount { get; set; }
public bool? hasPinnedPosts { get; set; }
public bool? hasLabels { get; set; }
public bool? canChat { get; set; }
public string? callPrice { get; set; }
public bool? isPrivateRestriction { get; set; }
public bool? showSubscribersCount { get; set; }
public bool? showMediaCount { get; set; }
public SubscribedByData subscribedByData { get; set; }
public SubscribedOnData subscribedOnData { get; set; }
public bool? canPromotion { get; set; }
public bool? canCreatePromotion { get; set; }
public bool? canCreateTrial { get; set; }
public bool? isAdultContent { get; set; }
public bool? canTrialSend { get; set; }
public bool? hadEnoughLastPhotos { get; set; }
public bool? hasLinks { get; set; }
public DateTime? firstPublishedPostDate { get; set; }
public bool? isSpringConnected { get; set; }
public bool? isFriend { get; set; }
public bool? isBlocked { get; set; }
public bool? canReport { get; set; }
public class AvatarThumbs
{
public string c50 { get; set; }
public string c144 { get; set; }
}
public class HeaderSize
{
public int? width { get; set; }
public int? height { get; set; }
}
public class HeaderThumbs
{
public string w480 { get; set; }
public string w760 { get; set; }
}
public class ListsState
{
public string id { get; set; }
public string type { get; set; }
public string name { get; set; }
public bool hasUser { get; set; }
public bool canAddUser { get; set; }
}
public class Subscribe
{
public long? id { get; set; }
public long? userId { get; set; }
public int? subscriberId { get; set; }
public DateTime? date { get; set; }
public int? duration { get; set; }
public DateTime? startDate { get; set; }
public DateTime? expireDate { get; set; }
public object cancelDate { get; set; }
public string? price { get; set; }
public string? regularPrice { get; set; }
public int? discount { get; set; }
public string action { get; set; }
public string type { get; set; }
public object offerStart { get; set; }
public object offerEnd { get; set; }
public bool? isCurrent { get; set; }
}
public class SubscribedByData
{
public string? price { get; set; }
public string? newPrice { get; set; }
public string? regularPrice { get; set; }
public string? subscribePrice { get; set; }
public int? discountPercent { get; set; }
public int? discountPeriod { get; set; }
public DateTime? subscribeAt { get; set; }
public DateTime? expiredAt { get; set; }
public object? renewedAt { get; set; }
public object? discountFinishedAt { get; set; }
public object? discountStartedAt { get; set; }
public string? status { get; set; }
public bool? isMuted { get; set; }
public string? unsubscribeReason { get; set; }
public string? duration { get; set; }
public bool? showPostsInFeed { get; set; }
public List<Subscribe>? subscribes { get; set; }
}
public class SubscribedOnData
{
public string? price { get; set; }
public string? newPrice { get; set; }
public string? regularPrice { get; set; }
public string? subscribePrice { get; set; }
public int? discountPercent { get; set; }
public int? discountPeriod { get; set; }
public DateTime? subscribeAt { get; set; }
public DateTime? expiredAt { get; set; }
public DateTime? renewedAt { get; set; }
public object? discountFinishedAt { get; set; }
public object? discountStartedAt { get; set; }
public object? status { get; set; }
public bool? isMuted { get; set; }
public string? unsubscribeReason { get; set; }
public string? duration { get; set; }
public string? tipsSumm { get; set; }
public string? subscribesSumm { get; set; }
public string? messagesSumm { get; set; }
public string? postsSumm { get; set; }
public string? streamsSumm { get; set; }
public string? totalSumm { get; set; }
public List<Subscribe>? subscribes { get; set; }
}
}

View File

@ -14,6 +14,7 @@ using MessageEntities = OF_DL.Models.Entities.Messages;
using PostEntities = OF_DL.Models.Entities.Posts; using PostEntities = OF_DL.Models.Entities.Posts;
using PurchasedEntities = OF_DL.Models.Entities.Purchased; using PurchasedEntities = OF_DL.Models.Entities.Purchased;
using StreamEntities = OF_DL.Models.Entities.Streams; using StreamEntities = OF_DL.Models.Entities.Streams;
using UserEntities = OF_DL.Models.Entities.Users;
using OF_DL.Services; using OF_DL.Services;
using Serilog; using Serilog;
using Spectre.Console; using Spectre.Console;
@ -534,8 +535,8 @@ public class Program(IServiceProvider serviceProvider)
"[yellow]device_client_id_blob and/or device_private_key missing, https://ofdl.tools/ or https://cdrm-project.com/ will be used instead for DRM protected videos\n[/]"); "[yellow]device_client_id_blob and/or device_private_key missing, https://ofdl.tools/ or https://cdrm-project.com/ will be used instead for DRM protected videos\n[/]");
} }
User? validate = await apiService.GetUserInfo("/users/me"); UserEntities.User? validate = await apiService.GetUserInfo("/users/me");
if (validate == null || (validate?.name == null && validate?.username == null)) if (validate == null || (validate?.Name == null && validate?.Username == null))
{ {
Log.Error("Auth failed"); Log.Error("Auth failed");
@ -563,7 +564,7 @@ public class Program(IServiceProvider serviceProvider)
} }
} }
AnsiConsole.Markup($"[green]Logged In successfully as {validate.name} {validate.username}\n[/]"); AnsiConsole.Markup($"[green]Logged In successfully as {validate.Name} {validate.Username}\n[/]");
await DownloadAllData(); await DownloadAllData();
} }
catch (Exception ex) catch (Exception ex)
@ -784,7 +785,7 @@ public class Program(IServiceProvider serviceProvider)
Log.Debug($"Folder for {user.Key} already created"); Log.Debug($"Folder for {user.Key} already created");
} }
User user_info = await apiService.GetUserInfo($"/users/{user.Key}"); UserEntities.User user_info = await apiService.GetUserInfo($"/users/{user.Key}");
await dbService.CreateDB(path); await dbService.CreateDB(path);
} }
@ -967,10 +968,10 @@ public class Program(IServiceProvider serviceProvider)
if (Config.DownloadAvatarHeaderPhoto) if (Config.DownloadAvatarHeaderPhoto)
{ {
User? user_info = await apiService.GetUserInfo($"/users/{user.Key}"); UserEntities.User? user_info = await apiService.GetUserInfo($"/users/{user.Key}");
if (user_info != null) if (user_info != null)
{ {
await downloadService.DownloadAvatarHeader(user_info.avatar, user_info.header, path, await downloadService.DownloadAvatarHeader(user_info.Avatar, user_info.Header, path,
user.Key); user.Key);
} }
} }

View File

@ -15,6 +15,7 @@ using PostDtos = OF_DL.Models.Dtos.Posts;
using PurchasedDtos = OF_DL.Models.Dtos.Purchased; using PurchasedDtos = OF_DL.Models.Dtos.Purchased;
using StoriesDtos = OF_DL.Models.Dtos.Stories; using StoriesDtos = OF_DL.Models.Dtos.Stories;
using StreamsDtos = OF_DL.Models.Dtos.Streams; using StreamsDtos = OF_DL.Models.Dtos.Streams;
using UserDtos = OF_DL.Models.Dtos.Users;
using ArchivedEntities = OF_DL.Models.Entities.Archived; using ArchivedEntities = OF_DL.Models.Entities.Archived;
using HighlightEntities = OF_DL.Models.Entities.Highlights; using HighlightEntities = OF_DL.Models.Entities.Highlights;
using ListEntities = OF_DL.Models.Entities.Lists; using ListEntities = OF_DL.Models.Entities.Lists;
@ -23,7 +24,9 @@ using PostEntities = OF_DL.Models.Entities.Posts;
using PurchasedEntities = OF_DL.Models.Entities.Purchased; using PurchasedEntities = OF_DL.Models.Entities.Purchased;
using StoryEntities = OF_DL.Models.Entities.Stories; using StoryEntities = OF_DL.Models.Entities.Stories;
using StreamEntities = OF_DL.Models.Entities.Streams; using StreamEntities = OF_DL.Models.Entities.Streams;
using UserEntities = OF_DL.Models.Entities.Users;
using OF_DL.Models.Mappers; using OF_DL.Models.Mappers;
using OF_DL.Models.Subscriptions;
using OF_DL.Widevine; using OF_DL.Widevine;
using Serilog; using Serilog;
using Spectre.Console; using Spectre.Console;
@ -115,13 +118,13 @@ public class APIService(IAuthService authService, IConfigService configService,
} }
public async Task<User?> GetUserInfo(string endpoint) public async Task<UserEntities.User?> GetUserInfo(string endpoint)
{ {
Log.Debug($"Calling GetUserInfo: {endpoint}"); Log.Debug($"Calling GetUserInfo: {endpoint}");
try try
{ {
User? user = new(); UserEntities.User? user = new();
int post_limit = 50; int post_limit = 50;
Dictionary<string, string> getParams = new() Dictionary<string, string> getParams = new()
{ {
@ -140,7 +143,9 @@ public class APIService(IAuthService authService, IConfigService configService,
response.EnsureSuccessStatusCode(); response.EnsureSuccessStatusCode();
string body = await response.Content.ReadAsStringAsync(); string body = await response.Content.ReadAsStringAsync();
user = JsonConvert.DeserializeObject<User>(body, m_JsonSerializerSettings); UserDtos.UserDto? userDto =
JsonConvert.DeserializeObject<UserDtos.UserDto>(body, m_JsonSerializerSettings);
user = UserMapper.FromDto(userDto) ?? new UserEntities.User();
return user; return user;
} }
catch (Exception ex) catch (Exception ex)

View File

@ -1,11 +1,11 @@
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using OF_DL.Models;
using OF_DL.Enumerations; using OF_DL.Enumerations;
using ArchivedEntities = OF_DL.Models.Entities.Archived; using ArchivedEntities = OF_DL.Models.Entities.Archived;
using MessageEntities = OF_DL.Models.Entities.Messages; using MessageEntities = OF_DL.Models.Entities.Messages;
using PostEntities = OF_DL.Models.Entities.Posts; using PostEntities = OF_DL.Models.Entities.Posts;
using PurchasedEntities = OF_DL.Models.Entities.Purchased; using PurchasedEntities = OF_DL.Models.Entities.Purchased;
using StreamEntities = OF_DL.Models.Entities.Streams; using StreamEntities = OF_DL.Models.Entities.Streams;
using UserEntities = OF_DL.Models.Entities.Users;
using Spectre.Console; using Spectre.Console;
namespace OF_DL.Services; namespace OF_DL.Services;
@ -46,7 +46,7 @@ public interface IAPIService
Task<List<PurchasedEntities.PurchasedTabCollection>> GetPurchasedTab(string endpoint, string folder, Task<List<PurchasedEntities.PurchasedTabCollection>> GetPurchasedTab(string endpoint, string folder,
Dictionary<string, long> users); Dictionary<string, long> users);
Task<User> GetUserInfo(string endpoint); Task<UserEntities.User> GetUserInfo(string endpoint);
Task<JObject> GetUserInfoById(string endpoint); Task<JObject> GetUserInfoById(string endpoint);
Dictionary<string, string> GetDynamicHeaders(string path, string queryParam); Dictionary<string, string> GetDynamicHeaders(string path, string queryParam);
Task<Dictionary<string, long>> GetActiveSubscriptions(string endpoint, bool includeRestrictedSubscriptions); Task<Dictionary<string, long>> GetActiveSubscriptions(string endpoint, bool includeRestrictedSubscriptions);