diff --git a/OF DL/Models/Dtos/Lists/AvatarThumbsDto.cs b/OF DL/Models/Dtos/Lists/AvatarThumbsDto.cs new file mode 100644 index 0000000..62ece7c --- /dev/null +++ b/OF DL/Models/Dtos/Lists/AvatarThumbsDto.cs @@ -0,0 +1,10 @@ +using Newtonsoft.Json; + +namespace OF_DL.Models.Dtos.Lists; + +public class AvatarThumbsDto +{ + [JsonProperty("c50")] public string C50 { get; set; } = ""; + + [JsonProperty("c144")] public string C144 { get; set; } = ""; +} diff --git a/OF DL/Models/Dtos/Lists/HeaderSizeDto.cs b/OF DL/Models/Dtos/Lists/HeaderSizeDto.cs new file mode 100644 index 0000000..4e37f8c --- /dev/null +++ b/OF DL/Models/Dtos/Lists/HeaderSizeDto.cs @@ -0,0 +1,10 @@ +using Newtonsoft.Json; + +namespace OF_DL.Models.Dtos.Lists; + +public class HeaderSizeDto +{ + [JsonProperty("width")] public int? Width { get; set; } + + [JsonProperty("height")] public int? Height { get; set; } +} diff --git a/OF DL/Models/Dtos/Lists/HeaderThumbsDto.cs b/OF DL/Models/Dtos/Lists/HeaderThumbsDto.cs new file mode 100644 index 0000000..8ddbbe3 --- /dev/null +++ b/OF DL/Models/Dtos/Lists/HeaderThumbsDto.cs @@ -0,0 +1,10 @@ +using Newtonsoft.Json; + +namespace OF_DL.Models.Dtos.Lists; + +public class HeaderThumbsDto +{ + [JsonProperty("w480")] public string W480 { get; set; } = ""; + + [JsonProperty("w760")] public string W760 { get; set; } = ""; +} diff --git a/OF DL/Models/Dtos/Lists/ListsStateDto.cs b/OF DL/Models/Dtos/Lists/ListsStateDto.cs new file mode 100644 index 0000000..375e9a2 --- /dev/null +++ b/OF DL/Models/Dtos/Lists/ListsStateDto.cs @@ -0,0 +1,16 @@ +using Newtonsoft.Json; + +namespace OF_DL.Models.Dtos.Lists; + +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; } +} diff --git a/OF DL/Models/Dtos/Lists/SubscribeDto.cs b/OF DL/Models/Dtos/Lists/SubscribeDto.cs new file mode 100644 index 0000000..bb7c0b7 --- /dev/null +++ b/OF DL/Models/Dtos/Lists/SubscribeDto.cs @@ -0,0 +1,38 @@ +using Newtonsoft.Json; + +namespace OF_DL.Models.Dtos.Lists; + +public class SubscribeDto +{ + [JsonProperty("id")] public object Id { get; set; } = new(); + + [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 string? 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; } +} diff --git a/OF DL/Models/Dtos/Lists/SubscribedByDataDto.cs b/OF DL/Models/Dtos/Lists/SubscribedByDataDto.cs new file mode 100644 index 0000000..8e73fad --- /dev/null +++ b/OF DL/Models/Dtos/Lists/SubscribedByDataDto.cs @@ -0,0 +1,40 @@ +using Newtonsoft.Json; + +namespace OF_DL.Models.Dtos.Lists; + +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 string? DiscountPercent { get; set; } + + [JsonProperty("discountPeriod")] public string? DiscountPeriod { get; set; } + + [JsonProperty("subscribeAt")] public DateTime? SubscribeAt { get; set; } + + [JsonProperty("expiredAt")] public DateTime? ExpiredAt { get; set; } + + [JsonProperty("renewedAt")] public object RenewedAt { get; set; } = new(); + + [JsonProperty("discountFinishedAt")] public object DiscountFinishedAt { get; set; } = new(); + + [JsonProperty("discountStartedAt")] public object DiscountStartedAt { get; set; } = new(); + + [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 Subscribes { get; set; } = []; +} diff --git a/OF DL/Models/Dtos/Lists/SubscribedOnDataDto.cs b/OF DL/Models/Dtos/Lists/SubscribedOnDataDto.cs new file mode 100644 index 0000000..ab1ed2f --- /dev/null +++ b/OF DL/Models/Dtos/Lists/SubscribedOnDataDto.cs @@ -0,0 +1,54 @@ +using Newtonsoft.Json; + +namespace OF_DL.Models.Dtos.Lists; + +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 string? DiscountPercent { get; set; } + + [JsonProperty("discountPeriod")] public string? DiscountPeriod { get; set; } + + [JsonProperty("subscribeAt")] public DateTime? SubscribeAt { get; set; } + + [JsonProperty("expiredAt")] public DateTime? ExpiredAt { get; set; } + + [JsonProperty("renewedAt")] public object RenewedAt { get; set; } = new(); + + [JsonProperty("discountFinishedAt")] public object DiscountFinishedAt { get; set; } = new(); + + [JsonProperty("discountStartedAt")] public object DiscountStartedAt { get; set; } = new(); + + [JsonProperty("status")] public object Status { get; set; } = new(); + + [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("lastActivity")] public DateTime? LastActivity { get; set; } + + [JsonProperty("recommendations")] public int? Recommendations { get; set; } + + [JsonProperty("subscribes")] public List Subscribes { get; set; } = []; +} diff --git a/OF DL/Models/Dtos/Lists/SubscriptionBundleDto.cs b/OF DL/Models/Dtos/Lists/SubscriptionBundleDto.cs new file mode 100644 index 0000000..38e9c62 --- /dev/null +++ b/OF DL/Models/Dtos/Lists/SubscriptionBundleDto.cs @@ -0,0 +1,16 @@ +using Newtonsoft.Json; + +namespace OF_DL.Models.Dtos.Lists; + +public class SubscriptionBundleDto +{ + [JsonProperty("id")] public long? Id { get; set; } + + [JsonProperty("discount")] public string? Discount { get; set; } + + [JsonProperty("duration")] public string? Duration { get; set; } + + [JsonProperty("price")] public string? Price { get; set; } + + [JsonProperty("canBuy")] public bool? CanBuy { get; set; } +} diff --git a/OF DL/Models/Dtos/Lists/UserListDto.cs b/OF DL/Models/Dtos/Lists/UserListDto.cs new file mode 100644 index 0000000..ded01cb --- /dev/null +++ b/OF DL/Models/Dtos/Lists/UserListDto.cs @@ -0,0 +1,10 @@ +using Newtonsoft.Json; + +namespace OF_DL.Models.Dtos.Lists; + +public class UserListDto +{ + [JsonProperty("list")] public List List { get; set; } = []; + + [JsonProperty("hasMore")] public bool? HasMore { get; set; } +} diff --git a/OF DL/Models/Dtos/Lists/UserListItemDto.cs b/OF DL/Models/Dtos/Lists/UserListItemDto.cs new file mode 100644 index 0000000..9b5f7a8 --- /dev/null +++ b/OF DL/Models/Dtos/Lists/UserListItemDto.cs @@ -0,0 +1,42 @@ +using Newtonsoft.Json; + +namespace OF_DL.Models.Dtos.Lists; + +public class UserListItemDto +{ + [JsonProperty("id")] public string Id { get; set; } = ""; + + [JsonProperty("type")] public string Type { get; set; } = ""; + + [JsonProperty("name")] public string Name { get; set; } = ""; + + [JsonProperty("usersCount")] public int? UsersCount { get; set; } + + [JsonProperty("postsCount")] public int? PostsCount { get; set; } + + [JsonProperty("canUpdate")] public bool? CanUpdate { get; set; } + + [JsonProperty("canDelete")] public bool? CanDelete { get; set; } + + [JsonProperty("canManageUsers")] public bool? CanManageUsers { get; set; } + + [JsonProperty("canAddUsers")] public bool? CanAddUsers { get; set; } + + [JsonProperty("canPinnedToFeed")] public bool? CanPinnedToFeed { get; set; } + + [JsonProperty("isPinnedToFeed")] public bool? IsPinnedToFeed { get; set; } + + [JsonProperty("canPinnedToChat")] public bool? CanPinnedToChat { get; set; } + + [JsonProperty("isPinnedToChat")] public bool? IsPinnedToChat { get; set; } + + [JsonProperty("order")] public string Order { get; set; } = ""; + + [JsonProperty("direction")] public string Direction { get; set; } = ""; + + [JsonProperty("users")] public List Users { get; set; } = []; + + [JsonProperty("customOrderUsersIds")] public List CustomOrderUsersIds { get; set; } = []; + + [JsonProperty("posts")] public List Posts { get; set; } = []; +} diff --git a/OF DL/Models/Dtos/Lists/UserListUserDto.cs b/OF DL/Models/Dtos/Lists/UserListUserDto.cs new file mode 100644 index 0000000..aaca253 --- /dev/null +++ b/OF DL/Models/Dtos/Lists/UserListUserDto.cs @@ -0,0 +1,10 @@ +using Newtonsoft.Json; + +namespace OF_DL.Models.Dtos.Lists; + +public class UserListUserDto +{ + [JsonProperty("id")] public long? Id { get; set; } + + [JsonProperty("_view")] public string View { get; set; } = ""; +} diff --git a/OF DL/Models/Dtos/Lists/UsersListDto.cs b/OF DL/Models/Dtos/Lists/UsersListDto.cs new file mode 100644 index 0000000..2154096 --- /dev/null +++ b/OF DL/Models/Dtos/Lists/UsersListDto.cs @@ -0,0 +1,115 @@ +using Newtonsoft.Json; + +namespace OF_DL.Models.Dtos.Lists; + +public class UsersListDto +{ + [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("subscriptionBundles")] + public List SubscriptionBundles { 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 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("canReport")] public bool? CanReport { get; set; } + + [JsonProperty("canReceiveChatMessage")] public bool? CanReceiveChatMessage { get; set; } + + [JsonProperty("hideChat")] public bool? HideChat { get; set; } + + [JsonProperty("lastSeen")] public DateTime? LastSeen { get; set; } + + [JsonProperty("isPerformer")] public bool? IsPerformer { get; set; } + + [JsonProperty("isRealPerformer")] public bool? IsRealPerformer { get; set; } + + [JsonProperty("subscribedByData")] public SubscribedByDataDto SubscribedByData { get; set; } = new(); + + [JsonProperty("subscribedOnData")] public SubscribedOnDataDto SubscribedOnData { get; set; } = new(); + + [JsonProperty("canTrialSend")] public bool? CanTrialSend { get; set; } + + [JsonProperty("isBlocked")] public bool? IsBlocked { get; set; } + + [JsonProperty("promoOffers")] public List PromoOffers { get; set; } = []; +} diff --git a/OF DL/Models/Entities/Lists/UserList.cs b/OF DL/Models/Entities/Lists/UserList.cs new file mode 100644 index 0000000..69babb3 --- /dev/null +++ b/OF DL/Models/Entities/Lists/UserList.cs @@ -0,0 +1,8 @@ +namespace OF_DL.Models.Entities.Lists; + +public class UserList +{ + public List List { get; set; } = []; + + public bool HasMore { get; set; } +} diff --git a/OF DL/Models/Entities/Lists/UserListItem.cs b/OF DL/Models/Entities/Lists/UserListItem.cs new file mode 100644 index 0000000..ad57069 --- /dev/null +++ b/OF DL/Models/Entities/Lists/UserListItem.cs @@ -0,0 +1,8 @@ +namespace OF_DL.Models.Entities.Lists; + +public class UserListItem +{ + public string Id { get; set; } = ""; + + public string Name { get; set; } = ""; +} diff --git a/OF DL/Models/Entities/Lists/UsersList.cs b/OF DL/Models/Entities/Lists/UsersList.cs new file mode 100644 index 0000000..877b982 --- /dev/null +++ b/OF DL/Models/Entities/Lists/UsersList.cs @@ -0,0 +1,6 @@ +namespace OF_DL.Models.Entities.Lists; + +public class UsersList +{ + public string Username { get; set; } = ""; +} diff --git a/OF DL/Models/Lists/UserList.cs b/OF DL/Models/Lists/UserList.cs deleted file mode 100644 index f499edb..0000000 --- a/OF DL/Models/Lists/UserList.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace OF_DL.Models.Lists; - -public class UserList -{ - public List list { get; set; } - public bool? hasMore { get; set; } - - public class List - { - public string id { get; set; } - public string type { get; set; } - public string name { get; set; } - public int? usersCount { get; set; } - public int? postsCount { get; set; } - public bool? canUpdate { get; set; } - public bool? canDelete { get; set; } - public bool? canManageUsers { get; set; } - public bool? canAddUsers { get; set; } - public bool? canPinnedToFeed { get; set; } - public bool? isPinnedToFeed { get; set; } - public bool? canPinnedToChat { get; set; } - public bool? isPinnedToChat { get; set; } - public string order { get; set; } - public string direction { get; set; } - public List users { get; set; } - public List customOrderUsersIds { get; set; } - public List posts { get; set; } - } - - public class User - { - public long? id { get; set; } - public string _view { get; set; } - } -} diff --git a/OF DL/Models/Lists/UsersList.cs b/OF DL/Models/Lists/UsersList.cs deleted file mode 100644 index 806b4aa..0000000 --- a/OF DL/Models/Lists/UsersList.cs +++ /dev/null @@ -1,164 +0,0 @@ -namespace OF_DL.Models.Lists; - -public class UsersList -{ - 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 List subscriptionBundles { get; set; } - public string displayName { get; set; } - public string notice { get; set; } - public bool? isPaywallRequired { get; set; } - public bool? unprofitable { get; set; } - public List 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 bool? canReport { get; set; } - public bool? canReceiveChatMessage { get; set; } - public bool? hideChat { get; set; } - public DateTime? lastSeen { get; set; } - public bool? isPerformer { get; set; } - public bool? isRealPerformer { get; set; } - public SubscribedByData subscribedByData { get; set; } - public SubscribedOnData subscribedOnData { get; set; } - public bool? canTrialSend { get; set; } - public bool? isBlocked { get; set; } - public List promoOffers { 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 object 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 string? 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 string? discountPercent { get; set; } - public string? 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 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 string? discountPercent { get; set; } - public string? 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 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 DateTime? lastActivity { get; set; } - public int? recommendations { get; set; } - public List subscribes { get; set; } - } - - public class SubscriptionBundle - { - public long? id { get; set; } - public string? discount { get; set; } - public string? duration { get; set; } - public string? price { get; set; } - public bool? canBuy { get; set; } - } -} diff --git a/OF DL/Models/Mappers/UserListsMapper.cs b/OF DL/Models/Mappers/UserListsMapper.cs new file mode 100644 index 0000000..1ff4e32 --- /dev/null +++ b/OF DL/Models/Mappers/UserListsMapper.cs @@ -0,0 +1,40 @@ +using OF_DL.Models.Dtos.Lists; +using OF_DL.Models.Entities.Lists; + +namespace OF_DL.Models.Mappers; + +public static class UserListsMapper +{ + public static UserList FromDto(UserListDto? dto) + { + UserList mapped = new() { HasMore = dto?.HasMore ?? false }; + + if (dto?.List == null) + { + return mapped; + } + + foreach (UserListItemDto entry in dto.List) + { + mapped.List.Add(MapListItem(entry)); + } + + return mapped; + } + + public static List FromDto(List? dto) + { + if (dto == null) + { + return []; + } + + return dto.Select(MapUsersList).ToList(); + } + + private static UserListItem MapListItem(UserListItemDto dto) => + new() { Id = dto.Id, Name = dto.Name }; + + private static UsersList MapUsersList(UsersListDto dto) => + new() { Username = dto.Username }; +} diff --git a/OF DL/Services/APIService.cs b/OF DL/Services/APIService.cs index 04beede..149a35f 100644 --- a/OF DL/Services/APIService.cs +++ b/OF DL/Services/APIService.cs @@ -6,7 +6,6 @@ using System.Xml.Linq; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using OF_DL.Models; -using OF_DL.Models.Lists; using OF_DL.Models.Messages; using OF_DL.Models.Post; using OF_DL.Models.Purchased; @@ -14,9 +13,11 @@ using OF_DL.Models.Stories; using OF_DL.Models.Streams; using OF_DL.Enumerations; using OF_DL.Models.Dtos.Archived; +using OF_DL.Models.Dtos.Lists; using OF_DL.Models.Dtos.Highlights; using ArchivedModels = OF_DL.Models.Entities.Archived; using HighlightEntities = OF_DL.Models.Entities.Highlights; +using ListEntities = OF_DL.Models.Entities.Lists; using OF_DL.Models.Mappers; using OF_DL.Widevine; using Serilog; @@ -242,21 +243,18 @@ public class APIService(IAuthService authService, IConfigService configService, break; } - UserList userList = JsonConvert.DeserializeObject(body); - if (userList == null) - { - break; - } + UserListDto? userListDto = JsonConvert.DeserializeObject(body); + ListEntities.UserList userList = UserListsMapper.FromDto(userListDto); - foreach (UserList.List l in userList.list) + foreach (ListEntities.UserListItem listItem in userList.List) { - if (IsStringOnlyDigits(l.id) && !lists.ContainsKey(l.name)) + if (IsStringOnlyDigits(listItem.Id) && !lists.ContainsKey(listItem.Name)) { - lists.Add(l.name, Convert.ToInt32(l.id)); + lists.Add(listItem.Name, Convert.ToInt32(listItem.Id)); } } - if (userList.hasMore.Value) + if (userList.HasMore) { offset += 50; getParams["offset"] = Convert.ToString(offset); @@ -305,16 +303,17 @@ public class APIService(IAuthService authService, IConfigService configService, break; } - List? usersList = JsonConvert.DeserializeObject>(body); + List? usersListDto = JsonConvert.DeserializeObject>(body); + List usersList = UserListsMapper.FromDto(usersListDto); - if (usersList == null || usersList.Count <= 0) + if (usersList.Count <= 0) { break; } - foreach (UsersList ul in usersList) + foreach (ListEntities.UsersList ul in usersList) { - users.Add(ul.username); + users.Add(ul.Username); } if (users.Count < 50)