This commit is contained in:
Paul Schneider 2023-03-18 12:50:31 +00:00
commit 34d0c3c4fe
16 changed files with 241 additions and 37 deletions

View file

@ -1,35 +1,39 @@
using System.ComponentModel.DataAnnotations;
using System.IO;
using System.Linq;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using NuGet.Versioning;
using isnd.Data;
using isnd.Entities;
using Unleash;
using isnd.Services;
using isnd.ViewModels;
using System.Threading.Tasks;
using isnd.Interfaces;
using isn.Abstract;
using isn.abst;
using isnd.Interfaces;
using Unleash;
using System.Linq;
namespace isnd.Controllers
{
/// <summary>
/// Packages Controller
/// Api Controller
/// </summary>
public partial class PackagesController : Controller
public class ApiController : Controller
{
private readonly IPackageManager packageManager;
private readonly Resource[] resources;
/// <summary>
/// Api Controller Constructor
/// </summary>
/// <param name="pm"></param>
/// <param name="unleashĈlient"></param>
public ApiController(IPackageManager pm, IUnleash unleashĈlient)
{
packageManager = pm;
resources = packageManager.GetResources(unleashĈlient).ToArray();
}
/// <summary>
/// API index
/// </summary>
/// <returns></returns>
[HttpGet(_pkgRootPrefix + ApiConfig.IndexDotJson)]
[HttpGet(Constants.PackageRootServerPrefix + ApiConfig.IndexDotJson)]
public IActionResult ApiIndex()
{
return Ok(new ApiIndexViewModel(packageManager.CatalogBaseUrl + ApiConfig.IndexDotJson){ Version = PackageManager.BASE_API_LEVEL, Resources = resources });