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