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