packages feed

bugsnag-types-1.1.0.0: src/Data/Bugsnag/Types/Breadcrumb.hs

module Data.Bugsnag.Types.Breadcrumb
  ( Breadcrumb (..)
  , exampleBreadcrumb
  ) where

import Data.Bugsnag.Types.Prelude


import Data.Bugsnag.Types.BreadcrumbType

data Breadcrumb = Breadcrumb
  { timestamp :: Text
  -- ^ The time at which the event occurred, in [ISO 8601
  -- format](https://tools.ietf.org/html/rfc3339#section-5.8).
  , name :: Text
  -- ^ A short summary describing the event, such as the user action taken or a new application state.
  , type_ :: BreadcrumbType
  -- ^ A category which describes the breadcrumb, from the list of allowed values.
  , metaData :: Maybe (KeyMap Text)
  -- ^ Additional information about the event, as key/value pairs.
  -- 
  -- ```
  -- {
  --     "to": "PauseView",
  --     "from": "PodBayDoorView"
  -- }
  -- ```
  }
  deriving stock (Eq, Show, Generic)

instance FromJSON Breadcrumb where
  parseJSON = genericParseJSON aesonOptions

instance ToJSON Breadcrumb where
  toJSON = genericToJSON aesonOptions
  toEncoding = genericToEncoding aesonOptions

exampleBreadcrumb :: Breadcrumb
exampleBreadcrumb = Breadcrumb
  { timestamp = "2016-07-19T12:17:27-0700"
  , name = "Open menu"
  , type_ = exampleBreadcrumbType
  , metaData = Just mempty
  }