mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
feat(directory): ✨ add explicit API response types for swagger ui
This commit is contained in:
parent
81317e9652
commit
df859318d5
8 changed files with 30 additions and 8 deletions
|
|
@ -1,4 +1,6 @@
|
|||
using System.Threading;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using FilterLists.Directory.Application.Queries;
|
||||
using MediatR;
|
||||
|
|
@ -18,6 +20,7 @@ public LanguagesController(IMediator mediator)
|
|||
}
|
||||
|
||||
[HttpGet]
|
||||
[ProducesResponseType(typeof(IEnumerable<GetLanguages.LanguageViewModel>), (int)HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> Get(CancellationToken cancellationToken)
|
||||
{
|
||||
return Ok(await _mediator.Send(new GetLanguages.Query(), cancellationToken));
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
using System.Threading;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using FilterLists.Directory.Application.Queries;
|
||||
using MediatR;
|
||||
|
|
@ -18,6 +20,7 @@ public LicensesController(IMediator mediator)
|
|||
}
|
||||
|
||||
[HttpGet]
|
||||
[ProducesResponseType(typeof(IEnumerable<GetLicenses.LicenseViewModel>), (int)HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> Get(CancellationToken cancellationToken)
|
||||
{
|
||||
return Ok(await _mediator.Send(new GetLicenses.Query(), cancellationToken));
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
using System.Threading;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using FilterLists.Directory.Application.Queries;
|
||||
using MediatR;
|
||||
|
|
@ -18,12 +20,14 @@ public ListsController(IMediator mediator)
|
|||
}
|
||||
|
||||
[HttpGet]
|
||||
[ProducesResponseType(typeof(IEnumerable<GetLists.ListViewModel>), (int)HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> Get(CancellationToken cancellationToken)
|
||||
{
|
||||
return Ok(await _mediator.Send(new GetLists.Query(), cancellationToken));
|
||||
}
|
||||
|
||||
[HttpGet("{id}")]
|
||||
[ProducesResponseType(typeof(GetListDetails.ListViewModel), (int)HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetDetails(int id, CancellationToken cancellationToken)
|
||||
{
|
||||
return Ok(await _mediator.Send(new GetListDetails.Query(id), cancellationToken));
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
using System.Threading;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using FilterLists.Directory.Application.Queries;
|
||||
using MediatR;
|
||||
|
|
@ -18,6 +20,7 @@ public MaintainersController(IMediator mediator)
|
|||
}
|
||||
|
||||
[HttpGet]
|
||||
[ProducesResponseType(typeof(IEnumerable<GetMaintainers.MaintainerViewModel>), (int)HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> Get(CancellationToken cancellationToken)
|
||||
{
|
||||
return Ok(await _mediator.Send(new GetMaintainers.Query(), cancellationToken));
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
using System.Threading;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using FilterLists.Directory.Application.Queries;
|
||||
using MediatR;
|
||||
|
|
@ -18,6 +20,7 @@ public SoftwareController(IMediator mediator)
|
|||
}
|
||||
|
||||
[HttpGet]
|
||||
[ProducesResponseType(typeof(IEnumerable<GetSoftware.SoftwareViewModel>), (int)HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> Get(CancellationToken cancellationToken)
|
||||
{
|
||||
return Ok(await _mediator.Send(new GetSoftware.Query(), cancellationToken));
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
using System.Threading;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using FilterLists.Directory.Application.Queries;
|
||||
using MediatR;
|
||||
|
|
@ -18,6 +20,7 @@ public SyntaxesController(IMediator mediator)
|
|||
}
|
||||
|
||||
[HttpGet]
|
||||
[ProducesResponseType(typeof(IEnumerable<GetSyntaxes.SyntaxViewModel>), (int)HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> Get(CancellationToken cancellationToken)
|
||||
{
|
||||
return Ok(await _mediator.Send(new GetSyntaxes.Query(), cancellationToken));
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
using System.Threading;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using FilterLists.Directory.Application.Queries;
|
||||
using MediatR;
|
||||
|
|
@ -18,6 +20,7 @@ public TagsController(IMediator mediator)
|
|||
}
|
||||
|
||||
[HttpGet]
|
||||
[ProducesResponseType(typeof(IEnumerable<GetTags.TagViewModel>), (int)HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> Get(CancellationToken cancellationToken)
|
||||
{
|
||||
return Ok(await _mediator.Send(new GetTags.Query(), cancellationToken));
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ public void ConfigureServices(IServiceCollection services)
|
|||
services.AddRouting(o => o.LowercaseUrls = true);
|
||||
services.AddControllers()
|
||||
.AddJsonOptions(o => o.JsonSerializerOptions.IgnoreNullValues = true);
|
||||
services.AddSwaggerGen();
|
||||
services.AddSwaggerGen(o => o.CustomSchemaIds(type => type.ToString()));
|
||||
services.AddApplicationServices(Configuration);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue