blob: 98ff4d237f67af114fd2f34bf0b0d0c426a82fef (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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"`
Mfg 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"`
}
// InteriorValidation contains the validation status of an interior file.
type InteriorValidation struct {
Id uint
SrcUrl string `json:"source_url"`
NPages uint `json:"page_count"`
Errors string
Status InteriorValidationStatus
ValidPkgIds []PkgId `json:"valid_pod_package_ids"`
}
|