aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Playlists/IPlaylistManager.cs
blob: 497c4a511e8671d0798e982065b00b81f68c5295 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#pragma warning disable CS1591

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Playlists;

namespace MediaBrowser.Controller.Playlists
{
    public interface IPlaylistManager
    {
        /// <summary>
        /// Gets the playlist.
        /// </summary>
        /// <param name="playlistId">The playlist identifier.</param>
        /// <param name="userId">The user identifier.</param>
        /// <returns>Playlist.</returns>
        Playlist GetPlaylistForUser(Guid playlistId, Guid userId);

        /// <summary>
        /// Creates the playlist.
        /// </summary>
        /// <param name="request">The <see cref="PlaylistCreationRequest"/>.</param>
        /// <returns>The created playlist.</returns>
        Task<PlaylistCreationResult> CreatePlaylist(PlaylistCreationRequest request);

        /// <summary>
        /// Updates a playlist.
        /// </summary>
        /// <param name="request">The <see cref="PlaylistUpdateRequest"/>.</param>
        /// <returns>Task.</returns>
        Task UpdatePlaylist(PlaylistUpdateRequest request);

        /// <summary>
        /// Gets all playlists a user has access to.
        /// </summary>
        /// <param name="userId">The user identifier.</param>
        /// <returns>IEnumerable&lt;Playlist&gt;.</returns>
        IEnumerable<Playlist> GetPlaylists(Guid userId);

        /// <summary>
        /// Adds a share to the playlist.
        /// </summary>
        /// <param name="request">The <see cref="PlaylistUserUpdateRequest"/>.</param>
        /// <returns>Task.</returns>
        Task AddUserToShares(PlaylistUserUpdateRequest request);

        /// <summary>
        /// Removes a share from the playlist.
        /// </summary>
        /// <param name="playlistId">The playlist identifier.</param>
        /// <param name="userId">The user identifier.</param>
        /// <param name="share">The share.</param>
        /// <returns>Task.</returns>
        Task RemoveUserFromShares(Guid playlistId, Guid userId, PlaylistUserPermissions share);

        /// <summary>
        /// Adds to playlist.
        /// </summary>
        /// <param name="playlistId">The playlist identifier.</param>
        /// <param name="itemIds">The item ids.</param>
        /// <param name="userId">The user identifier.</param>
        /// <returns>Task.</returns>
        Task AddItemToPlaylistAsync(Guid playlistId, IReadOnlyCollection<Guid> itemIds, Guid userId);

        /// <summary>
        /// Removes from playlist.
        /// </summary>
        /// <param name="playlistId">The playlist identifier.</param>
        /// <param name="entryIds">The entry ids.</param>
        /// <returns>Task.</returns>
        Task RemoveItemFromPlaylistAsync(string playlistId, IEnumerable<string> entryIds);

        /// <summary>
        /// Gets the playlists folder.
        /// </summary>
        /// <returns>Folder.</returns>
        Folder GetPlaylistsFolder();

        /// <summary>
        /// Gets the playlists folder for a user.
        /// </summary>
        /// <param name="userId">The user identifier.</param>
        /// <returns>Folder.</returns>
        Folder GetPlaylistsFolder(Guid userId);

        /// <summary>
        /// Moves the item.
        /// </summary>
        /// <param name="playlistId">The playlist identifier.</param>
        /// <param name="entryId">The entry identifier.</param>
        /// <param name="newIndex">The new index.</param>
        /// <param name="callingUserId">The calling user.</param>
        /// <returns>Task.</returns>
        Task MoveItemAsync(string playlistId, string entryId, int newIndex, Guid callingUserId);

        /// <summary>
        /// Removed all playlists of a user.
        /// If the playlist is shared, ownership is transferred.
        /// </summary>
        /// <param name="userId">The user id.</param>
        /// <returns>Task.</returns>
        Task RemovePlaylistsAsync(Guid userId);

        /// <summary>
        /// Saves a playlist.
        /// </summary>
        /// <param name="item">The playlist.</param>
        void SavePlaylistFile(Playlist item);
    }
}