// Copyright Epic Games, Inc. All Rights Reserved.
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Horde.Server.Acls;
using Horde.Server.Configuration;
using Horde.Server.Server;
using Horde.Server.Streams;
using Horde.Server.Utilities;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.StaticFiles;
using Microsoft.Extensions.Options;
namespace Horde.Server.Projects
{
///
/// Controller for the /api/v1/projects endpoint
///
[ApiController]
[Authorize]
[Route("[controller]")]
public class ProjectsController : HordeControllerBase
{
private readonly IOptionsSnapshot _globalConfig;
private static readonly FileExtensionContentTypeProvider s_contentTypeProvider = new FileExtensionContentTypeProvider();
///
/// Constructor
///
public ProjectsController(IOptionsSnapshot globalConfig)
{
_globalConfig = globalConfig;
}
///
/// Query all the projects
///
/// Whether to include streams in the response
/// Whether to include categories in the response
/// Filter for the properties to return
/// Information about all the projects
[HttpGet]
[Route("/api/v1/projects")]
[ProducesResponseType(typeof(List), 200)]
public ActionResult> GetProjects([FromQuery(Name = "Streams")] bool includeStreams = false, [FromQuery(Name = "Categories")] bool includeCategories = false, [FromQuery] PropertyFilter? filter = null)
{
GlobalConfig globalConfig = _globalConfig.Value;
List