private static async Task <IEnumerable <IServerPackage> > GetUpdateCandidatesAsync( IServerPackageRepository repository, IEnumerable <IPackageName> packages, bool includePrerelease, ClientCompatibility compatibility, CancellationToken token) { var query = await repository.GetPackagesAsync(compatibility, token); var ids = new HashSet <string>( packages.Select(p => p.Id), StringComparer.OrdinalIgnoreCase); query = query.Where(p => ids.Contains(p.Id)); if (!includePrerelease) { query = query.Where(p => p.IsReleaseVersion()); } // for updates, we never consider unlisted packages query = query.Where(p => p.Listed); return(query); }
public static async Task <IEnumerable <IServerPackage> > FindPackagesByIdAsync( this IServerPackageRepository repository, string id, ClientCompatibility compatibility, CancellationToken token) { var packages = await repository.GetPackagesAsync(compatibility, token); return(packages.Where(p => StringComparer.OrdinalIgnoreCase.Equals(p.Id, id))); }
public virtual async Task <IHttpActionResult> Get( ODataQueryOptions <ODataPackage> options, [FromUri] string semVerLevel = "", CancellationToken token = default(CancellationToken)) { var clientCompatibility = ClientCompatibilityFactory.FromProperties(semVerLevel); var sourceQuery = await _serverRepository.GetPackagesAsync(clientCompatibility, token); return(TransformToQueryResult(options, sourceQuery, clientCompatibility)); }