packages feed

chatwork 0.1.1.0 → 0.1.1.1

raw patch · 6 files changed

+70/−28 lines, 6 filesdep +chatworkdep ~aesonsetup-changednew-component:exe:sample-exePVP ok

version bump matches the API change (PVP)

Dependencies added: chatwork

Dependency ranges changed: aeson

API changes (from Hackage documentation)

Files

LICENSE view
@@ -1,21 +1,21 @@-MIT License--Copyright (c) 2017 MATSUBARA Nobutada--Permission is hereby granted, free of charge, to any person obtaining a copy-of this software and associated documentation files (the "Software"), to deal-in the Software without restriction, including without limitation the rights-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell-copies of the Software, and to permit persons to whom the Software is-furnished to do so, subject to the following conditions:--The above copyright notice and this permission notice shall be included in all-copies or substantial portions of the Software.--THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE-SOFTWARE.+MIT License
+
+Copyright (c) 2017 MATSUBARA Nobutada
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
Setup.hs view
@@ -1,2 +1,2 @@-import Distribution.Simple-main = defaultMain+import Distribution.Simple
+main = defaultMain
chatwork.cabal view
@@ -3,7 +3,7 @@ -- see: https://github.com/sol/hpack  name:                chatwork-version:             0.1.1.0+version:             0.1.1.1 synopsis:            The ChatWork API in Haskell description:         See README at <https://github.com/matsubara0507/chatwork#readme> homepage:            https://github.com/matsubara0507/chatwork#readme@@ -48,7 +48,7 @@       ChatWork.Internal   build-depends:       base >=4.7 && <5-    , aeson >=1.0.2.1 && <1.2+    , aeson >=1.0.2.1 && <1.3     , aeson-casing >=0.1.0.5 && <0.2     , bytestring >=0.10.8.1 && <0.11     , connection >=0.2.7 && <0.3@@ -61,6 +61,27 @@     , text >=1.2.2.1 && <1.3   default-language: Haskell2010 +executable sample-exe+  main-is: Main.hs+  hs-source-dirs:+      sample+  ghc-options: -Wall+  build-depends:+      base >=4.7 && <5+    , aeson >=1.0.2.1 && <1.3+    , aeson-casing >=0.1.0.5 && <0.2+    , bytestring >=0.10.8.1 && <0.11+    , connection >=0.2.7 && <0.3+    , data-default-class >=0.1.2.0 && <0.2+    , http-api-data >=0.3.5 && <0.3.8+    , http-client >=0.5.5.0 && <0.6+    , http-client-tls >=0.3.3.1 && <0.4+    , http-types >=0.9.1 && <0.10+    , req >=0.3.0 && <0.4+    , text >=1.2.2.1 && <1.3+    , chatwork+  default-language: Haskell2010+ test-suite spec   type: exitcode-stdio-1.0   main-is: Spec.hs@@ -70,7 +91,7 @@   ghc-options: -Wall   build-depends:       base >=4.7 && <5-    , aeson >=1.0.2.1 && <1.2+    , aeson >=1.0.2.1 && <1.3     , aeson-casing >=0.1.0.5 && <0.2     , bytestring >=0.10.8.1 && <0.11     , connection >=0.2.7 && <0.3
+ sample/Main.hs view
@@ -0,0 +1,21 @@+{-# LANGUAGE OverloadedStrings #-}
+
+import           ChatWork
+import           Network.HTTP.Req (responseBody)
+
+main :: IO ()
+main = do
+  let
+    token  = "xxx"
+    client = ChatWorkClient token
+  (Right myId) <- (fmap meToAccountId . responseBody) <$> getMe client
+  (Right ids) <-
+      (fmap (fmap contactToAccountId) . responseBody) <$> getContacts client
+  (Right roomId) <- (fmap getRoomId . responseBody) <$> createRoom client
+      (CreateRoomParams Nothing Nothing [myId] (Just ids) Nothing "test")
+  _ <- postMessage client roomId "Wellcome to Test Room !!"
+  _ <- createTask client roomId
+      (CreateTaskParams "Self-Introduction" Nothing ids)
+
+  putStrLn $
+    "I Created Test Room and Tasks that Self-Introductions to my contact members."
src/ChatWork/Types/My.hs view
@@ -47,7 +47,7 @@   parseJSON = genericParseJSON $ aesonDrop (strLength "myTaskTo") snakeCase
 
 -- |
--- see: <http://developer.chatwork.com/ja/endpoint_rooms.html#GET-rooms-room_id-tasks>
+-- see: <http://developer.chatwork.com/ja/endpoint_my.html#GET-my-tasks>
 data GetMyTasksParams = GetMyTasksParams
                    { getMyTasksAssignedByAccountId :: Maybe AccountId
                    , getMyTasksStatus              :: Maybe TaskStatus
test/Spec.hs view
@@ -1,1 +1,1 @@-{-# OPTIONS_GHC -F -pgmF hspec-discover #-}+{-# OPTIONS_GHC -F -pgmF hspec-discover #-}