IInstallationManager.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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="manifestName">Name of the repository.</param>
  20. /// <param name="manifest">The URL to query.</param>
  21. /// <param name="cancellationToken">The cancellation token.</param>
  22. /// <returns>Task{IReadOnlyList{PackageInfo}}.</returns>
  23. Task<IList<PackageInfo>> GetPackages(string manifestName, string manifest, CancellationToken cancellationToken = default);
  24. /// <summary>
  25. /// Gets all available packages.
  26. /// </summary>
  27. /// <param name="cancellationToken">The cancellation token.</param>
  28. /// <returns>Task{IReadOnlyList{PackageInfo}}.</returns>
  29. Task<IReadOnlyList<PackageInfo>> GetAvailablePackages(CancellationToken cancellationToken = default);
  30. /// <summary>
  31. /// Returns all plugins matching the requirements.
  32. /// </summary>
  33. /// <param name="availablePackages">The available packages.</param>
  34. /// <param name="name">The name of the plugin.</param>
  35. /// <param name="guid">The id of the plugin.</param>
  36. /// <param name="specificVersion">The version of the plugin.</param>
  37. /// <returns>All plugins matching the requirements.</returns>
  38. IEnumerable<PackageInfo> FilterPackages(
  39. IEnumerable<PackageInfo> availablePackages,
  40. string name = null,
  41. Guid guid = default,
  42. Version specificVersion = null);
  43. /// <summary>
  44. /// Returns all compatible versions ordered from newest to oldest.
  45. /// </summary>
  46. /// <param name="availablePackages">The available packages.</param>
  47. /// <param name="name">The name.</param>
  48. /// <param name="guid">The guid of the plugin.</param>
  49. /// <param name="minVersion">The minimum required version of the plugin.</param>
  50. /// <param name="specificVersion">The specific version of the plugin to install.</param>
  51. /// <returns>All compatible versions ordered from newest to oldest.</returns>
  52. IEnumerable<InstallationInfo> GetCompatibleVersions(
  53. IEnumerable<PackageInfo> availablePackages,
  54. string name = null,
  55. Guid guid = default,
  56. Version minVersion = null,
  57. Version specificVersion = null);
  58. /// <summary>
  59. /// Returns the available plugin updates.
  60. /// </summary>
  61. /// <param name="cancellationToken">The cancellation token.</param>
  62. /// <returns>The available plugin updates.</returns>
  63. Task<IEnumerable<InstallationInfo>> GetAvailablePluginUpdates(CancellationToken cancellationToken = default);
  64. /// <summary>
  65. /// Installs the package.
  66. /// </summary>
  67. /// <param name="package">The package.</param>
  68. /// <param name="cancellationToken">The cancellation token.</param>
  69. /// <returns><see cref="Task" />.</returns>
  70. Task InstallPackage(InstallationInfo package, CancellationToken cancellationToken = default);
  71. /// <summary>
  72. /// Uninstalls a plugin.
  73. /// </summary>
  74. /// <param name="plugin">The plugin.</param>
  75. void UninstallPlugin(IPlugin plugin);
  76. /// <summary>
  77. /// Cancels the installation.
  78. /// </summary>
  79. /// <param name="id">The id of the package that is being installed.</param>
  80. /// <returns>Returns true if the install was cancelled.</returns>
  81. bool CancelInstallation(Guid id);
  82. }
  83. }