packages feed

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

module Data.Bugsnag.Types.User
  ( User (..)
  , exampleUser
  ) where

import Data.Bugsnag.Types.Prelude


data User = User
  { id :: Maybe Text
  -- ^ A unique identifier for a user affected by this event. This could be any
  -- distinct identifier that makes sense for your application/platform.
  , name :: Maybe Text
  -- ^ The user's name, or a string you use to identify them.
  , email :: Maybe Text
  -- ^ The user's email address.
  }
  deriving stock (Eq, Show, Generic)

instance FromJSON User where
  parseJSON = genericParseJSON aesonOptions

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

exampleUser :: User
exampleUser = User
  { id = Just "19"
  , name = Just $ "Robert Hawkins"
  , email = Just "bob@example.com"
  }