packages feed

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

module Data.Bugsnag.Types.Session
  ( Session (..)
  , exampleSession
  ) where

import Data.Bugsnag.Types.Prelude


import Data.Bugsnag.Types.SessionEvent

data Session = Session
  { id :: Text
  -- ^ The unique identifier of the session.
  , startedAt :: Text
  -- ^ The time (in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format) at which the session started.
  , events :: SessionEvent
  -- ^ Details of the number of handled and unhandled events that have occurred so far in this session.
  }
  deriving stock (Eq, Show, Generic)

instance FromJSON Session where
  parseJSON = genericParseJSON aesonOptions

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

exampleSession :: Session
exampleSession = Session
  { id = "9f65c975-8155-456f-91e5-c4c4b3db0555"
  , startedAt = "2017-01-01T14:30:00.000Z"
  , events = exampleSessionEvent
  }