Versions in this module Expand all Collapse all v1 v1.0.0 Sep 23, 2026 Changes in this version + const DefaultBaseURL + const DefaultTolerance + const Version + var ErrFileTooLarge = errors.New("ifax: file exceeds 32 MB") + var ErrInsufficientCredits = &APIError + var ErrInvalidKey = &APIError + var ErrInvalidSignature = errors.New("ifax: webhook signature does not match") + var ErrMalformedSignatureHeader = errors.New("ifax: malformed X-Fax-Signature header") + var ErrNoAPIKey = errors.New("ifax: no API key (set IFAX_API_KEY)") + var ErrNotFound = &APIError + var ErrRateLimited = &APIError + var ErrTimestampOutsideTolerance = errors.New("ifax: webhook timestamp outside tolerance") + func IsInsufficientCredits(err error) bool + func IsNotFound(err error) bool + func IsRateLimited(err error) bool + func VerifyWebhook(secret, signatureHeader string, body []byte, tolerance time.Duration) error + type APIError struct + Code string + Message string + RetryAfter time.Duration + StatusCode int + func (e *APIError) Error() string + func (e *APIError) Is(target error) bool + type Account struct + BalanceCents int + CallbackSecretSet bool + DailyCap int + Email string + FaxesLast24h int + KeyPrefix string + MaxPages int + PriceCents int + RateLimitPerMin int + type Client struct + func New(apiKey string, opts ...Option) *Client + func NewFromEnv(opts ...Option) (*Client, error) + func (c *Client) GetFax(ctx context.Context, id string) (*Fax, error) + func (c *Client) ListFaxes(ctx context.Context, limit int) (*FaxList, error) + func (c *Client) Me(ctx context.Context) (*Account, error) + func (c *Client) Pricing(ctx context.Context) (*Pricing, error) + func (c *Client) SendFax(ctx context.Context, p *SendFaxParams) (*Fax, error) + type Event struct + Bitrate int + CompletedAt *time.Time + Error string + ID string + Mode string + Pages int + Status string + To string + func ParseEvent(body []byte) (*Event, error) + type Fax struct + Bitrate int + CompletedAt *time.Time + CreatedAt *time.Time + Error string + ID string + Mode string + Pages int + PriceCents int + Status string + To string + type FaxList struct + BalanceCents int + Data []Fax + type File struct + Filename string + func FileBytes(name string, b []byte) File + func FilePath(path string) File + func FileReader(name string, r io.Reader) File + type Option func(*Client) + func WithBaseURL(u string) Option + func WithHTTPClient(h *http.Client) Option + func WithMaxRetries(n int) Option + func WithTimeout(d time.Duration) Option + type Pricing struct + Callbacks bool + Countries []string + CoverAvailable bool + Currency string + IdempotencyHeader string + MaxPages int + MinCreditCents int + PriceCents int + type SendFaxParams struct + CallbackURL string + Cover bool + CoverText string + Files []File + IdempotencyKey string + RecipientCompany string + RecipientName string + SenderCompany string + SenderName string + SenderPhone string + To string