Stream custom live channels using your own media
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

34 lines
1.0 KiB

using ErsatzTV.Core;
using ErsatzTV.Core.Interfaces.GitHub;
using Refit;
namespace ErsatzTV.Infrastructure.GitHub;
public class GitHubApiClient : IGitHubApiClient
{
public async Task<Either<BaseError, string>> GetLatestReleaseNotes(CancellationToken cancellationToken)
{
try
{
IGitHubApi service = RestService.For<IGitHubApi>("https://api.github.com");
return await service.GetReleases(cancellationToken).Map(releases => releases.Head().Body);
}
catch (Exception ex)
{
return BaseError.New(ex.ToString());
}
}
public async Task<Either<BaseError, string>> GetReleaseNotes(string tag, CancellationToken cancellationToken)
{
try
{
IGitHubApi service = RestService.For<IGitHubApi>("https://api.github.com");
return await service.GetTag(tag, cancellationToken).Map(t => t.Body);
}
catch (Exception ex)
{
return BaseError.New(ex.ToString());
}
}
}