Safe Haskell | None |
---|---|
Language | Haskell2010 |
- type Signature = String
- type HashType = String
- data Message a = Message {}
- data AnyContent = AnyContent {}
- narrowParse :: FromJSON a => Message AnyContent -> Parser (Message a)
- data PrivateContent = PrivateContent Text
- data Post = Post {}
- data Mention = Mention {}
- data About = About {
- about :: GenericLink
- name :: Maybe Text
- image :: Maybe AboutImage
- data AboutImage = AboutImage {}
- data Contact = Contact {}
- data Vote = Vote {}
- data Pub = Pub {}
- parseMessageType :: Text -> (Value -> Parser a) -> Value -> Parser a
Documentation
data AnyContent Source #
Parsing a Message AnyContent allows parsing the message envelope, regardless of the type of content in the message.
narrowParse :: FromJSON a => Message AnyContent -> Parser (Message a) Source #
For best efficiency when the type of a message is not known,
first parse to a Message AnyContent, and then use this function
with parseMaybe
or parseEither
to try to further parse that
to different message types.
For example:
Just somemsg = decode b :: Maybe Message AnyContent case parseMaybe narrowParse somemsg :: Maybe (Message Post) of Just postmsg -> ... Nothing -> case parseMaybe narrowParse somemsg :: Maybe (Message PrivateContent) of Just privmsg -> ... Nothing -> ...
data PrivateContent Source #
A message with encrypted content.
A post is a text-based message, for a public or private audience. It can be a reply to other posts.
A generic reference to other feeds, entities, or blobs
About-messages set attributes about someone or something. They can be used to set a name or picture for users, files, or messages. However, they're most commonly published about users.
About | |
|
data AboutImage Source #
Contact-messages determine who you are following or blocking.
Vote-messages signal approval about someone or something. Votes can be on users, messages, or blobs.
Vote | |
|