Migration
This page tracks breaking changes between releases of github.com/poli-page/sdk-go. Before 1.0, a breaking change bumps the minor version. For the full per-release diff, see the changelog.
From 0.9.x to 0.11.0
Section titled “From 0.9.x to 0.11.0”0.10.0 was never released for Go: 0.11.0 follows 0.9.0 and carries both groups of changes below.
Environments replace versions
Section titled “Environments replace versions”An API key now names its environment (pp_{env}_…), and a render uses the project’s copy published in that environment. Template versions, the template preview and inline-HTML rendering are gone from the API, so they are gone from the SDK, with no deprecation window.
- Rename
polipage.ProjectModeInputtopolipage.RenderInput, and drop itsVersionfield.polipage.Optis gone with it. Publish the project to the key’s environment instead of pinning a version. Render.Preview,InlineModeInputandPreviewResultare removed. Try a template or raw HTML in the playground at play.poli.page.Documents.Preview(the stored HTML of a rendered document) stays.DocumentDescriptor.Versionis removed.DocumentDescriptor.Environmentis a plainstring, and theEnvironmenttype and itsEnvironmentSandbox/EnvironmentLiveconstants are removed: compare with"sandbox","live"or your own environment names.- Use
sandboxkeys (pp_sandbox_…) where you used test keys. Standard and service keys share the onepp_{env}_…format; see Authentication. - Replace the removed error codes and sentinels:
VERSION_NOT_FOUND,INVALID_VERSION_FORMAT,VERSION_REQUIRED,INVALID_VERSION_FOR_KEY_ENVandErrVersionNotFound: a render now fails withPROJECT_NOT_FOUND,PROJECT_NOT_IN_ENVIRONMENTorTEMPLATE_NOT_FOUND.GONEandErrGone: useDOCUMENT_GONEandErrDocumentGone.PAYMENT_REQUIREDandErrPaymentRequired: past-due billing is reported asORGANIZATION_PAYMENT_GRACE.MISSING_PROJECT_OR_TEMPLATEis removed.
ThumbnailOptions.Widthis optional: a zero value is not sent and the API uses 400 px.
The full list is in CHANGELOG.md and MIGRATION.md.
API contract v1.3.0
Section titled “API contract v1.3.0”The SDK now follows the retry policy and the error messages of the Poli Page API contract. The full guide is in MIGRATION.md in the repo.
QUOTA_EXCEEDEDandOVERAGE_CAP_EXCEEDED(429) andSTORAGE_ACCESS_DENIED(502) are no longer retried, andIsRetryable()returnsfalsefor them. A queue that requeues onIsRetryable()now drops these errors at once: handle them by code. See Retries and idempotency.DOWNLOAD_FAILEDis never retryable:IsRetryable()isfalsefor it whatever the storage status (it wastruefor a storage 5xx or 429). CallDocuments.Getfor a fresh URL and download again.Retry-After: 0retries at once; only integer seconds and HTTP-dates are read.- The SDK-side messages are the specification’s exact texts (
apiKey is required,Network request failed,Request timed out after <ms>ms,Request was aborted,Failed to download PDF: HTTP <status>,Failed to download PDF: network error,HTTP <status>for a non-JSON error body,project is required). MatchCode, not the message. See Errors. - Canceling the context during the PDF download returns
aborted, notDOWNLOAD_FAILED.