createIssues method

Future<SuccessfulStatus> createIssues(
  1. List<Todo> todos,
  2. Configuration configuration
)

Implementation

Future<SuccessfulStatus> createIssues(
    List<Todo> todos, Configuration configuration) async {
  int issueCounter = 0;

  for (Todo todo in todos) {
    if (!todo.wasPosted) {
      HttpResponse response =
          await _openSourcePlatform.createIssue(todo, configuration);

      if (response.statusCode != 201) handleErrorStatusCode(response);

      issueCounter++;
      sleep(Duration(seconds: 2));
    }
  }
  return SuccessfulStatus(issueCounter);
}