slack-api 0.6 → 0.7
raw patch · 6 files changed
+16/−9 lines, 6 filesdep ~lens
Dependency ranges changed: lens
Files
- slack-api.cabal +2/−2
- src/Web/Slack/Types/Event.hs +6/−0
- src/Web/Slack/Types/Event/Subtype.hs +4/−1
- src/Web/Slack/Types/File.hs +2/−2
- src/Web/Slack/Types/Preferences.hs +2/−3
- src/Web/Slack/Types/TeamPreferences.hs +0/−1
slack-api.cabal view
@@ -1,5 +1,5 @@ Name: slack-api-Version: 0.6+Version: 0.7 Synopsis: Bindings to the Slack RTM API. Description: This library provides bindings to the <https://api.slack.com/rtm Slack Real Time Messaging API>. Users should find it easy to program their own Slack bots using the functionality found in `Web.Slack`.@@ -69,7 +69,7 @@ websockets > 0.9, wreq >= 0.2, text >= 1.2,- lens >= 4.6,+ lens >= 4.8, lens-aeson >= 1.0 , network >= 2.6, network-uri >= 2.6,
src/Web/Slack/Types/Event.hs view
@@ -89,6 +89,8 @@ MessageError :: Int -> SlackError -> Event StatusChange :: UserId -> Text -> SlackTimeStamp -> Event Pong :: Time -> Event+ ReconnectUrl :: URL -> Event+ TeamMigrationStarted :: Event -- Unstable PinAdded :: Event PinRemoved :: Event@@ -183,6 +185,8 @@ "accounts_changed" -> pure AccountsChanged "status_change" -> StatusChange <$> v .: "user" <*> v .: "status" <*> v .: "event_ts" "pong" -> Pong <$> v .: "timestamp"+ "reconnect_url" -> ReconnectUrl <$> v .: "url"+ "team_migration_started" -> pure TeamMigrationStarted "pin_added" -> pure PinAdded "pin_removed" -> pure PinRemoved _ -> return $ UnknownEvent o@@ -201,3 +205,5 @@ instance FromJSON ChannelRenameInfo where parseJSON = withObject "ChannelRenameInfo" (\o -> ChannelRenameInfo <$> o .: "id" <*> o .: "name" <*> o .: "created") ++makePrisms ''Event
src/Web/Slack/Types/Event/Subtype.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE LambdaCase, GADTs, OverloadedStrings #-}+{-# LANGUAGE LambdaCase, GADTs, OverloadedStrings, TemplateHaskell #-} module Web.Slack.Types.Event.Subtype (Subtype(..), subtype) where import Data.Aeson@@ -11,6 +11,7 @@ import Web.Slack.Types.Item import Control.Applicative import Data.Text (Text)+import Control.Lens.TH type Username = Text @@ -42,6 +43,8 @@ SPinnedItem :: Subtype SUnpinnedItem :: Subtype deriving Show++makePrisms ''Subtype subtype :: String -> Value -> Parser Subtype subtype s = withObject "subtype" (\v ->
src/Web/Slack/Types/File.hs view
@@ -56,7 +56,7 @@ <*> o .: "channels" <*> o .: "groups" <*> o .:? "initial_comment" <*> fmap (fromMaybe 0) (o .:? "num_stars") <*> o .: "comments_count" ) instance FromJSON FileUrl where- parseJSON = withObject "FileURL" (\o -> URL <$> o .: "url" <*> o .: "url_download" <*> o .: "url_private" <*> o .: "url_private_download")+ parseJSON = withObject "FileURL" (\o -> URL <$> o .: "url_private" <*> o .: "url_private_download") instance FromJSON Thumbnail where parseJSON = withObject "Thumbnail" (\o -> Thumbnail <$> o .:? "thumb_64" <*> o .:? "thumb_80" <*> o .:? "thumb_360" <*> o .:? "thumb_360_gif" <*> o .:? "thumb_360_w" <*> o .:? "thumb_360_h") instance FromJSON Preview where@@ -64,7 +64,7 @@ <*> o .: "lines" <*> o .: "lines_more") data Preview = Preview { _previewText :: Text, _previewHighlight :: Text, _lines :: Int, _linesMore :: Int } deriving Show-data FileUrl = URL { _access :: Text, _download :: Text, _private :: Text, _privateDownload :: Text } deriving Show+data FileUrl = URL { _private :: Text, _privateDownload :: Text } deriving Show data Thumbnail = Thumbnail { _w64 :: Maybe URL, _w80 :: Maybe URL, _w360 :: Maybe URL, _w360gif :: Maybe URL, _width :: Maybe Int, _height :: Maybe Int} deriving Show makeLenses ''File
src/Web/Slack/Types/Preferences.hs view
@@ -4,7 +4,7 @@ import Data.Aeson.TH import Data.Text (Text) import Web.Slack.Utils---import Control.Lens.TH+import Control.Lens.TH data Preferences = Preferences@@ -87,7 +87,6 @@ , _prefMutedChannels :: Text , _prefPrivacyPolicySeen :: Bool , _prefSearchExcludeBots :: Bool- , _prefFuzzyMatching :: Bool } deriving Show @@ -97,5 +96,5 @@ -- Bad performance regression from lens 4.6 causes GHC to run out of memory -- on compilation---makeLenses ''Preferences+makeLenses ''Preferences
src/Web/Slack/Types/TeamPreferences.hs view
@@ -44,7 +44,6 @@ , _teamGroupRetentionDuration :: Int , _teamDmRetentionType :: Int , _teamDmRetentionDuration :: Int- , _teamRequireAtForMention :: Int } deriving Show