Rename New API methods to New and NewDefault
This commit is contained in:
		
							parent
							
								
									f068cfdd73
								
							
						
					
					
						commit
						a20643bfc1
					
				
							
								
								
									
										2
									
								
								api.go
								
								
								
								
							
							
						
						
									
										2
									
								
								api.go
								
								
								
								
							| 
						 | 
				
			
			@ -3,5 +3,5 @@ package twitch
 | 
			
		|||
import "go.fifitido.net/twitch/api"
 | 
			
		||||
 | 
			
		||||
func NewAPI() *api.API {
 | 
			
		||||
	return api.New()
 | 
			
		||||
	return api.NewDefault()
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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)
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue