public async Task <IReadOnlyList <NuGetVersion> > ListPackageVersionsAsync( string id, CancellationToken cancellationToken) { try { return(await _client.ListPackageVersionsAsync(id, includeUnlisted : true, cancellationToken)); } catch (Exception e) { _logger.LogError(e, "Failed to mirror {PackageId}'s upstream versions", id); return(new List <NuGetVersion>()); } }
public async Task <IReadOnlyList <NuGetVersion> > FindPackageVersionsOrNullAsync( string id, CancellationToken cancellationToken) { var upstreamVersions = await _upstreamClient.ListPackageVersionsAsync(id, includeUnlisted : true, cancellationToken); if (!upstreamVersions.Any()) { return(null); } // Merge the local package versions into the upstream package versions. var localPackages = await _localPackages.FindAsync(id, includeUnlisted : true, cancellationToken); var localVersions = localPackages.Select(p => p.Version); return(upstreamVersions.Concat(localVersions).Distinct().ToList()); }
public async Task <IReadOnlyList <NuGetVersion> > ListPackageVersionsAsync(string id, bool includeUnlisted, CancellationToken cancellationToken) { return(await _client.ListPackageVersionsAsync(id, includeUnlisted, cancellationToken)); }