Documentation
¶
Overview ¶
Package common provides shared types and constants for Gotenberg client modules.
Index ¶
- Constants
- type DownloadFrom
- type Gotenberg
- func (r *Gotenberg) Bool(fieldName string, value bool) *Gotenberg
- func (r *Gotenberg) DownloadFrom(df DownloadFrom) *Gotenberg
- func (r *Gotenberg) File(fieldName, filename string, content io.Reader) *Gotenberg
- func (r *Gotenberg) Float(fieldName string, value float64) *Gotenberg
- func (r *Gotenberg) Header(key, value string) *Gotenberg
- func (r *Gotenberg) Metadata(key, value string) *Gotenberg
- func (r *Gotenberg) OutputFilename(filename string) *Gotenberg
- func (r *Gotenberg) Param(key, value string) *Gotenberg
- func (r *Gotenberg) Send() (*Response, error)
- func (r *Gotenberg) Trace(trace string) *Gotenberg
- func (r *Gotenberg) WebhookErrorURL(url, method string) *Gotenberg
- func (r *Gotenberg) WebhookHeader(key, value string) *Gotenberg
- func (r *Gotenberg) WebhookURL(url, method string) *Gotenberg
- type Response
Constants ¶
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) DownloadFrom ¶
func (r *Gotenberg) DownloadFrom(df DownloadFrom) *Gotenberg
DownloadFrom sets the download from configuration.
func (*Gotenberg) OutputFilename ¶
OutputFilename sets the output filename.
func (*Gotenberg) Send ¶
Send executes the request and returns the response. It handles common fields like webhook headers, downloadFrom, and metadata.
func (*Gotenberg) Trace ¶
Trace sets the request trace identifier for debugging and monitoring. If not set, Gotenberg will assign a unique UUID trace.
func (*Gotenberg) WebhookErrorURL ¶
WebhookErrorURL sets the webhook URL and HTTP method for failed operations.
func (*Gotenberg) WebhookHeader ¶
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 ¶
WebhookURL sets the webhook URL and HTTP method for successful operations.