Skip to content

Commit

Permalink
Update existing addColaborator to meet Github specs
Browse files Browse the repository at this point in the history
Update the existing method addCollaborator to meet the current docs.
https://docs.github.com/en/rest/collaborators/collaborators#add-a-repository-collaborator

Instead of NO_CONTENT, the expected status code is CREATED.
  • Loading branch information
ianmaciel committed Oct 25, 2022
1 parent 7e93cc9 commit 50e44fb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/src/common/repos_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -329,16 +329,17 @@ class RepositoriesService extends Service {
return false;
}

/// https://docs.github.com/en/rest/collaborators/collaborators#add-a-repository-collaborator
Future<bool> addCollaborator(RepositorySlug slug, String user) async {
ArgumentError.checkNotNull(slug);
ArgumentError.checkNotNull(user);
return github
.request(
'PUT',
'/repos/${slug.fullName}/collaborators/$user',
statusCode: StatusCodes.NO_CONTENT,
statusCode: StatusCodes.CREATED,
)
.then((response) => response.statusCode == StatusCodes.NO_CONTENT);
.then((response) => response.statusCode == StatusCodes.CREATED);
}

Future<bool> removeCollaborator(RepositorySlug slug, String user) async {
Expand Down

0 comments on commit 50e44fb

Please sign in to comment.