using MediatR; using Web.Api.Common; namespace Web.Api.Endpoints.Crypto; internal sealed class CryptoTickers : IEndpoint { public void MapEndpoint(IEndpointRouteBuilder app) { app.MapGet("api/crypto/tickers", async ( ISender sender, CancellationToken ct ) => { return ApiResponse.Ok( await sender.Send(new Application.Features.Api.Crypto.Ticker.GetAll.Query(false), ct) ); }) .WithTags("Crypto") .AllowAnonymous(); app.MapGet("api/crypto/tickers/featured", async ( ISender sender, CancellationToken ct ) => { return ApiResponse.Ok( await sender.Send(new Application.Features.Api.Crypto.Ticker.GetAll.Query(true), ct) ); }) .WithTags("Crypto") .AllowAnonymous(); app.MapGet("api/crypto/{symbol}/ticker", async ( string symbol, ISender sender, CancellationToken ct ) => { return ApiResponse.Ok( await sender.Send(new Application.Features.Api.Crypto.Ticker.GetDetail.Query(symbol), ct) ); }) .WithTags("Crypto") .AllowAnonymous(); } }