add variable and method comments
This commit is contained in:
@@ -21,6 +21,7 @@ var defaultHTTPClient = &http.Client{
|
||||
Timeout: 5 * time.Second,
|
||||
}
|
||||
|
||||
// Client is the permissions client.
|
||||
type Client struct {
|
||||
logger *zap.SugaredLogger
|
||||
|
||||
@@ -32,6 +33,8 @@ type Client struct {
|
||||
allowURL *url.URL
|
||||
}
|
||||
|
||||
// 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.token != "" {
|
||||
req.Header.Set(echo.HeaderAuthorization, "Bearer "+c.token)
|
||||
@@ -55,6 +58,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