using System; using System.Collections.Generic; using System.Text.Json.Serialization; namespace Jellyfin.Plugin.Floatplane.Api.Models; /// /// A blog post (the unit shown in Floatplane's feed). List endpoints return posts /// without attachment details; GET /api/v3/content/post expands them. /// public class PostModel : IHasId { public string Id { get; set; } = string.Empty; [JsonIgnore] public bool IsReferenceOnly { get; set; } public string? Guid { get; set; } public string Title { get; set; } = string.Empty; /// HTML body. public string? Text { get; set; } public string? TextMarkdown { get; set; } public string? Type { get; set; } public List Tags { get; set; } = new(); public List AttachmentOrder { get; set; } = new(); public DateTimeOffset? ReleaseDate { get; set; } public int Likes { get; set; } public int Dislikes { get; set; } public int Score { get; set; } public int Comments { get; set; } public bool IsAccessible { get; set; } = true; public bool WasReleasedSilently { get; set; } public PostMetadata? Metadata { get; set; } public ImageModel? Thumbnail { get; set; } public CreatorModel? Creator { get; set; } public ChannelModel? Channel { get; set; } /// Full objects from /content/post; ids (or missing) from list endpoints. public List? VideoAttachments { get; set; } [JsonIgnore] public bool HasVideo => Metadata?.HasVideo ?? (VideoAttachments is { Count: > 0 }); [JsonIgnore] public double DurationSeconds => Metadata?.VideoDuration ?? 0; } public class PostMetadata { public bool HasVideo { get; set; } public int VideoCount { get; set; } public double VideoDuration { get; set; } public bool HasAudio { get; set; } public int AudioCount { get; set; } public double AudioDuration { get; set; } public bool HasPicture { get; set; } public int PictureCount { get; set; } public bool HasGallery { get; set; } public int GalleryCount { get; set; } public bool IsFeatured { get; set; } public double DisplayDuration { get; set; } } /// A video attachment (GET /api/v3/content/video or expanded in /content/post). public class VideoModel : IHasId { public string Id { get; set; } = string.Empty; [JsonIgnore] public bool IsReferenceOnly { get; set; } public string? Guid { get; set; } public string Title { get; set; } = string.Empty; public string? Type { get; set; } public string? Description { get; set; } public double Duration { get; set; } public string? Creator { get; set; } public string? PrimaryBlogPost { get; set; } public bool IsProcessing { get; set; } public bool IsAccessible { get; set; } = true; public List Levels { get; set; } = new(); public List TextTracks { get; set; } = new(); public ImageModel? Thumbnail { get; set; } public ImageModel? TimelineSprite { get; set; } /// Resume position in seconds (only present when logged in). public double? Progress { get; set; } } public class VideoLevel { /// "360", "480", "720", "1080", "2160". public string Name { get; set; } = string.Empty; public int Width { get; set; } public int Height { get; set; } public string? Label { get; set; } public int Order { get; set; } } public class TextTrackModel { public string Id { get; set; } = string.Empty; /// S3-presigned URL (expires after 15 minutes). public string Src { get; set; } = string.Empty; public string? Kind { get; set; } public string? Language { get; set; } public bool Generated { get; set; } public bool Processing { get; set; } } /// Entry of GET /api/v3/content/progress (percentage) or POST /content/get/progress. public class ProgressModel { public string Id { get; set; } = string.Empty; public double Progress { get; set; } }