From 8854cf167e82f8bd0bec728a2982b69ee3cd99b6 Mon Sep 17 00:00:00 2001 From: aaron Date: Fri, 30 Aug 2024 11:08:45 +0200 Subject: [PATCH] move models to single file --- publibike/api/models.go | 65 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 publibike/api/models.go diff --git a/publibike/api/models.go b/publibike/api/models.go new file mode 100644 index 0000000..8d6971b --- /dev/null +++ b/publibike/api/models.go @@ -0,0 +1,65 @@ +package api + +// Represenation of a station location and ID +type StationLoc struct { + Id int `json:"id"` + Latitude float64 `json:"latitude"` + Longitude float64 `json:"longitude"` + State State `json:"state"` +} + +// Representation of a state +type State struct { + Id int `json:"id"` + Name string `json:"name"` +} + +// Representation of a vehicle +type Vehicles struct { + Id int `json:"id"` + name string `json:"name"` + ebike_battery_level float64 `json:"ebike_battery_level"` + VehicleType VehicleType `json:"type"` +} + +// Representation of a type +type VehicleType struct { + Id int `json:"id"` + Name string `json:"name"` +} + +// Representation of a network +type Network struct { + Id int `json:"id"` + Name string `json:"name"` + BackgroundImg string `json:"background_img"` + LogoImg string `json:"logo_img"` + Sponsors []Sponsors `json:"sponsors"` +} + +// Represents a sponsor item containing an image and link (translated) +type Sponsors struct { + Id int `json:"id"` + Name string `json:"name"` + Image string `json:"image"` + Url string `json:"url"` +} + +// StationLoc struct to store station data +type Station struct { + StationLoc // embedded struct + Name string `json:"name"` + address string `json:"address"` + zip string `json:"zip"` + city string `json:"city"` + Vehicles []Vehicles `json:"vehicles"` + Network Network `json:"network"` + Sponsors []Sponsors `json:"sponsors"` +} + +// StationLoc struct to store station data +type PartnerStation struct { + Station // embedded struct + is_virtual_station bool `json:"is_virtual_station"` + capacity int `json:"capacity"` +}