module App.UserPublic where import Prelude import Data.Maybe import Data.Codec.Argonaut (JsonCodec) import Data.Codec.Argonaut as CA import Data.Codec.Argonaut.Record as CAR import Data.Newtype (class Newtype) -- | Currently not the real type. -- | Lacks 'profile' attribute. -- TODO: add profile :: JSON any type UserPublic = { login :: String, uid :: Int, date_registration :: Maybe String } -- | UserPublic.codec can be used to parse and encode public user info, -- | which can be exchanged in different messages. codec :: JsonCodec UserPublic codec = CA.object "UserPublic" (CAR.record { login: CA.string , uid: CA.int , date_registration: CAR.optional CA.string }) -- {"user":{"login":"a","uid": 1003,"date_registration":"2023-06-03T03:32:10+02:00"}}