Update XML-Documentation with Mediatype

This commit is contained in:
Glax 2025-03-07 14:46:15 +01:00
parent 6c5bc3685e
commit 3a8b400851
7 changed files with 55 additions and 62 deletions

View File

@ -8,7 +8,6 @@ namespace API.Controllers;
[ApiVersion(2)] [ApiVersion(2)]
[ApiController] [ApiController]
[Produces("application/json")]
[Route("v{version:apiVersion}/[controller]")] [Route("v{version:apiVersion}/[controller]")]
public class JobController(PgsqlContext context) : Controller public class JobController(PgsqlContext context) : Controller
{ {
@ -17,7 +16,7 @@ public class JobController(PgsqlContext context) : Controller
/// </summary> /// </summary>
/// <response code="200"></response> /// <response code="200"></response>
[HttpGet] [HttpGet]
[ProducesResponseType<Job[]>(Status200OK)] [ProducesResponseType<Job[]>(Status200OK, "application/json")]
public IActionResult GetAllJobs() public IActionResult GetAllJobs()
{ {
Job[] ret = context.Jobs.ToArray(); Job[] ret = context.Jobs.ToArray();
@ -30,7 +29,7 @@ public class JobController(PgsqlContext context) : Controller
/// <param name="ids">Array of Job-IDs</param> /// <param name="ids">Array of Job-IDs</param>
/// <response code="200"></response> /// <response code="200"></response>
[HttpPost("WithIDs")] [HttpPost("WithIDs")]
[ProducesResponseType<Job[]>(Status200OK)] [ProducesResponseType<Job[]>(Status200OK, "application/json")]
public IActionResult GetJobs([FromBody]string[] ids) public IActionResult GetJobs([FromBody]string[] ids)
{ {
Job[] ret = context.Jobs.Where(job => ids.Contains(job.JobId)).ToArray(); Job[] ret = context.Jobs.Where(job => ids.Contains(job.JobId)).ToArray();
@ -43,7 +42,7 @@ public class JobController(PgsqlContext context) : Controller
/// <param name="state">Requested Job-State</param> /// <param name="state">Requested Job-State</param>
/// <response code="200"></response> /// <response code="200"></response>
[HttpGet("State/{state}")] [HttpGet("State/{state}")]
[ProducesResponseType<Job[]>(Status200OK)] [ProducesResponseType<Job[]>(Status200OK, "application/json")]
public IActionResult GetJobsInState(JobState state) public IActionResult GetJobsInState(JobState state)
{ {
Job[] jobsInState = context.Jobs.Where(job => job.state == state).ToArray(); Job[] jobsInState = context.Jobs.Where(job => job.state == state).ToArray();
@ -56,7 +55,7 @@ public class JobController(PgsqlContext context) : Controller
/// <param name="type">Requested Job-Type</param> /// <param name="type">Requested Job-Type</param>
/// <response code="200"></response> /// <response code="200"></response>
[HttpGet("Type/{type}")] [HttpGet("Type/{type}")]
[ProducesResponseType<Job[]>(Status200OK)] [ProducesResponseType<Job[]>(Status200OK, "application/json")]
public IActionResult GetJobsOfType(JobType type) public IActionResult GetJobsOfType(JobType type)
{ {
Job[] jobsOfType = context.Jobs.Where(job => job.JobType == type).ToArray(); Job[] jobsOfType = context.Jobs.Where(job => job.JobType == type).ToArray();
@ -70,7 +69,7 @@ public class JobController(PgsqlContext context) : Controller
/// <response code="200"></response> /// <response code="200"></response>
/// <response code="404">Job with ID could not be found</response> /// <response code="404">Job with ID could not be found</response>
[HttpGet("{id}")] [HttpGet("{id}")]
[ProducesResponseType<Job>(Status200OK)] [ProducesResponseType<Job>(Status200OK, "application/json")]
[ProducesResponseType(Status404NotFound)] [ProducesResponseType(Status404NotFound)]
public IActionResult GetJob(string id) public IActionResult GetJob(string id)
{ {
@ -91,7 +90,7 @@ public class JobController(PgsqlContext context) : Controller
/// <response code="500">Error during Database Operation</response> /// <response code="500">Error during Database Operation</response>
[HttpPut("NewDownloadChapterJob/{mangaId}")] [HttpPut("NewDownloadChapterJob/{mangaId}")]
[ProducesResponseType(Status201Created)] [ProducesResponseType(Status201Created)]
[ProducesResponseType<string>(Status500InternalServerError)] [ProducesResponseType<string>(Status500InternalServerError, "text/plain")]
public IActionResult CreateNewDownloadChapterJob(string mangaId, [FromBody]ulong recurrenceTime) public IActionResult CreateNewDownloadChapterJob(string mangaId, [FromBody]ulong recurrenceTime)
{ {
Job job = new DownloadNewChaptersJob(recurrenceTime, mangaId); Job job = new DownloadNewChaptersJob(recurrenceTime, mangaId);
@ -106,7 +105,7 @@ public class JobController(PgsqlContext context) : Controller
/// <response code="500">Error during Database Operation</response> /// <response code="500">Error during Database Operation</response>
[HttpPut("DownloadSingleChapterJob/{chapterId}")] [HttpPut("DownloadSingleChapterJob/{chapterId}")]
[ProducesResponseType(Status201Created)] [ProducesResponseType(Status201Created)]
[ProducesResponseType<string>(Status500InternalServerError)] [ProducesResponseType<string>(Status500InternalServerError, "text/plain")]
public IActionResult CreateNewDownloadChapterJob(string chapterId) public IActionResult CreateNewDownloadChapterJob(string chapterId)
{ {
Job job = new DownloadSingleChapterJob(chapterId); Job job = new DownloadSingleChapterJob(chapterId);
@ -121,7 +120,7 @@ public class JobController(PgsqlContext context) : Controller
/// <response code="500">Error during Database Operation</response> /// <response code="500">Error during Database Operation</response>
[HttpPut("UpdateMetadataJob/{mangaId}")] [HttpPut("UpdateMetadataJob/{mangaId}")]
[ProducesResponseType(Status201Created)] [ProducesResponseType(Status201Created)]
[ProducesResponseType<string>(Status500InternalServerError)] [ProducesResponseType<string>(Status500InternalServerError, "text/plain")]
public IActionResult CreateUpdateMetadataJob(string mangaId) public IActionResult CreateUpdateMetadataJob(string mangaId)
{ {
Job job = new UpdateMetadataJob(0, mangaId); Job job = new UpdateMetadataJob(0, mangaId);
@ -135,7 +134,7 @@ public class JobController(PgsqlContext context) : Controller
/// <response code="500">Error during Database Operation</response> /// <response code="500">Error during Database Operation</response>
[HttpPut("UpdateMetadataJob")] [HttpPut("UpdateMetadataJob")]
[ProducesResponseType(Status201Created)] [ProducesResponseType(Status201Created)]
[ProducesResponseType<string>(Status500InternalServerError)] [ProducesResponseType<string>(Status500InternalServerError, "text/plain")]
public IActionResult CreateUpdateAllMetadataJob() public IActionResult CreateUpdateAllMetadataJob()
{ {
List<string> ids = context.Manga.Select(m => m.MangaId).ToList(); List<string> ids = context.Manga.Select(m => m.MangaId).ToList();
@ -174,9 +173,9 @@ public class JobController(PgsqlContext context) : Controller
/// <response code="404">Job could not be found</response> /// <response code="404">Job could not be found</response>
/// <response code="500">Error during Database Operation</response> /// <response code="500">Error during Database Operation</response>
[HttpDelete("{id}")] [HttpDelete("{id}")]
[ProducesResponseType<string[]>(Status200OK)] [ProducesResponseType<string[]>(Status200OK, "application/json")]
[ProducesResponseType(Status404NotFound)] [ProducesResponseType(Status404NotFound)]
[ProducesResponseType(Status500InternalServerError)] [ProducesResponseType<string>(Status500InternalServerError, "text/plain")]
public IActionResult DeleteJob(string id) public IActionResult DeleteJob(string id)
{ {
try try
@ -216,10 +215,10 @@ public class JobController(PgsqlContext context) : Controller
/// <response code="404">Job with ID not found</response> /// <response code="404">Job with ID not found</response>
/// <response code="500">Error during Database Operation</response> /// <response code="500">Error during Database Operation</response>
[HttpPatch("{id}/")] [HttpPatch("{id}/")]
[ProducesResponseType<Job>(Status202Accepted)] [ProducesResponseType<Job>(Status202Accepted, "application/json")]
[ProducesResponseType(Status400BadRequest)] [ProducesResponseType(Status400BadRequest)]
[ProducesResponseType(Status404NotFound)] [ProducesResponseType(Status404NotFound)]
[ProducesResponseType<string>(Status500InternalServerError)] [ProducesResponseType<string>(Status500InternalServerError, "text/plain")]
public IActionResult ModifyJob(string id, [FromBody]ModifyJobRecord modifyJobRecord) public IActionResult ModifyJob(string id, [FromBody]ModifyJobRecord modifyJobRecord)
{ {
try try
@ -252,7 +251,7 @@ public class JobController(PgsqlContext context) : Controller
[ProducesResponseType(Status202Accepted)] [ProducesResponseType(Status202Accepted)]
[ProducesResponseType(Status404NotFound)] [ProducesResponseType(Status404NotFound)]
[ProducesResponseType(Status409Conflict)] [ProducesResponseType(Status409Conflict)]
[ProducesResponseType<string>(Status500InternalServerError)] [ProducesResponseType<string>(Status500InternalServerError, "text/plain")]
public IActionResult StartJob(string id) public IActionResult StartJob(string id)
{ {
Job? ret = context.Jobs.Find(id); Job? ret = context.Jobs.Find(id);

View File

@ -8,7 +8,6 @@ namespace API.Controllers;
[ApiVersion(2)] [ApiVersion(2)]
[ApiController] [ApiController]
[Produces("application/json")]
[Route("v{v:apiVersion}/[controller]")] [Route("v{v:apiVersion}/[controller]")]
public class LibraryConnectorController(PgsqlContext context) : Controller public class LibraryConnectorController(PgsqlContext context) : Controller
{ {
@ -17,7 +16,7 @@ public class LibraryConnectorController(PgsqlContext context) : Controller
/// </summary> /// </summary>
/// <response code="200"></response> /// <response code="200"></response>
[HttpGet] [HttpGet]
[ProducesResponseType<LibraryConnector[]>(Status200OK)] [ProducesResponseType<LibraryConnector[]>(Status200OK, "application/json")]
public IActionResult GetAllConnectors() public IActionResult GetAllConnectors()
{ {
LibraryConnector[] connectors = context.LibraryConnectors.ToArray(); LibraryConnector[] connectors = context.LibraryConnectors.ToArray();
@ -31,7 +30,7 @@ public class LibraryConnectorController(PgsqlContext context) : Controller
/// <response code="200"></response> /// <response code="200"></response>
/// <response code="404">Connector with ID not found.</response> /// <response code="404">Connector with ID not found.</response>
[HttpGet("{id}")] [HttpGet("{id}")]
[ProducesResponseType<LibraryConnector>(Status200OK)] [ProducesResponseType<LibraryConnector>(Status200OK, "application/json")]
[ProducesResponseType(Status404NotFound)] [ProducesResponseType(Status404NotFound)]
public IActionResult GetConnector(string id) public IActionResult GetConnector(string id)
{ {
@ -47,11 +46,11 @@ public class LibraryConnectorController(PgsqlContext context) : Controller
/// Creates a new Library-Connector /// Creates a new Library-Connector
/// </summary> /// </summary>
/// <param name="libraryConnector">Library-Connector</param> /// <param name="libraryConnector">Library-Connector</param>
/// <response code="200"></response> /// <response code="201"></response>
/// <response code="500">Error during Database Operation</response> /// <response code="500">Error during Database Operation</response>
[HttpPut] [HttpPut]
[ProducesResponseType(Status200OK)] [ProducesResponseType(Status201Created)]
[ProducesResponseType<string>(Status500InternalServerError)] [ProducesResponseType<string>(Status500InternalServerError, "text/plain")]
public IActionResult CreateConnector([FromBody]LibraryConnector libraryConnector) public IActionResult CreateConnector([FromBody]LibraryConnector libraryConnector)
{ {
try try
@ -76,20 +75,18 @@ public class LibraryConnectorController(PgsqlContext context) : Controller
[HttpDelete("{id}")] [HttpDelete("{id}")]
[ProducesResponseType(Status200OK)] [ProducesResponseType(Status200OK)]
[ProducesResponseType(Status404NotFound)] [ProducesResponseType(Status404NotFound)]
[ProducesResponseType(Status500InternalServerError)] [ProducesResponseType<string>(Status500InternalServerError, "text/plain")]
public IActionResult DeleteConnector(string id) public IActionResult DeleteConnector(string id)
{ {
try try
{ {
LibraryConnector? ret = context.LibraryConnectors.Find(id); LibraryConnector? ret = context.LibraryConnectors.Find(id);
switch (ret is not null) if (ret is null)
{ return NotFound();
case true:
context.Remove(ret); context.Remove(ret);
context.SaveChanges(); context.SaveChanges();
return Ok(); return Ok();
case false: return NotFound();
}
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -8,7 +8,6 @@ namespace API.Controllers;
[ApiVersion(2)] [ApiVersion(2)]
[ApiController] [ApiController]
[Produces("application/json")]
[Route("v{v:apiVersion}")] [Route("v{v:apiVersion}")]
public class MangaConnectorController(PgsqlContext context) : Controller public class MangaConnectorController(PgsqlContext context) : Controller
{ {
@ -17,7 +16,7 @@ public class MangaConnectorController(PgsqlContext context) : Controller
/// </summary> /// </summary>
/// <response code="200"></response> /// <response code="200"></response>
[HttpGet] [HttpGet]
[ProducesResponseType<MangaConnector[]>(Status200OK)] [ProducesResponseType<MangaConnector[]>(Status200OK, "application/json")]
public IActionResult GetConnectors() public IActionResult GetConnectors()
{ {
MangaConnector[] connectors = context.MangaConnectors.ToArray(); MangaConnector[] connectors = context.MangaConnectors.ToArray();
@ -29,7 +28,7 @@ public class MangaConnectorController(PgsqlContext context) : Controller
/// </summary> /// </summary>
/// <response code="200"></response> /// <response code="200"></response>
[HttpGet("enabled")] [HttpGet("enabled")]
[ProducesResponseType<MangaConnector[]>(Status200OK)] [ProducesResponseType<MangaConnector[]>(Status200OK, "application/json")]
public IActionResult GetEnabledConnectors() public IActionResult GetEnabledConnectors()
{ {
MangaConnector[] connectors = context.MangaConnectors.Where(c => c.Enabled == true).ToArray(); MangaConnector[] connectors = context.MangaConnectors.Where(c => c.Enabled == true).ToArray();
@ -41,7 +40,7 @@ public class MangaConnectorController(PgsqlContext context) : Controller
/// </summary> /// </summary>
/// <response code="200"></response> /// <response code="200"></response>
[HttpGet("disabled")] [HttpGet("disabled")]
[ProducesResponseType<MangaConnector[]>(Status200OK)] [ProducesResponseType<MangaConnector[]>(Status200OK, "application/json")]
public IActionResult GetDisabledConnectors() public IActionResult GetDisabledConnectors()
{ {
MangaConnector[] connectors = context.MangaConnectors.Where(c => c.Enabled == false).ToArray(); MangaConnector[] connectors = context.MangaConnectors.Where(c => c.Enabled == false).ToArray();
@ -55,9 +54,11 @@ public class MangaConnectorController(PgsqlContext context) : Controller
/// <param name="enabled">Set true to enable</param> /// <param name="enabled">Set true to enable</param>
/// <response code="200"></response> /// <response code="200"></response>
/// <response code="404">Connector with ID not found.</response> /// <response code="404">Connector with ID not found.</response>
/// <response code="500">Error during Database Operation</response>
[HttpPatch("{id}/SetEnabled/{enabled}")] [HttpPatch("{id}/SetEnabled/{enabled}")]
[ProducesResponseType(Status200OK)] [ProducesResponseType(Status200OK)]
[ProducesResponseType(Status404NotFound)] [ProducesResponseType(Status404NotFound)]
[ProducesResponseType<string>(Status500InternalServerError, "text/plain")]
public IActionResult SetEnabled(string id, bool enabled) public IActionResult SetEnabled(string id, bool enabled)
{ {
try try

View File

@ -12,7 +12,6 @@ namespace API.Controllers;
[ApiVersion(2)] [ApiVersion(2)]
[ApiController] [ApiController]
[Produces("application/json")]
[Route("v{v:apiVersion}/[controller]")] [Route("v{v:apiVersion}/[controller]")]
public class MangaController(PgsqlContext context) : Controller public class MangaController(PgsqlContext context) : Controller
{ {
@ -21,7 +20,7 @@ public class MangaController(PgsqlContext context) : Controller
/// </summary> /// </summary>
/// <response code="200"></response> /// <response code="200"></response>
[HttpGet] [HttpGet]
[ProducesResponseType<Manga[]>(Status200OK)] [ProducesResponseType<Manga[]>(Status200OK, "application/json")]
public IActionResult GetAllManga() public IActionResult GetAllManga()
{ {
Manga[] ret = context.Manga.ToArray(); Manga[] ret = context.Manga.ToArray();
@ -34,7 +33,7 @@ public class MangaController(PgsqlContext context) : Controller
/// <param name="ids">Array of Manga-IDs</param> /// <param name="ids">Array of Manga-IDs</param>
/// <response code="200"></response> /// <response code="200"></response>
[HttpPost("WithIDs")] [HttpPost("WithIDs")]
[ProducesResponseType<Manga[]>(Status200OK)] [ProducesResponseType<Manga[]>(Status200OK, "application/json")]
public IActionResult GetManga([FromBody]string[] ids) public IActionResult GetManga([FromBody]string[] ids)
{ {
Manga[] ret = context.Manga.Where(m => ids.Contains(m.MangaId)).ToArray(); Manga[] ret = context.Manga.Where(m => ids.Contains(m.MangaId)).ToArray();
@ -48,7 +47,7 @@ public class MangaController(PgsqlContext context) : Controller
/// <response code="200"></response> /// <response code="200"></response>
/// <response code="404">Manga with ID not found</response> /// <response code="404">Manga with ID not found</response>
[HttpGet("{id}")] [HttpGet("{id}")]
[ProducesResponseType<Manga>(Status200OK)] [ProducesResponseType<Manga>(Status200OK, "application/json")]
[ProducesResponseType(Status404NotFound)] [ProducesResponseType(Status404NotFound)]
public IActionResult GetManga(string id) public IActionResult GetManga(string id)
{ {
@ -68,7 +67,7 @@ public class MangaController(PgsqlContext context) : Controller
[HttpDelete("{id}")] [HttpDelete("{id}")]
[ProducesResponseType(Status200OK)] [ProducesResponseType(Status200OK)]
[ProducesResponseType(Status404NotFound)] [ProducesResponseType(Status404NotFound)]
[ProducesResponseType<string>(Status500InternalServerError)] [ProducesResponseType<string>(Status500InternalServerError, "text/plain")]
public IActionResult DeleteManga(string id) public IActionResult DeleteManga(string id)
{ {
try try
@ -97,8 +96,7 @@ public class MangaController(PgsqlContext context) : Controller
/// <response code="400">The formatting-request was invalid</response> /// <response code="400">The formatting-request was invalid</response>
/// <response code="404">Manga with ID not found</response> /// <response code="404">Manga with ID not found</response>
[HttpPost("{id}/Cover")] [HttpPost("{id}/Cover")]
[Produces("image/jpeg")] [ProducesResponseType<byte[]>(Status200OK,"image/jpeg")]
[ProducesResponseType(Status200OK)]
[ProducesResponseType(Status204NoContent)] [ProducesResponseType(Status204NoContent)]
[ProducesResponseType(Status400BadRequest)] [ProducesResponseType(Status400BadRequest)]
[ProducesResponseType(Status404NotFound)] [ProducesResponseType(Status404NotFound)]
@ -135,7 +133,7 @@ public class MangaController(PgsqlContext context) : Controller
/// <response code="200"></response> /// <response code="200"></response>
/// <response code="404">Manga with ID not found</response> /// <response code="404">Manga with ID not found</response>
[HttpGet("{id}/Chapters")] [HttpGet("{id}/Chapters")]
[ProducesResponseType<Chapter[]>(Status200OK)] [ProducesResponseType<Chapter[]>(Status200OK, "application/json")]
[ProducesResponseType(Status404NotFound)] [ProducesResponseType(Status404NotFound)]
public IActionResult GetChapters(string id) public IActionResult GetChapters(string id)
{ {
@ -156,10 +154,10 @@ public class MangaController(PgsqlContext context) : Controller
/// <response code="404">Manga with ID not found.</response> /// <response code="404">Manga with ID not found.</response>
/// <response code="500">Could not retrieve the maximum chapter-number</response> /// <response code="500">Could not retrieve the maximum chapter-number</response>
[HttpGet("{id}/Chapter/Latest")] [HttpGet("{id}/Chapter/Latest")]
[ProducesResponseType<Chapter>(Status200OK)] [ProducesResponseType<Chapter>(Status200OK, "application/json")]
[ProducesResponseType(Status204NoContent)] [ProducesResponseType(Status204NoContent)]
[ProducesResponseType(Status404NotFound)] [ProducesResponseType(Status404NotFound)]
[ProducesResponseType<string>(Status500InternalServerError)] [ProducesResponseType<string>(Status500InternalServerError, "text/plain")]
public IActionResult GetLatestChapter(string id) public IActionResult GetLatestChapter(string id)
{ {
Manga? m = context.Manga.Find(id); Manga? m = context.Manga.Find(id);
@ -184,7 +182,7 @@ public class MangaController(PgsqlContext context) : Controller
/// <response code="200"></response> /// <response code="200"></response>
/// <response code="404">Manga with ID not found.</response> /// <response code="404">Manga with ID not found.</response>
[HttpPatch("{id}/IgnoreChaptersBefore")] [HttpPatch("{id}/IgnoreChaptersBefore")]
[ProducesResponseType<float>(Status200OK)] [ProducesResponseType<float>(Status200OK, "text/plain")]
[ProducesResponseType(Status404NotFound)] [ProducesResponseType(Status404NotFound)]
public IActionResult IgnoreChaptersBefore(string id) public IActionResult IgnoreChaptersBefore(string id)
{ {

View File

@ -17,7 +17,7 @@ public class NotificationConnectorController(PgsqlContext context) : Controller
/// </summary> /// </summary>
/// <response code="200"></response> /// <response code="200"></response>
[HttpGet] [HttpGet]
[ProducesResponseType<NotificationConnector[]>(Status200OK)] [ProducesResponseType<NotificationConnector[]>(Status200OK, "application/json")]
public IActionResult GetAllConnectors() public IActionResult GetAllConnectors()
{ {
NotificationConnector[] ret = context.NotificationConnectors.ToArray(); NotificationConnector[] ret = context.NotificationConnectors.ToArray();
@ -31,7 +31,7 @@ public class NotificationConnectorController(PgsqlContext context) : Controller
/// <response code="200"></response> /// <response code="200"></response>
/// <response code="404">NotificationConnector with ID not found</response> /// <response code="404">NotificationConnector with ID not found</response>
[HttpGet("{id}")] [HttpGet("{id}")]
[ProducesResponseType<NotificationConnector>(Status200OK)] [ProducesResponseType<NotificationConnector>(Status200OK, "application/json")]
[ProducesResponseType(Status404NotFound)] [ProducesResponseType(Status404NotFound)]
public IActionResult GetConnector(string id) public IActionResult GetConnector(string id)
{ {
@ -50,8 +50,8 @@ public class NotificationConnectorController(PgsqlContext context) : Controller
/// <response code="201"></response> /// <response code="201"></response>
/// <response code="500">Error during Database Operation</response> /// <response code="500">Error during Database Operation</response>
[HttpPut] [HttpPut]
[ProducesResponseType<NotificationConnector[]>(Status200OK)] [ProducesResponseType<NotificationConnector[]>(Status200OK, "application/json")]
[ProducesResponseType<string>(Status500InternalServerError)] [ProducesResponseType<string>(Status500InternalServerError, "text/plain")]
public IActionResult CreateConnector([FromBody]NotificationConnector notificationConnector) public IActionResult CreateConnector([FromBody]NotificationConnector notificationConnector)
{ {
try try
@ -76,7 +76,7 @@ public class NotificationConnectorController(PgsqlContext context) : Controller
[HttpDelete("{id}")] [HttpDelete("{id}")]
[ProducesResponseType(Status200OK)] [ProducesResponseType(Status200OK)]
[ProducesResponseType(Status404NotFound)] [ProducesResponseType(Status404NotFound)]
[ProducesResponseType(Status500InternalServerError)] [ProducesResponseType<string>(Status500InternalServerError, "text/plain")]
public IActionResult DeleteConnector(string id) public IActionResult DeleteConnector(string id)
{ {
try try

View File

@ -10,7 +10,6 @@ namespace API.Controllers;
[ApiVersion(2)] [ApiVersion(2)]
[ApiController] [ApiController]
[Produces("application/json")]
[Route("v{v:apiVersion}/[controller]")] [Route("v{v:apiVersion}/[controller]")]
public class SearchController(PgsqlContext context) : Controller public class SearchController(PgsqlContext context) : Controller
{ {
@ -22,8 +21,8 @@ public class SearchController(PgsqlContext context) : Controller
/// <response code="200"></response> /// <response code="200"></response>
/// <response code="500">Error during Database Operation</response> /// <response code="500">Error during Database Operation</response>
[HttpPost("{name}")] [HttpPost("{name}")]
[ProducesResponseType<Manga[]>(Status200OK)] [ProducesResponseType<Manga[]>(Status200OK, "application/json")]
[ProducesResponseType<string>(Status500InternalServerError)] [ProducesResponseType<string>(Status500InternalServerError, "text/plain")]
public IActionResult SearchMangaGlobal(string name) public IActionResult SearchMangaGlobal(string name)
{ {
List<(Manga, List<Author>?, List<MangaTag>?, List<Link>?, List<MangaAltTitle>?)> allManga = new(); List<(Manga, List<Author>?, List<MangaTag>?, List<Link>?, List<MangaAltTitle>?)> allManga = new();
@ -57,10 +56,10 @@ public class SearchController(PgsqlContext context) : Controller
/// <response code="406">MangaConnector with ID is disabled</response> /// <response code="406">MangaConnector with ID is disabled</response>
/// <response code="500">Error during Database Operation</response> /// <response code="500">Error during Database Operation</response>
[HttpPost("{id}/{name}")] [HttpPost("{id}/{name}")]
[ProducesResponseType<Manga[]>(Status200OK)] [ProducesResponseType<Manga[]>(Status200OK, "application/json")]
[ProducesResponseType(Status404NotFound)] [ProducesResponseType(Status404NotFound)]
[ProducesResponseType(Status406NotAcceptable)] [ProducesResponseType(Status406NotAcceptable)]
[ProducesResponseType<string>(Status500InternalServerError)] [ProducesResponseType<string>(Status500InternalServerError, "text/plain")]
public IActionResult SearchManga(string id, string name) public IActionResult SearchManga(string id, string name)
{ {
MangaConnector? connector = context.MangaConnectors.Find(id); MangaConnector? connector = context.MangaConnectors.Find(id);

View File

@ -9,7 +9,6 @@ namespace API.Controllers;
[ApiVersion(2)] [ApiVersion(2)]
[ApiController] [ApiController]
[Produces("application/json")]
[Route("v{v:apiVersion}/[controller]")] [Route("v{v:apiVersion}/[controller]")]
public class SettingsController(PgsqlContext context) : Controller public class SettingsController(PgsqlContext context) : Controller
{ {
@ -18,7 +17,7 @@ public class SettingsController(PgsqlContext context) : Controller
/// </summary> /// </summary>
/// <response code="200"></response> /// <response code="200"></response>
[HttpGet] [HttpGet]
[ProducesResponseType<JsonObject>(StatusCodes.Status200OK)] [ProducesResponseType<string>(StatusCodes.Status200OK, "application/json")]
public IActionResult GetSettings() public IActionResult GetSettings()
{ {
return Ok(TrangaSettings.Serialize()); return Ok(TrangaSettings.Serialize());
@ -29,7 +28,7 @@ public class SettingsController(PgsqlContext context) : Controller
/// </summary> /// </summary>
/// <response code="200"></response> /// <response code="200"></response>
[HttpGet("UserAgent")] [HttpGet("UserAgent")]
[ProducesResponseType<string>(Status200OK)] [ProducesResponseType<string>(Status200OK, "text/plain")]
public IActionResult GetUserAgent() public IActionResult GetUserAgent()
{ {
return Ok(TrangaSettings.userAgent); return Ok(TrangaSettings.userAgent);
@ -64,7 +63,7 @@ public class SettingsController(PgsqlContext context) : Controller
/// </summary> /// </summary>
/// <response code="200"></response> /// <response code="200"></response>
[HttpGet("RequestLimits")] [HttpGet("RequestLimits")]
[ProducesResponseType<Dictionary<RequestType,int>>(Status200OK)] [ProducesResponseType<Dictionary<RequestType,int>>(Status200OK, "application/json")]
public IActionResult GetRequestLimits() public IActionResult GetRequestLimits()
{ {
return Ok(TrangaSettings.requestLimits); return Ok(TrangaSettings.requestLimits);
@ -97,7 +96,7 @@ public class SettingsController(PgsqlContext context) : Controller
/// </summary> /// </summary>
/// <response code="200">JPEG compression-level as Integer</response> /// <response code="200">JPEG compression-level as Integer</response>
[HttpGet("ImageCompression")] [HttpGet("ImageCompression")]
[ProducesResponseType<int>(Status200OK)] [ProducesResponseType<int>(Status200OK, "text/plain")]
public IActionResult GetImageCompression() public IActionResult GetImageCompression()
{ {
return Ok(TrangaSettings.compression); return Ok(TrangaSettings.compression);
@ -125,7 +124,7 @@ public class SettingsController(PgsqlContext context) : Controller
/// </summary> /// </summary>
/// <response code="200">True if enabled</response> /// <response code="200">True if enabled</response>
[HttpGet("BWImages")] [HttpGet("BWImages")]
[ProducesResponseType<bool>(Status200OK)] [ProducesResponseType<bool>(Status200OK, "text/plain")]
public IActionResult GetBwImagesToggle() public IActionResult GetBwImagesToggle()
{ {
return Ok(TrangaSettings.bwImages); return Ok(TrangaSettings.bwImages);
@ -150,7 +149,7 @@ public class SettingsController(PgsqlContext context) : Controller
/// <remarks>April Fools Mode disables all downloads on April 1st</remarks> /// <remarks>April Fools Mode disables all downloads on April 1st</remarks>
/// <response code="200">True if enabled</response> /// <response code="200">True if enabled</response>
[HttpGet("AprilFoolsMode")] [HttpGet("AprilFoolsMode")]
[ProducesResponseType<bool>(Status200OK)] [ProducesResponseType<bool>(Status200OK, "text/plain")]
public IActionResult GetAprilFoolsMode() public IActionResult GetAprilFoolsMode()
{ {
return Ok(TrangaSettings.aprilFoolsMode); return Ok(TrangaSettings.aprilFoolsMode);