You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jellyfin/MediaBrowser.Common/Updates/IInstallationManager.cs

120 lines
4.9 KiB

#pragma warning disable CS1591
#pragma warning disable SA1600
using System;
6 years ago
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Common.Plugins;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Updates;
6 years ago
namespace MediaBrowser.Common.Updates
{
public interface IInstallationManager : IDisposable
{
event EventHandler<InstallationEventArgs> PackageInstalling;
5 years ago
6 years ago
event EventHandler<InstallationEventArgs> PackageInstallationCompleted;
5 years ago
6 years ago
event EventHandler<InstallationFailedEventArgs> PackageInstallationFailed;
5 years ago
6 years ago
event EventHandler<InstallationEventArgs> PackageInstallationCancelled;
/// <summary>
5 years ago
/// Occurs when a plugin is uninstalled.
6 years ago
/// </summary>
event EventHandler<GenericEventArgs<IPlugin>> PluginUninstalled;
/// <summary>
5 years ago
/// Occurs when a plugin is updated.
6 years ago
/// </summary>
event EventHandler<GenericEventArgs<(IPlugin, PackageVersionInfo)>> PluginUpdated;
6 years ago
/// <summary>
5 years ago
/// Occurs when a plugin is installed.
6 years ago
/// </summary>
event EventHandler<GenericEventArgs<PackageVersionInfo>> PluginInstalled;
/// <summary>
/// Gets the completed installations.
6 years ago
/// </summary>
IEnumerable<InstallationInfo> CompletedInstallations { get; }
6 years ago
/// <summary>
/// Gets all available packages.
6 years ago
/// </summary>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{IReadOnlyList{PackageInfo}}.</returns>
Task<IReadOnlyList<PackageInfo>> GetAvailablePackages(CancellationToken cancellationToken = default);
6 years ago
/// <summary>
/// Returns all plugins matching the requirements.
6 years ago
/// </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>
/// <returns>All plugins matching the requirements.</returns>
IEnumerable<PackageInfo> FilterPackages(
IEnumerable<PackageInfo> availablePackages,
string name = null,
Guid guid = default);
6 years ago
/// <summary>
/// Returns all compatible versions ordered from newest to oldest.
6 years ago
/// </summary>
/// <param name="availableVersions">The available version of the plugin.</param>
/// <param name="minVersion">The minimum required version of the plugin.</param>
/// <param name="classification">The classification of updates.</param>
/// <returns>All compatible versions ordered from newest to oldest.</returns>
IEnumerable<PackageVersionInfo> GetCompatibleVersions(
IEnumerable<PackageVersionInfo> availableVersions,
Version minVersion = null,
PackageVersionClass classification = PackageVersionClass.Release);
6 years ago
/// <summary>
/// Returns all compatible versions ordered from newest to oldest.
6 years ago
/// </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>
6 years ago
/// <param name="classification">The classification.</param>
/// <returns>All compatible versions ordered from newest to oldest.</returns>
IEnumerable<PackageVersionInfo> GetCompatibleVersions(
IEnumerable<PackageInfo> availablePackages,
string name = null,
Guid guid = default,
Version minVersion = null,
PackageVersionClass classification = PackageVersionClass.Release);
6 years ago
/// <summary>
/// Returns the available plugin updates.
6 years ago
/// </summary>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The available plugin updates.</returns>
IAsyncEnumerable<PackageVersionInfo> GetAvailablePluginUpdates(CancellationToken cancellationToken = default);
6 years ago
/// <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(PackageVersionInfo package, CancellationToken cancellationToken = default);
6 years ago
/// <summary>
/// Uninstalls a plugin.
6 years ago
/// </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);
6 years ago
}
}