Get.cs 808 B

12345678910111213141516171819202122232425
  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. /// identifier: @handle 또는 YouTube Channel ID (SID)
  12. app.MapGet("api/channel/{identifier}", async (string identifier, ISender sender, CancellationToken ct) =>
  13. {
  14. var result = await sender.Send(new Application.Features.Api.Channel.Get.Query(identifier), ct);
  15. return result.Match(
  16. () => ApiResponse.Ok(result.Value),
  17. CustomResults.Problem
  18. );
  19. })
  20. .WithTags("Channel");
  21. }
  22. }