aboutsummaryrefslogtreecommitdiffstats
path: root/print.go
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2026-05-13 15:47:33 -0400
committerSam Anthony <sam@samanthony.xyz>2026-05-13 15:47:33 -0400
commit48f85453ffbe36f6c428a5d9a23b74122686b64c (patch)
tree13720a581029307fd9303f025d9cd8c1012261b3 /print.go
parent66ef9438a3489bf8a0b80bb44e320c85261a6658 (diff)
downloadlulu-48f85453ffbe36f6c428a5d9a23b74122686b64c.zip
test marshal print and reprint requests
Diffstat (limited to 'print.go')
-rw-r--r--print.go22
1 files changed, 20 insertions, 2 deletions
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"`