makeCommit method

Future<Map<String, dynamic>?> makeCommit({
  1. required String projectId,
  2. required String message,
  3. required List<Map<String, String>> actions,
  4. String branch = 'master',
})

Implementation

Future<Map<String, dynamic>?> makeCommit({
  required String projectId,
  required String message,
  required List<Map<String, String>> actions,
  String branch = 'master',
}) async {
  final body = {'branch': branch, 'commit_message': message, 'actions': actions};
  final response = await _httpPostRequest(jsonEncode(body), 'projects/$projectId/repository/commits');

  if (httpSuccess(response.statusCode)) {
    return jsonDecode(response.body) as Map<String, dynamic>;
  } else {
    print(response.body);
    print('Making commit failed. Statuscode: ${response.statusCode} Reason: ${response.reasonPhrase}');
  }
  return null;
}