This commit is contained in:
Paul Schneider 2021-09-02 23:37:28 +01:00
commit a92bee32e1
5 changed files with 81 additions and 67 deletions

View file

@ -22,7 +22,7 @@ namespace isnd.Controllers
public partial class PackagesController
{
[HttpPut(_pkgRootPrefix)]
[HttpPut(_pkgRootPrefix + ApiConfig.Publish)]
public async Task<IActionResult> Put()
{
try

View file

@ -24,7 +24,6 @@ namespace isnd.Controllers
{
const int maxTake = 100;
const string _pkgRootPrefix = "~/package";
const string defaultSemVer = "2.0.0";
private readonly Resource[] _ressources;
private readonly ILogger<PackagesController> _logger;
@ -94,22 +93,24 @@ namespace isnd.Controllers
}
const string _pkgRootPrefix = "~" + ApiConfig.BaseApiPath;
[HttpGet("~/index.json")]
[HttpGet(_pkgRootPrefix + ApiConfig.Base)]
public IActionResult ApiIndex()
{
return Ok(_ressources);
}
//
[HttpGet(_pkgRootPrefix)]
public IActionResult Index()
[HttpGet(_pkgRootPrefix + ApiConfig.Catalog)]
public IActionResult CatalogIndex()
{
// https://docs.microsoft.com/en-us/nuget/api/catalog-resource#versioning
return Ok(PackageManager.CurrentCatalogIndex);
}
[HttpGet(_pkgRootPrefix + "/index-{id}")]
[HttpGet(_pkgRootPrefix + ApiConfig.Catalog + "-{id}")]
public IActionResult Index(string id)
{
// https://docs.microsoft.com/en-us/nuget/api/catalog-resource#versioning
@ -117,7 +118,7 @@ namespace isnd.Controllers
}
// GET /autocomplete?id=isn.protocol&prerelease=true
[HttpGet(_pkgRootPrefix + "/autocomplete")]
[HttpGet(_pkgRootPrefix + ApiConfig.AutoComplete)]
public IActionResult AutoComplete(
string id,
string semVerLevel,
@ -141,7 +142,7 @@ namespace isnd.Controllers
// TODO GET {@id}/{LOWER_ID}/index.json
// LOWER_ID URL string yes The package ID, lowercased
// response : versions array of strings yes The versions available
[HttpGet(_pkgRootPrefix + "/{id}/{lower}/index.json")]
[HttpGet(_pkgRootPrefix + ApiConfig.Get + "/{id}/{lower}/index.json")]
public IActionResult GetVersions(
string id,
string lower,
@ -174,7 +175,7 @@ namespace isnd.Controllers
// LOWER_ID URL string yes The package ID, lowercase
// LOWER_VERSION URL string yes The package version, normalized and lowercased
// response 200 : the package
[HttpGet(_pkgRootPrefix + "/{id}/{lower}/{idf}-{lowerf}.nupkg")]
[HttpGet(_pkgRootPrefix + ApiConfig.Get + "/{id}/{lower}/{idf}-{lowerf}.nupkg")]
public IActionResult GetPackage(
[FromRoute] string id, [FromRoute] string lower,
[FromRoute] string idf, [FromRoute] string lowerf)
@ -194,7 +195,7 @@ namespace isnd.Controllers
// TODO GET {@id}/{LOWER_ID}/{LOWER_VERSION}/{LOWER_ID}.nuspec
// response 200 : the nuspec
[HttpGet(_pkgRootPrefix + "/{id}/{lower}/{idf}-{lowerf}.nuspec")]
[HttpGet(_pkgRootPrefix + ApiConfig.Get + "/{id}/{lower}/{idf}-{lowerf}.nuspec")]
public IActionResult GetNuspec(
[FromRoute][SafeName][Required] string id,
[FromRoute][SafeName][Required] string lower,