@@ -168,29 +168,34 @@ class RepositoriesService extends Service {
168
168
169
169
/// Edit a Repository.
170
170
///
171
- /// API docs: https://developer.github.com/v3/repos/#edit
172
- Future <Repository > editRepository (RepositorySlug slug,
173
- {String ? name,
174
- String ? description,
175
- String ? homepage,
176
- bool ? private,
177
- bool ? hasIssues,
178
- bool ? hasWiki,
179
- bool ? hasDownloads}) async {
171
+ /// API docs: https://docs.github.com/en/rest/repos/repos#update-a-repository
172
+ Future <Repository > editRepository (
173
+ RepositorySlug slug, {
174
+ String ? name,
175
+ String ? description,
176
+ String ? homepage,
177
+ bool ? private,
178
+ bool ? hasIssues,
179
+ bool ? hasWiki,
180
+ bool ? hasDownloads,
181
+ String ? defaultBranch,
182
+ }) async {
180
183
ArgumentError .checkNotNull (slug);
184
+
181
185
final data = createNonNullMap ({
182
- 'name' : name! ,
183
- 'description' : description! ,
184
- 'homepage' : homepage! ,
185
- 'private' : private! ,
186
- 'has_issues' : hasIssues! ,
187
- 'has_wiki' : hasWiki! ,
188
- 'has_downloads' : hasDownloads! ,
189
- 'default_branch' : ' defaultBranch'
186
+ 'name' : name,
187
+ 'description' : description,
188
+ 'homepage' : homepage,
189
+ 'private' : private,
190
+ 'has_issues' : hasIssues,
191
+ 'has_wiki' : hasWiki,
192
+ 'has_downloads' : hasDownloads,
193
+ 'default_branch' : defaultBranch,
190
194
});
191
- return github.postJSON (
195
+ return github.postJSON < Map < String , dynamic >, Repository > (
192
196
'/repos/${slug .fullName }' ,
193
197
body: GitHubJson .encode (data),
198
+ convert: (i) => Repository .fromJson (i),
194
199
statusCode: 200 ,
195
200
);
196
201
}
0 commit comments