feat(go): IO layer behind interfaces (M4) #13
@@ -4,6 +4,7 @@ package fio
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -29,7 +30,11 @@ type Client interface {
|
||||
}
|
||||
|
||||
// New returns an apiClient when token is non-empty, otherwise a transparentClient.
|
||||
// hc may be nil, in which case http.DefaultClient is used.
|
||||
func New(token, accountNum string, hc httpDoer) Client {
|
||||
if hc == nil {
|
||||
hc = http.DefaultClient
|
||||
}
|
||||
if token != "" {
|
||||
return &apiClient{token: token, hc: hc}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user