|
|
|
@ -21,7 +21,7 @@ instance (ToJSON a) => ToJSON (Authenticated a) where
|
|
|
|
|
other -> error $! "ToJSON (Authenticated a).toJSON: toJSON inner didn't return Aeson.Object: " <> show other
|
|
|
|
|
|
|
|
|
|
data NonExhaustive a = Known a | Unknown Aeson.Value
|
|
|
|
|
deriving stock (Show)
|
|
|
|
|
deriving stock (Eq, Ord, Show)
|
|
|
|
|
|
|
|
|
|
instance (FromJSON a) => FromJSON (NonExhaustive a) where
|
|
|
|
|
parseJSON j = Known <$> parseJSON j <|> pure (Unknown j)
|
|
|
|
@ -57,7 +57,7 @@ data Note = Note
|
|
|
|
|
, filesIds :: Maybe [DriveFileId]
|
|
|
|
|
-- , poll :: Maybe Poll
|
|
|
|
|
}
|
|
|
|
|
deriving stock (Generic, Show)
|
|
|
|
|
deriving stock (Eq, Ord, Generic, Show)
|
|
|
|
|
|
|
|
|
|
instance FromJSON Note
|
|
|
|
|
|
|
|
|
@ -66,7 +66,7 @@ data NoteVisibility
|
|
|
|
|
| VisibilityHome
|
|
|
|
|
| VisibilityFollowers
|
|
|
|
|
| VisibilitySpecified
|
|
|
|
|
deriving stock (Generic, Show)
|
|
|
|
|
deriving stock (Eq, Ord, Generic, Show)
|
|
|
|
|
|
|
|
|
|
instance FromJSON NoteVisibility where
|
|
|
|
|
parseJSON = genericParseJSON defaultJSONOptions {constructorTagModifier = fmap Char.toLower . fromJust . stripPrefix "Visibility"}
|
|
|
|
@ -96,7 +96,7 @@ data DriveFile = DriveFile
|
|
|
|
|
, user :: Maybe UserLite
|
|
|
|
|
, userId :: Maybe UserId
|
|
|
|
|
}
|
|
|
|
|
deriving stock (Generic, Show)
|
|
|
|
|
deriving stock (Eq, Ord, Generic, Show)
|
|
|
|
|
|
|
|
|
|
instance FromJSON DriveFile where
|
|
|
|
|
parseJSON =
|
|
|
|
@ -111,7 +111,7 @@ data DriveFileProperties = DriveFileProperties
|
|
|
|
|
{ width, heigth, orientation :: Maybe Integer
|
|
|
|
|
, avgColor :: Maybe Text
|
|
|
|
|
}
|
|
|
|
|
deriving stock (Generic, Show)
|
|
|
|
|
deriving stock (Eq, Ord, Generic, Show)
|
|
|
|
|
|
|
|
|
|
instance FromJSON DriveFileProperties
|
|
|
|
|
|
|
|
|
@ -144,7 +144,7 @@ data UserLite = UserLite
|
|
|
|
|
themeColor: Instance['themeColor'];
|
|
|
|
|
-}
|
|
|
|
|
}
|
|
|
|
|
deriving stock (Generic, Show)
|
|
|
|
|
deriving stock (Eq, Ord, Generic, Show)
|
|
|
|
|
|
|
|
|
|
userLiteJsonOptions :: Options
|
|
|
|
|
userLiteJsonOptions = defaultJSONOptions {fieldLabelModifier = dropWhileEnd (== '_')}
|
|
|
|
@ -162,7 +162,7 @@ instance Show UserId where
|
|
|
|
|
show (UserId i) = "user:" <> show i
|
|
|
|
|
|
|
|
|
|
data OnlineStatus = StatusOnline | StatusActive | StatusOffline | StatusUnknown
|
|
|
|
|
deriving stock (Generic, Show)
|
|
|
|
|
deriving stock (Eq, Ord, Generic, Show)
|
|
|
|
|
|
|
|
|
|
onlineStatusJsonOptions :: Options
|
|
|
|
|
onlineStatusJsonOptions = defaultJSONOptions {constructorTagModifier = fmap Char.toLower . fromJust . stripPrefix "Status"}
|
|
|
|
@ -179,7 +179,7 @@ data Notification = Notification
|
|
|
|
|
, isRead :: Bool
|
|
|
|
|
, variant :: NonExhaustive NotificationVariant
|
|
|
|
|
}
|
|
|
|
|
deriving stock (Show)
|
|
|
|
|
deriving stock (Eq, Ord, Show)
|
|
|
|
|
|
|
|
|
|
instance FromJSON Notification where
|
|
|
|
|
parseJSON = Aeson.withObject "Notification" \o ->
|
|
|
|
@ -207,7 +207,7 @@ data NotificationVariant
|
|
|
|
|
, user :: User
|
|
|
|
|
, userId :: UserId
|
|
|
|
|
}
|
|
|
|
|
deriving stock (Show)
|
|
|
|
|
deriving stock (Eq, Ord, Show)
|
|
|
|
|
|
|
|
|
|
instance FromJSON NotificationVariant where
|
|
|
|
|
parseJSON = Aeson.withObject "NotificationVariant" \o ->
|
|
|
|
@ -263,13 +263,13 @@ data NotificationNoteVariant
|
|
|
|
|
| NotificationNoteQuote
|
|
|
|
|
| NotificationNoteMention
|
|
|
|
|
| NotificationNotePollVote
|
|
|
|
|
deriving stock (Show)
|
|
|
|
|
deriving stock (Eq, Ord, Show)
|
|
|
|
|
|
|
|
|
|
data NotificationFollowVariant
|
|
|
|
|
= NotificationFollowFollow
|
|
|
|
|
| NotificationFollowRequestAccepted
|
|
|
|
|
| NotificationFollowReceiveRequest
|
|
|
|
|
deriving stock (Show)
|
|
|
|
|
deriving stock (Eq, Ord, Show)
|
|
|
|
|
|
|
|
|
|
newtype NotificationId = NotificationId Id
|
|
|
|
|
deriving newtype (Eq, Ord, FromJSON, ToJSON)
|
|
|
|
|