From a2668cdd2c50b1c1c8cb12d987b292f85e4abcb0 Mon Sep 17 00:00:00 2001 From: Joscha Date: Thu, 9 Jan 2020 16:18:06 +0000 Subject: [PATCH] Parse bounce and hello events correctly --- src/Haboli/Euphoria/Api.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Haboli/Euphoria/Api.hs b/src/Haboli/Euphoria/Api.hs index 941adde..5b91d8e 100644 --- a/src/Haboli/Euphoria/Api.hs +++ b/src/Haboli/Euphoria/Api.hs @@ -227,8 +227,8 @@ data BounceEvent = BounceEvent instance FromJSON BounceEvent where parseJSON = fromPacket "bounce-event" $ \o -> BounceEvent - <$> o .: "reason" - <*> o .: "auth_options" + <$> o .:? "reason" + <*> o .:? "auth_options" .!= [] {- disconnect-event -} @@ -253,7 +253,7 @@ data HelloEvent = HelloEvent instance FromJSON HelloEvent where parseJSON = fromPacket "hello-event" $ \o -> HelloEvent - <$> o .: "account" + <$> o .:? "account" <*> o .: "session" <*> o .:? "account_has_access" <*> o .:? "account_email_verified"