summaryrefslogtreecommitdiff
path: root/Network/API/Telegram/Bot/Object/Update/Message/Content/Size.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Network/API/Telegram/Bot/Object/Update/Message/Content/Size.hs')
-rw-r--r--Network/API/Telegram/Bot/Object/Update/Message/Content/Size.hs17
1 files changed, 17 insertions, 0 deletions
diff --git a/Network/API/Telegram/Bot/Object/Update/Message/Content/Size.hs b/Network/API/Telegram/Bot/Object/Update/Message/Content/Size.hs
new file mode 100644
index 0000000..b910a82
--- /dev/null
+++ b/Network/API/Telegram/Bot/Object/Update/Message/Content/Size.hs
@@ -0,0 +1,17 @@
+module Network.API.Telegram.Bot.Object.Update.Message.Content.Size (Size (..)) where
+
+import "aeson" Data.Aeson (FromJSON (parseJSON), withObject, (.:))
+import "base" Control.Applicative ((<*>))
+import "base" Data.Int (Int)
+import "base" Data.Function (($))
+import "base" Data.Functor ((<$>))
+import "base" Data.Maybe (Maybe)
+import "base" Text.Show (Show)
+import "text" Data.Text (Text)
+
+data Size = Size Text Int Int (Maybe Int)
+ deriving Show
+
+instance FromJSON Size where
+ parseJSON = withObject "Size" $ \v -> Size <$> v .: "file_id"
+ <*> v .: "width" <*> v .: "height" <*> v .: "file_size"