2
0

IInstallationManager.cs 4.1 KB

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