@@ -80,28 +80,38 @@ data Item = Item
8080 , itemServer :: Maybe Server
8181 -- ^ Data about the server related to this event.
8282 -- client
83- -- custom
84- -- fingerprint
85- -- title
86- -- uuid
83+ , custom :: Maybe Object
84+ -- ^ Any arbitrary metadata you want to send.
85+ , title :: Maybe Text
86+ -- ^ A string that will be used as the title of the Item occurrences will be grouped into.
87+ , uuid :: Maybe Text
88+ -- ^ Identifies this occurrence.
89+ , fingerprint :: Maybe Text
90+ -- ^ Controlls how this occurrence should be grouped.
8791 , itemNotifier :: Notifier
8892 -- ^ Describes the library used to send this event.
8993 } deriving (Eq , Show )
9094
9195instance ToJSON Item where
92- toJSON Item {.. } = object
93- [ " data" .= object
94- [ " environment" .= itemEnvironment
95- , " body" .= itemBody
96- , " level" .= itemLevel
97- , " platform" .= itemPlatform
98- , " language" .= itemLanguage
99- , " framework" .= itemFramework
100- , " request" .= itemRequest
101- , " server" .= itemServer
102- , " notifier" .= itemNotifier
103- ]
104- ]
96+ toJSON Item {.. } =
97+ let dataFields =
98+ [ " environment" .= itemEnvironment
99+ , " body" .= itemBody
100+ , " level" .= itemLevel
101+ , " platform" .= itemPlatform
102+ , " language" .= itemLanguage
103+ , " framework" .= itemFramework
104+ , " request" .= itemRequest
105+ , " server" .= itemServer
106+ , " notifier" .= itemNotifier
107+ ] ++ catMaybes
108+ [ (" custom" .= ) <$> custom
109+ , (" fingerprint" .= ) <$> fingerprint
110+ , (" title" .= ) <$> title
111+ , (" uuid" .= ) <$> uuid
112+ ]
113+ in
114+ object [ " data" .= object dataFields ]
105115
106116-- | Builds an 'Item' based on a 'Payload'.
107117mkItem
@@ -129,6 +139,10 @@ mkItem payload = do
129139 , serverCodeVersion = Nothing
130140 }
131141 , itemNotifier = defaultNotifier
142+ , custom = Nothing
143+ , title = Nothing
144+ , uuid = Nothing
145+ , fingerprint = Nothing
132146 }
133147
134148-- | The main data being sent. It can either be a message, an exception, or a
0 commit comments