@@ -75,13 +75,16 @@ class GistsService extends Service {
75
75
return _github.postJSON ("/gists" , statusCode: 201 , body: JSON .encode (map), convert: Gist .fromJSON);
76
76
}
77
77
78
+ /// Deletes the specified Gist.
79
+ ///
80
+ /// API docs: https://developer.github.com/v3/gists/#delete-a-gist
78
81
Future <bool > deleteGist (String id) {
79
82
return _github.request ("DELETE" , "/gists/${id }" ).then ((response) {
80
83
return response.statusCode == 204 ;
81
84
});
82
85
}
83
86
84
- /// Edits a Gist
87
+ /// Edits a Gist.
85
88
///
86
89
/// API docs: https://developer.github.com/v3/gists/#edit-a-gist
87
90
Future <Gist > editGist (Map <String , String > files, {String description, bool public: false }) {
@@ -109,10 +112,43 @@ class GistsService extends Service {
109
112
}
110
113
111
114
// TODO: Implement listGistCommits: https://developer.github.com/v3/gists/#list-gist-commits
112
- // TODO: Implement starGist: https://developer.github.com/v3/gists/#star-a-gist
113
- // TODO: Implement unstarGist: https://developer.github.com/v3/gists/#unstar-a-gist
114
- // TODO: Implement isStarredGist: https://developer.github.com/v3/gists/#check-if-a-gist-is-starred
115
- // TODO: Implement forkGist: https://developer.github.com/v3/gists/#fork-a-gist
115
+
116
+ /// Star the specified Gist.
117
+ ///
118
+ /// API docs: https://developer.github.com/v3/gists/#star-a-gist
119
+ Future <bool > starGist (String id) {
120
+ return _github.request ("POST" , "/gists/${id }/star" ).then ((response) {
121
+ return response.statusCode == 204 ;
122
+ });
123
+ }
124
+
125
+ /// Unstar the specified Gist.
126
+ ///
127
+ /// API docs: https://developer.github.com/v3/gists/#star-a-gist
128
+ Future <bool > unstarGist (String id) {
129
+ return _github.request ("DELETE" , "/gists/${id }/star" ).then ((response) {
130
+ return response.statusCode == 204 ;
131
+ });
132
+ }
133
+
134
+ /// Checks if the specified Gist is starred.
135
+ ///
136
+ /// API docs: https://developer.github.com/v3/gists/#check-if-a-gist-is-starred
137
+ Future <bool > isGistStarred (String id) {
138
+ return _github.request ("GET" , "/gists/${id }/star" ).then ((response) {
139
+ return response.statusCode == 204 ;
140
+ });
141
+ }
142
+
143
+ /// Forks the specified Gist.
144
+ ///
145
+ /// API docs: https://developer.github.com/v3/gists/#check-if-a-gist-is-starred
146
+ Future <Gist > forkGist (String id) {
147
+ return _github.request ("POST" , "/gists/${id }/forks" , statusCode: 201 ).then ((response) {
148
+ return Gist .fromJSON (response.asJSON ());
149
+ });
150
+ }
151
+
116
152
// TODO: Implement listGistForks: https://developer.github.com/v3/gists/#list-gist-forks
117
153
118
154
/// Lists all comments for a gist.
0 commit comments