From 509b36e85ffd7331405b24f806627261bd76c104 Mon Sep 17 00:00:00 2001 From: Bradley Falzon Date: Fri, 26 May 2017 13:26:25 +0930 Subject: [PATCH] Add link to GitHub Apps authentication package in docs. --- README.md | 20 ++++++++++++++++++++ github/doc.go | 18 ++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/README.md b/README.md index e3ca4403a9d..9c12172b57e 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,26 @@ See the [oauth2 docs][] for complete instructions on using that library. For API methods that require HTTP Basic Authentication, use the [`BasicAuthTransport`](https://godoc.org/github.com/google/go-github/github#BasicAuthTransport). +GitHub Apps authentication can be provided by the [ghinstallation](https://github.com/bradleyfalzon/ghinstallation) +package. + +```go +import "github.com/bradleyfalzon/ghinstallation" + +func main() { + // Wrap the shared transport for use with the integration ID 1 authenticating with installation ID 99. + itr, err := ghinstallation.NewKeyFromFile(http.DefaultTransport, 1, 99, "2016-10-19.private-key.pem") + if err != nil { + // Handle error. + } + + // Use installation transport with client. + client := github.NewClient(&http.Client{Transport: itr}) + + // Use client... +} +``` + ### Rate Limiting ### GitHub imposes a rate limit on all API clients. Unauthenticated clients are diff --git a/github/doc.go b/github/doc.go index 08e86d996dd..abbcf6406f4 100644 --- a/github/doc.go +++ b/github/doc.go @@ -63,6 +63,24 @@ See the oauth2 docs for complete instructions on using that library. For API methods that require HTTP Basic Authentication, use the BasicAuthTransport. +GitHub Apps authentication can be provided by the +https://github.com/bradleyfalzon/ghinstallation package. + + import "github.com/bradleyfalzon/ghinstallation" + + func main() { + // Wrap the shared transport for use with the integration ID 1 authenticating with installation ID 99. + itr, err := ghinstallation.NewKeyFromFile(http.DefaultTransport, 1, 99, "2016-10-19.private-key.pem") + if err != nil { + // Handle error. + } + + // Use installation transport with client + client := github.NewClient(&http.Client{Transport: itr}) + + // Use client... + } + Rate Limiting GitHub imposes a rate limit on all API clients. Unauthenticated clients are