1
0
Fork 0
mirror of https://code.naskya.net/repos/ndqEd synced 2025-03-20 15:14:54 +09:00

S2S: deckOfferTicketF (i.e. local deck receives ticket from remote author)

This commit is contained in:
fr33domlover 2022-09-23 15:58:54 +00:00
parent 0d922b0e5a
commit ef8e1c1108
4 changed files with 178 additions and 102 deletions

View file

@ -1418,19 +1418,21 @@ encodeAdd h (Add obj target)
data Apply u = Apply
{ applyObject :: ObjURI u
, applyTarget :: ObjURI u
, applyTarget :: Either (ObjURI u) (Authority u, Branch u)
}
parseApply :: UriMode u => Object -> Parser (Apply u)
parseApply o =
Apply
<$> o .: "object"
<*> o .: "target"
<*> (second fromDoc <$> o .:+ "target")
where
fromDoc (Doc h v) = (h, v)
encodeApply :: UriMode u => Apply u -> Series
encodeApply (Apply obj target)
= "object" .= obj
<> "target" .= target
<> "target" .=+ second (uncurry Doc) target
data CreateObject u
= CreateNote (Authority u) (Note u)