aboutsummaryrefslogtreecommitdiffstats
path: root/interior.go
diff options
context:
space:
mode:
Diffstat (limited to 'interior.go')
-rw-r--r--interior.go45
1 files changed, 45 insertions, 0 deletions
diff --git a/interior.go b/interior.go
new file mode 100644
index 0000000..19417e5
--- /dev/null
+++ b/interior.go
@@ -0,0 +1,45 @@
+package lulu
+
+//go:generate go run github.com/yawnak/string-enumer -t InteriorValidationStatus --text -o ./interior_gen.go .
+
+// InteriorValidationStatus is the status of a validation job for an
+// interior file that is running on the server.
+type InteriorValidationStatus string
+
+const (
+ InteriorStatusNull InteriorValidationStatus = "NULL" // file validation is not started yet
+ InteriorStatusValidating InteriorValidationStatus = "VALIDATING" // file validation is still running
+ InteriorStatusValidated InteriorValidationStatus = "VALIDATED" // file validation finished without any errors
+ InteriorStatusNormalizing InteriorValidationStatus = "NORMALIZING" // file normalization (next step of validation, available only if pod_package_id is was passed in the payload) is still running
+ InteriorStatusNormalized InteriorValidationStatus = "NORMALIZED" // file normalization finished without any errors
+ InteriorStatusError InteriorValidationStatus = "ERROR" // file is invalid, list of errors is included in the response
+)
+
+func (s InteriorValidationStatus) IsFinal() bool {
+ switch s {
+ case InteriorStatusValidated, InteriorStatusNormalized, InteriorStatusError:
+ return true
+ }
+ return false
+}
+
+// validateInteriorReq is the json body of a /validate-interior/ request.
+type validateInteriorReq struct {
+ SrcUrl string `json:"source_url"`
+ PkgId PkgId `json:"pod_package_id"`
+}
+
+// validateInteriorReq is the json body of a /validate-interior/ request without the optional pod_package_id.
+type validateInteriorBasicReq struct {
+ SrcUrl string `json:"source_url"`
+}
+
+// InteriorValidationRecord contains the validation status of an interior file.
+type InteriorValidationRecord struct {
+ Id uint
+ SrcUrl string `json:"source_url"`
+ NPages uint `json:"page_count"`
+ Errors string
+ Status InteriorValidationStatus
+ ValidPkgIds []PkgId `json:"valid_pod_package_ids"`
+}