Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIClient ¶
type APIClient struct {
BaseURL string
HTTPClient *http.Client
// contains filtered or unexported fields
}
APIClient represents the HTTP client.
func NewAPIClient ¶
func NewAPIClient(baseURL string, token string, config APIClientConfig) *APIClient
NewAPIClient initializes a new API client.
func (*APIClient) MakeRequest ¶
func (c *APIClient) MakeRequest(params RequestParams) (*APIResponse, error)
MakeRequest performs an HTTP request and returns the response.
type APIClientConfig ¶
type APIClientConfig struct {
MaxIdleConns int
MaxIdleConnsPerHost int
MaxConnsPerHost int
IdleConnTimeout time.Duration
TLSHandshakeTimeout time.Duration
ExpectContinueTimeout time.Duration
DisableKeepAlives bool
DialTimeout time.Duration
DialKeepAlive time.Duration
RequestTimeout time.Duration
}
APIClientConfig holds the configuration values for the API client.
func DefaultAPIClientConfig ¶
func DefaultAPIClientConfig() APIClientConfig
DefaultAPIClientConfig returns the default configuration for the API client.
type APIResponse ¶
type APIResponse struct {
StatusCode int // HTTP status code
Headers http.Header // Response headers
Body []byte // Raw response body
}
APIResponse represents a generic API response.
type ErrorResponse ¶
ErrorResponse represents a structured error response.
func ParseError ¶
func ParseError(responseBody []byte) (*ErrorResponse, error)
ParseError attempts to parse a JSON error response.
type RequestParams ¶
type RequestParams struct {
Method string // HTTP method (GET, POST, PUT, etc.)
Path string // API endpoint path
Headers map[string]string // HTTP headers
QueryParams map[string]string // Query parameters
Body interface{} // Request body
}
RequestParams defines the input parameters for making an API request.
Click to show internal directories.
Click to hide internal directories.