IInstallationManager.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #pragma warning disable CS1591
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Threading;
  5. using System.Threading.Tasks;
  6. using MediaBrowser.Common.Plugins;
  7. using MediaBrowser.Model.Updates;
  8. namespace MediaBrowser.Common.Updates
  9. {
  10. public interface IInstallationManager : IDisposable
  11. {
  12. /// <summary>
  13. /// Gets the completed installations.
  14. /// </summary>
  15. IEnumerable<InstallationInfo> CompletedInstallations { get; }
  16. /// <summary>
  17. /// Parses a plugin manifest at the supplied URL.
  18. /// </summary>
  19. /// <param name="manifest">The URL to query.</param>
  20. /// <param name="cancellationToken">The cancellation token.</param>
  21. /// <returns>Task{IReadOnlyList{PackageInfo}}.</returns>
  22. Task<IReadOnlyList<PackageInfo>> GetPackages(string manifest, CancellationToken cancellationToken = default);
  23. /// <summary>
  24. /// Gets all available packages.
  25. /// </summary>
  26. /// <param name="cancellationToken">The cancellation token.</param>
  27. /// <returns>Task{IReadOnlyList{PackageInfo}}.</returns>
  28. Task<IReadOnlyList<PackageInfo>> GetAvailablePackages(CancellationToken cancellationToken = default);
  29. /// <summary>
  30. /// Returns all plugins matching the requirements.
  31. /// </summary>
  32. /// <param name="availablePackages">The available packages.</param>
  33. /// <param name="name">The name of the plugin.</param>
  34. /// <param name="guid">The id of the plugin.</param>
  35. /// <returns>All plugins matching the requirements.</returns>
  36. IEnumerable<PackageInfo> FilterPackages(
  37. IEnumerable<PackageInfo> availablePackages,
  38. string name = null,
  39. Guid guid = default);
  40. /// <summary>
  41. /// Returns all compatible versions ordered from newest to oldest.
  42. /// </summary>
  43. /// <param name="availablePackages">The available packages.</param>
  44. /// <param name="name">The name.</param>
  45. /// <param name="guid">The guid of the plugin.</param>
  46. /// <param name="minVersion">The minimum required version of the plugin.</param>
  47. /// <param name="specificVersion">The specific version of the plugin to install.</param>
  48. /// <returns>All compatible versions ordered from newest to oldest.</returns>
  49. IEnumerable<InstallationInfo> GetCompatibleVersions(
  50. IEnumerable<PackageInfo> availablePackages,
  51. string name = null,
  52. Guid guid = default,
  53. Version minVersion = null,
  54. Version specificVersion = null);
  55. /// <summary>
  56. /// Returns the available plugin updates.
  57. /// </summary>
  58. /// <param name="cancellationToken">The cancellation token.</param>
  59. /// <returns>The available plugin updates.</returns>
  60. Task<IEnumerable<InstallationInfo>> GetAvailablePluginUpdates(CancellationToken cancellationToken = default);
  61. /// <summary>
  62. /// Installs the package.
  63. /// </summary>
  64. /// <param name="package">The package.</param>
  65. /// <param name="cancellationToken">The cancellation token.</param>
  66. /// <returns><see cref="Task" />.</returns>
  67. Task InstallPackage(InstallationInfo package, CancellationToken cancellationToken = default);
  68. /// <summary>
  69. /// Uninstalls a plugin.
  70. /// </summary>
  71. /// <param name="plugin">The plugin.</param>
  72. void UninstallPlugin(IPlugin plugin);
  73. /// <summary>
  74. /// Cancels the installation.
  75. /// </summary>
  76. /// <param name="id">The id of the package that is being installed.</param>
  77. /// <returns>Returns true if the install was cancelled.</returns>
  78. bool CancelInstallation(Guid id);
  79. }
  80. }