createCommitComment method
Future<CommitComment>
createCommitComment(
- RepositorySlug slug,
- RepositoryCommit commit, {
- required String body,
- String? path,
- int? position,
- @Deprecated('Use position parameter instead') int? line,
Create a comment for a commit using its sha.
body
: The contents of the comment.path
: Relative path of the file to comment on.position
: Line index in the diff to comment on.line
: Deprecated. Use position parameter instead. Line number in the file to comment on.
https://developer.github.com/v3/repos/comments/#create-a-commit-comment
Implementation
Future<CommitComment> createCommitComment(
RepositorySlug slug,
RepositoryCommit commit, {
required String body,
String? path,
int? position,
@Deprecated('Use position parameter instead') int? line,
}) async {
ArgumentError.checkNotNull(slug);
ArgumentError.checkNotNull(commit);
final data = createNonNullMap({
'body': body,
'path': path!,
'position': position!,
'line': line!,
});
return github.postJSON<Map<String, dynamic>, CommitComment>(
'/repos/${slug.fullName}/commits/${commit.sha}/comments',
body: GitHubJson.encode(data),
statusCode: StatusCodes.CREATED,
convert: CommitComment.fromJson,
);
}