public async Task <List <SegmentEffortStream> > GetSegmentEffortStreamAsync(string effortId, SegmentStreamType typeFlags, StreamResolution resolution = StreamResolution.All) { StringBuilder types = new StringBuilder(); StreamType[] array = (StreamType[])Enum.GetValues(typeof(SegmentStreamType)); for (int i = 0; i < array.Length; i++) { SegmentStreamType type = (SegmentStreamType)array[i]; if (typeFlags.HasFlag(type)) { types.Append(type.ToString().ToLower()); types.Append(","); } } types.Remove(types.ToString().Length - 1, 1); string getUrl = string.Format("https://www.strava.com/api/v3/segment_efforts/{0}/streams/{1}?{2}&access_token={3}", effortId, types, (resolution != StreamResolution.All) ? ("resolution=" + resolution.ToString().ToLower()) : "", Authentication.AccessToken); return(Unmarshaller <List <SegmentEffortStream> > .Unmarshal(await WebRequest.SendGetAsync(new Uri(getUrl)))); }
public List <SegmentStream> GetSegmentStream(string segmentId, SegmentStreamType typeFlags, StreamResolution resolution = StreamResolution.All) { StringBuilder stringBuilder = new StringBuilder(); StreamType[] array = (StreamType[])Enum.GetValues(typeof(SegmentStreamType)); for (int i = 0; i < array.Length; i++) { SegmentStreamType segmentStreamType = (SegmentStreamType)array[i]; if (typeFlags.HasFlag(segmentStreamType)) { stringBuilder.Append(segmentStreamType.ToString().ToLower()); stringBuilder.Append(","); } } stringBuilder.Remove(stringBuilder.ToString().Length - 1, 1); string uriString = string.Format("{0}/{1}/streams/{2}?{3}&access_token={4}", "https://www.strava.com/api/v3/segments", segmentId, stringBuilder, (resolution != StreamResolution.All) ? ("resolution=" + resolution.ToString().ToLower()) : "", Authentication.AccessToken); string json = WebRequest.SendGet(new Uri(uriString)); return(Unmarshaller <List <SegmentStream> > .Unmarshal(json)); }