Skip to content

Commit

Permalink
Allow client creation from an existing http.Client
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyDWJones committed Apr 22, 2020
1 parent 158b186 commit e484766
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion spotify.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,24 @@ const (
const baseAddress = "https://api.spotify.com/v1/"

// Client is a client for working with the Spotify Web API.
// To create an authenticated client, use the `Authenticator.NewClient` method.
// It is created by `NewClient` and `Authenticator.NewClient`.
type Client struct {
http *http.Client
baseURL string

AutoRetry bool
}

// NewClient returns a client for working with the Spotify Web API.
// The provided HTTP client must include the user's access token in each request;
// if you do not have such a client, use the `Authenticator.NewClient` method instead.
func NewClient(client *http.Client) Client {
return Client{
http: client,
baseURL: baseAddress,
}
}

// URI identifies an artist, album, track, or category. For example,
// spotify:track:6rqhFgbbKwnb9MLmUQDhG6
type URI string
Expand Down

0 comments on commit e484766

Please sign in to comment.