Ejemplo n.º 1
0
 internal static string ToApiString(this RankViewsPlatform platform)
 {
     return(platform switch
     {
         RankViewsPlatform.Youtube => "youtube",
         RankViewsPlatform.TikTok => "tiktok",
         _ => throw new NotSupportedException("Invalid platform type.")
     });
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 public Task <Rank[]> GetViewsScoreboardAsync(RankViewsPlatform platform, Size size)
 {
     return(_service.GetViewsScoreboardAsync(platform, size));
 }