Skip to content

Commit

Permalink
More doc tweaks to GettingStarted
Browse files Browse the repository at this point in the history
Change-Id: I4f6b9e27c5c897509b63ea166bbb85b2f6b089f9
Reviewed-on: https://code-review.googlesource.com/4242
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
  • Loading branch information
bradfitz committed Mar 2, 2016
1 parent a1a3189 commit 9dd1471
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions GettingStarted.md
Expand Up @@ -42,7 +42,7 @@ import (
```

The package name, if you don't override it on your import line, is the name of the
API without the version number. In the case above, just `urlshortener`.
API without the version number. In the case above, just `urlshortener`.

## Instantiating

Expand Down Expand Up @@ -97,10 +97,14 @@ To do this, you can use
[transport.APIKey](https://godoc.org/google.golang.org/api/googleapi/transport#APIKey):

```go
ctx = context.WithValue(context.Background(), oauth2.HTTPClient, &http.Client{
ctx := context.WithValue(context.Background(), oauth2.HTTPClient, &http.Client{
Transport: &transport.APIKey{Key: developerKey},
})
httpClient := newOAuthClient(ctx, config)
oauthConfig := &oauth2.Config{ .... }
var token *oauth2.Token = .... // via cache, or oauthConfig.Exchange
httpClient := oauthConfig.Client(ctx, token)
svc, err := urlshortener.New(httpClient)
...
```

## Using the Service
Expand Down

0 comments on commit 9dd1471

Please sign in to comment.