createGist method
Creates a Gist
API docs: https://developer.github.com/v3/gists/#create-a-gist
Implementation
Future<Gist> createGist(
Map<String, String> files, {
String? description,
bool public = false,
}) {
final map = <String, dynamic>{'files': {}};
if (description != null) {
map['description'] = description;
}
map['public'] = public;
final f = {};
for (final key in files.keys) {
f[key] = {'content': files[key]};
}
map['files'] = f;
return github.postJSON(
'/gists',
statusCode: 201,
body: GitHubJson.encode(map),
convert: (dynamic i) => Gist.fromJson(i),
);
}