using MediatR; using Web.Api.Common; using Web.Api.Extensions; namespace Web.Api.Endpoints.Developers.Apps; internal sealed class RotateSecret : IEndpoint { public void MapEndpoint(IEndpointRouteBuilder app) { app.MapPost("api/developers/apps/{appID:int}/rotate-secret", async ( int appID, HttpContext httpContext, ISender sender, CancellationToken ct ) => { var memberID = httpContext.User.GetRequiredMemberID(); var command = new Application.Features.Api.Developers.Apps.RotateSecret.Command(memberID, appID); var result = await sender.Send(command, ct); return result.Match( data => ApiResponse.Ok(data), CustomResults.Problem ); }) .WithTags("Developers") .RequireAuthorization(); } }