Versions in this module Expand all Collapse all v1 v1.1.0 Dec 26, 2025 v1.0.0 Dec 26, 2025 Changes in this version + const DefaultMaxRetries + const DefaultRetryWait + const DefaultTimeout + var ErrBadRequest = errors.New("bad request") + var ErrForbidden = errors.New("permission denied") + var ErrNotFound = errors.New("resource not found") + var ErrRateLimited = errors.New("rate limit exceeded") + var ErrServerError = errors.New("server error") + var ErrUnauthorized = errors.New("authentication failed") + func IsForbidden(err error) bool + func IsNotFound(err error) bool + func IsRateLimited(err error) bool + func IsRetryable(err error) bool + func IsUnauthorized(err error) bool + type APIError struct + Endpoint string + Message string + RequestID string + Service string + StatusCode int + func (e *APIError) Error() string + func (e *APIError) Unwrap() error + type AuthError struct + Reason string + Service string + func (e *AuthError) Error() string + func (e *AuthError) Unwrap() error + type Client struct + func NewClient(cfg ClientConfig) *Client + func (c *Client) Delete(ctx context.Context, path string) error + func (c *Client) Get(ctx context.Context, path string, result any) error + func (c *Client) GetRaw(ctx context.Context, path string) ([]byte, error) + func (c *Client) Post(ctx context.Context, path string, body, result any) error + func (c *Client) Put(ctx context.Context, path string, body, result any) error + func (c *Client) Request(ctx context.Context, method, path string, body any) (*http.Response, error) + func (c *Client) RequestWithHeaders(ctx context.Context, method, path string, body any, headers map[string]string) (*http.Response, error) + type ClientConfig struct + BaseURL string + BeforeRequest func(req *http.Request) + Client *http.Client + MaxRetries int + RetryWait time.Duration + ServiceName string + type PageFetcher func(ctx context.Context, page int) (items []T, hasMore bool, err error) + type PageIterator struct + func NewPageIterator[T any](fetch PageFetcher[T]) *PageIterator[T] + func (p *PageIterator[T]) All(ctx context.Context) ([]T, error) + func (p *PageIterator[T]) Err() error + func (p *PageIterator[T]) Fetched() int + func (p *PageIterator[T]) ForEach(ctx context.Context, fn func(T) error) error + func (p *PageIterator[T]) Next(ctx context.Context) (T, bool, error) + func (p *PageIterator[T]) Reset() + func (p *PageIterator[T]) SetTotal(total int) + func (p *PageIterator[T]) Skip(ctx context.Context, n int) error + func (p *PageIterator[T]) Take(ctx context.Context, n int) ([]T, error) + func (p *PageIterator[T]) Total() int + type RateLimitError struct + Limit int + Remaining int + RetryAfter time.Duration + Service string + func (e *RateLimitError) Error() string + func (e *RateLimitError) Unwrap() error + type ValidationError struct + Field string + Message string + Service string + func (e *ValidationError) Error() string + func (e *ValidationError) Unwrap() error