diff --git a/types/base.go b/types/base.go index ae86f1c1c..cacf7b302 100644 --- a/types/base.go +++ b/types/base.go @@ -7,8 +7,12 @@ import ( ) type Vector2 struct { - X float64 `json:"x"` - Y float64 `json:"y"` + X float64 + Y float64 +} + +func (v Vector2) MarshalJSON() ([]byte, error) { + return json.Marshal([]float64{v.X, v.Y}) } type Vector2Wrapper struct { @@ -29,9 +33,13 @@ func (v *Vector2Wrapper) UnmarshalJSON(data []byte) error { } type Vector3 struct { - X float64 `json:"x"` - Y float64 `json:"y"` - Z float64 `json:"z"` + X float64 + Y float64 + Z float64 +} + +func (v Vector3) MarshalJSON() ([]byte, error) { + return json.Marshal([]float64{v.X, v.Y, v.Z}) } type Vector3Wrapper struct { @@ -52,24 +60,8 @@ func (v *Vector3Wrapper) UnmarshalJSON(data []byte) error { } type Color string - type MetricImperialUnit string - -const ( - MetricMM MetricImperialUnit = "mm" - MetricCM MetricImperialUnit = "cm" - MetricM MetricImperialUnit = "m" - MetricF MetricImperialUnit = "f" -) - type FloorMetric string - -const ( - FloorM FloorMetric = "m" - FloorT FloorMetric = "t" - FloorF FloorMetric = "f" -) - type Slug string type Header struct { diff --git a/types/corridor.go b/types/corridor.go index 63545064e..28e523426 100644 --- a/types/corridor.go +++ b/types/corridor.go @@ -4,11 +4,6 @@ import "encoding/json" type Temperature string -const ( - COLD Temperature = "cold" - WARM Temperature = "warm" -) - type Corridor struct { Header Content string `json:"content"` diff --git a/types/device.go b/types/device.go index 8465f58a7..ea2fdb156 100644 --- a/types/device.go +++ b/types/device.go @@ -4,13 +4,6 @@ import "encoding/json" type DeviceOrientation string -const ( - DeviceFront DeviceOrientation = "front" - DeviceRear DeviceOrientation = "rear" - DeviceFrontflipped DeviceOrientation = "frontflipped" - DeviceRearflipped DeviceOrientation = "rearflipped" -) - type DeviceTemplate = RackTemplate type Device struct { diff --git a/types/rack.go b/types/rack.go index 437a05e02..47491abfb 100644 --- a/types/rack.go +++ b/types/rack.go @@ -6,43 +6,10 @@ import ( ) type RackOrientation string - -const ( - RackFront RackOrientation = "front" - RackRear RackOrientation = "rear" - RackLeft RackOrientation = "left" - RackRight RackOrientation = "right" -) - type RackUnit string - -const ( - RackMM RackUnit = "mm" - RackCM RackUnit = "cm" - RackM RackUnit = "m" - RackU RackUnit = "u" - RackOU RackUnit = "ou" - RackF RackUnit = "f" -) - type LabelPosition string - -const ( - LabelFront LabelPosition = "front" - LabelRear LabelPosition = "rear" - LabelFrontrear LabelPosition = "frontrear" - LabelTop LabelPosition = "top" - LabelRight LabelPosition = "right" - LabelLeft LabelPosition = "left" -) - type ComponentOrientation string -const ( - ComponentHorizontal ComponentOrientation = "horizontal" - ComponentVertical ComponentOrientation = "vertical" -) - type Component struct { Factor string `json:"factor,omitempty"` Color *Color `json:"color,omitempty"` diff --git a/types/site.go b/types/site.go index 67dd69b96..9e62d0d83 100644 --- a/types/site.go +++ b/types/site.go @@ -4,13 +4,6 @@ import "encoding/json" type SiteOrientation string -const ( - EN SiteOrientation = "EN" - NW SiteOrientation = "NW" - WS SiteOrientation = "WS" - SE SiteOrientation = "SE" -) - type Site struct { Header Orientation *SiteOrientation `json:"orientation,omitempty"`