A valid package index page
This commit is contained in:
parent
88c8480911
commit
58f77a06ea
15 changed files with 210 additions and 153 deletions
|
|
@ -24,28 +24,32 @@ namespace isnd.Controllers
|
|||
return Ok(PackageManager.CurrentCatalogPages[int.Parse(id)]);
|
||||
}
|
||||
|
||||
[HttpGet(_pkgRootPrefix + "{apiVersion}/" + ApiConfig.Registration + "/{id}/index.json")]
|
||||
public async Task<IActionResult> CatalogRegistrationAsync(string apiVersion, string id)
|
||||
[HttpGet(_pkgRootPrefix + "{apiVersion}/" + ApiConfig.Registration + "/{id}/{lower}.json")]
|
||||
public IActionResult CatalogRegistration(string apiVersion, string id, string lower)
|
||||
{
|
||||
var pkgs = packageManager.SearchById(id, null, null);
|
||||
if (pkgs == null) return NotFound();
|
||||
return Ok(pkgs);
|
||||
if (lower.Equals("index", System.StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var query = new Data.Catalog.RegistrationPageIndexQuery
|
||||
{
|
||||
Query = id,
|
||||
Prerelease = true
|
||||
};
|
||||
var index = packageManager.GetPackageRegistrationIndex(query);
|
||||
if (index == null) return NotFound();
|
||||
// query.TotalHits = result.Items.Select(i=>i.Items.Length).Aggregate((a,b)=>a+b);
|
||||
return Ok(index);
|
||||
}
|
||||
var leaf = packageManager.SearchById(id,lower,null);
|
||||
if (leaf.Count()==0) return NotFound(new { id, lower });
|
||||
return Ok(leaf.First());
|
||||
}
|
||||
|
||||
|
||||
[HttpGet(_pkgRootPrefix + ApiConfig.CatalogLeaf + "/{id}/{version}/{lower}/index.json")]
|
||||
public async Task<IActionResult> CatalogLeafAsync(string id, string pversion, string lower)
|
||||
public IActionResult CatalogLeaf(string id, string pversion, string lower)
|
||||
{
|
||||
|
||||
bool askForindex = lower == null;
|
||||
if (false)
|
||||
{
|
||||
if (!NuGetVersion.TryParse(lower, out NuGetVersion version))
|
||||
return BadRequest(lower);
|
||||
|
||||
var pkgFromname = packageManager.GetVersions(id, version, true);
|
||||
if (pkgFromname == null) return NotFound();
|
||||
return Ok(pkgFromname);
|
||||
}
|
||||
var pkgvs = this.packageManager.GetCatalogLeaf(id, pversion, lower).ToArray();
|
||||
if (pkgvs.Count() == 0) return NotFound();
|
||||
List<string> types = pkgvs.Select(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue