static void GetActivity(string ActivityName) { var apiInstance = new ClubsApi(); try { // List Athlete Activities var clubs = apiInstance.GetLoggedInAthleteClubs(null, null); } catch (Exception e) { } }
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); }
public void Init() { instance = new ClubsApi(); }