diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2026-05-13 15:47:33 -0400 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2026-05-13 15:47:33 -0400 |
| commit | 48f85453ffbe36f6c428a5d9a23b74122686b64c (patch) | |
| tree | 13720a581029307fd9303f025d9cd8c1012261b3 /print.go | |
| parent | 66ef9438a3489bf8a0b80bb44e320c85261a6658 (diff) | |
| download | lulu-48f85453ffbe36f6c428a5d9a23b74122686b64c.zip | |
test marshal print and reprint requests
Diffstat (limited to 'print.go')
| -rw-r--r-- | print.go | 22 |
1 files changed, 20 insertions, 2 deletions
@@ -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"` |