Skip to content

Commit fc12a12

Browse files
author
Patrick FINKELSTEIN
committed
starSegment now working
1 parent 6c055ed commit fc12a12

File tree

4 files changed

+8
-15
lines changed

4 files changed

+8
-15
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ https://developers.strava.com/docs/authentication/
3535
- getSegmentById
3636
- getLoggedInAthleteStarredSegments
3737
- getLeaderboardBySegmentId (only 50 athletes for the moment)
38+
- starSegment
3839

3940

4041

@@ -66,7 +67,7 @@ If you have any problem or need an API not yet implemented please post a new iss
6667
## Contributors welcome!
6768
If you spot a problem/bug or if you consider that the code could be better please post an issue.
6869
I am not planning to implement all the Strava APIs, because I dont need all of them in my dev.
69-
But let me know if you need some APIs that are in the current list and I will add it.
70+
But let me know if you need some APIs that are not in the current list and I will add it.
7071
Alternatively, you can easily implement additional API and I will add it to strava_futter.
7172

7273

example/lib/examples.dart

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,7 @@ Future<Fault> exampleSegment(String secret) async {
116116

117117
/// Star (or unstar) a segment for the loggedInAthlete
118118
///
119+
DetailedSegment _segmentStarred = await strava.starSegment(8186850, true);
119120

120-
// NOT working for the moment
121-
// DetailedSegment _segmentStarred = await strava.starSegment(8186850, true);
122-
// DetailedSegment _segmentStarred = await strava.starSegment(8186850, true);
123-
124-
// print('new starred segment ${_segmentStarred.id} ${_segmentStarred.name} starred: ${_segmentStarred.starred}');
121+
print('new starred segment ${_segmentStarred.id} ${_segmentStarred.name} starred: ${_segmentStarred.starred}');
125122
}

lib/API/segments.dart

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,12 @@ abstract class Segments {
169169
globals.displayInfo('Entering starSegment');
170170

171171
if (_header != null) {
172-
final path = '/api/v3/segments/' + id.toString() + '/starred';
172+
final reqStar = 'https://www.strava.com/api/v3/segments/' + id.toString() + '/starred?starred=' + star.toString();
173+
var rep = await http.put(reqStar, headers: _header);
173174

174-
var uri = Uri.https('www.strava.com', path);
175+
// var uri = Uri.https('www.strava.com', path);
175176

176-
var rep = await http.put(
177-
uri,
178-
headers: _header,
179-
);
177+
// var rep = await http.put( uri, headers: _header, );
180178
if (rep.statusCode == 200) {
181179
globals.displayInfo(rep.statusCode.toString());
182180
globals.displayInfo('Star segment info ${rep.body}');

lib/Models/activity.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,6 @@ class HighlightedKudosers {
833833
}
834834
}
835835

836-
837836
//------------------
838837
// Summary activity
839838
//------------------
@@ -895,7 +894,6 @@ class SummaryActivity {
895894
}
896895
}
897896

898-
899897
/****
900898
class Athlete {
901899
int resourceState;
@@ -919,4 +917,3 @@ class Athlete {
919917
}
920918
}
921919
***/
922-

0 commit comments

Comments
 (0)