Compilation warns
This commit is contained in:
parent
217cc49019
commit
4191513eef
22 changed files with 72 additions and 57 deletions
38
src/isnd/Controllers/Packages/AutoComplete.cs
Normal file
38
src/isnd/Controllers/Packages/AutoComplete.cs
Normal 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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue