This commit is contained in:
Gabrieal Jimmy
2026-07-16 13:14:58 -05:00
commit f321976d70
18 changed files with 2435 additions and 0 deletions

View File

@@ -0,0 +1,97 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Jellyfin.Plugin.RedditComments.Models;
/// <summary>
/// A single Reddit comment with nested replies.
/// </summary>
public class CommentDto
{
/// <summary>Gets or sets the comment author.</summary>
public string Author { get; set; } = string.Empty;
/// <summary>Gets or sets the comment body (plain text / markdown source).</summary>
public string Body { get; set; } = string.Empty;
/// <summary>Gets or sets the comment score.</summary>
public int Score { get; set; }
/// <summary>Gets or sets the creation time (unix seconds, UTC).</summary>
public long CreatedUtc { get; set; }
/// <summary>Gets or sets the nested replies.</summary>
public List<CommentDto> Replies { get; set; } = new List<CommentDto>();
}
/// <summary>
/// Response returned by the plugin API for a Jellyfin item.
/// </summary>
public class CommentsResponse
{
/// <summary>Gets or sets a value indicating whether a Reddit thread was found.</summary>
public bool Found { get; set; }
/// <summary>Gets or sets the Jellyfin item id.</summary>
public string ItemId { get; set; } = string.Empty;
/// <summary>Gets or sets a human-readable label for the media (e.g. "Show — Episode 5").</summary>
public string MediaLabel { get; set; } = string.Empty;
/// <summary>Gets or sets the Reddit thread id.</summary>
public string ThreadId { get; set; } = string.Empty;
/// <summary>Gets or sets the Reddit thread title.</summary>
public string ThreadTitle { get; set; } = string.Empty;
/// <summary>Gets or sets the subreddit.</summary>
public string Subreddit { get; set; } = string.Empty;
/// <summary>Gets or sets the thread permalink path.</summary>
public string Permalink { get; set; } = string.Empty;
/// <summary>Gets or sets the thread score.</summary>
public int ThreadScore { get; set; }
/// <summary>Gets or sets the thread's total comment count.</summary>
public int NumComments { get; set; }
/// <summary>Gets or sets when the data was fetched from Reddit (ISO 8601, UTC).</summary>
public string FetchedAt { get; set; } = string.Empty;
/// <summary>Gets or sets a value indicating whether the response came from the local cache.</summary>
public bool Cached { get; set; }
/// <summary>Gets or sets an informational message (e.g. why nothing was found).</summary>
public string Message { get; set; } = string.Empty;
/// <summary>Gets or sets the top-level comments.</summary>
public List<CommentDto> Comments { get; set; } = new List<CommentDto>();
}
/// <summary>
/// A Reddit thread candidate found via search.
/// </summary>
public class ThreadCandidate
{
/// <summary>Gets or sets the thread id.</summary>
public string Id { get; set; } = string.Empty;
/// <summary>Gets or sets the thread title.</summary>
public string Title { get; set; } = string.Empty;
/// <summary>Gets or sets the subreddit.</summary>
public string Subreddit { get; set; } = string.Empty;
/// <summary>Gets or sets the permalink path.</summary>
public string Permalink { get; set; } = string.Empty;
/// <summary>Gets or sets the thread score.</summary>
public int Score { get; set; }
/// <summary>Gets or sets the thread's comment count.</summary>
public int NumComments { get; set; }
/// <summary>Gets or sets the link flair text, if any.</summary>
public string LinkFlairText { get; set; } = string.Empty;
}