gotenberg

package
v1.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package common provides shared types and constants for Gotenberg client modules.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Gotenberg

type Gotenberg struct {
	Client *httpclient.Client
	Req    *httpclient.Multipart
	Wh     map[string]string
	Meta   map[string]string
	Df     []downloadFrom
}

Gotenberg provides common functionality for building Gotenberg requests. It wraps the underlying multipart request and provides shared methods.

func NewGotenberg

func NewGotenberg(client *httpclient.Client) *Gotenberg

NewGotenberg creates a new RequestBuilder with the given client.

func (*Gotenberg) Bool

func (r *Gotenberg) Bool(fieldName string, value bool) *Gotenberg

Bool adds a boolean form parameter to the request.

func (*Gotenberg) DownloadFrom

func (r *Gotenberg) DownloadFrom(url string, headers map[string]string) *Gotenberg

DownloadFrom sets the download from configuration.

func (*Gotenberg) File

func (r *Gotenberg) File(fieldName, filename string, content io.Reader) *Gotenberg

File adds a file to the request.

func (*Gotenberg) Float

func (r *Gotenberg) Float(fieldName string, value float64) *Gotenberg

Float adds a float64 form parameter to the request.

func (*Gotenberg) Header

func (r *Gotenberg) Header(key, value string) *Gotenberg

Header adds a header to the request.

func (*Gotenberg) Metadata

func (r *Gotenberg) Metadata(key, value string) *Gotenberg

Metadata sets the metadata for the operation.

func (*Gotenberg) OutputFilename

func (r *Gotenberg) OutputFilename(filename string) *Gotenberg

OutputFilename sets the output filename.

func (*Gotenberg) Param

func (r *Gotenberg) Param(key, value string) *Gotenberg

Param adds a form parameter to the request.

func (*Gotenberg) Send

func (r *Gotenberg) Send() (*Response, error)

Send executes the request and returns the response. It handles common fields like webhook headers, downloadFrom, and metadata.

func (*Gotenberg) Timeout added in v1.8.2

func (r *Gotenberg) Timeout(duration time.Duration) *Gotenberg

Timeout sets a timeout for the request.

func (*Gotenberg) Trace

func (r *Gotenberg) Trace(trace string) *Gotenberg

Trace sets the request trace identifier for debugging and monitoring. If not set, Gotenberg will assign a unique UUID trace.

func (*Gotenberg) WebhookErrorURL

func (r *Gotenberg) WebhookErrorURL(url, method string) *Gotenberg

WebhookErrorURL sets the webhook URL and HTTP method for failed operations.

func (*Gotenberg) WebhookHeader

func (r *Gotenberg) WebhookHeader(key, value string) *Gotenberg

WebhookHeader adds a custom header to be sent with webhook requests. Multiple headers can be added by calling this method multiple times.

func (*Gotenberg) WebhookURL

func (r *Gotenberg) WebhookURL(url, method string) *Gotenberg

WebhookURL sets the webhook URL and HTTP method for successful operations.

type Response

type Response struct {
	*http.Response
	GotenbergTrace string
}

Response represents a Gotenberg conversion response. It wraps the HTTP response and provides access to the Gotenberg trace header.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL