Safe Haskell | None |
---|---|
Language | Haskell2010 |
Google Firebase Cloud Messaging model / JSON conversions. https://firebase.google.com/docs/cloud-messaging/http-server-ref
Data types in this module map field for field in the google docs. See FCMClient.Types module for some wrapper functions on top of raw JSON types.
Synopsis
- type FCMData = Map Text Text
- data FCMNotification
- fcmTitle :: Lens' FCMNotification (Maybe Text)
- fcmBody :: Lens' FCMNotification (Maybe Text)
- fcmIcon :: Lens' FCMNotification (Maybe Text)
- fcmSound :: Lens' FCMNotification (Maybe Text)
- fcmTag :: Lens' FCMNotification (Maybe Text)
- fcmColor :: Lens' FCMNotification (Maybe Text)
- fcmBadge :: Lens' FCMNotification (Maybe Text)
- fcmClickAction :: Lens' FCMNotification (Maybe Text)
- fcmBodyLocKey :: Lens' FCMNotification (Maybe Text)
- fcmBodyLocArgs :: Lens' FCMNotification (Maybe Text)
- fcmTitleLocKey :: Lens' FCMNotification (Maybe Text)
- fcmTitleLocArgs :: Lens' FCMNotification (Maybe Text)
- data FCMMessage
- fcmTo :: Lens' FCMMessage (Maybe Text)
- fcmRegistrationIDs :: Lens' FCMMessage (Maybe (NonEmpty Text))
- fcmCondition :: Lens' FCMMessage (Maybe Text)
- fcmCollapseKey :: Lens' FCMMessage (Maybe Text)
- fcmPriority :: Lens' FCMMessage (Maybe Text)
- fcmContentAvailable :: Lens' FCMMessage (Maybe Bool)
- fcmDelayWhileIdle :: Lens' FCMMessage (Maybe Bool)
- fcmTimeToLive :: Lens' FCMMessage (Maybe Word)
- fcmRestrictedPackageName :: Lens' FCMMessage (Maybe Text)
- fcmDryRun :: Lens' FCMMessage (Maybe Bool)
- fcmData :: Lens' FCMMessage (Maybe FCMData)
- fcmNotification :: Lens' FCMMessage (Maybe FCMNotification)
- data FCMResult
- _FCMResultSuccess :: Prism' FCMResult FCMResponseBody
- _FCMResultError :: Prism' FCMResult FCMClientError
- data FCMClientError
- fcmErrorMessage :: Traversal' FCMClientError Text
- fcmErrorHttpStatus :: Traversal' FCMClientError Status
- _FCMErrorResponseInvalidJSON :: Prism' FCMClientError Text
- _FCMErrorResponseInvalidAuth :: Prism' FCMClientError ()
- _FCMServerError :: Prism' FCMClientError (Status, Text)
- _FCMClientJSONError :: Prism' FCMClientError Text
- _FCMClientHTTPError :: Prism' FCMClientError Text
- data FCMResponseBody
- data FCMMessageResponse
- _FCMMessageResponse :: Prism' FCMResponseBody FCMMessageResponse
- _FCMTopicResponse :: Prism' FCMResponseBody FCMTopicResponse
- fcmCanonicalIds :: Lens' FCMMessageResponse Integer
- fcmFailure :: Lens' FCMMessageResponse Integer
- fcmMulticastId :: Lens' FCMMessageResponse Integer
- fcmResults :: Lens' FCMMessageResponse (Maybe (NonEmpty FCMMessageResponseResult))
- fcmSuccess :: Lens' FCMMessageResponse Integer
- data FCMMessageResponseResult
- _FCMMessageResponseResultOk :: Prism' FCMMessageResponseResult FCMMessageResponseResultOk
- _FCMMessageResponseResultError :: Prism' FCMMessageResponseResult FCMError
- data FCMMessageResponseResultOk
- fcmMessageId :: Lens' FCMMessageResponseResultOk Text
- fcmRegistrationId :: Lens' FCMMessageResponseResultOk (Maybe Text)
- data FCMTopicResponse
- data FCMTopicResponseOk
- _FCMTopicResponseOk :: Prism' FCMTopicResponse FCMTopicResponseOk
- _FCMTopicResponseError :: Prism' FCMTopicResponse FCMError
- fcmTopicMessageId :: Iso' FCMTopicResponseOk Integer
- data FCMError
- = FCMErrorDeviceMessageRate
- | FCMErrorInternalServerError
- | FCMErrorInvalidDataKey
- | FCMErrorInvalidPackageName
- | FCMErrorInvalidRegistration
- | FCMErrorInvalidTtl
- | FCMErrorMessageTooBig
- | FCMErrorMismatchSenderId
- | FCMErrorMissingRegistration
- | FCMErrorNotRegistered
- | FCMErrorTopicsMessageRate
- | FCMErrorUnavailable
- | FCMErrorOther Text
Documentation
data FCMNotification Source #
FCM Notification as defined in https://firebase.google.com/docs/cloud-messaging/http-server-ref#notification-payload-support Abstract type, use lens API to access fields. Record fields are kept private and used for JSON conversion.
Instances
Eq FCMNotification Source # | |
Defined in FCMClient.JSON.Types (==) :: FCMNotification -> FCMNotification -> Bool # (/=) :: FCMNotification -> FCMNotification -> Bool # | |
Show FCMNotification Source # | |
Defined in FCMClient.JSON.Types showsPrec :: Int -> FCMNotification -> ShowS # show :: FCMNotification -> String # showList :: [FCMNotification] -> ShowS # | |
ToJSON FCMNotification Source # | |
Defined in FCMClient.JSON.Types toJSON :: FCMNotification -> Value # toEncoding :: FCMNotification -> Encoding # toJSONList :: [FCMNotification] -> Value # toEncodingList :: [FCMNotification] -> Encoding # | |
FromJSON FCMNotification Source # | |
Defined in FCMClient.JSON.Types parseJSON :: Value -> Parser FCMNotification # parseJSONList :: Value -> Parser [FCMNotification] # | |
Default FCMNotification Source # | |
Defined in FCMClient.JSON.Types def :: FCMNotification # |
data FCMMessage Source #
FCM Message as defined in https://firebase.google.com/docs/cloud-messaging/http-server-ref#send-downstream Abstract type, use lens API to access fields. Record fields are kept private and used for JSON conversion.
Instances
Eq FCMMessage Source # | |
Defined in FCMClient.JSON.Types (==) :: FCMMessage -> FCMMessage -> Bool # (/=) :: FCMMessage -> FCMMessage -> Bool # | |
Show FCMMessage Source # | |
Defined in FCMClient.JSON.Types showsPrec :: Int -> FCMMessage -> ShowS # show :: FCMMessage -> String # showList :: [FCMMessage] -> ShowS # | |
ToJSON FCMMessage Source # | |
Defined in FCMClient.JSON.Types toJSON :: FCMMessage -> Value # toEncoding :: FCMMessage -> Encoding # toJSONList :: [FCMMessage] -> Value # toEncodingList :: [FCMMessage] -> Encoding # | |
FromJSON FCMMessage Source # | |
Defined in FCMClient.JSON.Types parseJSON :: Value -> Parser FCMMessage # parseJSONList :: Value -> Parser [FCMMessage] # | |
Default FCMMessage Source # | |
Defined in FCMClient.JSON.Types def :: FCMMessage # |
fcmCondition :: Lens' FCMMessage (Maybe Text) Source #
fcmPriority :: Lens' FCMMessage (Maybe Text) Source #
fcmTimeToLive :: Lens' FCMMessage (Maybe Word) Source #
Result of an RPC call.
Successful response doesn't imply all the messages were delivered, e.g. some may need to be re-sent if a rate limit was exceeded.
Error cases enumerate all, client and server error conditions.
FCMResultSuccess !FCMResponseBody | Successful response (http 200). Doesn't imply all the messages were delivered, response body may contain error codes. |
FCMResultError !FCMClientError | Didn't receive JSON response, there were an error of some kind. |
data FCMClientError Source #
Types of FCM errors.
FCMErrorResponseInvalidJSON !Text | Indicates that the request could not be parsed as JSON, or it contained invalid fields (for instance, passing a string where a number was expected). The exact failure reason is described in the response and the problem should be addressed before the request can be retried. |
FCMErrorResponseInvalidAuth | There was an error authenticating the sender account. |
FCMServerError !Status !Text | Errors in the 500-599 range (such as 500 or 503) indicate that there was an internal error in the FCM connection server while trying to process the request, or that the server is temporarily unavailable (for example, because of timeouts). Sender must retry later, honoring any Retry-After header included in the response. Application servers must implement exponential back-off. |
FCMClientJSONError !Text | Client couldn't parse JSON response from server. |
FCMClientHTTPError !Text | Unexpected HTTP response or some other HTTP error. |
Instances
Show FCMClientError Source # | |
Defined in FCMClient.JSON.Types showsPrec :: Int -> FCMClientError -> ShowS # show :: FCMClientError -> String # showList :: [FCMClientError] -> ShowS # |
data FCMResponseBody Source #
Instances
Eq FCMResponseBody Source # | |
Defined in FCMClient.JSON.Types (==) :: FCMResponseBody -> FCMResponseBody -> Bool # (/=) :: FCMResponseBody -> FCMResponseBody -> Bool # | |
Show FCMResponseBody Source # | |
Defined in FCMClient.JSON.Types showsPrec :: Int -> FCMResponseBody -> ShowS # show :: FCMResponseBody -> String # showList :: [FCMResponseBody] -> ShowS # | |
ToJSON FCMResponseBody Source # | |
Defined in FCMClient.JSON.Types toJSON :: FCMResponseBody -> Value # toEncoding :: FCMResponseBody -> Encoding # toJSONList :: [FCMResponseBody] -> Value # toEncodingList :: [FCMResponseBody] -> Encoding # | |
FromJSON FCMResponseBody Source # | |
Defined in FCMClient.JSON.Types parseJSON :: Value -> Parser FCMResponseBody # parseJSONList :: Value -> Parser [FCMResponseBody] # |
data FCMMessageResponse Source #
Instances
Eq FCMMessageResponse Source # | |
Defined in FCMClient.JSON.Types (==) :: FCMMessageResponse -> FCMMessageResponse -> Bool # (/=) :: FCMMessageResponse -> FCMMessageResponse -> Bool # | |
Show FCMMessageResponse Source # | |
Defined in FCMClient.JSON.Types showsPrec :: Int -> FCMMessageResponse -> ShowS # show :: FCMMessageResponse -> String # showList :: [FCMMessageResponse] -> ShowS # | |
ToJSON FCMMessageResponse Source # | |
Defined in FCMClient.JSON.Types toJSON :: FCMMessageResponse -> Value # toEncoding :: FCMMessageResponse -> Encoding # toJSONList :: [FCMMessageResponse] -> Value # toEncodingList :: [FCMMessageResponse] -> Encoding # | |
FromJSON FCMMessageResponse Source # | |
Defined in FCMClient.JSON.Types parseJSON :: Value -> Parser FCMMessageResponse # parseJSONList :: Value -> Parser [FCMMessageResponse] # | |
Default FCMMessageResponse Source # | |
Defined in FCMClient.JSON.Types |
data FCMMessageResponseResult Source #
Instances
Eq FCMMessageResponseResult Source # | |
Defined in FCMClient.JSON.Types | |
Show FCMMessageResponseResult Source # | |
Defined in FCMClient.JSON.Types showsPrec :: Int -> FCMMessageResponseResult -> ShowS # show :: FCMMessageResponseResult -> String # showList :: [FCMMessageResponseResult] -> ShowS # | |
ToJSON FCMMessageResponseResult Source # | |
Defined in FCMClient.JSON.Types | |
FromJSON FCMMessageResponseResult Source # | |
Defined in FCMClient.JSON.Types |
data FCMMessageResponseResultOk Source #
Instances
Eq FCMMessageResponseResultOk Source # | |
Defined in FCMClient.JSON.Types | |
Show FCMMessageResponseResultOk Source # | |
Defined in FCMClient.JSON.Types showsPrec :: Int -> FCMMessageResponseResultOk -> ShowS # show :: FCMMessageResponseResultOk -> String # showList :: [FCMMessageResponseResultOk] -> ShowS # | |
ToJSON FCMMessageResponseResultOk Source # | |
Defined in FCMClient.JSON.Types | |
FromJSON FCMMessageResponseResultOk Source # | |
Defined in FCMClient.JSON.Types | |
Default FCMMessageResponseResultOk Source # | |
Defined in FCMClient.JSON.Types |
data FCMTopicResponse Source #
Instances
Eq FCMTopicResponse Source # | |
Defined in FCMClient.JSON.Types (==) :: FCMTopicResponse -> FCMTopicResponse -> Bool # (/=) :: FCMTopicResponse -> FCMTopicResponse -> Bool # | |
Show FCMTopicResponse Source # | |
Defined in FCMClient.JSON.Types showsPrec :: Int -> FCMTopicResponse -> ShowS # show :: FCMTopicResponse -> String # showList :: [FCMTopicResponse] -> ShowS # | |
ToJSON FCMTopicResponse Source # | |
Defined in FCMClient.JSON.Types toJSON :: FCMTopicResponse -> Value # toEncoding :: FCMTopicResponse -> Encoding # toJSONList :: [FCMTopicResponse] -> Value # toEncodingList :: [FCMTopicResponse] -> Encoding # | |
FromJSON FCMTopicResponse Source # | |
Defined in FCMClient.JSON.Types parseJSON :: Value -> Parser FCMTopicResponse # parseJSONList :: Value -> Parser [FCMTopicResponse] # |
data FCMTopicResponseOk Source #
Instances
Eq FCMTopicResponseOk Source # | |
Defined in FCMClient.JSON.Types (==) :: FCMTopicResponseOk -> FCMTopicResponseOk -> Bool # (/=) :: FCMTopicResponseOk -> FCMTopicResponseOk -> Bool # | |
Show FCMTopicResponseOk Source # | |
Defined in FCMClient.JSON.Types showsPrec :: Int -> FCMTopicResponseOk -> ShowS # show :: FCMTopicResponseOk -> String # showList :: [FCMTopicResponseOk] -> ShowS # | |
ToJSON FCMTopicResponseOk Source # | |
Defined in FCMClient.JSON.Types toJSON :: FCMTopicResponseOk -> Value # toEncoding :: FCMTopicResponseOk -> Encoding # toJSONList :: [FCMTopicResponseOk] -> Value # toEncodingList :: [FCMTopicResponseOk] -> Encoding # | |
FromJSON FCMTopicResponseOk Source # | |
Defined in FCMClient.JSON.Types parseJSON :: Value -> Parser FCMTopicResponseOk # parseJSONList :: Value -> Parser [FCMTopicResponseOk] # | |
Default FCMTopicResponseOk Source # | |
Defined in FCMClient.JSON.Types |
String specifying the error that occurred when processing the message for the recipient. The possible values can be found in table 9. https://firebase.google.com/docs/cloud-messaging/http-server-ref#table9