packages feed

line-bot-sdk 0.5.0.2 → 0.5.1.0

raw patch · 6 files changed

+21/−64 lines, 6 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Line.Bot.Client: broadcastMessage :: [Message] -> Line NoContent
- Line.Bot.Client: getBroadcastMessageCount :: Day -> Line (Maybe Int)
- Line.Bot.Internal.Endpoints: type BroadcastMessage = BroadcastMessage' BroadcastMessageBody
- Line.Bot.Internal.Endpoints: type BroadcastMessage' a = "v2" :> "bot" :> "message" :> "broadcast" :> ReqBody '[JSON] a :> ChannelAuth :> PostNoContent '[JSON] NoContent
- Line.Bot.Internal.Endpoints: type GetBroadcastMessageCount = GetBroadcastMessageCount' LineDate MessageCount
- Line.Bot.Internal.Endpoints: type GetBroadcastMessageCount' a b = "v2" :> "bot" :> "message" :> "delivery" :> "broadcast" :> QueryParam' '[Required, Strict] "date" a :> ChannelAuth :> Get '[JSON] b
- Line.Bot.Types: BroadcastMessageBody :: [Message] -> BroadcastMessageBody
- Line.Bot.Types: instance Data.Aeson.Types.ToJSON.ToJSON Line.Bot.Types.BroadcastMessageBody
- Line.Bot.Types: instance GHC.Generics.Generic Line.Bot.Types.BroadcastMessageBody
- Line.Bot.Types: instance GHC.Show.Show Line.Bot.Types.BroadcastMessageBody
- Line.Bot.Types: newtype BroadcastMessageBody
- Line.Bot.Webhook.Events: instance Data.Aeson.Types.ToJSON.ToJSON Line.Bot.Webhook.Events.Source
+ Line.Bot.Webhook.Events: instance GHC.Classes.Eq Line.Bot.Webhook.Events.Event
+ Line.Bot.Webhook.Events: instance GHC.Classes.Eq Line.Bot.Webhook.Events.Events
+ Line.Bot.Webhook.Events: instance GHC.Classes.Eq Line.Bot.Webhook.Events.Members
+ Line.Bot.Webhook.Events: instance GHC.Classes.Eq Line.Bot.Webhook.Events.Source

Files

README.md view
@@ -41,24 +41,21 @@ ## Usage  ```haskell-{-# LANGUAGE DataKinds         #-} {-# LANGUAGE OverloadedStrings #-} -import           Data.String        (fromString)-import           Line.Bot.Client-import           Line.Bot.Types-import           System.Environment (getEnv)+import Data.String (fromString)+import Line.Bot.Client (Line, getProfile, runLine)+import Line.Bot.Types (Profile)+import System.Environment (getEnv) -getProfiles :: Id Room -> Line [Profile]-getProfiles roomId = do-  userIds <- getRoomMemberUserIds roomId-  sequence $ getRoomMemberProfile roomId <$> userIds+profile :: Line Profile+profile = getProfile "U4af4980629..."  main = do-  token  <- fromString <$> getEnv "CHANNEL_TOKEN"-  result <- runLine (getProfiles "U4af4980629...") token+  token <- fromString <$> getEnv "CHANNEL_TOKEN"+  result <- runLine profile token   case result of-    Left err      -> print err+    Left err -> print err     Right profile -> print profile ``` 
line-bot-sdk.cabal view
@@ -1,5 +1,5 @@ name:                line-bot-sdk-version:             0.5.0.2+version:             0.5.1.0 synopsis:            Haskell SDK for LINE Messaging API homepage:            https://github.com/moleike/line-bot-sdk#readme bug-reports:         https://github.com/moleike/line-bot-sdk/issues
src/Line/Bot/Client.hs view
@@ -36,12 +36,10 @@   , replyMessage   , pushMessage   , multicastMessage-  , broadcastMessage   , getContent   , getPushMessageCount   , getReplyMessageCount   , getMulticastMessageCount-  , getBroadcastMessageCount   , getMessageQuota   -- ** Account Link   , issueLinkToken@@ -100,10 +98,10 @@   addLineAuth comp = ask >>= \token -> lift $ comp (mkAuth token)  instance HasLine (a -> LineAuth b) where-  addLineAuth comp = addLineAuth . comp+  addLineAuth comp a = addLineAuth (comp a)  instance HasLine (a -> b -> LineAuth c) where-  addLineAuth comp = addLineAuth . comp+  addLineAuth comp a = addLineAuth (comp a)  line :: (HasLine (Client ClientM api), HasClient ClientM api)      => Proxy api -> AddLineAuth (Client ClientM api)@@ -174,12 +172,6 @@ multicastMessage :: [Id User] -> [Message] -> Line NoContent multicastMessage a ms = multicastMessage' (MulticastMessageBody a ms) -broadcastMessage' :: BroadcastMessageBody -> Line NoContent-broadcastMessage' = line (Proxy :: Proxy BroadcastMessage)--broadcastMessage :: [Message] -> Line NoContent-broadcastMessage = broadcastMessage' . BroadcastMessageBody- getContent :: MessageId -> Line LB.ByteString getContent = line (Proxy :: Proxy GetContent) @@ -200,12 +192,6 @@  getMulticastMessageCount :: Day -> Line (Maybe Int) getMulticastMessageCount = fmap count . getMulticastMessageCount' . LineDate--getBroadcastMessageCount' :: LineDate -> Line MessageCount-getBroadcastMessageCount' = line (Proxy :: Proxy GetBroadcastMessageCount)--getBroadcastMessageCount :: Day -> Line (Maybe Int)-getBroadcastMessageCount = fmap count . getBroadcastMessageCount' . LineDate  getMessageQuota' :: Line MessageQuota getMessageQuota' = line (Proxy :: Proxy GetMessageQuota)
src/Line/Bot/Internal/Endpoints.hs view
@@ -113,15 +113,6 @@  type MulticastMessage = MulticastMessage' MulticastMessageBody -type BroadcastMessage' a =-     "v2":> "bot" :> "message"-  :> "broadcast"-  :> ReqBody '[JSON] a-  :> ChannelAuth-  :> PostNoContent '[JSON] NoContent--type BroadcastMessage = BroadcastMessage' BroadcastMessageBody- type GetContent =      "v2":> "bot" :> "message"   :> Capture "messageId" MessageId@@ -162,15 +153,6 @@   :> Get '[JSON] b  type GetMulticastMessageCount = GetMulticastMessageCount' LineDate MessageCount--type GetBroadcastMessageCount' a b =-     "v2" :> "bot" :> "message" :> "delivery"-  :> "broadcast"-  :> QueryParam' '[Required, Strict] "date" a-  :> ChannelAuth-  :> Get '[JSON] b--type GetBroadcastMessageCount = GetBroadcastMessageCount' LineDate MessageCount  type GetMessageQuota' a =      "v2":> "bot" :> "message" :> "quota"
src/Line/Bot/Types.hs view
@@ -33,7 +33,6 @@   , ReplyMessageBody(ReplyMessageBody)   , PushMessageBody(PushMessageBody)   , MulticastMessageBody(MulticastMessageBody)-  , BroadcastMessageBody(BroadcastMessageBody)   , Profile(..)   , QuickReply(..)   , QuickReplyButton(..)@@ -248,12 +247,6 @@   deriving (Show, Generic)  instance ToJSON MulticastMessageBody--newtype BroadcastMessageBody = BroadcastMessageBody-  { messages :: [Message] }-  deriving (Show, Generic)--instance ToJSON BroadcastMessageBody  newtype QuickReply = QuickReply   { items :: [QuickReplyButton] }
src/Line/Bot/Webhook/Events.hs view
@@ -60,7 +60,7 @@   { destination :: Id User -- ^ User ID of a bot that should receive webhook events   , events      :: [Event] -- ^ List of webhook event objects   }-  deriving (Show, Generic)+  deriving (Eq, Show, Generic)  instance FromJSON Events @@ -114,7 +114,7 @@                       , timestamp  :: EpochMilli                       , things     :: Things                       }-  deriving (Show, Generic)+  deriving (Eq, Show, Generic)  instance FromJSON Event where   parseJSON = genericParseJSON defaultOptions@@ -197,6 +197,12 @@  deriving instance Show Source +instance Eq Source where+  Source (UserId a)  == Source (UserId b)  = a == b+  Source (GroupId a) == Source (GroupId b) = a == b+  Source (RoomId a)  == Source (RoomId b)  = a == b+  _                  == _                  = False+ instance FromJSON Source where   parseJSON = withObject "Source" $ \o -> do     messageType <- o .: "type"@@ -206,15 +212,8 @@       "room"  -> (Source . RoomId)  <$> o .: "roomId"       _       -> fail ("unknown source: " ++ messageType) --instance ToJSON Source where-  toJSON (Source (UserId a))  = object ["type" .= "user", "userId" .= a]-  toJSON (Source (GroupId a)) = object ["type" .= "group", "groupId" .= a]-  toJSON (Source (RoomId a))  = object ["type" .= "room", "roomId" .= a]-- newtype Members = Members { members :: [Source] }-  deriving (Show, Generic)+  deriving (Eq, Show, Generic)  instance FromJSON Members