deleteFile method
- RepositorySlug slug,
- String path,
- String message,
- String sha,
- String branch,
Deletes the specified file.
API docs: https://developer.github.com/v3/repos/contents/#delete-a-file
Implementation
Future<ContentCreation> deleteFile(
RepositorySlug slug,
String path,
String message,
String sha,
String branch,
) async {
ArgumentError.checkNotNull(slug);
ArgumentError.checkNotNull(path);
final map = createNonNullMap({
'message': message,
'sha': sha,
'branch': branch,
});
final response = await github.request(
'DELETE',
'/repos/${slug.fullName}/contents/$path',
body: GitHubJson.encode(map),
statusCode: StatusCodes.OK,
);
return ContentCreation.fromJson(
jsonDecode(response.body) as Map<String, dynamic>,
);
}