Permalink
Browse files

added flags to version for latest stable and prerelease so the NuGet …

…client can filter as needed for tab completion
  • Loading branch information...
half-ogre committed Jun 1, 2012
1 parent a75a8ee commit c4017313b8c405aca0a47067ba87e512112d16d3
Showing with 21 additions and 8 deletions.
  1. +21 −8 Website/Controllers/ApiController.cs
@@ -194,28 +194,41 @@ protected internal virtual IPackage ReadPackageFromRequest()
public virtual ActionResult GetPackagesTabCompletionInfo()
{
var cache = GetService<ICache>();
- var packageRegistrations = cache.Get(Constants.PackagesTabCompletionInfoCacheKey) as PackageRegistrationWithVersionsApiModel[];
+ var packageRegistrations = cache.Get(Constants.PackagesTabCompletionInfoCacheKey) as PackageTabCompletionInfo[];
if (packageRegistrations == null)
{
packageRegistrations = GetService<IAllPackageRegistrationsQuery>()
.Execute()
.ToArray()
- .Select(pr => new PackageRegistrationWithVersionsApiModel
- {
- Id = pr.Id,
- Versions = pr.Packages.Select(p => p.Version).ToArray()
- })
+ .Select(pr => new PackageTabCompletionInfo
+ {
+ Id = pr.Id,
+ Versions = pr.Packages.Select(p => new VersionTabCompletionInfo
+ {
+ IsLatestStable = p.IsLatestStable,
+ IsPrerelease = p.IsPrerelease,
+ Version = p.Version
+ }).ToArray()
+ })
.ToArray();
cache.Add(Constants.PackagesTabCompletionInfoCacheKey, packageRegistrations);
}
return new JsonNetResult(packageRegistrations);
}
[Serializable]
- class PackageRegistrationWithVersionsApiModel
+ class PackageTabCompletionInfo
{
public string Id { get; set; }
- public string[] Versions { get; set; }
+ public VersionTabCompletionInfo[] Versions { get; set; }
+ }
+
+ [Serializable]
+ class VersionTabCompletionInfo
+ {
+ public bool IsLatestStable { get; set; }
+ public bool IsPrerelease { get; set; }
+ public string Version { get; set; }
}
}
}

0 comments on commit c401731

Please sign in to comment.