Rename New API methods to New and NewDefault

This commit is contained in:
Evan Fiordeliso 2024-03-03 16:50:13 -05:00
parent f068cfdd73
commit a20643bfc1
2 changed files with 5 additions and 6 deletions

2
api.go
View File

@ -3,5 +3,5 @@ package twitch
import "go.fifitido.net/twitch/api" import "go.fifitido.net/twitch/api"
func NewAPI() *api.API { func NewAPI() *api.API {
return api.New() return api.NewDefault()
} }

View File

@ -58,9 +58,7 @@ type API struct {
Search *search.Search Search *search.Search
} }
func NewWithClient(client *http.Client) *API { func New(client *http.Client, baseUrl *url.URL) *API {
baseUrl, _ := url.Parse(HelixBaseUrl)
return &API{ return &API{
client: client, client: client,
baseUrl: baseUrl, baseUrl: baseUrl,
@ -90,8 +88,9 @@ func NewWithClient(client *http.Client) *API {
} }
} }
func New() *API { func NewDefault() *API {
client := &http.Client{} client := &http.Client{}
baseUrl, _ := url.Parse(HelixBaseUrl)
return NewWithClient(client) return New(client, baseUrl)
} }