Get.cs 875 B

1234567891011121314151617181920212223242526
  1. using Web.Api.Common;
  2. using Web.Api.Extensions;
  3. using Application.Abstractions.Messaging;
  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. .RequireFeature(c => c.Channel);
  22. }
  23. }