From 48f85453ffbe36f6c428a5d9a23b74122686b64c Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Wed, 13 May 2026 15:47:33 -0400 Subject: test marshal print and reprint requests --- print.go | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'print.go') diff --git a/print.go b/print.go index 8532fff..22880ed 100644 --- a/print.go +++ b/print.go @@ -11,10 +11,10 @@ const ( MaxProductionDelay = 48 * time.Hour ) -type printReq struct { +type printReq[P Printable | Reprintable] struct { Contact EmailAddress `json:"contact_email"` ExternalId string `json:"external_id"` - LineItems []Printable `json:"line_items"` + LineItems []P `json:"line_items"` ProductionDelayMins uint `json:"production_delay"` ShipAddr ShippingAddress `json:"shipping_address"` ShipOpt ShippingLevel `json:"shipping_level"` @@ -52,6 +52,24 @@ type Printable struct { Title string `json:"title"` } +// Reprintable is a printable whose PrintableId is known from an prior +// print job. +type Reprintable struct { + // Arbitrary string to identify and connect a print job to your + // systems. Set it to an order number, a purchase order or + // whatever else works for your particular use case. + ExternalId string `json:"external_id"` + + // Uniquely identifies the printable. + PrintableId PrintableId `json:"printable_id"` + + // The number of copies to print. + Quantity uint `json:"quantity"` + + // The title of the book. Must not exceed 255 bytes. + Title string `json:"title"` +} + type getPrintJobsResp struct { Count uint `json:"count"` Next string `json:"next"` -- cgit v1.2.3