コード例 #1
0
ファイル: Program.cs プロジェクト: sonuame/Strava
        static void GetActivity(string ActivityName)
        {
            var apiInstance = new ClubsApi();


            try
            {
                // List Athlete Activities
                var clubs = apiInstance.GetLoggedInAthleteClubs(null, null);
            }
            catch (Exception e)
            {
            }
        }
コード例 #2
0
        public async Task <List <SummaryClub> > GetAthleteClubs(StravaToken token)
        {
            var allClubs   = new List <SummaryClub>();
            var pageNumber = 1;

            try
            {
                await this.RefreshAccessTokenIfNeededAsync(token);

                var apiClient = new ApiClient {
                    AccessToken = token.AccessToken
                };
                var apiInstance = new ClubsApi(apiClient);

                while (true)
                {
                    var clubs = apiInstance.GetLoggedInAthleteClubs(pageNumber, StravaConsts.MaxApiRecordsPerPage);
                    allClubs.AddRange(clubs);

                    if (clubs.Count <= StravaConsts.MaxApiRecordsPerPage * 0.9)
                    {
                        break;
                    }
                    else
                    {
                        pageNumber++;
                    }
                }
            }
            catch (Exception)
            {
                // TODO: log error
                throw;
            }

            return(allClubs);
        }
コード例 #3
0
 public void Init()
 {
     instance = new ClubsApi();
 }