Types
The Go SDK exposes the types below. Import any of them from the top-level polipage package (or the option subpackage for the functional options).
import ( polipage "github.com/poli-page/sdk-go" "github.com/poli-page/sdk-go/option")Client
Section titled “Client”Client is the Poli Page SDK entry point. Construct one via NewClient and reuse it for the lifetime of the process.
Render
Section titled “Render”Render is the render namespace exposed as client.Render: PDF, PDFStream and Document, the spec §5 surface.
Documents
Section titled “Documents”Documents is the stored-documents namespace exposed as client.Documents. It hosts the four lifecycle methods defined in spec §6.
RenderInput
Section titled “RenderInput”RenderInput is the input of every render method: a template of a project, rendered with the project’s copy published in the API key’s environment. Only these seven fields are sent; unset optional fields are omitted from the wire.
DocumentPreviewResult
Section titled “DocumentPreviewResult”DocumentPreviewResult is the result of Documents.Preview — the paginated HTML for an already-stored document and the page count the engine emitted at render time.
DocumentDescriptor
Section titled “DocumentDescriptor”DocumentDescriptor is a stored document returned by Render.Document and Documents.Get. Top-level fields are system-controlled; Metadata echoes caller-supplied data.
Nullable wire fields (ProjectID, ProjectSlug, TemplateID, TemplateSlug, APIKeyID, Orientation, Locale) are *string so the SDK can distinguish JSON null from an empty string.
Thumbnail
Section titled “Thumbnail”Thumbnail is a single page thumbnail returned by Documents.Thumbnails. Data is base64-encoded image bytes; the caller decodes via encoding/base64.StdEncoding.DecodeString as needed.
ThumbnailOptions
Section titled “ThumbnailOptions”ThumbnailOptions configures a thumbnail-generation request. Every field is optional: a zero value is not sent and the API applies its default. The SDK does not check bounds; the API answers 400 VALIDATION_ERROR.
RenderMetadata
Section titled “RenderMetadata”RenderMetadata is free-form caller metadata forwarded to the API and echoed on responses that support it. Values must be primitives (string, number, bool); nested maps and slices are rejected at serialise time with *Error{Code: ErrCodeInvalidOptions}.
PageFormat
Section titled “PageFormat”PageFormat is a canonical Poli Page page format. Values match the strings accepted by the deployed API and shared across every SDK.
Orientation
Section titled “Orientation”Orientation is the page orientation: portrait or landscape.
ThumbnailFormat
Section titled “ThumbnailFormat”ThumbnailFormat is the image format for a generated thumbnail. The API default is JPEG, which also accepts a Quality option.
RetryEvent
Section titled “RetryEvent”RetryEvent is delivered to the OnRetry hook before each retry sleep. Aliased to clientconfig.RetryEvent so option.WithOnRetry and the re-export here can both spell the type identically.
Error is the single error type raised by the SDK: API errors, network failures, timeouts, caller cancellation, and constructor validation failures all surface as *Error.
Callers can use either errors.Is against the package-level sentinels (ErrNotFound, ErrUnauthorized, etc.) for quick branching or errors.As to inspect Code, StatusCode, RequestID, and the wrapped Cause.
Functional options
Section titled “Functional options”Options live in the option subpackage and produce option.RequestOption values.
See the source on GitHub for the full struct definitions.