-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | A server-side library for sending push notifications.
--
-- This library offers a simple abstraction for sending notifications
-- through APNS, GCM and MPNS.
--
-- For more information and test examples:
-- http://gsoc2013cwithmobiledevices.blogspot.com.ar/
--
-- GitHub repository:
-- https://github.com/MarcosPividori/GSoC-Communicating-with-mobile-devices
@package push-notify
@version 0.1.0.0
-- | This library defines an API for communicating with WPhone powered
-- devices, sending Push Notifications through Microsoft Push
-- Notification Service.
module Network.PushNotify.Mpns
-- | sendMPNS sends the message to a MPNS Server.
sendMPNS :: Manager -> MPNSConfig -> MPNSmessage -> IO MPNSresult
-- | MPNSConfig represents the main necessary information for
-- sending notifications through MPNS. If it is not necessary a secure
-- connection, the default value can be used.
--
-- For loading the certificate and privateKey you can use:
-- fileReadCertificate and fileReadPrivateKey .
data MPNSConfig
MPNSConfig :: Int -> Bool -> X509 -> PrivateKey -> MPNSConfig
-- | Number of attemps to send the message to the server.
numRet :: MPNSConfig -> Int
-- | To set a secure connection (HTTPS).
useSecure :: MPNSConfig -> Bool
-- | Certificate (only necessary for secure connections).
mpnsCertificate :: MPNSConfig -> X509
-- | Private key (only necessary for secure connections).
mpnsPrivatekey :: MPNSConfig -> PrivateKey
-- | DeviceURI is an unique identifier of an app/device, provided by
-- MPNS.
type DeviceURI = Text
-- | MPNSType represents the three different kind of notifications.
data MPNSType
Toast :: MPNSType
Raw :: MPNSType
Tile :: MPNSType
-- | MPNSType represents the batching interval.
data MPNSInterval
-- | Immediate delivery.
Immediate :: MPNSInterval
-- | Delivered within 450 seconds.
Sec450 :: MPNSInterval
-- | Delivered within 900 seconds.
Sec900 :: MPNSInterval
-- | MPNSmessage represents a message to be sent through MPNS.
data MPNSmessage
MPNSmessage :: HashSet DeviceURI -> MPNSInterval -> MPNSType -> Document -> MPNSmessage
-- | Destination.
deviceURIs :: MPNSmessage -> HashSet DeviceURI
-- | When to deliver the notification.
batching_interval :: MPNSmessage -> MPNSInterval
-- | The kind of notification.
target :: MPNSmessage -> MPNSType
-- | The XML data content to be sent.
restXML :: MPNSmessage -> Document
-- | MPNSresult represents information about messages after a
-- communication with MPNS Servers.
--
-- Take into account that a successful result after communicating with
-- MPNS servers does not mean that the notification was successfully
-- sent. It is necessary to check the MPNSinfo , provided by the
-- servers, to really know about the state of the notification.
data MPNSresult
MPNSresult :: HashMap DeviceURI MPNSinfo -> HashMap DeviceURI SomeException -> MPNSresult
-- | Notifications that were successfully sent. (To the server, not to
-- device)
successfullResults :: MPNSresult -> HashMap DeviceURI MPNSinfo
-- | Failed notifications that you need to resend, because there was a
-- problem connecting with MPNS servers.
errorException :: MPNSresult -> HashMap DeviceURI SomeException
-- | MPNSinfo represents information about a specific notification
-- and device, after a communication with MPNS Servers.
data MPNSinfo
MPNSinfo :: Maybe MPNSnotifStatus -> Maybe MPNSsubStatus -> Maybe MPNSconStatus -> MPNSinfo
notificationStatus :: MPNSinfo -> Maybe MPNSnotifStatus
subscriptionStatus :: MPNSinfo -> Maybe MPNSsubStatus
connectionStatus :: MPNSinfo -> Maybe MPNSconStatus
-- | MPNSnotifStatus represents the status of a notification which
-- has been sent.
data MPNSnotifStatus
Received :: MPNSnotifStatus
Dropped :: MPNSnotifStatus
QueueFull :: MPNSnotifStatus
Suppressed :: MPNSnotifStatus
-- | MPNSsubStatus represents the status of a subscription.
data MPNSsubStatus
Active :: MPNSsubStatus
Expired :: MPNSsubStatus
-- | MPNSconStatus represents the status of a connection.
data MPNSconStatus
Connected :: MPNSconStatus
InActive :: MPNSconStatus
Disconnected :: MPNSconStatus
TempDisconnected :: MPNSconStatus
-- | This library defines an API for communicating with iOS powered
-- devices, sending Push Notifications through Apple Push Notification
-- Service.
module Network.PushNotify.Apns
-- | sendAPNS sends the message to a APNS Server.
sendAPNS :: APNSManager -> APNSmessage -> IO APNSresult
-- | startAPNS starts the APNS service.
startAPNS :: APNSConfig -> IO APNSManager
-- | closeAPNS stops the APNS service.
closeAPNS :: APNSManager -> IO ()
-- | withAPNS creates a new manager, uses it in the provided
-- function, and then releases it.
withAPNS :: APNSConfig -> (APNSManager -> IO a) -> IO a
-- | feedBackAPNS connects to the Feedback service.
feedBackAPNS :: APNSConfig -> IO APNSFeedBackresult
-- | APNSConfig represents the main necessary information for
-- sending notifications through APNS.
--
-- For loading the certificate and privateKey you can use:
-- fileReadCertificate and fileReadPrivateKey .
data APNSConfig
APNSConfig :: X509 -> PrivateKey -> Env -> Int -> RetrySettings -> APNSConfig
-- | Certificate provided by Apple.
apnsCertificate :: APNSConfig -> X509
-- | Private key provided by Apple.
apnsPrivateKey :: APNSConfig -> PrivateKey
-- | One of the possible environments.
environment :: APNSConfig -> Env
-- | The time to wait for a server response. (microseconds)
timeoutLimit :: APNSConfig -> Int
-- | How to retry to connect to APNS servers.
apnsRetrySettings :: APNSConfig -> RetrySettings
data APNSManager
-- | Binary token stored in hexadecimal representation as text.
type DeviceToken = Text
-- | Env represents the three possible working environments. This
-- determines the url and port to connect to.
data Env
-- | Development environment (by Apple).
Development :: Env
-- | Production environment (by Apple).
Production :: Env
-- | Local environment, just to test the service in the "localhost".
Local :: Env
-- | APNSmessage represents a message to be sent through APNS.
data APNSmessage
APNSmessage :: HashSet DeviceToken -> Maybe UTCTime -> Either Text AlertDictionary -> Maybe Int -> Text -> Maybe Object -> APNSmessage
-- | Destination.
deviceTokens :: APNSmessage -> HashSet DeviceToken
-- | Identifies when the notification is no longer valid and can be
-- discarded.
expiry :: APNSmessage -> Maybe UTCTime
-- | For the system to displays a standard alert.
alert :: APNSmessage -> Either Text AlertDictionary
-- | Number to display as the badge of the application icon.
badge :: APNSmessage -> Maybe Int
-- | The name of a sound file in the application bundle.
sound :: APNSmessage -> Text
-- | Extra information.
rest :: APNSmessage -> Maybe Object
-- | AlertDictionary represents the possible dictionary in the
-- alert label.
data AlertDictionary
AlertDictionary :: Text -> Text -> Text -> [Text] -> Text -> AlertDictionary
body :: AlertDictionary -> Text
action_loc_key :: AlertDictionary -> Text
loc_key :: AlertDictionary -> Text
loc_args :: AlertDictionary -> [Text]
launch_image :: AlertDictionary -> Text
-- | APNSresult represents information about messages after a
-- communication with APNS Servers.
data APNSresult
APNSresult :: HashSet DeviceToken -> HashSet DeviceToken -> APNSresult
successfulTokens :: APNSresult -> HashSet DeviceToken
-- | Failed tokens that you need to resend the message to, because there
-- was a problem.
toReSendTokens :: APNSresult -> HashSet DeviceToken
-- | APNSFeedBackresult represents information after connecting with
-- the Feedback service.
data APNSFeedBackresult
APNSFeedBackresult :: HashMap DeviceToken UTCTime -> APNSFeedBackresult
-- | Devices tokens and time indicating when APNS determined that the
-- application no longer exists on the device.
unRegisteredTokens :: APNSFeedBackresult -> HashMap DeviceToken UTCTime
-- | This Module define the main data types for sending Push Notifications
-- through Google Cloud Messaging.
module Network.PushNotify.Gcm.Types
-- | GCMHttpConfig represents the main necessary information for
-- sending notifications through GCM.
data GCMHttpConfig
GCMHttpConfig :: Text -> Int -> GCMHttpConfig
-- | Api key provided by Google.
apiKey :: GCMHttpConfig -> Text
-- | Number of attemps to send the message to the server.
numRet :: GCMHttpConfig -> Int
-- | RegId is an unique identifier of an app/device, provided by
-- GCM.
type RegId = Text
-- | GCMmessage represents a message to be sent through GCM. In
-- general cases, you can use the Default value and only specify
-- registration_ids and data_object.
--
-- On the other hand, if you want to use the rest of specific aspects,
-- you can find more information on GCM website.
data GCMmessage
GCMmessage :: HashSet RegId -> Maybe Text -> Maybe Object -> Bool -> Maybe Int -> Maybe Text -> Bool -> GCMmessage
-- | Destination.
registration_ids :: GCMmessage -> HashSet RegId
collapse_key :: GCMmessage -> Maybe Text
-- | Main JSON data to be sent.
data_object :: GCMmessage -> Maybe Object
delay_while_idle :: GCMmessage -> Bool
time_to_live :: GCMmessage -> Maybe Int
restricted_package_name :: GCMmessage -> Maybe Text
dry_run :: GCMmessage -> Bool
-- | GCMresult represents information about messages after a
-- communication with GCM Servers.
data GCMresult
GCMresult :: Maybe Integer -> Maybe Int -> Maybe Int -> Maybe Int -> HashMap RegId RegId -> HashMap RegId Text -> HashSet RegId -> HashSet RegId -> HashMap RegId Text -> GCMresult
-- | Unique ID (number) identifying the multicast message.
multicast_id :: GCMresult -> Maybe Integer
-- | Number of messages that were processed without an error.
success :: GCMresult -> Maybe Int
-- | Number of messages that could not be processed.
failure :: GCMresult -> Maybe Int
-- | Number of results that contain a canonical registration ID.
canonical_ids :: GCMresult -> Maybe Int
-- | RegIds that need to be replaced.
newRegids :: GCMresult -> HashMap RegId RegId
-- | Successful RegIds, and its "message_id".
messagesIds :: GCMresult -> HashMap RegId Text
-- | Failed regIds that need to be removed.
errorUnRegistered :: GCMresult -> HashSet RegId
-- | Failed regIds that is necessary to resend the message to, because
-- there was an internal problem in GCM servers.
errorToReSend :: GCMresult -> HashSet RegId
-- | Failed regIds with the rest of the possible errors (probably
-- non-recoverable errors).
errorRest :: GCMresult -> HashMap RegId Text
instance Show GCMHttpConfig
instance Show GCMmessage
instance Show GCMresult
instance ToJSON GCMmessage
instance Monoid GCMresult
instance Default GCMresult
instance Default GCMmessage
instance Default GCMHttpConfig
-- | This library defines an API for communicating with Android powered
-- devices, sending Push Notifications through Google Cloud Messaging
-- (HTTP connection).
module Network.PushNotify.Gcm
-- | sendGCM sends the message to a GCM Server.
sendGCM :: Manager -> GCMHttpConfig -> GCMmessage -> IO GCMresult
-- | GCMHttpConfig represents the main necessary information for
-- sending notifications through GCM.
data GCMHttpConfig
GCMHttpConfig :: Text -> Int -> GCMHttpConfig
-- | Api key provided by Google.
apiKey :: GCMHttpConfig -> Text
-- | Number of attemps to send the message to the server.
numRet :: GCMHttpConfig -> Int
-- | RegId is an unique identifier of an app/device, provided by
-- GCM.
type RegId = Text
-- | GCMmessage represents a message to be sent through GCM. In
-- general cases, you can use the Default value and only specify
-- registration_ids and data_object.
--
-- On the other hand, if you want to use the rest of specific aspects,
-- you can find more information on GCM website.
data GCMmessage
GCMmessage :: HashSet RegId -> Maybe Text -> Maybe Object -> Bool -> Maybe Int -> Maybe Text -> Bool -> GCMmessage
-- | Destination.
registration_ids :: GCMmessage -> HashSet RegId
collapse_key :: GCMmessage -> Maybe Text
-- | Main JSON data to be sent.
data_object :: GCMmessage -> Maybe Object
delay_while_idle :: GCMmessage -> Bool
time_to_live :: GCMmessage -> Maybe Int
restricted_package_name :: GCMmessage -> Maybe Text
dry_run :: GCMmessage -> Bool
-- | GCMresult represents information about messages after a
-- communication with GCM Servers.
data GCMresult
GCMresult :: Maybe Integer -> Maybe Int -> Maybe Int -> Maybe Int -> HashMap RegId RegId -> HashMap RegId Text -> HashSet RegId -> HashSet RegId -> HashMap RegId Text -> GCMresult
-- | Unique ID (number) identifying the multicast message.
multicast_id :: GCMresult -> Maybe Integer
-- | Number of messages that were processed without an error.
success :: GCMresult -> Maybe Int
-- | Number of messages that could not be processed.
failure :: GCMresult -> Maybe Int
-- | Number of results that contain a canonical registration ID.
canonical_ids :: GCMresult -> Maybe Int
-- | RegIds that need to be replaced.
newRegids :: GCMresult -> HashMap RegId RegId
-- | Successful RegIds, and its "message_id".
messagesIds :: GCMresult -> HashMap RegId Text
-- | Failed regIds that need to be removed.
errorUnRegistered :: GCMresult -> HashSet RegId
-- | Failed regIds that is necessary to resend the message to, because
-- there was an internal problem in GCM servers.
errorToReSend :: GCMresult -> HashSet RegId
-- | Failed regIds with the rest of the possible errors (probably
-- non-recoverable errors).
errorRest :: GCMresult -> HashMap RegId Text