getReleaseByTagName method

Future<Release> getReleaseByTagName(
  1. RepositorySlug slug,
  2. String? tagName
)

Fetches a single release by the release tag name.

Throws a ReleaseNotFound exception if the release doesn't exist.

API docs: https://developer.github.com/v3/repos/releases/#get-a-release-by-tag-name

Implementation

Future<Release> getReleaseByTagName(
    RepositorySlug slug, String? tagName) async {
  return github.getJSON(
    '/repos/${slug.fullName}/releases/tags/$tagName',
    convert: (dynamic i) => Release.fromJson(i),
    statusCode: StatusCodes.OK,
    fail: (http.Response response) {
      if (response.statusCode == 404) {
        throw ReleaseNotFound.fromTagName(github, tagName);
      }
    },
  );
}