listCheckSuitesForRef method

Stream<CheckSuite> listCheckSuitesForRef(
  1. RepositorySlug slug, {
  2. required String ref,
  3. int? appId,
  4. String? checkName,
})

Lists check suites for a commit [ref]. The [ref] can be a SHA, branch name, or a tag name. GitHub Apps must have the checks:read permission on a private repository or pull access to a public repository to list check suites. OAuth Apps and authenticated users must have the repo scope to get check suites in a private repository.

  • appId: Filters check suites by GitHub App id.
  • checkName: Filters checks suites by the name of the check run.

API docs: https://developer.github.com/v3/checks/suites/#list-check-suites-for-a-specific-ref

Implementation

Stream<CheckSuite> listCheckSuitesForRef(
  RepositorySlug slug, {
  required String ref,
  int? appId,
  String? checkName,
}) {
  ArgumentError.checkNotNull(ref);
  return PaginationHelper(github).objects<Map<String, dynamic>, CheckSuite>(
    'GET',
    'repos/$slug/commits/$ref/check-suites',
    CheckSuite.fromJson,
    preview: _previewHeader,
    params: createNonNullMap({
      'app_id': appId,
      'check_name': checkName,
    }),
    statusCode: StatusCodes.OK,
    arrayKey: 'check_suites',
  );
}