aboutsummaryrefslogtreecommitdiffstats
path: root/cover.go
diff options
context:
space:
mode:
Diffstat (limited to 'cover.go')
-rw-r--r--cover.go29
1 files changed, 28 insertions, 1 deletions
diff --git a/cover.go b/cover.go
index 30be2d6..e5845a7 100644
--- a/cover.go
+++ b/cover.go
@@ -6,7 +6,7 @@ import (
"strconv"
)
-//go:generate go run github.com/yawnak/string-enumer -t Unit --text -o ./cover_gen.go .
+//go:generate go run github.com/yawnak/string-enumer -t Unit -t CoverValidationStatus --text -o ./cover_gen.go .
// Unit is a unit of length measurement.
type Unit string
@@ -17,6 +17,17 @@ const (
Inches Unit = "inch"
)
+// CoverValidationStatus is the status of a validation job for a cover
+// file that is running on the server.
+type CoverValidationStatus string
+
+const (
+ CoverStatusNull CoverValidationStatus = "NULL" // file validation is not started yet
+ CoverStatusNormalizing CoverValidationStatus = "NORMALIZING" // file validation is still running
+ CoverStatusNormalized CoverValidationStatus = "NORMALIZED" // file validation finished without any errors
+ CoverStatusError CoverValidationStatus = "ERROR" // file is invalid, list of errors is included in the response
+)
+
// coverDimensionsReq is the json body of a /cover-dimensions/ request.
type coverDimensionsReq struct {
PkgId PkgId `json:"pod_package_id"`
@@ -24,6 +35,13 @@ type coverDimensionsReq struct {
Unit Unit `json:"unit"`
}
+// validateCoverReq is the json body of a /validate-cover/ request.
+type validateCoverReq struct {
+ SrcUrl string `json:"source_url"`
+ PkgId PkgId `json:"pod_package_id"`
+ NPages uint `json:"interior_page_count"`
+}
+
type CoverDimensions struct {
Width, Height float64
Unit Unit
@@ -53,3 +71,12 @@ func (cd *CoverDimensions) UnmarshalJSON(data []byte) error {
cd.Unit = alias.Unit
return nil
}
+
+// CoverValidationRecord contains the validation status of a cover file.
+type CoverValidationRecord struct {
+ Id uint
+ SrcUrl string `json:"source_url"`
+ NPages uint `json:"page_count"`
+ Errors string
+ Status CoverValidationStatus
+}