github :: GithubAPI :: get_branch
name
.Returns null
if the branch cannot be found.
var api = new GithubAPI(get_github_oauth)
var repo = api.get_repo("nitlang/nit")
assert repo != null
var branch = api.get_branch(repo, "master")
assert branch.name == "master"
assert branch.commit isa Commit
# Get the Github branch with `name`.
#
# Returns `null` if the branch cannot be found.
#
# ~~~nitish
# var api = new GithubAPI(get_github_oauth)
# var repo = api.get_repo("nitlang/nit")
# assert repo != null
# var branch = api.get_branch(repo, "master")
# assert branch.name == "master"
# assert branch.commit isa Commit
# ~~~
fun get_branch(repo_slug: String, name: String): nullable Branch do
return get("/repos/{repo_slug}/branches/{name}").as(nullable Branch)
end
lib/github/api.nit:275,2--289,4