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

20 lines
732 B
Gleam

import gleam/dynamic/decode.{type Decoder}
import models/ship_component.{type ShipComponent}
import models/ship_condition_event_symbol.{type ShipConditionEventSymbol}
pub type ShipConditionEvent {
ShipConditionEvent(
symbol: ShipConditionEventSymbol,
component: ShipComponent,
name: String,
description: String,
)
}
pub fn decoder() -> Decoder(ShipConditionEvent) {
use symbol <- decode.field("symbol", ship_condition_event_symbol.decoder())
use component <- decode.field("component", ship_component.decoder())
use name <- decode.field("name", decode.string)
use description <- decode.field("description", decode.string)
decode.success(ShipConditionEvent(symbol:, component:, name:, description:))
}