parent
b965920ada
commit
c084ee8e0a
@ -0,0 +1,26 @@
|
||||
module Participant exposing (Participant, decoder)
|
||||
|
||||
import Json.Decode exposing (Decoder, field, map2, string)
|
||||
import Json.Encode as Enc exposing (object)
|
||||
|
||||
|
||||
type alias Participant =
|
||||
{ id : String
|
||||
, name : String
|
||||
}
|
||||
|
||||
|
||||
decoder : Decoder Participant
|
||||
decoder =
|
||||
map2 Participant
|
||||
(field "id" string)
|
||||
(field "name" string)
|
||||
|
||||
|
||||
encode : Participant -> String
|
||||
encode participant =
|
||||
object
|
||||
[ ( "id", Enc.string participant.id )
|
||||
, ( "name", Enc.string participant.name )
|
||||
]
|
||||
|> Enc.encode 0
|
Loading…
Reference in new issue