Add a custom ActivityPub actor type: Project
This commit is contained in:
parent
3f2a178830
commit
ade1157a04
1 changed files with 8 additions and 5 deletions
|
@ -154,19 +154,22 @@ instance ActivityPub a => ToJSON (Doc a) where
|
||||||
$ "@context" .= jsonldContext (proxy v)
|
$ "@context" .= jsonldContext (proxy v)
|
||||||
<> toSeries h v
|
<> toSeries h v
|
||||||
|
|
||||||
data ActorType = ActorTypePerson | ActorTypeOther Text
|
data ActorType = ActorTypePerson | ActorTypeProject | ActorTypeOther Text
|
||||||
|
|
||||||
instance FromJSON ActorType where
|
instance FromJSON ActorType where
|
||||||
parseJSON = withText "ActorType" $ \ t ->
|
parseJSON = withText "ActorType" $ pure . parse
|
||||||
pure $ case t of
|
where
|
||||||
"Person" -> ActorTypePerson
|
parse t
|
||||||
_ -> ActorTypeOther t
|
| t == "Person" = ActorTypePerson
|
||||||
|
| t == frg <> "Project" = ActorTypeProject
|
||||||
|
| otherwise = ActorTypeOther t
|
||||||
|
|
||||||
instance ToJSON ActorType where
|
instance ToJSON ActorType where
|
||||||
toJSON = error "toJSON ActorType"
|
toJSON = error "toJSON ActorType"
|
||||||
toEncoding at =
|
toEncoding at =
|
||||||
toEncoding $ case at of
|
toEncoding $ case at of
|
||||||
ActorTypePerson -> "Person"
|
ActorTypePerson -> "Person"
|
||||||
|
ActorTypeProject -> frg <> "Project"
|
||||||
ActorTypeOther t -> t
|
ActorTypeOther t -> t
|
||||||
|
|
||||||
{-
|
{-
|
||||||
|
|
Loading…
Reference in a new issue