gleam-spacetraders-sdk/src/models/ship_nav.gleam
Lily Rose cc8edbed02
Some checks are pending
test / test (push) Waiting to run
Add functioning sdk
2025-06-17 01:43:06 +10:00

34 lines
1 KiB
Gleam

import gleam/dynamic/decode.{type Decoder}
import models/ship_nav_flight_mode.{type ShipNavFlightMode}
import models/ship_nav_route.{type ShipNavRoute}
import models/ship_nav_status.{type ShipNavStatus}
import models/system_symbol.{type SystemSymbol}
import models/waypoint_symbol.{type WaypointSymbol}
pub type ShipNav {
ShipNav(
system_symbol: SystemSymbol,
waypoint_symbol: WaypointSymbol,
route: ShipNavRoute,
status: ShipNavStatus,
flight_mode: ShipNavFlightMode,
)
}
pub fn decoder() -> Decoder(ShipNav) {
use system_symbol <- decode.field("systemSymbol", system_symbol.decoder())
use waypoint_symbol <- decode.field(
"waypointSymbol",
waypoint_symbol.decoder(),
)
use route <- decode.field("route", ship_nav_route.decoder())
use status <- decode.field("status", ship_nav_status.decoder())
use flight_mode <- decode.field("flightMode", ship_nav_flight_mode.decoder())
decode.success(ShipNav(
system_symbol:,
waypoint_symbol:,
route:,
status:,
flight_mode:,
))
}