more activities

This commit is contained in:
me 2024-10-31 15:45:26 +02:00
parent 334a2502b8
commit d3932e8282

View File

@ -217,12 +217,17 @@ instance ToObject TypeCreate where
, "object" A..= create.object
]
-- type Follow = Object (TypeActivity TypeFollow)
-- data TypeFollow = TypeFollow deriving Show
-- instance ToObject TypeFollow where
-- toObject TypeFollow =
-- [ "type" A..= ("Follow" :: String)
-- ]
type Follow = Object (TypeActivity TypeFollow)
data TypeFollow
= TypeFollow
{ object :: Actor
}
deriving Show
instance ToObject TypeFollow where
toObject follow =
[ "type" A..= ("Follow" :: String)
, "object" A..= follow.object
]
--
type Like = Object (TypeActivity TypeLike)
@ -236,17 +241,50 @@ instance ToObject TypeLike where
data AnyActivity
= -- ActivityAnnounce Announce
ActivityCreate Create
-- | ActivityFollow Follow
| ActivityFollow Follow
-- | ActivityLike Like
| ActivityAccept Accept
| ActivityReject Reject
deriving (Show)
instance A.ToJSON AnyActivity where
toJSON = \case
-- ActivityAnnounce obj -> A.toJSON obj
ActivityCreate obj -> A.toJSON obj
-- ActivityFollow obj -> A.toJSON obj
ActivityFollow obj -> A.toJSON obj
-- ActivityLike obj -> A.toJSON obj
ActivityAccept obj -> A.toJSON obj
ActivityReject obj -> A.toJSON obj
-- * Accept Reject Add Remove
type Accept = Object (TypeActivity TypeAccept)
data TypeAccept
= TypeAccept
{ object :: AnyActivity
}
deriving Show
instance ToObject TypeAccept where
toObject obj =
[ "type" A..= ("Accept" :: String)
, "object" A..= obj.object
]
type Reject = Object (TypeActivity TypeReject)
data TypeReject
= TypeReject
{ object :: AnyActivity
}
deriving Show
instance ToObject TypeReject where
toObject obj =
[ "type" A..= ("Reject" :: String)
, "object" A..= obj.object
]
-- * Actors