Safe Haskell | None |
---|---|
Language | Haskell2010 |
- type Signature = String
- data Message a = Message {}
- messageLink :: Hashed (Message a) -> MessageLink
- data AnyContent = AnyContent {}
- contentType :: Message AnyContent -> Text
- parseMessage :: FromJSON a => ByteString -> Maybe (Hashed (Message a))
- narrowParse :: FromJSON a => Message AnyContent -> Parser (Message a)
- data PrivateContent = PrivateContent Text
- data Post = Post {}
- newtype Branch = Branch {
- fromBranch :: [MessageLink]
- newtype Mentions = Mentions {
- fromMentions :: [Mention]
- data Mention = Mention {
- mentionLink :: Link
- mentionName :: Maybe Text
- data About = About {}
- data AboutImage = AboutImage {}
- data Contact = Contact {}
- data Vote = Vote {}
- data Pub = Pub {}
- parseMessageType :: Text -> (Value -> Parser a) -> Value -> Parser a
Documentation
messageLink :: Hashed (Message a) -> MessageLink Source #
data AnyContent Source #
Parsing a Message AnyContent allows parsing the message envelope, regardless of the type of content in the message.
contentType :: Message AnyContent -> Text Source #
Get the declared type of content in a Message AnyContent.
parseMessage :: FromJSON a => ByteString -> Maybe (Hashed (Message a)) Source #
Parses a JSON formatted message, and accompanies it with the hash that was originally used for 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.
Link to the message in the thread that a Post replies to.
Generally there is only one link, but sometimes more than one.
Branch | |
|
Mentions | |
|
A reference to other feeds, entities, or blobs that were mentioned in a Post.
Mention | |
|
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.
data AboutImage Source #
Eq AboutImage Source # | |
Show AboutImage Source # | |
Generic AboutImage Source # | |
FromJSON AboutImage Source # | AboutImage can be encoded as either a JSON object or as a string, which is the BlobLink. |
type Rep 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.