internal static string ToApiString(this RankViewsPlatform platform) { return(platform switch { RankViewsPlatform.Youtube => "youtube", RankViewsPlatform.TikTok => "tiktok", _ => throw new NotSupportedException("Invalid platform type.") });
public async Task <Rank[]> GetViewsScoreboardAsync(RankViewsPlatform platform, Size size) { var requestPlatform = platform.ToApiString(); var requestSize = size.ToApiString(); var jsonAsStream = await ApiProcessor.GetAsync($"{_baseUrl}/charts/{requestPlatform}/rankViews/{requestSize}"); var apiData = await _jsonHelper.Deserialise <Rank[]>(jsonAsStream); return(apiData); }
public async Task DemoRun_GetViewsScoreboardAsync(RankViewsPlatform platform, Size size) { //Arrange RanksClient client = new RanksClient(); //Act var result = await client.GetViewsScoreboardAsync(platform, size); //Assert Assert.NotNull(result); }
public Task <Rank[]> GetViewsScoreboardAsync(RankViewsPlatform platform, Size size) { return(_service.GetViewsScoreboardAsync(platform, size)); }