From 922c7f326382aa06f8bc4c9b5dcb2c0098160adb Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Thu, 21 May 2026 17:36:43 -0400 Subject: extend tests for print-jobs response unmarshaling --- print.go | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) (limited to 'print.go') diff --git a/print.go b/print.go index 8d48d17..930950c 100644 --- a/print.go +++ b/print.go @@ -188,20 +188,22 @@ type EstimatedShippingDates struct { type PrintableNormalization struct { Cover NormalizationJob `json:"cover"` Interior NormalizationJob `json:"interior"` + Mfg PkgId `json:"pod_package_id"` } // NormalizationJob represents the normalization process of an interior // or cover source file. type NormalizationJob struct { - JobId uint `json:"job_id"` - NormalizedFile NormalizedFile `json:"normalized_file"` - SrcMd5Sum string `json:"source_md5_sum"` // md5 hash of the source file. - SrcUrl string `json:"source_url"` // URL of the source file. + JobId uint `json:"job_id"` + Src File `json:"source_file"` + Norm File `json:"normalized_file"` + SrcMd5Sum string `json:"source_md5sum"` // md5 hash of the source file. + SrcUrl string `json:"source_url"` // URL of the source file. + NPages uint `json:"page_count"` } -// NormalizedFile represents a file on the server that was created by -// normalizing a cover or interior source file. -type NormalizedFile struct { +// File represents a file on the server. +type File struct { Id uint64 `json:"file_id"` Name string `json:"filename"` } @@ -212,14 +214,14 @@ type LineItemStatus struct { } type LineItemStatusMessages struct { - Delay time.Duration // Expected delay due to the error, if present. - Error string `json:"error"` - Info string `json:"info"` - PrintableNormalization PrintableNormalization `json:"printable_normalization"` - Timestamp time.Time `json:"timestamp"` // Timestamp of the last status change. - TrackingUrls []string - TrackingId string `json:"tracking_id"` // Tracking ID for this line item's shipment. - Carrier string `json:"carrier_name"` // Name of the carrier handling the shipment. + Delay time.Duration // Expected delay due to the error, if present. + Error string `json:"error"` + Info string `json:"info"` + Norm PrintableNormalizationMessages `json:"printable_normalization"` + Timestamp time.Time `json:"timestamp"` // Timestamp of the last status change. + TrackingUrls []string + TrackingId string `json:"tracking_id"` // Tracking ID for this line item's shipment. + Carrier string `json:"carrier_name"` // Name of the carrier handling the shipment. } func (msgs *LineItemStatusMessages) UnmarshalJSON(data []byte) error { @@ -254,6 +256,11 @@ func (msgs *LineItemStatusMessages) UnmarshalJSON(data []byte) error { return nil } +type PrintableNormalizationMessages struct { + Cover []string `json:"cover"` + Interior []string `json:"interior"` +} + type PrintJobStatus struct { Changed time.Time `json:"changed"` // time of the last status change Msg string `json:"message"` -- cgit v1.2.3