Versions in this module Expand all Collapse all v0 v0.3.32 Nov 26, 2026 v0.3.31 Nov 24, 2026 v0.3.30 Nov 24, 2026 Changes in this version + const DefaultWebhookTolerance + const Version + var ErrInvalidSignature = errors.New("formfeed: invalid webhook signature") + func Ptr[T any](v T) *T + func VerifyWebhook(secret, signatureHeader string, body []byte) bool + type AccountService struct + func (s *AccountService) Get(ctx context.Context) (map[string]any, error) + func (s *AccountService) Usage(ctx context.Context, period string) (*Usage, error) + type BatchRequest struct + CanaryKey string + Extra map[string]any + Items []RenderRequest + Meta map[string]any + Output string + Template string + WebhookSecret string + WebhookURL string + Zip bool + func (r BatchRequest) MarshalJSON() ([]byte, error) + type CallOption func(*callConfig) + func WithIdempotencyKey(key string) CallOption + type Client struct + Account *AccountService + Einvoices *EinvoicesService + Files *FilesService + Jobs *JobsService + PDF *PDFService + Renders *RendersService + Templates *TemplatesService + Webhooks *WebhooksService + func NewClient(apiKey string, opts ...Option) *Client + func (c *Client) Request(ctx context.Context, method, path string, body, out any, opts ...CallOption) error + type CompressRequest struct + Access string + ExpiresIn int + Extra map[string]any + File *Upload + Filename string + Meta map[string]any + Source string + Storage any + func (r CompressRequest) MarshalJSON() ([]byte, error) + type ConvertRequest struct + Access string + ExpiresIn int + Extra map[string]any + File *Upload + Filename string + Landscape bool + Meta map[string]any + PageRanges string + SinglePageSheets bool + Source string + Storage any + func (r ConvertRequest) MarshalJSON() ([]byte, error) + type CreateWebhookRequest struct + Description string + Environments []string + Events []string + Extra map[string]any + URL string + func (r CreateWebhookRequest) MarshalJSON() ([]byte, error) + type Diagnostic struct + Code string + Location ... + Message string + Paragraph int + Part string + Path string + Severity string + type EinvoiceReport struct + Checks []struct{ ... } + Explanation string + ID string + PDFSHA256 string + Profile string + Raw json.RawMessage + Reason string + Result string + Rules string + Scenario string + Truncated bool + ValidatedAt string + Validator string + Versions map[string]string + XMLSHA256 string + func (r *EinvoiceReport) UnmarshalJSON(data []byte) error + type EinvoicesService struct + func (s *EinvoicesService) Validate(ctx context.Context, req ValidateEinvoiceRequest, opts ...CallOption) (*EinvoiceReport, error) + type Error struct + Code string + Err error + Message string + Problem *Problem + RequestID string + Status int + func (e *Error) Error() string + func (e *Error) Unwrap() error + type FileListOptions struct + Cursor string + Limit int + Prefix string + type FilesService struct + func (s *FilesService) All(ctx context.Context, opts FileListOptions) iter.Seq2[*LibraryFile, error] + func (s *FilesService) Delete(ctx context.Context, idOrName string) error + func (s *FilesService) Get(ctx context.Context, idOrName string) (*LibraryFile, error) + func (s *FilesService) List(ctx context.Context, opts FileListOptions) (*Page[LibraryFile], error) + func (s *FilesService) Upload(ctx context.Context, file *Upload) (*LibraryFile, error) + type FillRequest struct + Access string + ExpiresIn int + Extra map[string]any + Fields map[string]any + File *Upload + Filename string + Flatten bool + Meta map[string]any + Source string + Storage any + Strict *bool + func (r FillRequest) MarshalJSON() ([]byte, error) + type FormFill struct + Filled int + Skipped []struct{ ... } + Warnings []struct{ ... } + XFARemoved bool + type InfoRequest struct + Extra map[string]any + File *Upload + Source string + func (r InfoRequest) MarshalJSON() ([]byte, error) + type Job struct + CompletedAt string + CreatedAt string + Failed int + ID string + Items []Render + Meta map[string]any + Raw json.RawMessage + Status string + Storage *StorageDelivery + Succeeded int + Total int + Type string + ZipExpiresAt string + ZipURL string + func (j *Job) Finished() bool + func (j *Job) UnmarshalJSON(data []byte) error + type JobsService struct + func (s *JobsService) Get(ctx context.Context, id string) (*Job, error) + func (s *JobsService) WaitFor(ctx context.Context, id string, opts ...WaitOption) (*Job, error) + type LibraryFile struct + Bytes int64 + ContentType string + CreatedAt string + ID string + Name string + Raw json.RawMessage + SHA256 string + URL string + UpdatedAt string + func (f *LibraryFile) UnmarshalJSON(data []byte) error + type MergeRequest struct + Access string + ExpiresIn int + Extra map[string]any + Filename string + Meta map[string]any + Sources []string + Storage any + func (r MergeRequest) MarshalJSON() ([]byte, error) + type Option func(*clientConfig) + func WithBaseURL(baseURL string) Option + func WithHTTPClient(client *http.Client) Option + func WithHeader(name, value string) Option + func WithJitter(jitter func() time.Duration) Option + func WithMaxRetries(n int) Option + func WithRegion(region string) Option + func WithSleep(sleep func(ctx context.Context, d time.Duration) error) Option + func WithTimeout(d time.Duration) Option + type PDFForm struct + Fields []PDFFormField + Signed bool + Type string + type PDFFormField struct + Calculated bool + Format string + Label string + Name string + Options []string + Pages []int + Readonly bool + Required bool + Type string + Value any + type PDFInfo struct + Encrypted bool + Form *PDFForm + Metadata map[string]any + PageCount int + Pages []PDFPage + Raw json.RawMessage + Source string + func (i *PDFInfo) UnmarshalJSON(data []byte) error + type PDFPage struct + HeightMM float64 + HeightPt float64 + WidthMM float64 + WidthPt float64 + type PDFService struct + func (s *PDFService) Compress(ctx context.Context, req CompressRequest, opts ...CallOption) (*Render, error) + func (s *PDFService) Convert(ctx context.Context, req ConvertRequest, opts ...CallOption) (*Render, error) + func (s *PDFService) Fill(ctx context.Context, req FillRequest, opts ...CallOption) (*Render, error) + func (s *PDFService) Info(ctx context.Context, req InfoRequest) (*PDFInfo, error) + func (s *PDFService) Merge(ctx context.Context, req MergeRequest, opts ...CallOption) (*Render, error) + func (s *PDFService) Protect(ctx context.Context, req ProtectRequest, opts ...CallOption) (*Render, error) + func (s *PDFService) Redact(ctx context.Context, req RedactRequest, opts ...CallOption) (*Render, error) + func (s *PDFService) Split(ctx context.Context, req SplitRequest, opts ...CallOption) (*Render, error) + func (s *PDFService) ToImage(ctx context.Context, req ToImageRequest, opts ...CallOption) (*Render, error) + func (s *PDFService) Watermark(ctx context.Context, req WatermarkRequest, opts ...CallOption) (*Render, error) + type Page struct + Data []T + NextCursor string + type Problem struct + Code string + Detail string + Members map[string]any + Raw json.RawMessage + RenderID string + RequestID string + Status int + Title string + Type string + func (p *Problem) UnmarshalJSON(data []byte) error + type ProtectRequest struct + Access string + ExpiresIn int + Extra map[string]any + Filename string + Meta map[string]any + OwnerPassword string + Permissions []string + Source string + Storage any + UserPassword string + func (r ProtectRequest) MarshalJSON() ([]byte, error) + type RedactRegion struct + Height float64 + Page int + Width float64 + X float64 + Y float64 + type RedactRequest struct + Access string + ExpiresIn int + Extra map[string]any + File *Upload + Filename string + Fill string + MatchCase bool + Meta map[string]any + NoFill bool + Regions []RedactRegion + Source string + Storage any + Text []string + WholeWords bool + func (r RedactRequest) MarshalJSON() ([]byte, error) + type Render struct + Accessibility map[string]any + Bytes int64 + CompletedAt string + CreatedAt string + Deduplicated bool + DownloadURL string + Einvoice map[string]any + EngineVersion string + Environment string + Error *RenderError + ExpiresAt string + Form *FormFill + ID string + Meta map[string]any + Output string + OutputSHA256 string + PDFA map[string]any + PageCount int + Raw json.RawMessage + Region string + Status string + Storage *StorageDelivery + Template *RenderTemplate + TemplateChecksum string + Timings map[string]int64 + Units float64 + func (r *Render) Finished() bool + func (r *Render) UnmarshalJSON(data []byte) error + type RenderError struct + Code string + Details map[string]any + Message string + func (e *RenderError) UnmarshalJSON(data []byte) error + type RenderInput struct + CreatedAt string + Data map[string]any + Engine string + Environment string + Filename string + HTML string + Locale string + Markdown string + Meta map[string]any + Output string + Post map[string]any + Raw json.RawMessage + RenderID string + Settings map[string]any + Template *RenderTemplate + URL string + func (r *RenderInput) UnmarshalJSON(data []byte) error + type RenderListOptions struct + Cursor string + Environment string + Limit int + Since string + Status string + Template string + Until string + type RenderRequest struct + Access string + CanaryKey string + Data map[string]any + Dedupe *bool + Engine string + ExpiresIn int + Extra map[string]any + Filename string + HTML string + Locale string + Markdown string + Meta map[string]any + Mode string + Output string + Post map[string]any + Region string + Settings map[string]any + Storage any + Template string + URL string + ValidateData bool + Version string + WebhookSecret string + WebhookURL string + func (r RenderRequest) MarshalJSON() ([]byte, error) + type RenderTemplate struct + Canary bool + Channel string + ID string + Slug string + Version int + type RendersService struct + func (s *RendersService) All(ctx context.Context, opts RenderListOptions) iter.Seq2[*Render, error] + func (s *RendersService) Batch(ctx context.Context, req BatchRequest, opts ...CallOption) (*Job, error) + func (s *RendersService) Create(ctx context.Context, req RenderRequest, opts ...CallOption) (*Render, error) + func (s *RendersService) DeleteOutputs(ctx context.Context, id string) error + func (s *RendersService) Download(ctx context.Context, render *Render) ([]byte, error) + func (s *RendersService) DownloadFile(ctx context.Context, render *Render, path string) (int64, error) + func (s *RendersService) DownloadTo(ctx context.Context, render *Render, w io.Writer) (int64, error) + func (s *RendersService) Get(ctx context.Context, id string) (*Render, error) + func (s *RendersService) Input(ctx context.Context, id string) (*RenderInput, error) + func (s *RendersService) List(ctx context.Context, opts RenderListOptions) (*Page[Render], error) + func (s *RendersService) WaitFor(ctx context.Context, id string, opts ...WaitOption) (*Render, error) + type SplitRequest struct + Access string + Every int + ExpiresIn int + Extra map[string]any + File *Upload + Filename string + Meta map[string]any + Ranges []string + Source string + Storage any + func (r SplitRequest) MarshalJSON() ([]byte, error) + type StorageDelivery struct + Bucket string + Error *StorageError + Key string + Reason string + Status string + URL string + type StorageError struct + Code string + HTTPStatus int + Message string + type Template struct + CreatedAt string + Description string + Engine string + ID string + Kind string + LatestVersion int + Name string + PublishedVersion int + Raw json.RawMessage + Slug string + Tags []string + UpdatedAt string + func (t *Template) UnmarshalJSON(data []byte) error + type TemplateListOptions struct + Cursor string + Engine string + Kind string + Limit int + Q string + Tag string + type TemplateValidation struct + Diagnostics []Diagnostic + OK bool + Raw json.RawMessage + Template struct{ ... } + func (v *TemplateValidation) UnmarshalJSON(data []byte) error + type TemplatesService struct + func (s *TemplatesService) All(ctx context.Context, opts TemplateListOptions) iter.Seq2[*Template, error] + func (s *TemplatesService) Get(ctx context.Context, idOrSlug string) (*Template, error) + func (s *TemplatesService) List(ctx context.Context, opts TemplateListOptions) (*Page[Template], error) + func (s *TemplatesService) Schema(ctx context.Context, idOrSlug, version string) (map[string]any, error) + func (s *TemplatesService) Validate(ctx context.Context, idOrSlug string, req ValidateTemplateRequest) (*TemplateValidation, error) + type ToImageRequest struct + Access string + DPI int + ExpiresIn int + Extra map[string]any + File *Upload + Filename string + Format string + Meta map[string]any + Pages string + Quality int + Source string + Storage any + func (r ToImageRequest) MarshalJSON() ([]byte, error) + type UpdateWebhookRequest struct + ClearDescription bool + Description *string + Enabled *bool + Environments []string + Events []string + Extra map[string]any + URL string + func (r UpdateWebhookRequest) MarshalJSON() ([]byte, error) + type Upload struct + ContentType string + Contents []byte + Name string + func UploadFromBytes(name string, contents []byte) *Upload + func UploadFromFile(path string) (*Upload, error) + func UploadFromReader(name string, r io.Reader) (*Upload, error) + type Usage struct + ByTemplate []struct{ ... } + Daily []struct{ ... } + HardCapUnits *float64 + Included float64 + OverageBalance float64 + OverageUsed float64 + Period string + PeriodEnd string + PeriodStart string + Raw json.RawMessage + Used float64 + func (u *Usage) UnmarshalJSON(data []byte) error + type ValidateEinvoiceRequest struct + Extra map[string]any + File *Upload + RenderID string + Rules string + func (r ValidateEinvoiceRequest) MarshalJSON() ([]byte, error) + type ValidateTemplateRequest struct + Data map[string]any + Extra map[string]any + Version string + func (r ValidateTemplateRequest) MarshalJSON() ([]byte, error) + type WaitOption func(*waitConfig) + func WithPollInterval(d time.Duration) WaitOption + func WithWaitTimeout(d time.Duration) WaitOption + type WatermarkRequest struct + Access string + Color string + ExpiresIn int + Extra map[string]any + Filename string + Image string + Meta map[string]any + Opacity *float64 + Rotation *float64 + Source string + Storage any + Text string + func (r WatermarkRequest) MarshalJSON() ([]byte, error) + type Webhook struct + Now func() time.Time + Secret string + Tolerance time.Duration + func (w Webhook) Handler(handle func(http.ResponseWriter, *http.Request, *WebhookEvent)) http.Handler + func (w Webhook) Parse(signatureHeader string, body []byte) (*WebhookEvent, error) + func (w Webhook) Verify(signatureHeader string, body []byte) bool + type WebhookEndpoint struct + ConsecutiveFailures int + CreatedAt string + Description string + Enabled bool + Environments []string + Events []string + ID string + Raw json.RawMessage + Secret string + URL string + UpdatedAt string + func (w *WebhookEndpoint) UnmarshalJSON(data []byte) error + type WebhookEvent struct + CreatedAt string + Data json.RawMessage + ID string + Type string + WorkspaceID string + func ParseWebhook(secret, signatureHeader string, body []byte) (*WebhookEvent, error) + func (e *WebhookEvent) Job() (*Job, error) + func (e *WebhookEvent) Render() (*Render, error) + type WebhookResend struct + DeliveryID string + EndpointID string + Event string + EventID string + type WebhookTest struct + Queued bool + type WebhooksService struct + func (s *WebhooksService) Create(ctx context.Context, req CreateWebhookRequest) (*WebhookEndpoint, error) + func (s *WebhooksService) Delete(ctx context.Context, id string) error + func (s *WebhooksService) List(ctx context.Context) ([]WebhookEndpoint, error) + func (s *WebhooksService) Resend(ctx context.Context, eventID, endpointID string) (*WebhookResend, error) + func (s *WebhooksService) Test(ctx context.Context, id string) (*WebhookTest, error) + func (s *WebhooksService) Update(ctx context.Context, id string, req UpdateWebhookRequest) (*WebhookEndpoint, error)