| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- 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();
- }
- }
|