add variable and method comments
This commit is contained in:
@@ -25,12 +25,14 @@ const (
|
||||
staffHeaderValue = "true"
|
||||
)
|
||||
|
||||
// DefaultHTTPClient is the default http client used if no client is provided.
|
||||
var DefaultHTTPClient = &http.Client{
|
||||
Timeout: defaultHTTPTimeout,
|
||||
}
|
||||
|
||||
var _ providers.Provider = &Client{}
|
||||
|
||||
// Client is the client to interact with the equinix metal api.
|
||||
type Client struct {
|
||||
logger *zap.SugaredLogger
|
||||
httpClient *http.Client
|
||||
@@ -39,6 +41,8 @@ type Client struct {
|
||||
consumerToken string
|
||||
}
|
||||
|
||||
// Do executes the provided request.
|
||||
// If the out value is provided, the response will attempt to be json decoded.
|
||||
func (c *Client) Do(req *http.Request, out any) (*http.Response, error) {
|
||||
if c.authToken != "" {
|
||||
req.Header.Set(authHeader, c.authToken)
|
||||
@@ -68,6 +72,7 @@ func (c *Client) Do(req *http.Request, out any) (*http.Response, error) {
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// DoRequest creates a new request from the provided parameters and executes the request.
|
||||
func (c *Client) DoRequest(ctx context.Context, method, path string, body io.Reader, out any) (*http.Response, error) {
|
||||
path = strings.TrimPrefix(path, c.baseURL.Path)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user