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)
|
||||
<> toSeries h v
|
||||
|
||||
data ActorType = ActorTypePerson | ActorTypeOther Text
|
||||
data ActorType = ActorTypePerson | ActorTypeProject | ActorTypeOther Text
|
||||
|
||||
instance FromJSON ActorType where
|
||||
parseJSON = withText "ActorType" $ \ t ->
|
||||
pure $ case t of
|
||||
"Person" -> ActorTypePerson
|
||||
_ -> ActorTypeOther t
|
||||
parseJSON = withText "ActorType" $ pure . parse
|
||||
where
|
||||
parse t
|
||||
| t == "Person" = ActorTypePerson
|
||||
| t == frg <> "Project" = ActorTypeProject
|
||||
| otherwise = ActorTypeOther t
|
||||
|
||||
instance ToJSON ActorType where
|
||||
toJSON = error "toJSON ActorType"
|
||||
toEncoding at =
|
||||
toEncoding $ case at of
|
||||
ActorTypePerson -> "Person"
|
||||
ActorTypeProject -> frg <> "Project"
|
||||
ActorTypeOther t -> t
|
||||
|
||||
{-
|
||||
|
|
Loading…
Reference in a new issue