Versions in this module Expand all Collapse all v1 v1.2.0 Mar 8, 2026 Changes in this version + type ForbiddenError struct + Code int + Error string v1.1.0 Jul 25, 2025 v1.0.0 May 30, 2025 Changes in this version + var ErrApiKeyInvalid = errors.New("invalid api key") + var ErrNotFound = errors.New("resource not found") + var ErrRateLimited = errors.New("rate limit exceeded") + type APIError struct + Code int + Detail string + Errors []ErrorItem + Status int + Title string + func (a *APIError) GetError() ErrorItem + type ErrorItem struct + More map[string]any + Name string + Reason string + type HTTPAPI struct + APIKey string + BaseURL string + func NewHTTPAPI(baseURL, apiKey string, client ...*http.Client) (*HTTPAPI, error) + func (g *HTTPAPI) DeleteJSON(ctx context.Context, uri string, post interface{}, dest interface{}, ...) (interface{}, error) + func (g *HTTPAPI) GetJSON(ctx context.Context, uri string, dest interface{}, options ...ReqOptions) (interface{}, error) + func (g *HTTPAPI) PostJSON(ctx context.Context, uri string, post interface{}, dest interface{}, ...) (interface{}, error) + func (g *HTTPAPI) PutJSON(ctx context.Context, uri string, post interface{}, dest interface{}, ...) (interface{}, error) + func (g *HTTPAPI) Req(ctx context.Context, method string, uri string, postBody []byte, isJSON bool, ...) ([]byte, int, string, error) + func (g *HTTPAPI) ReqBuf(ctx context.Context, method string, uri string, buf []byte, dest interface{}, ...) (interface{}, error) + func (g *HTTPAPI) ReqJSON(ctx context.Context, method string, uri string, post interface{}, ...) (interface{}, error) + func (g *HTTPAPI) ResolveBase(base *url.URL, uri string) string + func (g *HTTPAPI) SetRateLimit(requestsPerMinute int) + type RateInfo struct + Limit int + Remaining int + Reset int64 + Resource string + RetryAfter int64 + Used int + type RateLimiter struct + func NewRateLimiter(requestsPerMinute int) *RateLimiter + func (r *RateLimiter) Allow() bool + func (r *RateLimiter) IsAllowed() (bool, time.Duration) + func (r *RateLimiter) RemainingTokens() float64 + func (r *RateLimiter) Wait(ctx context.Context) error + func (r *RateLimiter) WaitMaxDuration(ctx context.Context, maxWait time.Duration) error + type ReqOptions struct + Headers map[string]string + Params map[string]string