Esempio n. 1
0
        /// <summary>
        /// Gets the gender-filtered and age-filtered leaderboard of a segment. This method requires the currently authenticated
        /// athlete to have a Strava premium account.
        /// </summary>
        /// <param name="segmentId">The Strava segment Id.</param>
        /// <param name="gender">The gender used to filter the leaderboard.</param>
        /// /// <param name="age">The age range used to filter the leaderboard.</param>
        /// <returns>The leaderboard filtered by gender and age.</returns>
        public Leaderboard GetSegmentLeaderboard(String segmentId, Gender gender, AgeGroup age)
        {
            String getUrl = String.Format("{0}/{1}/leaderboard?gender={2}&age_group={3}&filter=age_group&access_token={4}",
                                          Endpoints.Leaderboard,
                                          segmentId,
                                          gender.ToString().Substring(0, 1),
                                          UrlHelper.AgeGroupToString(age),
                                          Authentication.AccessToken
                                          );

            String json = WebRequest.SendGet(new Uri(getUrl));

            return(Unmarshaller <Leaderboard> .Unmarshal(json));
        }