Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPClient ¶
type HTTPClient struct {
Client *http.Client
BaseURL string
Timeout time.Duration
UserAgent string
}
HTTPClient is a struct for configuring the HTTP client.
func NewHTTPClient ¶
func NewHTTPClient(baseURL string, timeout time.Duration, userAgent string) *HTTPClient
NewHTTPClient creates a new HTTPClient with default configurations.
func (*HTTPClient) Request ¶
func (c *HTTPClient) Request(method, endpoint string, headers map[string]string, reqBody interface{}, respBody interface{}) error
Request sends an HTTP request with the specified method, headers, request body, and response structure.
func (*HTTPClient) SetTimeout ¶
func (c *HTTPClient) SetTimeout(timeout time.Duration)
SetTimeout sets the timeout for the HTTP client.
func (*HTTPClient) SetUserAgent ¶
func (c *HTTPClient) SetUserAgent(userAgent string)
SetUserAgent sets the User-Agent header for the HTTP client.
Click to show internal directories.
Click to hide internal directories.