listReferences method

Stream<GitReference> listReferences(
  1. RepositorySlug slug, {
  2. String? type,
})

Lists the references in a repository.

This will return all references on the system, including things like notes and stashes if they exist on the server. A sub-namespace can be requested by specifying a type, the most common being "heads" and "tags".

API docs: https://developer.github.com/v3/git/refs/#get-all-references

Implementation

Stream<GitReference> listReferences(RepositorySlug slug, {String? type}) {
  var path = '/repos/${slug.fullName}/git/refs';
  if (type != null) {
    path += '/$type';
  }

  return PaginationHelper(github)
      .objects('GET', path, (dynamic i) => GitReference.fromJson(i));
}