Skip to content

feat: re-point SDK to the real Pictify API (v1.0.0) - #2

Merged
suyash-thakur merged 1 commit into
mainfrom
feat/repoint-to-real-api
Jun 8, 2026
Merged

feat: re-point SDK to the real Pictify API (v1.0.0)#2
suyash-thakur merged 1 commit into
mainfrom
feat/repoint-to-real-api

Conversation

@suyash-thakur

Copy link
Copy Markdown
Member

Summary

The SDK targeted a /v1/render* API that does not exist on the deployed backend — every render call 404'd. This re-points the whole client to the real, live-verified API.

Changes

  • renderHtml/renderUrlPOST /image; render/renderLayoutsPOST /templates/:uid/render (results[] + .url); renderGifPOST /gif; renderBatch (async) → POST /templates/:uid/batch-render + getBatchResults; getTemplate/listTemplates/createTemplate/templates
  • Removed renderStream (no real equivalent); added createTemplate
  • Adapted response shapes; unified error mapping (error || message)
  • Fixed a pre-existing DTS build break so types ship correctly
  • Version 1.0.0

Testing

  • Unit: 90 passing (mocked) · Integration: 10 passing LIVE vs api.pictify.io · Build: tsup + tsc clean

⚠️ Breaking vs the previous (unpublished) surface. Not yet on npm.

The SDK previously targeted a /v1/render* API that does not exist on the
deployed backend. Re-point every method to the real, live-verified API:

- renderHtml / renderUrl  -> POST /image
- render / renderLayouts   -> POST /templates/:uid/render (results[] envelope)
- renderGif                -> POST /gif (nested {gif:{uid}})
- renderBatch (async)      -> POST /templates/:uid/batch-render + getBatchResults
- getTemplate/listTemplates/createTemplate -> /templates
- Remove renderStream (no real equivalent); add createTemplate
- Adapt response shapes; unify error mapping (error || message)

Unit tests + live integration tests pass against api.pictify.io. Version 1.0.0.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Node.js SDK to target the live, deployed Pictify API endpoints (instead of the non-existent /v1/render* routes), aligning request/response shapes, error mapping, and documentation/tests with the verified backend behavior.

Changes:

  • Repointed rendering methods to POST /image, POST /templates/:uid/render, POST /gif, and async POST /templates/:uid/batch-render + GET /templates/batch/:batchId/results.
  • Introduced/updated types for new response envelopes (results[], { url, id, createdAt }, batch status shapes) and expanded template CRUD support (listTemplates, createTemplate).
  • Refactored error handling into a more consistent mapping (error || message || statusText) and added live integration tests + expanded mocked coverage.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/types.ts Redefines SDK surface types to match the live API (image, template render envelopes, GIF, async batch, templates).
src/index.ts Updates package documentation and re-exports for the new/updated API surface.
src/errors.ts Adds API error-body shape and revises HTTP→typed-error mapping (including new ServerError).
src/client.ts Repoints client methods to the real endpoints; adds async batch polling and template CRUD; refines request/retry behavior.
src/tests/integration/client.integration.test.ts Adds opt-in live integration coverage against the real API (skips unless API key is set).
src/tests/helpers.ts Updates fetch mocking utilities and introduces live-verified response fixtures.
src/tests/errors.test.ts Updates unit tests for new error types and the revised mapping behavior.
src/tests/client.test.ts Rewrites unit tests for the new endpoints, request bodies, and response shapes.
src/tests/client.coverage.test.ts Adds supplemental mocked tests to cover happy/error paths across public methods and request-shape branches.
README.md Updates documentation to reflect the new endpoints, response envelopes, async batch behavior, and typed errors.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/client.ts
Comment on lines +222 to +231
async renderGif(options: GifRenderOptions): Promise<GifRenderResult> {
const body: Record<string, unknown> = {
width: options.width,
height: options.height,
quality: options.quality || 'medium',
};
if (options.html) body.html = options.html;
if (options.url) body.url = options.url;
if (options.templateId) body.template = options.templateId;
if (options.variables) body.variables = options.variables;
Comment thread src/types.ts
Comment on lines +165 to +180
export interface GifRenderOptions {
/** Raw HTML to render into a GIF (must contain CSS animation / motion) */
html?: string;
/** A live URL to capture motion from */
url?: string;
/** A template UID to render into a GIF */
templateId?: string;
/** Variables to inject when using `templateId` */
variables?: Record<string, unknown>;
/** Output width in pixels (default: 800) */
width?: number;
/** Output height in pixels (default: 600) */
height?: number;
/** Quality preset (default: medium) */
quality?: GifQuality;
}
@suyash-thakur
suyash-thakur merged commit 8d38ca8 into main Jun 8, 2026
1 check passed
@suyash-thakur
suyash-thakur deleted the feat/repoint-to-real-api branch June 8, 2026 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants