<commit_before>{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-|
Module      : Network.Pusher
Description : Haskell interface to the Pusher HTTP API
Copyright   : (c) <NAME>, 2016
Licence     : MIT
Maintainer  : <EMAIL>
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.

First create a 'Pusher' data structure with your Pusher '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.

An example of how you would use these functions:

@
  let
    credentials = Credentials
      { credentialsAppID     = 123
      , credentialsAppKey    = <KEY>
      , credentialsAppSecret = <KEY>
      , credentialsCluster   = Nothing
      }
  pusher <- getPusher credentials

  triggerRes <-
    trigger pusher [Channel Public "my-channel"] "my-event" "my-data" Nothing

  case triggerRes of
    Left e -> putStrLn $ displayException e
    Right resp -> print resp

  -- import qualified Data.HashMap.Strict as H
  -- import qualified Data.Aeson          as A
  let
    -- A Firebase Cloud Messaging notification payload
    fcmObject = H.fromList [("notification", A.Object $ H.fromList
                                [("title", A.String "TITLE")
                                ,("body" , A.String "BODY")
                                ,("icon" , A.String "logo.png")
                                ]
                            )]
    Just interest = mkInterest "INTEREST"

    -- A Pusher notification
    notification = Notification
      { notificationInterest     = interest
      , notificationWebhookURL   = Nothing
      , notificationWebhookLevel = Nothing
      , notificationAPNSPayload  = Nothing<commit_msg>Remove capitalised words in quotes in example code<commit_after>{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-|
Module      : Network.Pusher
Description : Haskell interface to the Pusher HTTP API
Copyright   : (c) <NAME>, 2016
Licence     : MIT
Maintainer  : <EMAIL>
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.

First create a 'Pusher' data structure with your Pusher '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.

An example of how you would use these functions:

@
  let
    credentials = Credentials
      { credentialsAppID     = 123
      , credentialsAppKey    = <KEY>
      , credentialsAppSecret = <KEY>
      , credentialsCluster   = Nothing
      }
  pusher <- getPusher credentials

  triggerRes <-
    trigger pusher [Channel Public "my-channel"] "my-event" "my-data" Nothing

  case triggerRes of
    Left e -> putStrLn $ displayException e
    Right resp -> print resp

  -- import qualified Data.HashMap.Strict as H
  -- import qualified Data.Aeson          as A
  let
    -- A Firebase Cloud Messaging notification payload
    fcmObject = H.fromList [("notification", A.Object $ H.fromList
                                [("title", A.String "a title")
                                ,("body" , A.String "some text")
                                ,("icon" , A.String "logo.png")
                                ]
                            )]
    Just interest = mkInterest "some-interest"

    -- A Pusher notification
    notification = Notification
      { notificationInterest     = interest
      , notificationWebhookURL   = Nothing
      , notificationWebhookLevel = Nothing
      , notificationAPNSPayload  = Nothing
{'fraction_non_alphanumeric': 0.07522464698331194, 'fraction_numerical': 0.003594351732991014, 'mean_word_length': 2.3731601731601732, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1641168', 'n_tokens_mistral': 1054, 'n_tokens_neox': 1017, 'n_words': 378}