v3 API prefix

This commit is contained in:
Paul Schneider 2026-07-05 20:17:12 +01:00
commit cd72b7b9aa
16 changed files with 24 additions and 32 deletions

View file

@ -5,6 +5,10 @@ namespace Isn.Abstract
public const string PaquetFileEstension = "nupkg";
public const string SpecFileEstension = "nuspec";
public const string JsonFileEstension = "json";
public const string PackageRootServerPrefix = "~/pkgs/";
/**
* The prefix for API routes.
*/
public const string APIPrefix = "api/v3/";
}
}

View file

@ -29,7 +29,7 @@ namespace isnd.Controllers
/// API index
/// </summary>
/// <returns></returns>
[HttpGet(Constants.PackageRootServerPrefix + ApiConfig.IndexDotJson)]
[HttpGet("~/" + Constants.APIPrefix + ApiConfig.IndexDotJson)]
public IActionResult ApiIndex()
{
return Ok(new ApiIndexViewModel(packageManager.CatalogBaseUrl + ApiConfig.IndexDotJson){ Version = PackageManager.BASE_API_LEVEL, Resources = resources });

View file

@ -9,7 +9,7 @@ namespace isnd.Controllers
{
// GET /autocomplete?id=isn.protocol&prerelease=true
[HttpGet(Constants.PackageRootServerPrefix + ApiConfig.AutoComplete)]
[HttpGet("~/" + Constants.APIPrefix + ApiConfig.AutoComplete)]
public IActionResult AutoComplete(
string id,
string semVerLevel,

View file

@ -16,14 +16,14 @@ namespace isnd.Controllers
{
// https://docs.microsoft.com/en-us/nuget/api/catalog-resource#versioning
[HttpGet(Constants.PackageRootServerPrefix + ApiConfig.Catalog)]
[HttpGet("~/" + Constants.APIPrefix + ApiConfig.Catalog)]
public async Task<IActionResult> CatalogIndex()
{
return Ok(await packageManager.GetCatalogIndexAsync());
}
[HttpGet(Constants.PackageRootServerPrefix + "{apiVersion}/" + ApiConfig.Registration + "/{id}/{lower}.json")]
[HttpGet("~/" + Constants.APIPrefix + "{apiVersion}/" + ApiConfig.Registration + "/{id}/{lower}.json")]
public async Task<IActionResult> CatalogRegistration(string apiVersion, string id, string lower)
{
if (lower.Equals("index", System.StringComparison.InvariantCultureIgnoreCase))

View file

@ -11,7 +11,7 @@ namespace isnd.Controllers
{
public partial class PackagesController
{
[HttpDelete(Constants.PackageRootServerPrefix + ApiConfig.Delete + "/{id}/{lower?}/{type?}")]
[HttpDelete("~/" + Constants.APIPrefix + ApiConfig.Delete + "/{id}/{lower?}/{type?}")]
public async Task<IActionResult> ApiDelete(
[FromRoute][SafeName][Required] string id,
[FromRoute][SafeName][Required] string lower,

View file

@ -11,7 +11,7 @@ namespace isnd.Controllers
public partial class PackagesController
{
// Web get the paquet
[HttpGet(Constants.PackageRootServerPrefix + ApiConfig.GetPackage + "/{id}/{lower}/{idf}-{lowerf}."
[HttpGet("~/" + Constants.APIPrefix + ApiConfig.GetPackage + "/{id}/{lower}/{idf}-{lowerf}."
+ Constants.PaquetFileEstension)]
public IActionResult GetPackage(
[FromRoute][SafeName][Required] string id,
@ -32,7 +32,7 @@ namespace isnd.Controllers
}
// Web get spec
[HttpGet(Constants.PackageRootServerPrefix + Constants.SpecFileEstension + "/{id}/{lower}/{idf}-{lowerf}."
[HttpGet("~/" + Constants.APIPrefix + Constants.SpecFileEstension + "/{id}/{lower}/{idf}-{lowerf}."
+ Constants.SpecFileEstension)]
public IActionResult GetNuspec(
[FromRoute][SafeName][Required] string id,

View file

@ -7,7 +7,7 @@ namespace isnd.Controllers
{
public partial class PackagesController
{
[HttpGet(Constants.PackageRootServerPrefix + ApiConfig.GetVersion + "/{id}/{lower}/" + ApiConfig.IndexDotJson)]
[HttpGet("~/" + Constants.APIPrefix + ApiConfig.GetVersion + "/{id}/{lower}/" + ApiConfig.IndexDotJson)]
public IActionResult GetVersions(
string id,
string lower,

View file

@ -25,7 +25,7 @@ namespace isnd.Controllers
public partial class PackagesController
{
// TODO [Authorize(Policy = IsndConstants.RequireValidApiKey)]
[HttpPut(Constants.PackageRootServerPrefix + ApiConfig.Publish)]
[HttpPut("~/" + Constants.APIPrefix + ApiConfig.Publish)]
public async Task<IActionResult> Put()
{
try

View file

@ -11,7 +11,7 @@ namespace isnd.Controllers
public partial class PackagesController
{
// GET {@id}?q={QUERY}&skip={SKIP}&take={TAKE}&prerelease={PRERELEASE}&semVerLevel={SEMVERLEVEL}&packageType={PACKAGETYPE}
[HttpGet(Constants.PackageRootServerPrefix + ApiConfig.Search)]
[HttpGet("~/" + Constants.APIPrefix + ApiConfig.Search)]
public IActionResult Search(
string q,
int skip = 0,

View file

@ -31,7 +31,7 @@ namespace isnd.Services
{
this.dbContext = dbContext;
isndSettings = siteConfigOptionsOptions.Value;
extUrl = isndSettings.ExternalUrl + "/";
extUrl = isndSettings.ExternalUrl + "/" +Constants.APIPrefix;
}
/**