pusher-http-haskell 1.5.1.13 → 1.5.1.14
raw patch · 6 files changed
+28/−26 lines, 6 filesdep ~cryptonitePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: cryptonite
API changes (from Hackage documentation)
Files
- pusher-http-haskell.cabal +5/−5
- src/Network/Pusher.hs +11/−10
- src/Network/Pusher/Data.hs +6/−5
- test/Auth.hs +3/−3
- test/Protocol.hs +2/−2
- test/Webhook.hs +1/−1
pusher-http-haskell.cabal view
@@ -1,5 +1,5 @@ name: pusher-http-haskell-version: 1.5.1.13+version: 1.5.1.14 cabal-version: 1.18 build-type: Simple license: MIT@@ -9,10 +9,10 @@ stability: experimental homepage: https://github.com/WillSewell/pusher-http-haskell bug-reports: https://github.com/WillSewell/pusher-http-haskell/issues-synopsis: Haskell client library for the Pusher HTTP API+synopsis: Haskell client library for the Pusher Channels HTTP API description:- Functions that correspond to endpoints of the Pusher HTTP- API. Messages can be triggered, and information about the+ Functions that correspond to endpoints of the Pusher Channels+ HTTP API. Messages can be triggered, and information about the channel can be queried. Additionally there are functions for authenticating users of private and presence channels. category: Network@@ -36,7 +36,7 @@ base >=4.7 && <4.15, bytestring ==0.10.*, base16-bytestring ==0.1.*,- cryptonite >= 0.6 && <0.27,+ cryptonite >= 0.6 && <0.28, hashable >=1.2 && <1.4, http-client >=0.4 && <0.8, http-types >=0.8 && <0.13,
src/Network/Pusher.hs view
@@ -2,18 +2,18 @@ {-# LANGUAGE FlexibleContexts #-} {-| Module : Network.Pusher-Description : Haskell interface to the Pusher HTTP API+Description : Haskell interface to the Pusher Channels HTTP API Copyright : (c) Will Sewell, 2016 Licence : MIT Maintainer : me@willsewell.com Stability : experimental -Exposes the functions necessary for interacting with the Pusher HTTP API, as-well as functions for generating auth signatures for private and presence-channels.+Exposes the functions necessary for interacting with the Pusher Channels HTTP+API, as well as functions for generating auth signatures for private and+presence channels. -First create a 'Pusher' data structure with your Pusher 'Credentials', and then-call the functions defined in this module to make the HTTP requests.+First create a 'Pusher' data structure with your Pusher Channels 'Credentials',+and then call the functions defined in this module to make the HTTP requests. If any of the requests fail, the return values of the functions will result in a 'Left' 'PusherError' when run.@@ -49,7 +49,7 @@ )] Just interest = 'mkInterest' "some-interest" - -- A Pusher notification+ -- A Pusher Channels notification notification = 'Notification' { 'notificationInterest' = interest , 'notificationWebhookURL' = Nothing@@ -66,7 +66,8 @@ There are simple working examples in the example/ directory. -See https://pusher.com/docs/rest_api for more detail on the HTTP requests.+See https://pusher.com/docs/channels/server_api/http-api for more detail on the+HTTP requests. -} module Network.Pusher ( -- * Data types@@ -228,8 +229,8 @@ HTTP.post (pusherConnectionManager pusher) requestParams requestBody -- |Parse webhooks from a list of HTTP headers and a HTTP body given their--- 'AppKey' matches the one in our Pusher credentials and the webhook is--- correctly encrypted by the corresponding 'AppSecret'.+-- 'AppKey' matches the one in our Pusher Channels credentials and the webhook+-- is correctly encrypted by the corresponding 'AppSecret'. parseWebhookPayload :: Pusher -> [(BC.ByteString, BC.ByteString)]
src/Network/Pusher/Data.hs view
@@ -3,16 +3,16 @@ {-| Module : Network.Pusher.Data-Description : Data structure representing Pusher concepts and config+Description : Data structure representing Pusher Channels concepts and config Copyright : (c) Will Sewell, 2016 Licence : MIT Maintainer : me@willsewell.com Stability : experimental You must create an instance of the Pusher datatype with your particular Pusher-app credentials in order to run the main API functions.+Channels app credentials in order to run the main API functions. -The other types represent Pusher channels and Pusher event fields.+The other types represent channels and event fields. -} module Network.Pusher.Data ( -- * Pusher config data type@@ -175,7 +175,7 @@ type ChannelName = T.Text --- |The possible types of Pusher channe.+-- |The possible types of channel. data ChannelType = Public | Private@@ -261,7 +261,8 @@ instance A.ToJSON Interest where toJSON (Interest txt) = A.String txt --- |URL to which pusher will send information about sent push notifications.+-- |URL to which Pusher Channels will send information about sent push+-- notifications. type WebhookURL = T.Text -- |Level of detail sent to WebhookURL. Defaults to Info.
test/Auth.hs view
@@ -11,7 +11,7 @@ test = do describe "Auth.makeQS" $ it "works" $- -- Happy case based on data from the docs: https://pusher.com/docs/rest_api#worked-authentication-example+ -- Happy case based on data from the docs: https://pusher.com/docs/channels/library_auth_reference/auth-signatures#worked-example let body = "{\"name\":\"foo\",\"channels\":[\"project-3\"],\"data\":\"{\\\"some\\\":\\\"data\\\"}\"}" in makeQS@@ -31,12 +31,12 @@ ] describe "Auth.authenticatePrivate" $ it "works" $- -- Data from https://pusher.com/docs/auth_signatures#worked-example+ -- Data from https://pusher.com/docs/channels/library_auth_reference/auth-signatures#worked-example authenticatePrivate credentials "1234.1234" (Channel Private "foobar") `shouldBe` "278d425bdf160c739803:58df8b0c36d6982b82c3ecf6b4662e34fe8c25bba48f5369f135bf843651c3a4" describe "Auth.authenticatePresenceWithEncoder" $ it "works for presence channels" $- -- Data from https://pusher.com/docs/auth_signatures#presence+ -- Data from https://pusher.com/docs/channels/library_auth_reference/auth-signatures#presence-channels let userData = "{\"user_id\":10,\"user_info\":{\"name\":\"Mr. Pusher\"}}" in authenticatePresenceWithEncoder (const userData)
test/Protocol.hs view
@@ -35,7 +35,7 @@ parseChannel (renderChannel chan) == chan describe "Protocol.ChannelsInfo" $ it "parsing works" $- -- Data from https://pusher.com/docs/rest_api#successful-response-1+ -- Data from https://pusher.com/docs/channels/library_auth_reference/rest-api#successful-response A.decode "{\ \ \"channels\": {\@@ -55,7 +55,7 @@ ]) describe "Protocol.FullChannelInfo" $ it "parsing works" $- -- Data from https://pusher.com/docs/rest_api#successful-response-2+ -- Data from https://pusher.com/docs/channels/library_auth_reference/rest-api#successful-response A.decode "{\ \ \"occupied\": true,\
test/Webhook.hs view
@@ -15,7 +15,7 @@ import Test.QuickCheck (property) data TestWebhookPayload = TestWebhookPayload {- -- A Request recieved from Pusher+ -- A Request recieved from Pusher Channels _webhookRequest :: ([(B.ByteString, B.ByteString)], B.ByteString) -- Must have this key , _hasKey :: AppKey