Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow client creation from authorizing HTTP client #123

Merged
merged 1 commit into from
Apr 22, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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