packages feed

mattermost-api 50200.8.0 → 50200.9.0

raw patch · 4 files changed

+31/−2 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Network.Mattermost.Types: ServerBaseURL :: Text -> ServerBaseURL
+ Network.Mattermost.Types: connectionDataURL :: ConnectionData -> ServerBaseURL
+ Network.Mattermost.Types: newtype ServerBaseURL
+ Network.Mattermost.Types.Internal: ServerBaseURL :: Text -> ServerBaseURL
+ Network.Mattermost.Types.Internal: connectionDataURL :: ConnectionData -> ServerBaseURL
+ Network.Mattermost.Types.Internal: instance GHC.Classes.Eq Network.Mattermost.Types.Internal.ServerBaseURL
+ Network.Mattermost.Types.Internal: instance GHC.Show.Show Network.Mattermost.Types.Internal.ServerBaseURL
+ Network.Mattermost.Types.Internal: newtype ServerBaseURL

Files

CHANGELOG.md view
@@ -1,5 +1,13 @@ -50200.7.0+50200.9.0+=========++API changes:+ * Added `Network.Mattermost.Types.Internal.connectionDataURL` and its+   return type, `ServerBaseURL`, to obtain base URLs corresponding to a+   connection handle.++50200.8.0 =========  API changes:
mattermost-api.cabal view
@@ -1,5 +1,5 @@ name:                mattermost-api-version:             50200.8.0+version:             50200.9.0 synopsis:            Client API for Mattermost chat system  description:         Client API for Mattermost chat system.  Mattermost is a
src/Network/Mattermost/Types.hs view
@@ -9,6 +9,8 @@     ( module Network.Mattermost.Types     , module Network.Mattermost.Types.Base     , ConnectionType(..)+    , connectionDataURL+    , ServerBaseURL(..)     )     where 
src/Network/Mattermost/Types/Internal.hs view
@@ -10,6 +10,7 @@ module Network.Mattermost.Types.Internal where  import Control.Monad (when)+import Data.Monoid ((<>)) import Data.Pool (Pool) import qualified Network.Connection as C import Control.Exception (finally)@@ -92,3 +93,21 @@   , cdLogger         :: Maybe Logger   , cdConnectionType :: ConnectionType   }++newtype ServerBaseURL = ServerBaseURL T.Text+                      deriving (Eq, Show)++connectionDataURL :: ConnectionData -> ServerBaseURL+connectionDataURL cd =+    let scheme = case cdConnectionType cd of+            ConnectHTTPS {} -> "https"+            ConnectHTTP {} -> "http"+        host = cdHostname cd+        port = T.pack $+               if cdConnectionType cd == ConnectHTTP+               then if cdPort cd == 80 then "" else ":" <> show (cdPort cd)+               else if cdPort cd == 443 then "" else ":" <> show (cdPort cd)+        path1 = cdUrlPath cd+        path2 = if "/" `T.isPrefixOf` path1+                then path1 else "/" <> path1+    in ServerBaseURL $ scheme <> "://" <> host <> port <> path2