jellyfin/MediaBrowser.Common/Updates/IInstallationManager.cs

98 lines
4.2 KiB
C#
Raw Normal View History

2020-12-06 16:48:54 -07:00
#nullable enable
using System;
2018-12-27 16:27:57 -07:00
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Common.Plugins;
using MediaBrowser.Model.Updates;
2018-12-27 16:27:57 -07:00
namespace MediaBrowser.Common.Updates
{
2020-12-06 16:48:54 -07:00
/// <summary>
/// Defines the <see cref="IInstallationManager" />.
/// </summary>
2018-12-27 16:27:57 -07:00
public interface IInstallationManager : IDisposable
{
/// <summary>
2019-11-09 12:23:09 -07:00
/// Gets the completed installations.
2018-12-27 16:27:57 -07:00
/// </summary>
2019-10-08 11:51:11 -07:00
IEnumerable<InstallationInfo> CompletedInstallations { get; }
2018-12-27 16:27:57 -07:00
/// <summary>
/// Parses a plugin manifest at the supplied URL.
/// </summary>
2020-11-19 06:34:09 -07:00
/// <param name="manifestName">Name of the repository.</param>
/// <param name="manifest">The URL to query.</param>
2020-12-06 16:48:54 -07:00
/// <param name="filterIncompatible">Filter out incompatible plugins.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{IReadOnlyList{PackageInfo}}.</returns>
2020-12-06 16:48:54 -07:00
Task<IList<PackageInfo>> GetPackages(string manifestName, string manifest, bool filterIncompatible, CancellationToken cancellationToken = default);
2018-12-27 16:27:57 -07:00
/// <summary>
2020-12-06 16:48:54 -07:00
/// Gets all available packages that are supported by this version.
2018-12-27 16:27:57 -07:00
/// </summary>
/// <param name="cancellationToken">The cancellation token.</param>
2019-10-08 11:51:11 -07:00
/// <returns>Task{IReadOnlyList{PackageInfo}}.</returns>
Task<IReadOnlyList<PackageInfo>> GetAvailablePackages(CancellationToken cancellationToken = default);
2018-12-27 16:27:57 -07:00
/// <summary>
2019-10-08 11:51:11 -07:00
/// Returns all plugins matching the requirements.
2018-12-27 16:27:57 -07:00
/// </summary>
2019-10-08 11:51:11 -07:00
/// <param name="availablePackages">The available packages.</param>
/// <param name="name">The name of the plugin.</param>
2020-12-18 14:11:29 -07:00
/// <param name="id">The id of the plugin.</param>
2020-11-19 06:34:09 -07:00
/// <param name="specificVersion">The version of the plugin.</param>
2019-10-08 11:51:11 -07:00
/// <returns>All plugins matching the requirements.</returns>
IEnumerable<PackageInfo> FilterPackages(
IEnumerable<PackageInfo> availablePackages,
2020-12-06 16:48:54 -07:00
string? name = null,
2020-12-18 14:11:29 -07:00
Guid? id = default,
2020-12-06 16:48:54 -07:00
Version? specificVersion = null);
2018-12-27 16:27:57 -07:00
/// <summary>
2019-10-08 11:51:11 -07:00
/// Returns all compatible versions ordered from newest to oldest.
2018-12-27 16:27:57 -07:00
/// </summary>
/// <param name="availablePackages">The available packages.</param>
/// <param name="name">The name.</param>
2020-12-18 14:11:29 -07:00
/// <param name="id">The id of the plugin.</param>
2019-10-08 11:51:11 -07:00
/// <param name="minVersion">The minimum required version of the plugin.</param>
/// <param name="specificVersion">The specific version of the plugin to install.</param>
2019-10-08 11:51:11 -07:00
/// <returns>All compatible versions ordered from newest to oldest.</returns>
IEnumerable<InstallationInfo> GetCompatibleVersions(
2019-10-08 11:51:11 -07:00
IEnumerable<PackageInfo> availablePackages,
2020-12-06 16:48:54 -07:00
string? name = null,
2020-12-18 14:11:29 -07:00
Guid? id = default,
2020-12-06 16:48:54 -07:00
Version? minVersion = null,
Version? specificVersion = null);
2018-12-27 16:27:57 -07:00
/// <summary>
2020-12-06 16:48:54 -07:00
/// Returns the available compatible plugin updates.
2018-12-27 16:27:57 -07:00
/// </summary>
/// <param name="cancellationToken">The cancellation token.</param>
2019-11-09 12:23:09 -07:00
/// <returns>The available plugin updates.</returns>
Task<IEnumerable<InstallationInfo>> GetAvailablePluginUpdates(CancellationToken cancellationToken = default);
2018-12-27 16:27:57 -07:00
/// <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);
2018-12-27 16:27:57 -07:00
/// <summary>
2019-12-10 16:13:57 -07:00
/// Uninstalls a plugin.
2018-12-27 16:27:57 -07:00
/// </summary>
/// <param name="plugin">The plugin.</param>
2020-12-06 16:48:54 -07:00
void UninstallPlugin(LocalPlugin plugin);
2019-06-14 09:38:14 -07:00
/// <summary>
2019-12-10 16:13:57 -07:00
/// Cancels the installation.
2019-06-14 09:38:14 -07:00
/// </summary>
2019-12-10 16:13:57 -07:00
/// <param name="id">The id of the package that is being installed.</param>
/// <returns>Returns true if the install was cancelled.</returns>
2019-06-14 09:38:14 -07:00
bool CancelInstallation(Guid id);
2018-12-27 16:27:57 -07:00
}
}