module TD.Data.FileType
(FileType(..)) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
data FileType
= FileTypeNone
| FileTypeAnimation
| FileTypeAudio
| FileTypeDocument
| FileTypeNotificationSound
| FileTypePhoto
| FileTypePhotoStory
| FileTypeProfilePhoto
| FileTypeSecret
| FileTypeSecretThumbnail
| FileTypeSecure
| FileTypeSelfDestructingPhoto
| FileTypeSelfDestructingVideo
| FileTypeSelfDestructingVideoNote
| FileTypeSelfDestructingVoiceNote
| FileTypeSticker
| FileTypeThumbnail
| FileTypeUnknown
| FileTypeVideo
| FileTypeVideoNote
| FileTypeVideoStory
| FileTypeVoiceNote
| FileTypeWallpaper
deriving (FileType -> FileType -> Bool
(FileType -> FileType -> Bool)
-> (FileType -> FileType -> Bool) -> Eq FileType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FileType -> FileType -> Bool
== :: FileType -> FileType -> Bool
$c/= :: FileType -> FileType -> Bool
/= :: FileType -> FileType -> Bool
Eq, Int -> FileType -> ShowS
[FileType] -> ShowS
FileType -> String
(Int -> FileType -> ShowS)
-> (FileType -> String) -> ([FileType] -> ShowS) -> Show FileType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FileType -> ShowS
showsPrec :: Int -> FileType -> ShowS
$cshow :: FileType -> String
show :: FileType -> String
$cshowList :: [FileType] -> ShowS
showList :: [FileType] -> ShowS
Show)
instance I.ShortShow FileType where
shortShow :: FileType -> String
shortShow FileType
FileTypeNone
= String
"FileTypeNone"
shortShow FileType
FileTypeAnimation
= String
"FileTypeAnimation"
shortShow FileType
FileTypeAudio
= String
"FileTypeAudio"
shortShow FileType
FileTypeDocument
= String
"FileTypeDocument"
shortShow FileType
FileTypeNotificationSound
= String
"FileTypeNotificationSound"
shortShow FileType
FileTypePhoto
= String
"FileTypePhoto"
shortShow FileType
FileTypePhotoStory
= String
"FileTypePhotoStory"
shortShow FileType
FileTypeProfilePhoto
= String
"FileTypeProfilePhoto"
shortShow FileType
FileTypeSecret
= String
"FileTypeSecret"
shortShow FileType
FileTypeSecretThumbnail
= String
"FileTypeSecretThumbnail"
shortShow FileType
FileTypeSecure
= String
"FileTypeSecure"
shortShow FileType
FileTypeSelfDestructingPhoto
= String
"FileTypeSelfDestructingPhoto"
shortShow FileType
FileTypeSelfDestructingVideo
= String
"FileTypeSelfDestructingVideo"
shortShow FileType
FileTypeSelfDestructingVideoNote
= String
"FileTypeSelfDestructingVideoNote"
shortShow FileType
FileTypeSelfDestructingVoiceNote
= String
"FileTypeSelfDestructingVoiceNote"
shortShow FileType
FileTypeSticker
= String
"FileTypeSticker"
shortShow FileType
FileTypeThumbnail
= String
"FileTypeThumbnail"
shortShow FileType
FileTypeUnknown
= String
"FileTypeUnknown"
shortShow FileType
FileTypeVideo
= String
"FileTypeVideo"
shortShow FileType
FileTypeVideoNote
= String
"FileTypeVideoNote"
shortShow FileType
FileTypeVideoStory
= String
"FileTypeVideoStory"
shortShow FileType
FileTypeVoiceNote
= String
"FileTypeVoiceNote"
shortShow FileType
FileTypeWallpaper
= String
"FileTypeWallpaper"
instance AT.FromJSON FileType where
parseJSON :: Value -> Parser FileType
parseJSON (AT.Object Object
obj) = do
String
t <- Object
obj Object -> Key -> Parser String
forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"@type" :: AT.Parser String
case String
t of
String
"fileTypeNone" -> FileType -> Parser FileType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure FileType
FileTypeNone
String
"fileTypeAnimation" -> FileType -> Parser FileType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure FileType
FileTypeAnimation
String
"fileTypeAudio" -> FileType -> Parser FileType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure FileType
FileTypeAudio
String
"fileTypeDocument" -> FileType -> Parser FileType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure FileType
FileTypeDocument
String
"fileTypeNotificationSound" -> FileType -> Parser FileType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure FileType
FileTypeNotificationSound
String
"fileTypePhoto" -> FileType -> Parser FileType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure FileType
FileTypePhoto
String
"fileTypePhotoStory" -> FileType -> Parser FileType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure FileType
FileTypePhotoStory
String
"fileTypeProfilePhoto" -> FileType -> Parser FileType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure FileType
FileTypeProfilePhoto
String
"fileTypeSecret" -> FileType -> Parser FileType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure FileType
FileTypeSecret
String
"fileTypeSecretThumbnail" -> FileType -> Parser FileType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure FileType
FileTypeSecretThumbnail
String
"fileTypeSecure" -> FileType -> Parser FileType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure FileType
FileTypeSecure
String
"fileTypeSelfDestructingPhoto" -> FileType -> Parser FileType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure FileType
FileTypeSelfDestructingPhoto
String
"fileTypeSelfDestructingVideo" -> FileType -> Parser FileType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure FileType
FileTypeSelfDestructingVideo
String
"fileTypeSelfDestructingVideoNote" -> FileType -> Parser FileType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure FileType
FileTypeSelfDestructingVideoNote
String
"fileTypeSelfDestructingVoiceNote" -> FileType -> Parser FileType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure FileType
FileTypeSelfDestructingVoiceNote
String
"fileTypeSticker" -> FileType -> Parser FileType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure FileType
FileTypeSticker
String
"fileTypeThumbnail" -> FileType -> Parser FileType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure FileType
FileTypeThumbnail
String
"fileTypeUnknown" -> FileType -> Parser FileType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure FileType
FileTypeUnknown
String
"fileTypeVideo" -> FileType -> Parser FileType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure FileType
FileTypeVideo
String
"fileTypeVideoNote" -> FileType -> Parser FileType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure FileType
FileTypeVideoNote
String
"fileTypeVideoStory" -> FileType -> Parser FileType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure FileType
FileTypeVideoStory
String
"fileTypeVoiceNote" -> FileType -> Parser FileType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure FileType
FileTypeVoiceNote
String
"fileTypeWallpaper" -> FileType -> Parser FileType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure FileType
FileTypeWallpaper
String
_ -> Parser FileType
forall a. Monoid a => a
mempty
parseJSON Value
_ = Parser FileType
forall a. Monoid a => a
mempty
instance AT.ToJSON FileType where
toJSON :: FileType -> Value
toJSON FileType
FileTypeNone
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"fileTypeNone"
]
toJSON FileType
FileTypeAnimation
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"fileTypeAnimation"
]
toJSON FileType
FileTypeAudio
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"fileTypeAudio"
]
toJSON FileType
FileTypeDocument
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"fileTypeDocument"
]
toJSON FileType
FileTypeNotificationSound
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"fileTypeNotificationSound"
]
toJSON FileType
FileTypePhoto
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"fileTypePhoto"
]
toJSON FileType
FileTypePhotoStory
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"fileTypePhotoStory"
]
toJSON FileType
FileTypeProfilePhoto
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"fileTypeProfilePhoto"
]
toJSON FileType
FileTypeSecret
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"fileTypeSecret"
]
toJSON FileType
FileTypeSecretThumbnail
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"fileTypeSecretThumbnail"
]
toJSON FileType
FileTypeSecure
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"fileTypeSecure"
]
toJSON FileType
FileTypeSelfDestructingPhoto
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"fileTypeSelfDestructingPhoto"
]
toJSON FileType
FileTypeSelfDestructingVideo
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"fileTypeSelfDestructingVideo"
]
toJSON FileType
FileTypeSelfDestructingVideoNote
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"fileTypeSelfDestructingVideoNote"
]
toJSON FileType
FileTypeSelfDestructingVoiceNote
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"fileTypeSelfDestructingVoiceNote"
]
toJSON FileType
FileTypeSticker
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"fileTypeSticker"
]
toJSON FileType
FileTypeThumbnail
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"fileTypeThumbnail"
]
toJSON FileType
FileTypeUnknown
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"fileTypeUnknown"
]
toJSON FileType
FileTypeVideo
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"fileTypeVideo"
]
toJSON FileType
FileTypeVideoNote
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"fileTypeVideoNote"
]
toJSON FileType
FileTypeVideoStory
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"fileTypeVideoStory"
]
toJSON FileType
FileTypeVoiceNote
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"fileTypeVoiceNote"
]
toJSON FileType
FileTypeWallpaper
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"fileTypeWallpaper"
]