Skip to content

Add printer_han (CJK) support and close SDK/docs gaps vs API v3 - #9

Merged
tomsaas merged 3 commits into
mainfrom
claude/sdk-github-asian-chars-5v3f2l
Aug 17, 2026
Merged

Add printer_han (CJK) support and close SDK/docs gaps vs API v3#9
tomsaas merged 3 commits into
mainfrom
claude/sdk-github-asian-chars-5v3f2l

Conversation

@tomsaas

@tomsaas tomsaas commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Summary

The official API docs (v3 export) document a new request-body field, printer_han,
required to print Chinese, Japanese or Korean text on both print endpoints
(printers.createPrintJob and devices.usb.createPrintJob). Without it, the server
composes the ticket in single-byte mode and silently replaces every CJK character with
? before the job reaches the printer
— no error is raised.

  • Added printer_han ("cn" | "kr" | "jp" | "1") to CreatePrintJobRequest and
    CreateUsbPrintJobRequest, exported as PrinterHan / PrinterHanScript.
  • New reference page docs/receipt-layout/asian-characters.md
    and two runnable examples (examples/receipt-asian-characters.ts,
    examples/device-rpi-usb-print-asian.ts).
  • Endpoint docs, text-layout-tags.md, docs/README.md and the root README.md updated
    to reference it.

While diffing the full doc export (340 articles) against the repo, I also found and fixed:

  • CreatePrintJobResponse.request_timestamp is now optional. It's returned by the API
    but isn't part of the documented v3 response contract — this is the one type change that
    could affect existing consumers who read it without an optional check.
  • printer_status documented as an activation flag ("1"/"0"), not a live
    connectivity indicator — the repo previously just said "numeric status flag".
  • JSDoc added across src/types/*.ts for fields that had no explanation in code
    (last_ping, notification_url, printer_graphic_mode, …).
  • New docs/getting-started/errors.md (status codes by endpoint, ExpedyError vs
    ExpedyApiError) and docs/concepts/delivery-and-idempotency.md (a 200 means
    accepted/queued, not printed; no de-duplication).

Additional groundwork requested alongside the CJK fix

  • openapi.yaml — OpenAPI 3.1 description of all 16 operations, printer_han as an
    enum, matches src/types/**. Linted clean with @redocly/cli.
  • Tests + CItest/client.test.mjs (Node's built-in test runner, no dependency,
    mocks fetch via the config the client already accepts) and .github/workflows/ci.yml
    (Node 18/20/22: typecheck, build, typecheck examples, test). publish.yml is untouched.
  • Agent/LLM-facing filesAGENTS.md, llms.txt.
  • Repo hygieneCONTRIBUTING.md, SECURITY.md, CHANGELOG.md (retro-filled from
    git history), issue templates, PR template.
  • docs/integrations.md — indexes the ~140 no-code/e-commerce/delivery platforms from
    the doc export (Zapier, Shopify, WooCommerce, Uber Eats, n8n, …), each linking to
    docs.expedy.io, with a short "SDK vs. no-code" decision note.

Bumps 1.0.21.1.0 (package.json + package-lock.json).

docs/integrations.md links — verified against the site's sitemap

The links initially missed the /en/ locale segment. The user provided the actual
docs.expedy.io sitemap, which confirms the canonical pattern is
docs.expedy.io/en/<category>/<subcategory>/<slug> (e.g.
docs.expedy.io/en/expedy-print/api-print-v2/create-a-print-job). All 140 links in
docs/integrations.md, plus the cross-reference in asian-characters.md, have been
corrected to include it.

Test plan

  • npm run typecheck && npm run build && npm run typecheck:examples — pass
  • npm test (node --test) — 12/12 pass, including a CJK round-trip test and tests
    confirming printer_han reaches the JSON body on both endpoints
  • npx @redocly/cli lint openapi.yaml — valid
  • Reviewed the full diff for real credentials/UIDs/internal URLs (public repo) — only
    placeholder values consistent with the existing repo conventions
  • docs/integrations.md link pattern verified against the site's sitemap

Suggested repo metadata (not something I can set via the tools available to me)

  • Topics: thermal-printer, receipt-printer, escpos, cloud-printing,
    pos-printer, raspberry-pi, label-printer, print-api, nodejs, typescript,
    sdk, google-cloud-print-alternative, cjk
  • About → website: https://docs.expedy.io
  • Publishing a GitHub Release v1.1.0 off this PR is what triggers publish.yml
    (OIDC trusted publishing) and gives the version its own indexed page.

🤖 Generated with Claude Code

claude added 3 commits August 17, 2026 14:14
Add the printer_han field (required for Chinese/Japanese/Korean text — omitting
it silently replaces every such character with `?`) to CreatePrintJobRequest
and CreateUsbPrintJobRequest, with a new docs/receipt-layout/asian-characters.md
reference page and two runnable examples.

Also close gaps found while diffing the repo against the official API docs:
- request_timestamp is now optional (returned by the API but undocumented)
- printer_status documented as an activation flag, not live connectivity
- new docs/getting-started/errors.md and docs/concepts/delivery-and-idempotency.md
- openapi.yaml (OpenAPI 3.1, all 16 operations)
- test/client.test.mjs + ci.yml (Node 18/20/22)
- AGENTS.md, llms.txt, CONTRIBUTING.md, SECURITY.md, CHANGELOG.md, issue/PR templates
- docs/integrations.md indexing the ~140 no-code/e-commerce/delivery integrations

Bumps 1.0.2 -> 1.1.0.
The user provided the site's sitemap, which confirms the canonical URL
pattern is docs.expedy.io/en/<category>/<subcategory>/<slug> — the
integrations index and the text-encoding-settings cross-reference were
missing the locale segment.
node --test's own glob resolution for a quoted pattern is a newer Node
feature — Node 18 doesn't have it and looks for a literal file named
"test/*.test.mjs", failing CI on that matrix leg. Letting bash expand
the glob before Node sees it works identically on Node 18/20/22.
@tomsaas
tomsaas merged commit f66dd62 into main Aug 17, 2026
3 checks passed
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