13 lines
454 B
Gleam
13 lines
454 B
Gleam
import gleam/dynamic/decode.{type Decoder}
|
|
import spacetraders_models/ship_symbol.{type ShipSymbol}
|
|
import spacetraders_models/siphon_yield.{type SiphonYield}
|
|
|
|
pub type Siphon {
|
|
Siphon(ship_symbol: ShipSymbol, yield: SiphonYield)
|
|
}
|
|
|
|
pub fn decoder() -> Decoder(Siphon) {
|
|
use ship_symbol <- decode.field("shipSymbol", ship_symbol.decoder())
|
|
use yield <- decode.field("yield", siphon_yield.decoder())
|
|
decode.success(Siphon(ship_symbol:, yield:))
|
|
}
|