| | 1 | | namespace Syki.Back.Features.Academic.GetWebhooks; |
| | 2 | |
|
| | 3 | | [ApiController, AuthAcademic] |
| | 4 | | [EnableRateLimiting("Medium")] |
| | 5 | | public class GetWebhooksController(GetWebhooksService service) : ControllerBase |
| | 6 | | { |
| | 7 | | /// <summary> |
| | 8 | | /// Webhooks |
| | 9 | | /// </summary> |
| | 10 | | /// <remarks> |
| | 11 | | /// Retorna todos os webhooks. |
| | 12 | | /// </remarks> |
| | 13 | | [HttpGet("academic/webhooks")] |
| | 14 | | [SwaggerResponseExample(200, typeof(ResponseExamples))] |
| | 15 | | public async Task<IActionResult> Get() |
| | 16 | | { |
| | 17 | | var webhooks = await service.Get(User.InstitutionId); |
| | 18 | | return Ok(webhooks); |
| | 19 | | } |
| | 20 | | } |
| | 21 | |
|
| | 22 | | internal class ResponseExamples : IMultipleExamplesProvider<List<GetWebhooksOut>> |
| | 23 | | { |
| | 24 | | public IEnumerable<SwaggerExample<List<GetWebhooksOut>>> GetExamples() |
| | 25 | | { |
| 0 | 26 | | yield return SwaggerExample.Create( |
| 0 | 27 | | "Webhooks", |
| 0 | 28 | | new List<GetWebhooksOut> |
| 0 | 29 | | { |
| 0 | 30 | | new() { |
| 0 | 31 | | Id = Guid.CreateVersion7(), |
| 0 | 32 | | Name = "GitHub", |
| 0 | 33 | | Url = "https://github.com/my-webhook", |
| 0 | 34 | | CallsCount = 42, |
| 0 | 35 | | CreatedAt = DateTime.Now.AddDays(-7) |
| 0 | 36 | | } |
| 0 | 37 | | } |
| 0 | 38 | | ); |
| 0 | 39 | | } |
| | 40 | | } |