bugsnag-types-1.1.0.1: src/Data/Bugsnag/Types/Payload.hs
module Data.Bugsnag.Types.Payload
( Payload (..)
, examplePayload
) where
import Data.Bugsnag.Types.Prelude
import Data.Bugsnag.Types.Notifier
import Data.Bugsnag.Types.Event
data Payload = Payload
{ apiKey :: Maybe Text
-- ^ The API Key associated with the project. Informs BugSnag which project
-- has generated this error. This is provided for legacy notifiers. It is
-- preferable to use the @Bugsnag-Api-Key@ header instead.
, payloadVersion :: Text
-- ^ The version number of the payload. This is currently @5@. The
-- @Bugsnag-Payload-Version@ header should be included as well for
-- compatibility reasons.
, notifier :: Notifier
, events :: [Event]
-- ^ An array of error events that BugSnag should be notified of. A notifier
-- can choose to group notices into an array to minimize network traffic,
-- or can notify BugSnag each time an event occurs. Should contain at least
-- 1 event.
}
deriving stock (Eq, Show, Generic)
instance FromJSON Payload where
parseJSON = genericParseJSON aesonOptions
instance ToJSON Payload where
toJSON = genericToJSON aesonOptions
toEncoding = genericToEncoding aesonOptions
examplePayload :: Payload
examplePayload = Payload
{ apiKey = Just "YOUR-NOTIFIER-API-KEY"
, payloadVersion = "5"
, notifier = exampleNotifier
, events = [exampleEvent]
}