From a20643bfc122ee857ddf82d3e60058f2e0c3558c Mon Sep 17 00:00:00 2001 From: Evan Fiordeliso Date: Sun, 3 Mar 2024 16:50:13 -0500 Subject: [PATCH] Rename New API methods to New and NewDefault --- api.go | 2 +- api/api.go | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/api.go b/api.go index 0c9af44..aeafd25 100644 --- a/api.go +++ b/api.go @@ -3,5 +3,5 @@ package twitch import "go.fifitido.net/twitch/api" func NewAPI() *api.API { - return api.New() + return api.NewDefault() } diff --git a/api/api.go b/api/api.go index 65e6c80..06d3fd0 100644 --- a/api/api.go +++ b/api/api.go @@ -58,9 +58,7 @@ type API struct { Search *search.Search } -func NewWithClient(client *http.Client) *API { - baseUrl, _ := url.Parse(HelixBaseUrl) - +func New(client *http.Client, baseUrl *url.URL) *API { return &API{ client: client, baseUrl: baseUrl, @@ -90,8 +88,9 @@ func NewWithClient(client *http.Client) *API { } } -func New() *API { +func NewDefault() *API { client := &http.Client{} + baseUrl, _ := url.Parse(HelixBaseUrl) - return NewWithClient(client) + return New(client, baseUrl) }