Skip to content

Commit

Permalink
Expand documentation for NewClient
Browse files Browse the repository at this point in the history
Also adds a reference to the godoc for the (now old) NewClient method.
  • Loading branch information
bentranter committed Mar 16, 2020
1 parent 014c98e commit e1575cf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ func main() {
}
```

If you need to provide a `context.Context` to your new client, you should use [`godo.NewClient`](https://godoc.org/github.com/digitalocean/godo#NewClient) to manually construct a client instead.

## Examples


Expand Down
7 changes: 6 additions & 1 deletion godo.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,12 @@ func NewFromToken(token string) *Client {
return NewClient(oauth2.NewClient(ctx, ts))
}

// NewClient returns a new DigitalOcean API client.
// NewClient returns a new DigitalOcean API client, using the given
// http.Client to perform all requests.
//
// Users who wish to pass their own http.Client should use this method. If
// you're in need of further customization, the godo.New method allows more
// options, such as setting a custom URL or a custom user agent string.
func NewClient(httpClient *http.Client) *Client {
if httpClient == nil {
httpClient = http.DefaultClient
Expand Down

0 comments on commit e1575cf

Please sign in to comment.