diff options
Diffstat (limited to 'MediaBrowser.Controller/Collections')
| -rw-r--r-- | MediaBrowser.Controller/Collections/CollectionCreatedEventArgs.cs | 24 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Collections/CollectionCreationOptions.cs | 21 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Collections/CollectionModifiedEventArgs.cs (renamed from MediaBrowser.Controller/Collections/CollectionEvents.cs) | 25 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Collections/ICollectionManager.cs | 22 |
4 files changed, 59 insertions, 33 deletions
diff --git a/MediaBrowser.Controller/Collections/CollectionCreatedEventArgs.cs b/MediaBrowser.Controller/Collections/CollectionCreatedEventArgs.cs new file mode 100644 index 000000000..82b3a4977 --- /dev/null +++ b/MediaBrowser.Controller/Collections/CollectionCreatedEventArgs.cs @@ -0,0 +1,24 @@ +#nullable disable + +#pragma warning disable CS1591 + +using System; +using MediaBrowser.Controller.Entities.Movies; + +namespace MediaBrowser.Controller.Collections +{ + public class CollectionCreatedEventArgs : EventArgs + { + /// <summary> + /// Gets or sets the collection. + /// </summary> + /// <value>The collection.</value> + public BoxSet Collection { get; set; } + + /// <summary> + /// Gets or sets the options. + /// </summary> + /// <value>The options.</value> + public CollectionCreationOptions Options { get; set; } + } +}
\ No newline at end of file diff --git a/MediaBrowser.Controller/Collections/CollectionCreationOptions.cs b/MediaBrowser.Controller/Collections/CollectionCreationOptions.cs index 51fe4ce29..30f5f4efa 100644 --- a/MediaBrowser.Controller/Collections/CollectionCreationOptions.cs +++ b/MediaBrowser.Controller/Collections/CollectionCreationOptions.cs @@ -1,3 +1,7 @@ +#nullable disable + +#pragma warning disable CS1591 + using System; using System.Collections.Generic; using MediaBrowser.Model.Entities; @@ -6,6 +10,13 @@ namespace MediaBrowser.Controller.Collections { public class CollectionCreationOptions : IHasProviderIds { + public CollectionCreationOptions() + { + ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); + ItemIdList = Array.Empty<string>(); + UserIds = Array.Empty<Guid>(); + } + public string Name { get; set; } public Guid? ParentId { get; set; } @@ -14,14 +25,8 @@ namespace MediaBrowser.Controller.Collections public Dictionary<string, string> ProviderIds { get; set; } - public string[] ItemIdList { get; set; } - public Guid[] UserIds { get; set; } + public IReadOnlyList<string> ItemIdList { get; set; } - public CollectionCreationOptions() - { - ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); - ItemIdList = Array.Empty<string>(); - UserIds = Array.Empty<Guid>(); - } + public IReadOnlyList<Guid> UserIds { get; set; } } } diff --git a/MediaBrowser.Controller/Collections/CollectionEvents.cs b/MediaBrowser.Controller/Collections/CollectionModifiedEventArgs.cs index bfc6af463..e538fa4b3 100644 --- a/MediaBrowser.Controller/Collections/CollectionEvents.cs +++ b/MediaBrowser.Controller/Collections/CollectionModifiedEventArgs.cs @@ -1,3 +1,5 @@ +#pragma warning disable CS1591 + using System; using System.Collections.Generic; using MediaBrowser.Controller.Entities; @@ -5,23 +7,14 @@ using MediaBrowser.Controller.Entities.Movies; namespace MediaBrowser.Controller.Collections { - public class CollectionCreatedEventArgs : EventArgs - { - /// <summary> - /// Gets or sets the collection. - /// </summary> - /// <value>The collection.</value> - public BoxSet Collection { get; set; } - - /// <summary> - /// Gets or sets the options. - /// </summary> - /// <value>The options.</value> - public CollectionCreationOptions Options { get; set; } - } - public class CollectionModifiedEventArgs : EventArgs { + public CollectionModifiedEventArgs(BoxSet collection, IReadOnlyCollection<BaseItem> itemsChanged) + { + Collection = collection; + ItemsChanged = itemsChanged; + } + /// <summary> /// Gets or sets the collection. /// </summary> @@ -32,6 +25,6 @@ namespace MediaBrowser.Controller.Collections /// Gets or sets the items changed. /// </summary> /// <value>The items changed.</value> - public List<BaseItem> ItemsChanged { get; set; } + public IReadOnlyCollection<BaseItem> ItemsChanged { get; set; } } } diff --git a/MediaBrowser.Controller/Collections/ICollectionManager.cs b/MediaBrowser.Controller/Collections/ICollectionManager.cs index cfe8493d3..b8c33ee5a 100644 --- a/MediaBrowser.Controller/Collections/ICollectionManager.cs +++ b/MediaBrowser.Controller/Collections/ICollectionManager.cs @@ -1,5 +1,9 @@ +#pragma warning disable CS1591 + using System; using System.Collections.Generic; +using System.Threading.Tasks; +using Jellyfin.Data.Entities; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Movies; @@ -10,40 +14,40 @@ namespace MediaBrowser.Controller.Collections /// <summary> /// Occurs when [collection created]. /// </summary> - event EventHandler<CollectionCreatedEventArgs> CollectionCreated; + event EventHandler<CollectionCreatedEventArgs>? CollectionCreated; /// <summary> /// Occurs when [items added to collection]. /// </summary> - event EventHandler<CollectionModifiedEventArgs> ItemsAddedToCollection; + event EventHandler<CollectionModifiedEventArgs>? ItemsAddedToCollection; /// <summary> /// Occurs when [items removed from collection]. /// </summary> - event EventHandler<CollectionModifiedEventArgs> ItemsRemovedFromCollection; + event EventHandler<CollectionModifiedEventArgs>? ItemsRemovedFromCollection; /// <summary> /// Creates the collection. /// </summary> /// <param name="options">The options.</param> - BoxSet CreateCollection(CollectionCreationOptions options); + /// <returns>BoxSet wrapped in an awaitable task.</returns> + Task<BoxSet> CreateCollectionAsync(CollectionCreationOptions options); /// <summary> /// Adds to collection. /// </summary> /// <param name="collectionId">The collection identifier.</param> /// <param name="itemIds">The item ids.</param> - void AddToCollection(Guid collectionId, IEnumerable<string> itemIds); + /// <returns><see cref="Task"/> representing the asynchronous operation.</returns> + Task AddToCollectionAsync(Guid collectionId, IEnumerable<Guid> itemIds); /// <summary> /// Removes from collection. /// </summary> /// <param name="collectionId">The collection identifier.</param> /// <param name="itemIds">The item ids.</param> - void RemoveFromCollection(Guid collectionId, IEnumerable<string> itemIds); - - void AddToCollection(Guid collectionId, IEnumerable<Guid> itemIds); - void RemoveFromCollection(Guid collectionId, IEnumerable<Guid> itemIds); + /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns> + Task RemoveFromCollectionAsync(Guid collectionId, IEnumerable<Guid> itemIds); /// <summary> /// Collapses the items within box sets. |
