Documentation
¶
Index ¶
Constants ¶
const DefaultEndpoint = "https://api.threatwinds.com"
DefaultEndpoint is the default ThreatWinds API base URL.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIError struct {
StatusCode int `json:"status_code"`
Method string `json:"-"`
Path string `json:"-"`
Message string `json:"message"`
ErrorID string `json:"error_id"`
Body []byte `json:"-"`
// contains filtered or unexported fields
}
APIError is returned when an API call results in a 4xx or 5xx response. It implements the error interface.
func (*APIError) IsForbidden ¶
func (*APIError) IsNotFound ¶
func (*APIError) IsRateLimited ¶
func (*APIError) IsUnauthorized ¶
func (*APIError) IsValidationError ¶
func (*APIError) RetryAfter ¶
RetryAfter returns the Retry-After header value stored on the error, used by the retry logic to determine backoff duration.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the root entry point for the ThreatWinds API SDK.
func New ¶
New creates a configured API client. At least one authentication option (WithAPIKey or WithBearer) must be provided, but not both.
func (*Client) Close ¶
func (c *Client) Close()
Close releases idle HTTP connections held by the SDK's internal transport. It is a no-op when the caller supplied their own http.Client via WithHTTPClient. Callers should invoke Close() when they are done with the client to avoid leaking TCP connections in long-running processes.
type ListOptions ¶
ListOptions holds pagination parameters for list endpoints.
type Option ¶
type Option func(*clientConfig)
Option configures a Client via the functional options pattern.
func WithAPIKey ¶
WithAPIKey sets API key authentication (key ID + secret).
func WithHTTPClient ¶
WithHTTPClient sets a custom HTTP client.
func WithMaxRetries ¶
WithMaxRetries sets the maximum number of retry attempts.
func WithTimeout ¶
WithTimeout sets the HTTP request timeout.