ms-azure-api 0.6.0.0 → 0.6.0.1
raw patch · 3 files changed
+18/−11 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ms-azure-api.cabal +1/−1
- src/MSAzureAPI/BotService.hs +12/−10
- src/MSAzureAPI/Internal/Common.hs +5/−0
ms-azure-api.cabal view
@@ -1,5 +1,5 @@ name: ms-azure-api-version: 0.6.0.0+version: 0.6.0.1 synopsis: Microsoft Azure API description: Bindings to the Microsoft Azure API homepage: https://github.com/unfoldml/ms-graph-api
src/MSAzureAPI/BotService.hs view
@@ -1,3 +1,4 @@+{-# options_ghc -Wno-unused-imports #-} -- | Azure Bot Framework -- -- https://learn.microsoft.com/en-us/azure/bot-service/rest-api/bot-framework-rest-connector-quickstart?view=azure-bot-service-4.0@@ -15,7 +16,7 @@ , TextBlock(..) , ColumnSet(..) , Column(..)- ) where+ ) where import Data.Char (toLower) import GHC.Exts (IsString(..))@@ -31,7 +32,7 @@ -- text import Data.Text (Text, pack, unpack) -import MSAzureAPI.Internal.Common (run, APIPlane(..), Location(..), locationDisplayName, (==:), get, getBs, post, postRaw, getLbs, put, tryReq, aesonOptions)+import MSAzureAPI.Internal.Common (run, APIPlane(..), Location(..), locationDisplayName, (==:), get, getBs, post, postRaw, getLbs, put, tryReq, aesonOptions, say) -- * Send and receive messages with the Bot Framework : https://learn.microsoft.com/en-us/azure/bot-service/rest-api/bot-framework-rest-connector-send-and-receive-messages?view=azure-bot-service-4.0@@ -45,7 +46,8 @@ -> AccessToken -> Req () sendReply acti txt atts atok = case aReplyToId acti of- Nothing -> pure ()+ Nothing -> do+ say "sendReply: replyToId is null" Just aid -> postRaw urib ["v3", "conversations", cid, "activities", aid] mempty actO atok where urib = aServiceUrl acti@@ -68,9 +70,9 @@ -- -- https://learn.microsoft.com/en-us/azure/bot-service/rest-api/bot-framework-rest-connector-send-and-receive-messages?view=azure-bot-service-4.0#send-a-non-reply-message sendMessage :: (A.FromJSON b) =>- Text- -> Text- -> Activity+ Text -- ^ base URI, taken from the @serviceUrl@ property in the incoming 'Activity' object+ -> Text -- ^ conversation ID+ -> Activity -- ^ message payload -> AccessToken -> Req b sendMessage urib cid = postRaw urib ["v3", "conversations", cid, "activities"] mempty@@ -83,12 +85,12 @@ , aId :: Maybe Text , aChannelId :: Maybe Text , aConversation :: ConversationAccount- , aFrom :: ChannelAccount- , aRecipient :: ChannelAccount+ , aFrom :: ChannelAccount -- ^ sender+ , aRecipient :: ChannelAccount -- ^ recipient , aServiceUrl :: Text -- ^ URL that specifies the channel's service endpoint. Set by the channel. , aReplyToId :: Maybe Text- , aText :: Text- , aAttachments :: [Attachment]+ , aText :: Text -- ^ message text+ , aAttachments :: [Attachment] -- ^ message attachments } deriving (Show, Generic) instance A.FromJSON Activity where parseJSON = A.genericParseJSON (aesonOptions "a")
src/MSAzureAPI/Internal/Common.hs view
@@ -34,6 +34,8 @@ , locationDisplayName -- ** JSON co\/dec , aesonOptions+ -- ** misc+ , say ) where import Control.Monad.IO.Class (MonadIO(..))@@ -293,3 +295,6 @@ -- > dropPrefix "Mr. " "Dr. Men" == "Dr. Men" dropPrefix :: Eq a => [a] -> [a] -> [a] dropPrefix a b = fromMaybe b $ stripPrefix a b++say :: MonadIO m => String -> m ()+say = liftIO . putStrLn