packages feed

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

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

import Data.Bugsnag.Types.Prelude

-- | Information about the user affected by the error. These fields are
-- optional but highly recommended. To display custom user data alongside
-- these standard fields on the dashboard, the custom data should be
-- included in the @metaData@ object in a @user@ object.
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"
  }