updatePreferencesForCheckSuites method

Future<List<AutoTriggerChecks>> updatePreferencesForCheckSuites(
  1. RepositorySlug slug, {
  2. required List<AutoTriggerChecks> autoTriggerChecks,
})

Changes the default automatic flow when creating check suites. By default, the CheckSuiteEvent is automatically created each time code is pushed to a repository. When you disable the automatic creation of check suites, you can manually Create a check suite. You must have admin permissions in the repository to set preferences for check suites.

  • autoTriggerChecks: Enables or disables automatic creation of CheckSuite events upon pushes to the repository. Enabled by default.

API docs: https://developer.github.com/v3/checks/suites/#update-repository-preferences-for-check-suites

Implementation

Future<List<AutoTriggerChecks>> updatePreferencesForCheckSuites(
  RepositorySlug slug, {
  required List<AutoTriggerChecks> autoTriggerChecks,
}) {
  ArgumentError.checkNotNull(autoTriggerChecks);
  return github.requestJson<Map<String, dynamic>, List<AutoTriggerChecks>>(
    'PATCH',
    'repos/$slug/check-suites/preferences',
    statusCode: StatusCodes.OK,
    preview: _previewHeader,
    body: {'auto_trigger_checks': autoTriggerChecks},
    convert: (input) => (input['preferences']['auto_trigger_checks'] as List)
        .cast<Map<String, dynamic>>()
        .map(AutoTriggerChecks.fromJson)
        .toList(),
  );
}