@ -1,14 +1,12 @@
# go-github #
# go-github #
go-github is Go library for accessing the [GitHub API][].
go-github is Go client library for accessing the [GitHub API][].
**Documentation:** < http: / / godoc . org / github . com / google / go-github / github >
**Documentation:** < http: / / godoc . org / github . com / google / go-github / github >
**Build Status:** [](https://travis-ci.org/google/go-github)
**Build Status:** [](https://travis-ci.org/google/go-github)
**Test Coverage:** [](https://coveralls.io/r/google/go-github?branch=master) ([gocov report](https://drone.io/github.com/google/go-github/files/coverage.html))
**Test Coverage:** [](https://coveralls.io/r/google/go-github?branch=master) ([gocov report](https://drone.io/github.com/google/go-github/files/coverage.html))
go-github requires Go version 1.1.
[issue-9]: https://github.com/google/go-github/issues/9
go-github requires Go version 1.1 or greater.
## Usage ##
## Usage ##
@ -26,8 +24,8 @@ orgs, _, err := client.Organizations.List("willnorris", nil)
```
```
Some API methods have optional parameters that can be passed. For example,
Some API methods have optional parameters that can be passed. For example,
to list repositories for org "github", sorted by the time they were last
updated:
to list repositories for the "github" organization, sorted by the time they
were last updated:
```go
```go
client := github.NewClient(nil)
client := github.NewClient(nil)
@ -35,12 +33,14 @@ opt := &github.RepositoryListByOrgOptions{Sort: "updated"}
repos, _, err := client.Repositories.ListByOrg("github", opt)
repos, _, err := client.Repositories.ListByOrg("github", opt)
```
```
### Authentication ###
The go-github library does not directly handle authentication. Instead, when
The go-github library does not directly handle authentication. Instead, when
creating a new client, pass an `http.Client` that can handle authentication for
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][]
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
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
`http.Client` . If you have an OAuth2 access token (for example, a [personal
API token][]), you can use it with the goauth2 library like the follow ing:
API token][]), you can use it with the goauth2 us ing:
```go
```go
t := & oauth.Transport{
t := & oauth.Transport{
@ -55,14 +55,13 @@ repos, _, err := client.Repositories.List("", nil)
See the [goauth2 docs][] for complete instructions on using that library.
See the [goauth2 docs][] for complete instructions on using that library.
Also note that when using an authenticated Client, all calls made by the client
will include the specified OAuth token. Therefore, authenticated clients should
almost never be shared between different users.
For complete usage of go-github, see the full [package docs][].
[GitHub API]: http://developer.github.com/v3/
[GitHub API]: http://developer.github.com/v3/
[goauth2]: https://code.google.com/p/goauth2/
[goauth2]: https://code.google.com/p/goauth2/
[goauth2 docs]: http://godoc.org/code.google.com/p/goauth2/oauth
[goauth2 docs]: http://godoc.org/code.google.com/p/goauth2/oauth
[personal API token]: https://github.com/blog/1509-personal-api-tokens
[personal API token]: https://github.com/blog/1509-personal-api-tokens
[package docs]: http://godoc.org/github.com/google/go-github/github
## Roadmap ##
## Roadmap ##
@ -70,13 +69,13 @@ almost never be shared between different users.
This library is being initially developed for an internal application at
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
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
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
[this Google spreadsheet][roadmap ]. Eventually, I would like to cover the entire
GitHub API, so contributions are of course [always welcome][contributing ]. The
calling pattern is pretty well established, so adding new methods is relatively
straightforward.
straightforward.
[this Google spreadsheet ]: https://docs.google.com/spreadsheet/ccc?key=0ApoVX4GOiXr-dGNKN1pObFh6ek1DR2FKUjBNZ1FmaEE& usp=sharing
[always welcome ]: CONTRIBUTING.md
[roadmap ]: https://docs.google.com/spreadsheet/ccc?key=0ApoVX4GOiXr-dGNKN1pObFh6ek1DR2FKUjBNZ1FmaEE& usp=sharing
[contributing ]: CONTRIBUTING.md
## License ##
## License ##