pip compatible server to serve Python packages out of GitHub
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
ttacon f9fd615479 Add ListContributorsStats and ListCommitActivity for RepositoriesService 12 years ago
examples split examples into separate directories 12 years ago
github Add ListContributorsStats and ListCommitActivity for RepositoriesService 12 years ago
.gitignore fix .gitignore 13 years ago
.travis.yml travis: test on go 1.2 and tip 12 years ago
AUTHORS add Trey Tacon as contributor 12 years ago
CONTRIBUTING.md minor cleanup from file refactor 13 years ago
CONTRIBUTORS add Trey Tacon as contributor 12 years ago
LICENSE include full text of creative commons license 12 years ago
README.md update documentation 12 years ago

README.md

go-github

go-github is Go client library for accessing the GitHub API.

Documentation: http://godoc.org/github.com/google/go-github/github
Build Status: Build Status
Test Coverage: Test Coverage (gocov report)

go-github requires Go version 1.1 or greater.

Usage

import "github.com/google/go-github/github"

Construct a new GitHub client, then use the various services on the client to access different parts of the GitHub API. For example, to list all organizations for user "willnorris":

client := github.NewClient(nil)
orgs, _, err := client.Organizations.List("willnorris", nil)

Some API methods have optional parameters that can be passed. For example, to list repositories for the "github" organization, sorted by the time they were last updated:

client := github.NewClient(nil)
opt := &github.RepositoryListByOrgOptions{Sort: "updated"}
repos, _, err := client.Repositories.ListByOrg("github", opt)

Authentication

The go-github library does not directly handle authentication. Instead, when creating a new client, pass an http.Client that can handle authentication for you. The easiest and recommended way to do this is using the goauth2 library, but you can always use any other library that provides an http.Client. If you have an OAuth2 access token (for example, a personal API token), you can use it with the goauth2 using:

t := &oauth.Transport{
  Token: &oauth.Token{AccessToken: "... your access token ..."},
}

client := github.NewClient(t.Client())

// list all repositories for the authenticated user
repos, _, err := client.Repositories.List("", nil)

See the goauth2 docs for complete instructions on using that library.

For complete usage of go-github, see the full package docs.

Roadmap

This library is being initially developed for an internal application at Google, so API methods will likely be implemented in the order that they are needed by that application. You can track the status of implementation in this Google spreadsheet. Eventually, I would like to cover the entire GitHub API, so contributions are of course always welcome. The calling pattern is pretty well established, so adding new methods is relatively straightforward.

License

This library is distributed under the BSD-style license found in the LICENSE file.