aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Common/Updates/IInstallationManager.cs
blob: 585b1ee19e10813c558448ac5ff31558c8df6baa (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
#pragma warning disable CS1591

using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Common.Plugins;
using MediaBrowser.Model.Updates;

namespace MediaBrowser.Common.Updates
{
    public interface IInstallationManager : IDisposable
    {
        /// <summary>
        /// Gets the completed installations.
        /// </summary>
        IEnumerable<InstallationInfo> CompletedInstallations { get; }

        /// <summary>
        /// Parses a plugin manifest at the supplied URL.
        /// </summary>
        /// <param name="manifestName">Name of the repository.</param>
        /// <param name="manifest">The URL to query.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>Task{IReadOnlyList{PackageInfo}}.</returns>
        Task<IList<PackageInfo>> GetPackages(string manifestName, string manifest, CancellationToken cancellationToken = default);

        /// <summary>
        /// Gets all available packages.
        /// </summary>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>Task{IReadOnlyList{PackageInfo}}.</returns>
        Task<IReadOnlyList<PackageInfo>> GetAvailablePackages(CancellationToken cancellationToken = default);

        /// <summary>
        /// Returns all plugins matching the requirements.
        /// </summary>
        /// <param name="availablePackages">The available packages.</param>
        /// <param name="name">The name of the plugin.</param>
        /// <param name="guid">The id of the plugin.</param>
        /// <param name="specificVersion">The version of the plugin.</param>
        /// <returns>All plugins matching the requirements.</returns>
        IEnumerable<PackageInfo> FilterPackages(
            IEnumerable<PackageInfo> availablePackages,
            string name = null,
            Guid guid = default,
            Version specificVersion = null);

        /// <summary>
        /// Returns all compatible versions ordered from newest to oldest.
        /// </summary>
        /// <param name="availablePackages">The available packages.</param>
        /// <param name="name">The name.</param>
        /// <param name="guid">The guid of the plugin.</param>
        /// <param name="minVersion">The minimum required version of the plugin.</param>
        /// <param name="specificVersion">The specific version of the plugin to install.</param>
        /// <returns>All compatible versions ordered from newest to oldest.</returns>
        IEnumerable<InstallationInfo> GetCompatibleVersions(
            IEnumerable<PackageInfo> availablePackages,
            string name = null,
            Guid guid = default,
            Version minVersion = null,
            Version specificVersion = null);

        /// <summary>
        /// Returns the available plugin updates.
        /// </summary>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>The available plugin updates.</returns>
        Task<IEnumerable<InstallationInfo>> GetAvailablePluginUpdates(CancellationToken cancellationToken = default);

        /// <summary>
        /// Installs the package.
        /// </summary>
        /// <param name="package">The package.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns><see cref="Task" />.</returns>
        Task InstallPackage(InstallationInfo package, CancellationToken cancellationToken = default);

        /// <summary>
        /// Uninstalls a plugin.
        /// </summary>
        /// <param name="plugin">The plugin.</param>
        void UninstallPlugin(IPlugin plugin);

        /// <summary>
        /// Cancels the installation.
        /// </summary>
        /// <param name="id">The id of the package that is being installed.</param>
        /// <returns>Returns true if the install was cancelled.</returns>
        bool CancelInstallation(Guid id);
    }
}