packages feed

slack-web 0.2.0.11 → 0.2.0.12

raw patch · 4 files changed

+83/−6 lines, 4 filesdep ~basedep ~megaparsec

Dependency ranges changed: base, megaparsec

Files

slack-web.cabal view
@@ -1,5 +1,5 @@ name: slack-web-version: 0.2.0.11+version: 0.2.0.12  build-type: Simple cabal-version: 1.20@@ -45,7 +45,7 @@       Web.Slack.Util   build-depends:       aeson >= 1.0 && < 1.5-    , base >= 4.11 && < 4.13+    , base >= 4.11 && < 4.14     , containers     , http-api-data >= 0.3 && < 0.5     , http-client >= 0.5 && < 0.7@@ -58,7 +58,7 @@     , mtl     , time     , errors-    , megaparsec >= 5.0 && < 7.1+    , megaparsec >= 5.0 && < 9   default-language:       Haskell2010   ghc-options:@@ -79,7 +79,7 @@       Web.Slack.MessageParserSpec       Web.Slack.Types   build-depends:-      base >= 4.11 && < 4.13+      base >= 4.11 && < 4.14     , containers     , aeson     , errors@@ -87,7 +87,7 @@     , http-api-data     , text     , time-    , megaparsec >= 5.0 && < 7.1+    , megaparsec >= 5.0 && < 9   default-language:     Haskell2010   ghc-options:
src/Web/Slack.hs view
@@ -31,6 +31,7 @@   , mpimHistory   , getUserDesc   , usersList+  , userLookupByEmail   , authenticateReq   , Response   , HasManager(..)@@ -196,6 +197,11 @@     "users.list"       :> AuthProtect "token"       :> Post '[JSON] (ResponseJSON User.ListRsp)+  :<|>+    "users.lookupByEmail"+      :> AuthProtect "token"+      :> ReqBody '[FormUrlEncoded] User.Email+      :> Post '[JSON] (ResponseJSON User.UserRsp)   -- |@@ -442,6 +448,27 @@   :: AuthenticatedRequest (AuthProtect "token")   -> ClientM (ResponseJSON User.ListRsp) +-- |+--+-- This method returns a list of all users in the team.+-- This includes deleted/deactivated users.+--+-- <https://api.slack.com/methods/users.lookupByEmail>++userLookupByEmail+  :: (MonadReader env m, HasManager env, HasToken env, MonadIO m)+  => User.Email +  -> m (Response User.UserRsp)+userLookupByEmail email = do+  authR <- mkSlackAuthenticateReq+  run (userLookupByEmail_ authR email)++userLookupByEmail_+  :: AuthenticatedRequest (AuthProtect "token")+  -> User.Email+  -> ClientM (ResponseJSON User.UserRsp)++ -- | Returns a function to get a username from a 'Common.UserId'. -- Comes in handy to use 'Web.Slack.MessageParser.messageToHtml' getUserDesc@@ -521,6 +548,7 @@   :<|> mpimList_   :<|> mpimHistory_   :<|> usersList_+  :<|> userLookupByEmail_   =   client (Proxy :: Proxy Api) 
src/Web/Slack/Chat.hs view
@@ -71,6 +71,7 @@     , postMsgReqParse :: Maybe Text     , postMsgReqLinkNames :: Maybe Bool     , postMsgReqAttachments :: Maybe Text+    , postMsgReqBlocks :: Maybe Text     , postMsgReqUnfurlLinks :: Maybe Bool     , postMsgReqUnfurlMedia :: Maybe Bool     , postMsgReqUsername :: Maybe Text@@ -114,6 +115,7 @@     , postMsgReqParse = Nothing     , postMsgReqLinkNames = Nothing     , postMsgReqAttachments = Nothing+    , postMsgReqBlocks = Nothing     , postMsgReqUnfurlLinks = Nothing     , postMsgReqUnfurlMedia = Nothing     , postMsgReqUsername = Nothing
src/Web/Slack/User.hs view
@@ -1,6 +1,7 @@ {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE OverloadedLists #-}  ---------------------------------------------------------------------- -- |@@ -12,8 +13,11 @@ ----------------------------------------------------------------------  module Web.Slack.User-  ( User(..)+  ( Profile(..)+  , User(..)   , ListRsp(..)+  , Email(..)+  , UserRsp(..)   )   where @@ -33,12 +37,41 @@ -- time import Data.Time.Clock.POSIX +-- http-api-data+import Web.HttpApiData+import Web.FormUrlEncoded++-- See https://api.slack.com/types/user++data Profile = +  Profile +    { profileAvatarHash :: Maybe Text+    , profileStatusText :: Maybe Text+    , profileStatusEmoji :: Maybe Text +    , profileRealName :: Maybe Text +    , profileDisplayName :: Maybe Text +    , profileRealNameNormalized :: Maybe Text +    , profileDisplayNameNormalized :: Maybe Text +    , profileEmail :: Maybe Text +    , profileImage_24 :: Text +    , profileImage_32 :: Text +    , profileImage_48 :: Text +    , profileImage_72 :: Text +    , profileImage_192 :: Text +    , profileImage_512 :: Text +    , profileTeam :: Maybe Text +    }+  deriving (Eq, Generic, Show)++$(deriveFromJSON (jsonOpts "profile") ''Profile)+ data User =   User     { userId :: UserId     , userName :: Text     , userDeleted :: Bool     , userColor :: Maybe Color+    , userProfile :: Maybe Profile     , userIsAdmin :: Maybe Bool     , userIsOwner :: Maybe Bool     , userIsPrimaryOwner :: Maybe Bool@@ -57,3 +90,17 @@   deriving (Eq, Generic, Show)  $(deriveFromJSON (jsonOpts "listRsp") ''ListRsp)+++data UserRsp =+  UserRsp+    { userRspUser :: User+    }+  deriving (Eq, Generic, Show)++$(deriveFromJSON (jsonOpts "UserRsp") ''UserRsp)++newtype Email = Email Text deriving (Eq, Generic, Show)+instance ToForm Email where +  toForm (Email txt) = [("email", toQueryParam txt)]+