| | | 1 | | namespace Syki.Back.Features.Webhooks.UpdateWebhookSubscription; |
| | | 2 | | |
| | | 3 | | [ApiController, Authorize(Policies.UpdateWebhookSubscription)] |
| | 0 | 4 | | public class UpdateWebhookSubscriptionController(UpdateWebhookSubscriptionService service) : ControllerBase |
| | | 5 | | { |
| | | 6 | | /// <summary> |
| | | 7 | | /// Editar inscrição de webhook |
| | | 8 | | /// </summary> |
| | | 9 | | /// <remarks> |
| | | 10 | | /// Atualiza os dados de uma inscrição de webhook. |
| | | 11 | | /// </remarks> |
| | | 12 | | [HttpPut("webhooks/subscriptions")] |
| | | 13 | | [SwaggerResponseExample(200, typeof(ResponseExamples))] |
| | | 14 | | [SwaggerResponseExample(400, typeof(ErrorsExamples))] |
| | | 15 | | public async Task<IActionResult> Update([FromBody] UpdateWebhookSubscriptionIn data) |
| | | 16 | | { |
| | 0 | 17 | | var result = await service.Update(data); |
| | 0 | 18 | | return result.Match<IActionResult>(Ok, BadRequest); |
| | 0 | 19 | | } |
| | | 20 | | } |
| | | 21 | | |
| | | 22 | | internal class RequestExamples : ExamplesProvider<UpdateWebhookSubscriptionIn>; |
| | | 23 | | internal class ResponseExamples : ExamplesProvider<UpdateWebhookSubscriptionOut>; |
| | | 24 | | internal class ErrorsExamples : ErrorExamplesProvider< |
| | | 25 | | InvalidWebhookName, |
| | | 26 | | InvalidWebhookUrl, |
| | | 27 | | InvalidWebhookEvents, |
| | | 28 | | WebhookSubscriptionNotFound |
| | | 29 | | >; |