packages feed

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

module Data.Bugsnag.Types.Device
  ( Device (..)
  , exampleDevice
  ) where

import Data.Bugsnag.Types.Prelude


import Data.Bugsnag.Types.RuntimeVersion

data Device = Device
  { hostname :: Maybe Text
  -- ^ The hostname of the server running your code, if applicable.
  , id :: Maybe Text
  -- ^ A unique identifier for the device.
  , manufacturer :: Maybe Text
  -- ^ The manufacturer of the device.
  , model :: Maybe Text
  -- ^ The model of the device.
  , modelNumber :: Maybe Text
  -- ^ The model number of the device.
  , osName :: Maybe Text
  -- ^ The device's operating system name.
  , osVersion :: Maybe Text
  -- ^ The device's operating system version.
  , freeMemory :: Maybe Int
  -- ^ The number of bytes unused in the device's RAM.
  , totalMemory :: Maybe Int
  -- ^ The number of total bytes in the device's RAM.
  , freeDisk :: Maybe Int
  -- ^ The number of unused bytes on the drive running the application.
  , browserName :: Maybe Text
  -- ^ If a web application, the web browser used by the device.
  , browserVersion :: Maybe Text
  -- ^ If a web application, the version of the browser used by the device.
  , jailbroken :: Maybe Bool
  -- ^ Whether or not the device has been modified to give users root access.
  , orientation :: Maybe Text
  -- ^ The orientation of the device at the time of the error.
  , time :: Maybe Text
  -- ^ The time at which the error occurred, in [ISO 8601
  -- format](https://tools.ietf.org/html/rfc3339#section-5.8).
  , cpuAbi :: Maybe [Text]
  -- ^ The [ABIs](https://developer.android.com/ndk/guides/abis) supported by the device (Android only).
  , runtimeVersions :: Maybe RuntimeVersion
  -- ^ The versions of the relevant runtimes, languages and/or frameworks for the platform.
  , macCatalystiOSVersion :: Maybe Text
  -- ^ The device's Mac Catalyst iOS version.
  }
  deriving stock (Eq, Show, Generic)

instance FromJSON Device where
  parseJSON = genericParseJSON aesonOptions

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

exampleDevice :: Device
exampleDevice = Device
  { hostname = Just "web1.internal"
  , id = Just "fd124e87760c4281aef"
  , manufacturer = Just "LGE"
  , model = Just $ "Nexus 6P"
  , modelNumber = Just "600"
  , osName = Just "android"
  , osVersion = Just "8.0.1"
  , freeMemory = Just 183879616
  , totalMemory = Just 201326592
  , freeDisk = Just 13478064128
  , browserName = Just "Chrome"
  , browserVersion = Just "61.0.3163.100"
  , jailbroken = Just False
  , orientation = Just "portrait"
  , time = Just "2018-08-07T10:16:34.564Z"
  , cpuAbi = Just ["x86_64"]
  , runtimeVersions = Just exampleRuntimeVersion
  , macCatalystiOSVersion = Just "14.0"
  }