gotenberg

package
v1.8.0 Latest Latest
Warning

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

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

Documentation

Overview

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

Index

Constants

View Source
const (
	HeaderWebhookURL              = "Gotenberg-Webhook-Url"
	HeaderWebhookErrorURL         = "Gotenberg-Webhook-Error-Url"
	HeaderWebhookMethod           = "Gotenberg-Webhook-Method"
	HeaderWebhookErrorMethod      = "Gotenberg-Webhook-Error-Method"
	HeaderWebhookExtraHTTPHeaders = "Gotenberg-Webhook-Extra-Http-Headers"
	HeaderOutputFilename          = "Gotenberg-Output-Filename"
	HeaderGotenbergTrace          = "Gotenberg-Trace"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DownloadFrom

type DownloadFrom struct {
	URL              string            `json:"url"`
	ExtraHttpHeaders map[string]string `json:"extraHttpHeaders,omitempty"`
}

DownloadFrom represents a single download configuration for the downloadFrom parameter.

type Gotenberg

type Gotenberg struct {
	Client *httpclient.Client
	Req    *formdata.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(df DownloadFrom) *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) 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