Expand documentation for NewClient
Also adds a reference to the godoc for the (now old) NewClient method.
This commit is contained in:
parent
014c98ed83
commit
e1575cffe0
|
@ -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
|
||||
|
||||
|
||||
|
|
7
godo.go
7
godo.go
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue