@@ -168,29 +168,34 @@ class RepositoriesService extends Service {
168168
169169 /// Edit a Repository.
170170 ///
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 {
180183 ArgumentError .checkNotNull (slug);
184+
181185 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,
190194 });
191- return github.postJSON (
195+ return github.postJSON < Map < String , dynamic >, Repository > (
192196 '/repos/${slug .fullName }' ,
193197 body: GitHubJson .encode (data),
198+ convert: (i) => Repository .fromJson (i),
194199 statusCode: 200 ,
195200 );
196201 }
0 commit comments