using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using JetBrains.Annotations; using NugetForUnity.Models; namespace NugetForUnity.PackageSource { /// /// Represents a NuGet package source that can be use to fetch NuGet packages. /// public interface INugetPackageSource : IDisposable { /// /// Gets or sets the name of the package source. /// [NotNull] string Name { get; set; } /// /// Gets or sets a value indicating whether this source is enabled or not. /// bool IsEnabled { get; set; } /// /// Gets or sets the password used to access the feed. Null indicates that no password is used. /// [CanBeNull] string SavedPassword { get; set; } /// /// Gets or sets a value indicating whether is encrypted. /// bool SavedPasswordIsEncrypted { get; set; } /// /// Gets or sets the path of the package source. /// [NotNull] string SavedPath { get; set; } /// /// Gets or sets the explicitly defined protocol version stored inside the 'NuGet.config'. /// /// Changing this value will only take effect after reloading as it potentially need to change the type of the class. [CanBeNull] string SavedProtocolVersion { get; set; } /// /// Gets or sets the user-name used to access the feed. Null indicates that no authentication is used. /// [CanBeNull] string UserName { get; set; } /// /// Gets or sets a value indicating whether this source uses a password for authentication. /// bool HasPassword { get; set; } /// /// Download the .nupkg file and store it inside a file at . /// /// The package to download its .nupkg from. /// Path where the downloaded file is placed. /// Hint for the url used to download the .nupkg file from. void DownloadNupkgToFile([NotNull] INugetPackageIdentifier package, [NotNull] string outputFilePath, [CanBeNull] string downloadUrlHint); /// /// Gets a NugetPackage from the NuGet source that matches (or is in range of) the given . /// /// The containing the ID and Version of the package to get. /// The retrieved package, if there is one. Null if no matching package was found. [NotNull] [ItemNotNull] List FindPackagesById([NotNull] INugetPackageIdentifier package); /// /// Gets a NugetPackage from the NuGet source that matches (or is in range of) the given . /// /// The containing the ID and Version of the package to get. /// The retrieved package, if there is one. Null if no matching package was found. [CanBeNull] INugetPackage GetSpecificPackage([NotNull] INugetPackageIdentifier package); /// /// Queries the source with the given list of installed packages to get any updates that are available. /// /// The list of packages to use to find updates. /// True to include prerelease packages (alpha, beta, etc). /// The specific frameworks to target?. /// The version constraints?. /// A list of all updates available. [NotNull] [ItemNotNull] List GetUpdates( [NotNull] [ItemNotNull] IEnumerable packages, bool includePrerelease = false, string targetFrameworks = "", string versionConstraints = ""); /// /// Gets a list of NugetPackages from this package source. /// This allows searching for partial IDs or even the empty string (the default) to list ALL packages. /// /// The search term to use to filter packages. Defaults to the empty string. /// True to include prerelease packages (alpha, beta, etc). /// The number of packages to fetch. /// The number of packages to skip before fetching. /// Token that can be used to cancel the asynchronous task. /// The list of available packages. [NotNull] [ItemNotNull] Task> SearchAsync( string searchTerm = "", bool includePrerelease = false, int numberToGet = 15, int numberToSkip = 0, CancellationToken cancellationToken = default); } }