Compilation warns

This commit is contained in:
Paul Schneider 2022-04-17 16:22:40 +01:00
commit 4191513eef
22 changed files with 72 additions and 57 deletions

View file

@ -0,0 +1,38 @@
using isnd.Services;
using isnd.Entities;
using Microsoft.AspNetCore.Mvc;
namespace isnd.Controllers
{
public partial class PackagesController
{
// GET /autocomplete?id=isn.protocol&prerelease=true
[HttpGet(_pkgRootPrefix + ApiConfig.AutoComplete)]
public IActionResult AutoComplete(
string id,
string semVerLevel,
bool prerelease = false,
string packageType = null,
int skip = 0,
int take = 25)
{
CheckParams(take, semVerLevel);
if (ModelState.ErrorCount > 0) return BadRequest(ModelState);
return Ok(_packageManager.AutoComplete(id,skip,take,prerelease,packageType));
}
protected void CheckParams(int take,string semVerLevel)
{
if (take > maxTake)
{
ModelState.AddModelError("take", "Maximum exceeded");
}
if (semVerLevel != PackageManager.BASE_API_LEVEL)
{
ModelState.AddModelError("semVerLevel", PackageManager.BASE_API_LEVEL + " expected");
}
}
}
}