diff --git a/Kyoo.Common/Controllers/ILibraryManager.cs b/Kyoo.Common/Controllers/ILibraryManager.cs
index 2cd0c909..53c7061a 100644
--- a/Kyoo.Common/Controllers/ILibraryManager.cs
+++ b/Kyoo.Common/Controllers/ILibraryManager.cs
@@ -242,6 +242,9 @@ namespace Kyoo.Controllers
/// The type of the source object
/// The related resource's type
/// The param
+ ///
+ ///
+ ///
Task Load([NotNull] T obj, Expression> member)
where T : class, IResource
where T2 : class, IResource, new();
@@ -254,6 +257,9 @@ namespace Kyoo.Controllers
/// The type of the source object
/// The related resource's type
/// The param
+ ///
+ ///
+ ///
Task Load([NotNull] T obj, Expression>> member)
where T : class, IResource
where T2 : class, new();
@@ -265,6 +271,9 @@ namespace Kyoo.Controllers
/// The name of the resource to load (case sensitive)
/// The type of the source object
/// The param
+ ///
+ ///
+ ///
Task Load([NotNull] T obj, string memberName)
where T : class, IResource;
@@ -273,6 +282,9 @@ namespace Kyoo.Controllers
///
/// The source object.
/// The name of the resource to load (case sensitive)
+ ///
+ ///
+ ///
Task Load([NotNull] IResource obj, string memberName);
///
diff --git a/Kyoo.Common/Models/Attributes/LinkAttribute.cs b/Kyoo.Common/Models/Attributes/LinkAttribute.cs
new file mode 100644
index 00000000..d98ad90a
--- /dev/null
+++ b/Kyoo.Common/Models/Attributes/LinkAttribute.cs
@@ -0,0 +1,13 @@
+using System;
+using JetBrains.Annotations;
+using Kyoo.Models.Attributes;
+
+namespace Kyoo.Common.Models.Attributes
+{
+ ///
+ /// An attribute to mark Link properties on resource.
+ ///
+ [AttributeUsage(AttributeTargets.Property)]
+ [MeansImplicitUse]
+ public class LinkAttribute : SerializeIgnoreAttribute { }
+}
\ No newline at end of file
diff --git a/Kyoo.Common/Models/Attributes/RelationAttributes.cs b/Kyoo.Common/Models/Attributes/RelationAttributes.cs
index aac0e633..ef84f5e5 100644
--- a/Kyoo.Common/Models/Attributes/RelationAttributes.cs
+++ b/Kyoo.Common/Models/Attributes/RelationAttributes.cs
@@ -1,17 +1,34 @@
using System;
+using Kyoo.Controllers;
namespace Kyoo.Models.Attributes
{
- [AttributeUsage(AttributeTargets.Property, Inherited = false)]
+ ///
+ /// The targeted relation can be edited via calls to the repository's method.
+ ///
+ [AttributeUsage(AttributeTargets.Property)]
public class EditableRelationAttribute : Attribute { }
+ ///
+ /// The targeted relation can be loaded via a call to .
+ ///
[AttributeUsage(AttributeTargets.Property)]
public class LoadableRelationAttribute : Attribute
{
+ ///
+ /// The name of the field containing the related resource's ID.
+ ///
public string RelationID { get; }
+ ///
+ /// Create a new .
+ ///
public LoadableRelationAttribute() {}
+ ///
+ /// Create a new with a baking relationID field.
+ ///
+ /// The name of the RelationID field.
public LoadableRelationAttribute(string relationID)
{
RelationID = relationID;
diff --git a/Kyoo.Common/Models/Resources/Collection.cs b/Kyoo.Common/Models/Resources/Collection.cs
index 3c7bed25..8162ff16 100644
--- a/Kyoo.Common/Models/Resources/Collection.cs
+++ b/Kyoo.Common/Models/Resources/Collection.cs
@@ -1,31 +1,59 @@
using System.Collections.Generic;
+using Kyoo.Common.Models.Attributes;
using Kyoo.Models.Attributes;
namespace Kyoo.Models
{
+ ///
+ /// A class representing collections of .
+ /// A collection can also be stored in a .
+ ///
public class Collection : IResource
{
+ ///
public int ID { get; set; }
+
+ ///
public string Slug { get; set; }
+
+ ///
+ /// The name of this collection.
+ ///
public string Name { get; set; }
+
+ ///
+ /// The path of this poster.
+ /// By default, the http path for this poster is returned from the public API.
+ /// This can be disabled using the internal query flag.
+ ///
[SerializeAs("{HOST}/api/collection/{Slug}/poster")] public string Poster { get; set; }
+
+ ///
+ /// The description of this collection.
+ ///
public string Overview { get; set; }
- [LoadableRelation] public virtual ICollection Shows { get; set; }
- [LoadableRelation] public virtual ICollection Libraries { get; set; }
+
+ ///
+ /// The list of shows contained in this collection.
+ ///
+ [LoadableRelation] public ICollection Shows { get; set; }
+
+ ///
+ /// The list of libraries that contains this collection.
+ ///
+ [LoadableRelation] public ICollection Libraries { get; set; }
#if ENABLE_INTERNAL_LINKS
- [SerializeIgnore] public virtual ICollection> ShowLinks { get; set; }
- [SerializeIgnore] public virtual ICollection> LibraryLinks { get; set; }
-#endif
- public Collection() { }
-
- public Collection(string slug, string name, string overview, string poster)
- {
- Slug = slug;
- Name = name;
- Overview = overview;
- Poster = poster;
- }
+ ///
+ /// The internal link between this collection and shows in the list.
+ ///
+ [Link] public ICollection> ShowLinks { get; set; }
+
+ ///
+ /// The internal link between this collection and libraries in the list.
+ ///
+ [Link] public ICollection> LibraryLinks { get; set; }
+#endif
}
}
diff --git a/Kyoo.Common/Models/Resources/Episode.cs b/Kyoo.Common/Models/Resources/Episode.cs
index 29aeab06..e5d0d7f1 100644
--- a/Kyoo.Common/Models/Resources/Episode.cs
+++ b/Kyoo.Common/Models/Resources/Episode.cs
@@ -1,40 +1,126 @@
using System;
using System.Collections.Generic;
+using JetBrains.Annotations;
+using Kyoo.Controllers;
using Kyoo.Models.Attributes;
namespace Kyoo.Models
{
+ ///
+ /// A class to represent a single show's episode.
+ /// This is also used internally for movies (their number is juste set to -1).
+ ///
public class Episode : IResource, IOnMerge
{
+ ///
public int ID { get; set; }
+
+ ///
public string Slug => GetSlug(ShowSlug, SeasonNumber, EpisodeNumber, AbsoluteNumber);
+
+ ///
+ /// The slug of the Show that contain this episode. If this is not set, this episode is ill-formed.
+ ///
[SerializeIgnore] public string ShowSlug { private get; set; }
+
+ ///
+ /// The ID of the Show containing this episode. This value is only set when the has been loaded.
+ ///
[SerializeIgnore] public int ShowID { get; set; }
- [LoadableRelation(nameof(ShowID))] public virtual Show Show { get; set; }
+ ///
+ /// The show that contains this episode. This must be explicitly loaded via a call to .
+ ///
+ [LoadableRelation(nameof(ShowID))] public Show Show { get; set; }
+
+ ///
+ /// The ID of the Season containing this episode. This value is only set when the has been loaded.
+ ///
[SerializeIgnore] public int? SeasonID { get; set; }
- [LoadableRelation(nameof(SeasonID))] public virtual Season Season { get; set; }
+ ///
+ /// The season that contains this episode. This must be explicitly loaded via a call to .
+ /// This can be null if the season is unknown and the episode is only identified by it's .
+ ///
+ [LoadableRelation(nameof(SeasonID))] public Season Season { get; set; }
+ ///
+ /// The season in witch this episode is in. This defaults to -1 if not specified.
+ ///
public int SeasonNumber { get; set; } = -1;
+
+ ///
+ /// The number of this episode is it's season. This defaults to -1 if not specified.
+ ///
public int EpisodeNumber { get; set; } = -1;
+
+ ///
+ /// The absolute number of this episode. It's an episode number that is not reset to 1 after a new season.
+ /// This defaults to -1 if not specified.
+ ///
public int AbsoluteNumber { get; set; } = -1;
+
+ ///
+ /// The path of the video file for this episode. Any format supported by a is allowed.
+ ///
[SerializeIgnore] public string Path { get; set; }
+ ///
+ /// The path of this episode's thumbnail.
+ /// By default, the http path for the thumbnail is returned from the public API.
+ /// This can be disabled using the internal query flag.
+ ///
[SerializeAs("{HOST}/api/episodes/{Slug}/thumb")] public string Thumb { get; set; }
+
+ ///
+ /// The title of this episode.
+ ///
public string Title { get; set; }
+
+ ///
+ /// The overview of this episode.
+ ///
public string Overview { get; set; }
+
+ ///
+ /// The release date of this episode. It can be null if unknown.
+ ///
public DateTime? ReleaseDate { get; set; }
- public int Runtime { get; set; } //This runtime variable should be in minutes
+ ///
+ /// The link to metadata providers that this episode has. See for more information.
+ ///
+ [EditableRelation] [LoadableRelation] public ICollection ExternalIDs { get; set; }
- [EditableRelation] [LoadableRelation] public virtual ICollection ExternalIDs { get; set; }
-
- [EditableRelation] [LoadableRelation] public virtual ICollection