julia> Pkg.add("GitHub")
julia> using GitHub
julia> my_auth = authenticate("an_access_token_for_your_account")
GitHub Authorization (8caaff**********************************)
julia> star("JuliaWeb", "GitHub.jl"; auth = my_auth) # :)
julia> stargazers("JuliaWeb", "GitHub.jl")
All API methods accept a named parameter auth
of type GitHub.Authorization
. By default, this parameter will be an instance of AnonymousAuth
, and the API request will be made without any privileges.
If you would like to make requests as an authorized user, you need to authenticate
.
authenticate(token::String)
token
is an "access token" which you can read about generating here
The User
type is used to represent GitHub accounts. It contains lots of interesting information about an account, and can be used in other API requests.
user(username; auth = AnonymousAuth())
username
is the GitHub login- if you provide
auth
potentially much more user information will be returned
followers(user::String)
followers(user::User)
following(user::String)
following(user::User)
user
is either a GitHub login orUser
type- the returned data will be an array of
User
types
Organizations let multiple users manage repositories together.
org(name; auth = AnonymousAuth())
name
is the GitHub organization login name
orgs(user::String; auth = AnonymousAuth())
user
is the GitHub account about which you are curious
The Repo
type is used to represent a repository hosted by GitHub. It contains all sorts of useful information about a repositories usage and history.
repo(owner, repo_name; auth = AnonymousAuth())
owner
is the GitHub login of theUser
orOrganization
that manages the reporepo_name
is the repositories name on GitHub
repos(owner::Owner; auth = AnonymousAuth(),
typ = nothing,
sort = nothing,
direction = nothing)
owner
is aUser
orOrganization
typ
is "all", "member", or "owner" (the default) for Usertyp
is "all" (the default), "public", "private", "forks", "sources", or "member".sort
is "created", "updated", "pushed", or "full_name" (the default).direction
is "asc" or "desc" (the default).
contributors(owner, repo; auth = AnonymousAuth()
include_anon = false)
owner
is the GitHub login of theUser
orOrganization
that manages the reporepo
is the repositories name on GitHubinclude_anon
will tell GitHub to include anonymous contributions
Repository statistics are interesting bits of information about activity. GitHub caches this data when possible, but sometimes a request will trigger regeneration and come back empty. For this reason all statistics functions have an argument attempts
which will be the number of tries made before admitting defeat.
contributor_stats(owner, repo, attempts = 3; auth = AnonymousAuth())
commit_activity(owner, repo, attempts = 3; auth = AnonymousAuth())
code_frequency(owner, repo, attempts = 3; auth = AnonymousAuth())
participation(owner, repo, attempts = 3; auth = AnonymousAuth())
punch_card(owner, repo, attempts = 3; auth = AnonymousAuth())
owner
is a GitHub loginrepo
is a repository nameattempts
is the number of tries made before admitting defeat
forks(owner, repo; auth = AnonymousAuth())
fork(owner, repo, organization = ""; auth = AnonymousAuth())
owner
is a GitHub loginrepo
is a repository name
stargazers(owner, repo; auth = AnonymousAuth())
starred(user; auth = AnonymousAuth())
star(owner, repo; auth = AnonymousAuth())
unstar(owner, repo; auth = AnonymousAuth())
owner
is a GitHub loginrepo
is a repository nameuser
is a GitHub login
watchers(owner, repo; auth = AnonymousAuth())
watched(user; auth = AnonymousAuth())
watching(owner, repo; auth = AnonymousAuth())
watch(owner, repo; auth = AnonymousAuth())
unwatch(owner, repo; auth = AnonymousAuth())
owner
is a GitHub loginrepo
is a repository nameuser
is a GitHub login
Collaborators are users that work together and share access to a repository.
collaborators(owner, repo; auth = AnonymousAuth())
iscollaborator(owner, repo, user; auth = AnonymousAuth())
add_collaborator(owner, repo, user; auth = AnonymousAuth()
remove_collaborator(owner, repo, user; auth = AnonymousAuth())
owner
is a GitHub loginrepo
is a repository nameuser
is the GitHub login being inspected, added, or removed
julia> using GitHub
julia> collaborators("JuliaLang","Julia")
26-element Array{Any,1}:
User - amitmurthy
User - andreasnoackjensen
⋮
User - tshort
User - vtjnash
julia> o = org("JuliaLang")
User - JuliaLang (The Julia Language, http://julialang.org/)
julia> collaborators(o,"julia")
26-element Array{Any,1}:
User - amitmurthy
User - andreasnoackjensen
⋮
User - tshort
User - vtjnash
julia> r = repo("JuliaLang","julia")
Repo - JuliaLang/julia (http://julialang.org/)
"The Julia Language: A fresh approach to technical computing."
julia> collaborators(r)
26-element Array{Any,1}:
User - amitmurthy
User - andreasnoackjensen
⋮
User - tshort
User - vtjnash
The Issue
type is used to represent issues and pull requests made against repositories.
issue(owner, repo, num; auth = AnonymousAuth())
owner
is a GitHub login orUser
typerepo
is the name of a repositorynum
is the issue numer
issues(owner, repo; auth = AnonymousAuth(),
milestone = nothing,
state = nothing,
assignee = nothing,
creator = nothing,
mentioned = nothing,
labels = nothing,
sort = nothing,
direction = nothing,
since = nothing)
owner
is a GitHub login orUser
typerepo
is a repository namemilestone
can be an int or string ("*" matches all milestones, "none" returns issues with no milestone)state
can be "open" or "closed"assignee
can be the name of a user ("*" matches all users, "none" returns issues with no assignee)creator
can be the user that created the issuementioned
is for any user mentioned in the issuelabels
is an array of labels to matchsort
can be "created", "updated", or "comments" (defaults to "created")direction
can be "asc" or "desc" (defaults to "desc")since
can be an ISO 8601 format (YYYY-MM-DDTHH:MM:SSZ) string
create_issue(owner, repo, title; auth = AnonymousAuth(),
body = nothing,
assignee = nothing,
milestone = nothing,
labels = nothing)
owner
is a GitHub login orUser
typerepo
is a repository nametitle
is the title of your new issuebody
can be a text description of your issueassignee
is a GitHub loginmilestone
is the milestone numberlabels
is an array of label strings
edit_issue(owner, repo, num; auth = AnonymousAuth(),
title = nothing,
body = nothing,
assignee = nothing,
state = nothing,
milestone = nothing,
labels = nothing)
owner
is a GitHub login orUser
typerepo
is a repository namenum
is the issue numbertitle
can be a new title for the issuebody
can be a new body for the issueassignee
can be the new assigneestate
can be "open" or "closed"milestone
can be the milestone numberlabels
can be an array of label strings
The Comment
type is used to represent comments on Github issues.
comments(owner, repo, num; auth = AnonymousAuth())
owner
is a GitHub login orUser
typerepo
is a repository namenum
is the issue number