jellyfin/MediaBrowser.Common/Updates/IInstallationManager.cs

119 lines
5.4 KiB
C#
Raw Normal View History

using System;
2018-12-27 23:27:57 +00:00
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Common.Plugins;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Updates;
2018-12-27 23:27:57 +00:00
namespace MediaBrowser.Common.Updates
{
public interface IInstallationManager : IDisposable
{
event EventHandler<InstallationEventArgs> PackageInstalling;
event EventHandler<InstallationEventArgs> PackageInstallationCompleted;
event EventHandler<InstallationFailedEventArgs> PackageInstallationFailed;
event EventHandler<InstallationEventArgs> PackageInstallationCancelled;
/// <summary>
/// The completed installations
/// </summary>
IEnumerable<InstallationInfo> CompletedInstallations { get; }
/// <summary>
/// Occurs when [plugin uninstalled].
/// </summary>
event EventHandler<GenericEventArgs<IPlugin>> PluginUninstalled;
/// <summary>
/// Occurs when [plugin updated].
/// </summary>
2019-06-14 16:38:14 +00:00
event EventHandler<GenericEventArgs<(IPlugin, PackageVersionInfo)>> PluginUpdated;
2018-12-27 23:27:57 +00:00
/// <summary>
/// Occurs when [plugin updated].
/// </summary>
event EventHandler<GenericEventArgs<PackageVersionInfo>> PluginInstalled;
/// <summary>
/// Gets all available packages.
/// </summary>
/// <param name="cancellationToken">The cancellation token.</param>
/// <param name="withRegistration">if set to <c>true</c> [with registration].</param>
/// <param name="packageType">Type of the package.</param>
/// <param name="applicationVersion">The application version.</param>
/// <returns>Task{List{PackageInfo}}.</returns>
Task<List<PackageInfo>> GetAvailablePackages(CancellationToken cancellationToken,
bool withRegistration = true, string packageType = null, Version applicationVersion = null);
2018-12-27 23:27:57 +00:00
/// <summary>
/// Gets all available packages from a static resource.
/// </summary>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{List{PackageInfo}}.</returns>
Task<List<PackageInfo>> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken);
/// <summary>
/// Gets the package.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="guid">The assembly guid</param>
/// <param name="classification">The classification.</param>
/// <param name="version">The version.</param>
/// <returns>Task{PackageVersionInfo}.</returns>
Task<PackageVersionInfo> GetPackage(string name, string guid, PackageVersionClass classification, Version version);
/// <summary>
/// Gets the latest compatible version.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="guid">The assembly guid</param>
/// <param name="currentServerVersion">The current server version.</param>
/// <param name="classification">The classification.</param>
/// <returns>Task{PackageVersionInfo}.</returns>
Task<PackageVersionInfo> GetLatestCompatibleVersion(string name, string guid, Version currentServerVersion, PackageVersionClass classification = PackageVersionClass.Release);
/// <summary>
/// Gets the latest compatible version.
/// </summary>
/// <param name="availablePackages">The available packages.</param>
/// <param name="name">The name.</param>
/// <param name="guid">The assembly guid</param>
/// <param name="currentServerVersion">The current server version.</param>
/// <param name="classification">The classification.</param>
/// <returns>PackageVersionInfo.</returns>
PackageVersionInfo GetLatestCompatibleVersion(IEnumerable<PackageInfo> availablePackages, string name, string guid, Version currentServerVersion, PackageVersionClass classification = PackageVersionClass.Release);
/// <summary>
/// Gets the available plugin updates.
/// </summary>
/// <param name="applicationVersion">The current server version.</param>
/// <param name="withAutoUpdateEnabled">if set to <c>true</c> [with auto update enabled].</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{IEnumerable{PackageVersionInfo}}.</returns>
Task<IEnumerable<PackageVersionInfo>> GetAvailablePluginUpdates(Version applicationVersion, bool withAutoUpdateEnabled, CancellationToken cancellationToken);
/// <summary>
/// Installs the package.
/// </summary>
/// <param name="package">The package.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns><see cref="Task" />.</returns>
2019-08-11 13:57:36 +00:00
Task InstallPackage(PackageVersionInfo package, CancellationToken cancellationToken = default);
2018-12-27 23:27:57 +00:00
/// <summary>
/// Uninstalls a plugin
/// </summary>
/// <param name="plugin">The plugin.</param>
2019-01-13 20:37:13 +00:00
/// <exception cref="ArgumentException"></exception>
2018-12-27 23:27:57 +00:00
void UninstallPlugin(IPlugin plugin);
2019-06-14 16:38:14 +00:00
/// <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);
2018-12-27 23:27:57 +00:00
}
}