gleam-spacetraders-sdk/src/models/survey_deposit.gleam
Lily Rose 64f3729d0c
Some checks are pending
test / test (push) Waiting to run
Refactoring and general tidying up
2025-06-17 19:04:29 +10:00

16 lines
467 B
Gleam

import gleam/dynamic/decode.{type Decoder}
import gleam/json.{type Json}
import models/trade_symbol.{type TradeSymbol}
pub type SurveyDeposit {
SurveyDeposit(symbol: TradeSymbol)
}
pub fn decoder() -> Decoder(SurveyDeposit) {
use symbol <- decode.field("symbol", trade_symbol.decoder())
decode.success(SurveyDeposit(symbol:))
}
pub fn encode(survey_deposit: SurveyDeposit) -> Json {
json.object([#("symbol", trade_symbol.encode(survey_deposit.symbol))])
}