mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-06-23 15:30:34 -04:00
64 lines
1.6 KiB
C#
64 lines
1.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Xml.Serialization;
|
|
|
|
namespace API.DTOs.OPDS;
|
|
|
|
// TODO: OPDS Dtos are internal state, shouldn't be in DTO directory
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
[XmlRoot("feed", Namespace = "http://www.w3.org/2005/Atom")]
|
|
public sealed record Feed
|
|
{
|
|
[XmlElement("updated")]
|
|
public string Updated { get; init; } = DateTime.UtcNow.ToString("s");
|
|
|
|
[XmlElement("id")]
|
|
public string Id { get; set; }
|
|
|
|
[XmlElement("title")]
|
|
public string Title { get; set; }
|
|
|
|
[XmlElement("icon")]
|
|
public string Icon { get; set; } = "/favicon.ico";
|
|
|
|
[XmlElement("author")]
|
|
public FeedAuthor Author { get; set; } = new FeedAuthor()
|
|
{
|
|
Name = "Kavita",
|
|
Uri = "https://www.kavitareader.com"
|
|
};
|
|
|
|
[XmlElement("totalResults", Namespace = "http://a9.com/-/spec/opensearch/1.1/")]
|
|
public int? Total { get; set; } = null;
|
|
|
|
[XmlElement("itemsPerPage", Namespace = "http://a9.com/-/spec/opensearch/1.1/")]
|
|
public int? ItemsPerPage { get; set; } = null;
|
|
|
|
[XmlElement("startIndex", Namespace = "http://a9.com/-/spec/opensearch/1.1/")]
|
|
public int? StartIndex { get; set; } = null;
|
|
|
|
[XmlElement("link")]
|
|
public List<FeedLink> Links { get; set; } = new List<FeedLink>() ;
|
|
|
|
[XmlElement("entry")]
|
|
public List<FeedEntry> Entries { get; set; } = new List<FeedEntry>();
|
|
|
|
public bool ShouldSerializeTotal()
|
|
{
|
|
return Total.HasValue;
|
|
}
|
|
|
|
public bool ShouldSerializeItemsPerPage()
|
|
{
|
|
return ItemsPerPage.HasValue;
|
|
}
|
|
|
|
public bool ShouldSerializeStartIndex()
|
|
{
|
|
return StartIndex.HasValue;
|
|
}
|
|
}
|