Decompose: Add HTTP service layer (FastAPI) exposing the EmbroideryPipeline — Phase 3: POST /v1/export #48

Closed
opened 2026-06-22 16:31:10 +00:00 by Mark · 2 comments
Owner

Phase 3: POST /v1/export

Take pre-computed stitch objects (already in the client or returned by
P2) and emit a binary embroidery file in the requested format.

Files:

  • Modify: src/service/app.py (add /v1/export route)
  • Modify: src/service/models.py (ExportRequest, ExportResponse or
    binary response)
  • New: src/service/handlers/export.py

Acceptance:

  • POST /v1/export with stitch objects and format=pes returns a
    valid PES file body. Header check: starts with #PES0001 or the
    correct v1 magic for the requested PES version.
  • format=dst, format=exp, format=jef each return a valid file
    with the correct magic bytes for that format.
  • Response includes X-Stitch-Count and X-Color-Count headers.
  • The output is the same bytes as calling the generator directly (no
    transformation in the service layer).

Depends on: P1 (skeleton), P2 (routing pattern). Independent of
P2's data path — accepts stitch objects from any source.



Decomposed from easystitch#31

## Phase 3: POST /v1/export Take pre-computed stitch objects (already in the client or returned by P2) and emit a binary embroidery file in the requested format. **Files:** - Modify: `src/service/app.py` (add `/v1/export` route) - Modify: `src/service/models.py` (ExportRequest, ExportResponse or binary response) - New: `src/service/handlers/export.py` **Acceptance:** - `POST /v1/export` with stitch objects and `format=pes` returns a valid PES file body. Header check: starts with `#PES0001` or the correct v1 magic for the requested PES version. - `format=dst`, `format=exp`, `format=jef` each return a valid file with the correct magic bytes for that format. - Response includes `X-Stitch-Count` and `X-Color-Count` headers. - The output is the same bytes as calling the generator directly (no transformation in the service layer). **Depends on:** P1 (skeleton), P2 (routing pattern). Independent of P2's data path — accepts stitch objects from any source. --- --- _Decomposed from [easystitch#31](https://forgejo.tail018ac4.ts.net/Mark/easystitch/issues/31)_
Author
Owner

Cross-link: ThreadCraft #11 — this phase is the /v1/export endpoint used by ThreadCraft #2 (PES export).

**Cross-link:** ThreadCraft #11 — this phase is the /v1/export endpoint used by ThreadCraft #2 (PES export).
Author
Owner

This issue has been decomposed into the following sub-issues:

# Title Phase Scope
#86 POST /v1/export Take pre-computed stitch objects (already in the client or returned by P2) and e

Each sub-issue awaits triage pipeline assessment before queue routing.

This issue has been decomposed into the following sub-issues: | # | Title | Phase Scope | |---|-------|-------------| | #86 | POST /v1/export | Take pre-computed stitch objects (already in the client or returned by P2) and e | Each sub-issue awaits triage pipeline assessment before queue routing.
Mark closed this issue 2026-06-26 19:18:11 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Mark/easystitch#48
No description provided.