public PackageSearchSourceProxy(IPackageSearchMetadata data, NuGetServer server) { _data = data; _server = server; }
/// <summary> /// The search term used to search the server synchronously /// </summary> /// <param name="server">The Extend Server</param> /// <param name="includePrerelease">Optional prerelease flag</param> /// <param name="cancelToken">Optional cancellation token</param> /// <param name="skip">Optional amount of results to skip</param> /// <param name="take">Optional amount of results to take</param> /// <returns>The results of search</returns> public static IEnumerable <IPackageSourceMetadata> GetAllPackages(this NuGetServer server, bool includePrerelease = false, CancellationToken cancelToken = default(CancellationToken), int skip = 0, int take = 100) { return(Extensions.RunSync(() => server.GetAllPackagesAsync(includePrerelease, cancelToken, skip, take))); }
/// <summary> /// Search the server for all Tags. Only OR Search is possible NuGet Api /// </summary> /// <param name="server">The server being extended</param> /// <param name="TagNames">The tags to search on</param> /// <returns>Search Results</returns> public static async Task <IEnumerable <IPackageSourceMetadata> > SearchContainsAllTagsAsync(this NuGetServer server, params string[] TagNames) { var tagQuery = NuGetSearcherUtility.GetTagQuery(TagNames); return(await server.SearchAsync(tagQuery).ConfigureAwait(false)); }
/// <summary> /// Search by the id /// </summary> /// <param name="server">Server to search</param> /// <param name="id">The id to search</param> /// <returns>Task of the results</returns> public static async Task <IEnumerable <IPackageSourceMetadata> > SearchByIdAsync(this NuGetServer server, string id) { return(await server.SearchAsync($"id:{id}").ConfigureAwait(false)); }
/// <summary> /// Convert to Internal Proxy /// </summary> /// <param name="data">The package</param> /// <param name="server">The NuGet Server</param> /// <returns>The package as a proxy containing server</returns> public static IPackageSourceMetadata ConvertToProxy(this IPackageSearchMetadata data, NuGetServer server) { return(new PackageSearchSourceProxy(data, server)); }