packages feed

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

module Data.Bugsnag.Types.Application
  ( Application (..)
  , exampleApplication
  ) where

import Data.Bugsnag.Types.Prelude


import Data.Bugsnag.Types.BinaryArch

data Application = Application
  { id :: Maybe Text
  -- ^ A unique ID for the application.
  , version :: Maybe Text
  -- ^ The version number of the application which generated the error.
  , versionCode :: Maybe Int
  -- ^ The [version
  -- code](https://developer.android.com/studio/publish/versioning.html) of the
  -- application (Android only)
  , bundleVersion :: Maybe Text
  -- ^ The [bundle version/build number](https://developer.apple.com/library/content/technotes/tn2420/_index.html)
  -- of the application (iOS/macOS/tvOS only)
  , codeBundleId :: Maybe Text
  -- ^ A unique identifier to identify a code bundle release when using tools like
  -- CodePush (mobile only).
  , buildUUID :: Maybe Text
  -- ^ A build ID that is required to identify a specific build when the version
  -- and version code are the same.
  , releaseStage :: Maybe Text
  -- ^ The release stage that this error occurred in, for example "development",
  -- "staging" or "production".
  , type_ :: Maybe Text
  -- ^ A specialized type of the application, such as the worker queue or web
  -- framework used, like "rails", "mailman", or "celery".
  , dsymUUIDs :: Maybe [Text]
  -- ^ The UUIDs of the [debug symbols file](http://lldb.llvm.org/symbols.html)
  -- corresponding to this application, if any.
  , duration :: Maybe Int
  -- ^ How long the app has been running for in milliseconds.
  , durationInForeground :: Maybe Int
  -- ^ How long the app has been in the foreground of the device in milliseconds.
  , inForeground :: Maybe Bool
  -- ^ Whether or not the app was in the foreground when the error occurred.
  , isLaunching :: Maybe Bool
  -- ^ Whether or not the app was still launching when the error occurred.
  , binaryArch :: Maybe BinaryArch
  -- ^ The architecture of the running binary.
  , runningOnRosetta :: Maybe Bool
  -- ^ Whether the application is running on the Rosetta emulator for Mac.
  }
  deriving stock (Eq, Show, Generic)

instance FromJSON Application where
  parseJSON = genericParseJSON aesonOptions

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

exampleApplication :: Application
exampleApplication = Application
  { id = Just "com.bugsnag.android.example.debug"
  , version = Just "1.1.3"
  , versionCode = Just 12
  , bundleVersion = Just "1.0.2"
  , codeBundleId = Just "1.0-1234"
  , buildUUID = Just "BE5BA3D0-971C-4418-9ECF-E2D1ABCB66BE"
  , releaseStage = Just "staging"
  , type_ = Just "rails"
  , dsymUUIDs = Just ["e6173678256785afd940392abee"]
  , duration = Just 1275
  , durationInForeground = Just 983
  , inForeground = Just True
  , isLaunching = Just True
  , binaryArch = Just exampleBinaryArch
  , runningOnRosetta = Just True
  }