gleam-spacetraders-sdk/src/models/ship_nav_route_waypoint.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

23 lines
785 B
Gleam

import gleam/dynamic/decode.{type Decoder}
import models/system_symbol.{type SystemSymbol}
import models/waypoint_symbol.{type WaypointSymbol}
import models/waypoint_type.{type WaypointType}
pub type ShipNavRouteWaypoint {
ShipNavRouteWaypoint(
symbol: WaypointSymbol,
type_: WaypointType,
system_symbol: SystemSymbol,
x: Int,
y: Int,
)
}
pub fn decoder() -> Decoder(ShipNavRouteWaypoint) {
use symbol <- decode.field("symbol", waypoint_symbol.decoder())
use type_ <- decode.field("type", waypoint_type.decoder())
use system_symbol <- decode.field("systemSymbol", system_symbol.decoder())
use x <- decode.field("x", decode.int)
use y <- decode.field("y", decode.int)
decode.success(ShipNavRouteWaypoint(symbol:, type_:, system_symbol:, x:, y:))
}