Пример #1
0
        private string BuildLeaderboardsRoute(LeaderboardsOptions options)
        {
            StringBuilder sb = new StringBuilder()
                               .Append("/leaderboards");

            if (options.GuildId.HasValue)
            {
                sb.Append($"/{options.GuildId}");
            }

            sb.Append($"/{options.Type.ToString().ToLower()}");

            QueryString qs = new QueryString();

            qs.Add("amount", options.Amount);
            qs.Add("offset", options.Offset);

            return(sb + qs.Query);
        }
Пример #2
0
 /// <summary>
 /// Pulls the leaderboards data from the API
 /// </summary>
 /// <param name="options">Leaderboards Options Object</param>
 public async Task <LeaderboardsObject> GetPagedLeaderboardsAsync(LeaderboardsOptions options)
 => JsonConvert.DeserializeObject <LeaderboardsObject>(
     (await client.GetAsync(BuildLeaderboardsRoute(options))).Body);
Пример #3
0
 /// <summary>
 /// Builds the url to the leaderboards page on the miki website
 /// </summary>
 /// <param name="options">Leaderboards Options Object</param>
 /// <returns>https://miki.ai/leaderboards/{guild_id?}/{type}</returns>
 public string BuildLeaderboardsUrl(MikiApiClient client, LeaderboardsOptions options)
 => "https://miki.ai" + BuildLeaderboardsRoute(options);