Get.cs 745 B

123456789101112131415161718192021222324
  1. using Web.Api.Common;
  2. using Web.Api.Extensions;
  3. using MediatR;
  4. namespace Web.Api.Endpoints.Channel;
  5. /// <summary>채널 상세</summary>
  6. internal sealed class Get : IEndpoint
  7. {
  8. public void MapEndpoint(IEndpointRouteBuilder app)
  9. {
  10. /// 채널 상세 정보 조회 (프로필, 구독자 수, 라이브 상태)
  11. app.MapGet("api/channel/{channelSID}", async (string channelSID, ISender sender, CancellationToken ct) =>
  12. {
  13. var result = await sender.Send(new Application.Features.Api.Channel.Get.Query(channelSID), ct);
  14. return result.Match(
  15. () => ApiResponse.Ok(result.Value),
  16. CustomResults.Problem
  17. );
  18. })
  19. .WithTags("Channel");
  20. }
  21. }