fedi/src/Fedi/Types.hs
2024-10-25 22:38:23 +03:00

41 lines
793 B
Haskell

module Fedi.Types where
import GHC.Generics (Generic)
import Data.Aeson qualified as A
import Data.Text qualified as T
data Rel = Self
deriving Show
instance A.ToJSON Rel where
toJSON Self = A.String "self"
data LinkType = ActivityJson
deriving Show
instance A.ToJSON LinkType where
toJSON ActivityJson = A.String "application/activity+json"
type Url = String
type Domain = String
type Username = String
newtype Pem = Pem T.Text
deriving Show
deriving A.FromJSON via T.Text
instance A.ToJSON Pem where
toJSON (Pem pem) = A.String pem
data UserDetails
= UserDetails
{ domain :: Domain
, username :: String
, name :: String
, summary :: String
, icon :: Url
, publicPem :: Pem
, privatePem :: FilePath
}
deriving (Generic, A.FromJSON)