diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2026-05-11 16:20:15 -0400 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2026-05-11 16:20:15 -0400 |
| commit | 6f2c582f691c6984d5296b714ae41477a102a77b (patch) | |
| tree | 6a6c80d4281acad5522f0772ee2629587a32ab8f | |
| parent | af2de318402df1fd8d33192d71613c21c4ee96bf (diff) | |
| download | lulu-6f2c582f691c6984d5296b714ae41477a102a77b.zip | |
include generated code
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | cover_gen.go | 70 | ||||
| -rw-r--r-- | interior_gen.go | 43 | ||||
| -rw-r--r-- | pkgid_gen.go | 298 | ||||
| -rw-r--r-- | ship_gen.go | 76 |
5 files changed, 487 insertions, 1 deletions
@@ -1,4 +1,3 @@ -*_gen.go spec.yml testdata/clientkey testdata/clientsecret diff --git a/cover_gen.go b/cover_gen.go new file mode 100644 index 0000000..1bcbde1 --- /dev/null +++ b/cover_gen.go @@ -0,0 +1,70 @@ +// Code generated by "string-enumer -t Unit -t CoverValidationStatus --text -o ./cover_gen.go ."; DO NOT EDIT. +package lulu + +import ( + "fmt" +) + +// validCoverValidationStatusValues contains a map of all valid CoverValidationStatus values for easy lookup +var validCoverValidationStatusValues = map[CoverValidationStatus]struct{}{ + CoverStatusNull: {}, + CoverStatusNormalizing: {}, + CoverStatusNormalized: {}, + CoverStatusError: {}, +} + +// Valid validates if a value is a valid CoverValidationStatus +func (v CoverValidationStatus) Valid() bool { + _, ok := validCoverValidationStatusValues[v] + return ok +} + +// CoverValidationStatusValues returns a list of all (valid) CoverValidationStatus values +func CoverValidationStatusValues() []CoverValidationStatus { + return []CoverValidationStatus{ + CoverStatusNull, + CoverStatusNormalizing, + CoverStatusNormalized, + CoverStatusError, + } +} + +// UnmarshalText takes a text, verifies that it is a correct CoverValidationStatus and unmarshals it +func (v *CoverValidationStatus) UnmarshalText(text []byte) error { + if valid := CoverValidationStatus(text).Valid(); !valid { + return fmt.Errorf("not valid value for CoverValidationStatus: %s", text) + } + *v = CoverValidationStatus(text) + return nil +} + +// validUnitValues contains a map of all valid Unit values for easy lookup +var validUnitValues = map[Unit]struct{}{ + Points: {}, + Millimeters: {}, + Inches: {}, +} + +// Valid validates if a value is a valid Unit +func (v Unit) Valid() bool { + _, ok := validUnitValues[v] + return ok +} + +// UnitValues returns a list of all (valid) Unit values +func UnitValues() []Unit { + return []Unit{ + Points, + Millimeters, + Inches, + } +} + +// UnmarshalText takes a text, verifies that it is a correct Unit and unmarshals it +func (v *Unit) UnmarshalText(text []byte) error { + if valid := Unit(text).Valid(); !valid { + return fmt.Errorf("not valid value for Unit: %s", text) + } + *v = Unit(text) + return nil +} diff --git a/interior_gen.go b/interior_gen.go new file mode 100644 index 0000000..71dda35 --- /dev/null +++ b/interior_gen.go @@ -0,0 +1,43 @@ +// Code generated by "string-enumer -t InteriorValidationStatus --text -o ./interior_gen.go ."; DO NOT EDIT. +package lulu + +import ( + "fmt" +) + +// validInteriorValidationStatusValues contains a map of all valid InteriorValidationStatus values for easy lookup +var validInteriorValidationStatusValues = map[InteriorValidationStatus]struct{}{ + InteriorStatusNull: {}, + InteriorStatusValidating: {}, + InteriorStatusValidated: {}, + InteriorStatusNormalizing: {}, + InteriorStatusNormalized: {}, + InteriorStatusError: {}, +} + +// Valid validates if a value is a valid InteriorValidationStatus +func (v InteriorValidationStatus) Valid() bool { + _, ok := validInteriorValidationStatusValues[v] + return ok +} + +// InteriorValidationStatusValues returns a list of all (valid) InteriorValidationStatus values +func InteriorValidationStatusValues() []InteriorValidationStatus { + return []InteriorValidationStatus{ + InteriorStatusNull, + InteriorStatusValidating, + InteriorStatusValidated, + InteriorStatusNormalizing, + InteriorStatusNormalized, + InteriorStatusError, + } +} + +// UnmarshalText takes a text, verifies that it is a correct InteriorValidationStatus and unmarshals it +func (v *InteriorValidationStatus) UnmarshalText(text []byte) error { + if valid := InteriorValidationStatus(text).Valid(); !valid { + return fmt.Errorf("not valid value for InteriorValidationStatus: %s", text) + } + *v = InteriorValidationStatus(text) + return nil +} diff --git a/pkgid_gen.go b/pkgid_gen.go new file mode 100644 index 0000000..df391e9 --- /dev/null +++ b/pkgid_gen.go @@ -0,0 +1,298 @@ +// Code generated by "string-enumer -t TrimSize -t ColorType -t Quality -t Binding -t Paper -t Finish -t Linen -t Foil --text -o ./pkgid_gen.go ."; DO NOT EDIT. +package lulu + +import ( + "fmt" +) + +// validBindingValues contains a map of all valid Binding values for easy lookup +var validBindingValues = map[Binding]struct{}{ + Perfect: {}, + Coil: {}, + SaddleStitch: {}, + CaseWrap: {}, + LinenWrap: {}, + WireO: {}, +} + +// Valid validates if a value is a valid Binding +func (v Binding) Valid() bool { + _, ok := validBindingValues[v] + return ok +} + +// BindingValues returns a list of all (valid) Binding values +func BindingValues() []Binding { + return []Binding{ + Perfect, + Coil, + SaddleStitch, + CaseWrap, + LinenWrap, + WireO, + } +} + +// UnmarshalText takes a text, verifies that it is a correct Binding and unmarshals it +func (v *Binding) UnmarshalText(text []byte) error { + if valid := Binding(text).Valid(); !valid { + return fmt.Errorf("not valid value for Binding: %s", text) + } + *v = Binding(text) + return nil +} + +// validColorTypeValues contains a map of all valid ColorType values for easy lookup +var validColorTypeValues = map[ColorType]struct{}{ + Mono: {}, + Color: {}, +} + +// Valid validates if a value is a valid ColorType +func (v ColorType) Valid() bool { + _, ok := validColorTypeValues[v] + return ok +} + +// ColorTypeValues returns a list of all (valid) ColorType values +func ColorTypeValues() []ColorType { + return []ColorType{ + Mono, + Color, + } +} + +// UnmarshalText takes a text, verifies that it is a correct ColorType and unmarshals it +func (v *ColorType) UnmarshalText(text []byte) error { + if valid := ColorType(text).Valid(); !valid { + return fmt.Errorf("not valid value for ColorType: %s", text) + } + *v = ColorType(text) + return nil +} + +// validFinishValues contains a map of all valid Finish values for easy lookup +var validFinishValues = map[Finish]struct{}{ + Gloss: {}, + Matte: {}, + Unlaminated: {}, +} + +// Valid validates if a value is a valid Finish +func (v Finish) Valid() bool { + _, ok := validFinishValues[v] + return ok +} + +// FinishValues returns a list of all (valid) Finish values +func FinishValues() []Finish { + return []Finish{ + Gloss, + Matte, + Unlaminated, + } +} + +// UnmarshalText takes a text, verifies that it is a correct Finish and unmarshals it +func (v *Finish) UnmarshalText(text []byte) error { + if valid := Finish(text).Valid(); !valid { + return fmt.Errorf("not valid value for Finish: %s", text) + } + *v = Finish(text) + return nil +} + +// validFoilValues contains a map of all valid Foil values for easy lookup +var validFoilValues = map[Foil]struct{}{ + GoldFoil: {}, + BlackFoil: {}, + WhiteFoil: {}, + NoFoil: {}, +} + +// Valid validates if a value is a valid Foil +func (v Foil) Valid() bool { + _, ok := validFoilValues[v] + return ok +} + +// FoilValues returns a list of all (valid) Foil values +func FoilValues() []Foil { + return []Foil{ + GoldFoil, + BlackFoil, + WhiteFoil, + NoFoil, + } +} + +// UnmarshalText takes a text, verifies that it is a correct Foil and unmarshals it +func (v *Foil) UnmarshalText(text []byte) error { + if valid := Foil(text).Valid(); !valid { + return fmt.Errorf("not valid value for Foil: %s", text) + } + *v = Foil(text) + return nil +} + +// validLinenValues contains a map of all valid Linen values for easy lookup +var validLinenValues = map[Linen]struct{}{ + RedLinen: {}, + NavyLinen: {}, + BlackLinen: {}, + GrayLinen: {}, + TanLinen: {}, + ForestLinen: {}, + InteriorCoverPrint: {}, + NoLinen: {}, +} + +// Valid validates if a value is a valid Linen +func (v Linen) Valid() bool { + _, ok := validLinenValues[v] + return ok +} + +// LinenValues returns a list of all (valid) Linen values +func LinenValues() []Linen { + return []Linen{ + RedLinen, + NavyLinen, + BlackLinen, + GrayLinen, + TanLinen, + ForestLinen, + InteriorCoverPrint, + NoLinen, + } +} + +// UnmarshalText takes a text, verifies that it is a correct Linen and unmarshals it +func (v *Linen) UnmarshalText(text []byte) error { + if valid := Linen(text).Valid(); !valid { + return fmt.Errorf("not valid value for Linen: %s", text) + } + *v = Linen(text) + return nil +} + +// validPaperValues contains a map of all valid Paper values for easy lookup +var validPaperValues = map[Paper]struct{}{ + P60UncoatedWhite: {}, + P60UncoatedCream: {}, + P70CoatedWhite: {}, + P80CoatedWhite: {}, + P100CoatedWhite: {}, +} + +// Valid validates if a value is a valid Paper +func (v Paper) Valid() bool { + _, ok := validPaperValues[v] + return ok +} + +// PaperValues returns a list of all (valid) Paper values +func PaperValues() []Paper { + return []Paper{ + P60UncoatedWhite, + P60UncoatedCream, + P70CoatedWhite, + P80CoatedWhite, + P100CoatedWhite, + } +} + +// UnmarshalText takes a text, verifies that it is a correct Paper and unmarshals it +func (v *Paper) UnmarshalText(text []byte) error { + if valid := Paper(text).Valid(); !valid { + return fmt.Errorf("not valid value for Paper: %s", text) + } + *v = Paper(text) + return nil +} + +// validQualityValues contains a map of all valid Quality values for easy lookup +var validQualityValues = map[Quality]struct{}{ + Premium: {}, + Standard: {}, +} + +// Valid validates if a value is a valid Quality +func (v Quality) Valid() bool { + _, ok := validQualityValues[v] + return ok +} + +// QualityValues returns a list of all (valid) Quality values +func QualityValues() []Quality { + return []Quality{ + Premium, + Standard, + } +} + +// UnmarshalText takes a text, verifies that it is a correct Quality and unmarshals it +func (v *Quality) UnmarshalText(text []byte) error { + if valid := Quality(text).Valid(); !valid { + return fmt.Errorf("not valid value for Quality: %s", text) + } + *v = Quality(text) + return nil +} + +// validTrimSizeValues contains a map of all valid TrimSize values for easy lookup +var validTrimSizeValues = map[TrimSize]struct{}{ + Pocketbook: {}, + Novella: {}, + Digest: {}, + A5: {}, + UsTrade: {}, + Royal: {}, + Comic: {}, + SmallSquare: {}, + Executive: {}, + CrownQuatro: {}, + Square: {}, + A4: {}, + UsLetter: {}, + Landscape: {}, + UsLetterLandscape: {}, + A4Landscape: {}, +} + +// Valid validates if a value is a valid TrimSize +func (v TrimSize) Valid() bool { + _, ok := validTrimSizeValues[v] + return ok +} + +// TrimSizeValues returns a list of all (valid) TrimSize values +func TrimSizeValues() []TrimSize { + return []TrimSize{ + Pocketbook, + Novella, + Digest, + A5, + UsTrade, + Royal, + Comic, + SmallSquare, + Executive, + CrownQuatro, + Square, + A4, + UsLetter, + Landscape, + UsLetterLandscape, + A4Landscape, + } +} + +// UnmarshalText takes a text, verifies that it is a correct TrimSize and unmarshals it +func (v *TrimSize) UnmarshalText(text []byte) error { + if valid := TrimSize(text).Valid(); !valid { + return fmt.Errorf("not valid value for TrimSize: %s", text) + } + *v = TrimSize(text) + return nil +} diff --git a/ship_gen.go b/ship_gen.go new file mode 100644 index 0000000..b45a02e --- /dev/null +++ b/ship_gen.go @@ -0,0 +1,76 @@ +// Code generated by "string-enumer -t ShippingLevel -t Title --text -o ./ship_gen.go ."; DO NOT EDIT. +package lulu + +import ( + "fmt" +) + +// validShippingLevelValues contains a map of all valid ShippingLevel values for easy lookup +var validShippingLevelValues = map[ShippingLevel]struct{}{ + Mail: {}, + PriorityMail: {}, + Ground: {}, + Expedited: {}, + Express: {}, +} + +// Valid validates if a value is a valid ShippingLevel +func (v ShippingLevel) Valid() bool { + _, ok := validShippingLevelValues[v] + return ok +} + +// ShippingLevelValues returns a list of all (valid) ShippingLevel values +func ShippingLevelValues() []ShippingLevel { + return []ShippingLevel{ + Mail, + PriorityMail, + Ground, + Expedited, + Express, + } +} + +// UnmarshalText takes a text, verifies that it is a correct ShippingLevel and unmarshals it +func (v *ShippingLevel) UnmarshalText(text []byte) error { + if valid := ShippingLevel(text).Valid(); !valid { + return fmt.Errorf("not valid value for ShippingLevel: %s", text) + } + *v = ShippingLevel(text) + return nil +} + +// validTitleValues contains a map of all valid Title values for easy lookup +var validTitleValues = map[Title]struct{}{ + Mr: {}, + Miss: {}, + Mrs: {}, + Ms: {}, + Dr: {}, +} + +// Valid validates if a value is a valid Title +func (v Title) Valid() bool { + _, ok := validTitleValues[v] + return ok +} + +// TitleValues returns a list of all (valid) Title values +func TitleValues() []Title { + return []Title{ + Mr, + Miss, + Mrs, + Ms, + Dr, + } +} + +// UnmarshalText takes a text, verifies that it is a correct Title and unmarshals it +func (v *Title) UnmarshalText(text []byte) error { + if valid := Title(text).Valid(); !valid { + return fmt.Errorf("not valid value for Title: %s", text) + } + *v = Title(text) + return nil +} |