packages feed

mattermost-api 50200.14.0 → 50200.15.0

raw patch · 3 files changed

+31/−1 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Network.Mattermost: [postMetadata] :: Post -> PostMetadata
+ Network.Mattermost.Lenses: postMetadataL :: Lens' Post PostMetadata
+ Network.Mattermost.Types: PostMetadata :: Seq FileInfo -> Seq Reaction -> PostMetadata
+ Network.Mattermost.Types: [postMetadataFiles] :: PostMetadata -> Seq FileInfo
+ Network.Mattermost.Types: [postMetadataReactions] :: PostMetadata -> Seq Reaction
+ Network.Mattermost.Types: [postMetadata] :: Post -> PostMetadata
+ Network.Mattermost.Types: data PostMetadata
+ Network.Mattermost.Types: instance Data.Aeson.Types.FromJSON.FromJSON Network.Mattermost.Types.PostMetadata
+ Network.Mattermost.Types: instance Data.Aeson.Types.ToJSON.ToJSON Network.Mattermost.Types.PostMetadata
+ Network.Mattermost.Types: instance GHC.Classes.Eq Network.Mattermost.Types.PostMetadata
+ Network.Mattermost.Types: instance GHC.Read.Read Network.Mattermost.Types.PostMetadata
+ Network.Mattermost.Types: instance GHC.Show.Show Network.Mattermost.Types.PostMetadata
- Network.Mattermost: Post :: Maybe PostId -> Maybe PostId -> PostProps -> Maybe PostId -> Seq FileId -> PostId -> PostType -> UserText -> Maybe ServerTime -> Text -> ServerTime -> ServerTime -> Maybe UserId -> ServerTime -> ChannelId -> Bool -> Maybe Bool -> Post
+ Network.Mattermost: Post :: Maybe PostId -> Maybe PostId -> PostProps -> Maybe PostId -> Seq FileId -> PostId -> PostType -> UserText -> Maybe ServerTime -> Text -> ServerTime -> ServerTime -> Maybe UserId -> ServerTime -> ChannelId -> Bool -> Maybe Bool -> PostMetadata -> Post
- Network.Mattermost.Types: Post :: Maybe PostId -> Maybe PostId -> PostProps -> Maybe PostId -> Seq FileId -> PostId -> PostType -> UserText -> Maybe ServerTime -> Text -> ServerTime -> ServerTime -> Maybe UserId -> ServerTime -> ChannelId -> Bool -> Maybe Bool -> Post
+ Network.Mattermost.Types: Post :: Maybe PostId -> Maybe PostId -> PostProps -> Maybe PostId -> Seq FileId -> PostId -> PostType -> UserText -> Maybe ServerTime -> Text -> ServerTime -> ServerTime -> Maybe UserId -> ServerTime -> ChannelId -> Bool -> Maybe Bool -> PostMetadata -> Post

Files

CHANGELOG.md view
@@ -1,4 +1,14 @@ +50200.15.0+==========++API changes:+ * The `Post` data type got a new `postMetadata` field of type+   `PostMetadata` which carries the `metadata` JSON data that the server+   provides in API responses. As of this implementation, only the file+   list (`files`) and reactions (`reactions`) are parsed from the post+   metdata.+ 50200.14.0 ========== 
mattermost-api.cabal view
@@ -1,5 +1,5 @@ name:                mattermost-api-version:             50200.14.0+version:             50200.15.0 synopsis:            Client API for Mattermost chat system  description:         Client API for Mattermost chat system.  Mattermost is a
src/Network/Mattermost/Types.hs view
@@ -808,6 +808,7 @@   , postChannelId     :: ChannelId   , postHasReactions  :: Bool   , postPinned        :: Maybe Bool+  , postMetadata      :: PostMetadata   } deriving (Read, Show, Eq)  instance HasId Post PostId where@@ -832,6 +833,7 @@     postChannelId     <- v .: "channel_id"     postHasReactions  <- v .:? "has_reactions" .!= False     postPinned        <- v .:? "is_pinned"+    postMetadata      <- (v .: "metadata") <|> (return $ PostMetadata mempty mempty)     return Post { .. }  instance A.ToJSON Post where@@ -852,7 +854,25 @@     , "channel_id"      .= postChannelId     , "has_reactions"   .= postHasReactions     , "is_pinned"       .= postPinned+    , "metadata"        .= postMetadata     ]++data PostMetadata =+    PostMetadata { postMetadataFiles :: Seq FileInfo+                 , postMetadataReactions :: Seq Reaction+                 }+                 deriving (Read, Show, Eq)++instance A.FromJSON PostMetadata where+    parseJSON = A.withObject "PostMetadata" $ \o -> do+        PostMetadata <$> (o A..: "files" <|> return mempty)+                     <*> (o A..: "reactions" <|> return mempty)++instance A.ToJSON PostMetadata where+    toJSON pm =+        A.object [ "files" A..= postMetadataFiles pm+                 , "reactions" A..= postMetadataReactions pm+                 ]  data PendingPost   = PendingPost