aboutsummaryrefslogtreecommitdiffstats
path: root/order_gen.go
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2026-05-12 15:35:06 -0400
committerSam Anthony <sam@samanthony.xyz>2026-05-12 15:37:29 -0400
commit9010ebe8a581fb9db7bc6e97d40ff062fb18495f (patch)
tree4301a455762a59d4951507c8a8781e99c6f91c6d /order_gen.go
parent329257be8d9fb05d3dcea49823acea0f878ed52c (diff)
downloadlulu-9010ebe8a581fb9db7bc6e97d40ff062fb18495f.zip
unmarshal GET /print-jobs response
Diffstat (limited to 'order_gen.go')
-rw-r--r--order_gen.go51
1 files changed, 51 insertions, 0 deletions
diff --git a/order_gen.go b/order_gen.go
new file mode 100644
index 0000000..5b17f05
--- /dev/null
+++ b/order_gen.go
@@ -0,0 +1,51 @@
+// Code generated by "string-enumer -t OrderStatus --text -o ./order_gen.go ."; DO NOT EDIT.
+package lulu
+
+import (
+ "fmt"
+)
+
+// validOrderStatusValues contains a map of all valid OrderStatus values for easy lookup
+var validOrderStatusValues = map[OrderStatus]struct{}{
+ OrderCreated: {},
+ OrderUnpaid: {},
+ OrderPaymentInProgress: {},
+ OrderProductionDelayed: {},
+ OrderProductionReady: {},
+ OrderInProduction: {},
+ OrderShipped: {},
+ OrderDelivered: {},
+ OrderRejected: {},
+ OrderCanceled: {},
+}
+
+// Valid validates if a value is a valid OrderStatus
+func (v OrderStatus) Valid() bool {
+ _, ok := validOrderStatusValues[v]
+ return ok
+}
+
+// OrderStatusValues returns a list of all (valid) OrderStatus values
+func OrderStatusValues() []OrderStatus {
+ return []OrderStatus{
+ OrderCreated,
+ OrderUnpaid,
+ OrderPaymentInProgress,
+ OrderProductionDelayed,
+ OrderProductionReady,
+ OrderInProduction,
+ OrderShipped,
+ OrderDelivered,
+ OrderRejected,
+ OrderCanceled,
+ }
+}
+
+// UnmarshalText takes a text, verifies that it is a correct OrderStatus and unmarshals it
+func (v *OrderStatus) UnmarshalText(text []byte) error {
+ if valid := OrderStatus(text).Valid(); !valid {
+ return fmt.Errorf("not valid value for OrderStatus: %s", text)
+ }
+ *v = OrderStatus(text)
+ return nil
+}