Kavita/API/DTOs/OPDS/FeedLink.cs
Joe Milazzo 47269b4c51
OPDS-PS v1.2 Support + a few bugfixes (#1869)
* Fixed up a localization lookup test case

* Refactored some webp to a unified method

* Cleaned up some code

* Expanded webp conversion for covers to all entities

* Code cleanup

* Prompt the user when they are about to delete multiple series via bulk actions

* Aligned Kavita to OPDS-PS 1.2.

* Fixed a bug where clearing metadata filter of series name didn't clear the actual field.

* Added some documentation

* Refactored how covert covers to webp works. Now we will handle all custom covers for all entities. Volumes and Series will not be touched but instead be updated via a RefreshCovers call. This will fix up the references much faster.

* Fixed up the OPDS-PS 1.2 attributes to only show on PS links
2023-03-09 16:41:42 -08:00

64 lines
1.6 KiB
C#

using System;
using System.Xml.Serialization;
namespace API.DTOs.OPDS;
public class FeedLink
{
[XmlIgnore]
public bool IsPageStream { get; set; }
/// <summary>
/// Relation on the Link
/// </summary>
[XmlAttribute("rel")]
public string Rel { get; set; }
/// <summary>
/// Should be any of the types here <see cref="FeedLinkType"/>
/// </summary>
[XmlAttribute("type")]
public string Type { get; set; }
[XmlAttribute("href")]
public string Href { get; set; }
[XmlAttribute("title")]
public string Title { get; set; }
[XmlAttribute("count", Namespace = "http://vaemendis.net/opds-pse/ns")]
public int TotalPages { get; set; }
/// <summary>
/// lastRead MUST provide the last page read for this document. The numbering starts at 1.
/// </summary>
[XmlAttribute("lastRead", Namespace = "http://vaemendis.net/opds-pse/ns")]
public int LastRead { get; set; } = -1;
/// <summary>
/// lastReadDate MAY provide the date of when the lastRead attribute was last updated.
/// </summary>
/// <remarks>Attribute MUST conform Atom's Date construct</remarks>
[XmlAttribute("lastReadDate", Namespace = "http://vaemendis.net/opds-pse/ns")]
public DateTime LastReadDate { get; set; }
public bool ShouldSerializeLastReadDate()
{
return IsPageStream;
}
public bool ShouldSerializeLastRead()
{
return LastRead >= 0;
}
public bool ShouldSerializeTitle()
{
return !string.IsNullOrEmpty(Title);
}
public bool ShouldSerializeTotalPages()
{
return TotalPages > 0;
}
}