summaryrefslogtreecommitdiff
path: root/src/Servall/Types.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Servall/Types.hs')
-rw-r--r--src/Servall/Types.hs21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/Servall/Types.hs b/src/Servall/Types.hs
index 69c2045..794482c 100644
--- a/src/Servall/Types.hs
+++ b/src/Servall/Types.hs
@@ -1,8 +1,6 @@
+{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
-module Servall.Types
- ( WikiTemplate(..)
- , Video(..)
- ) where
+module Servall.Types where
import Data.Aeson ( (.:)
, (.=)
@@ -13,6 +11,7 @@ import Data.Aeson ( (.:)
)
import qualified Data.HashMap.Lazy as HM
import Data.Text ( Text )
+import GHC.Generics ( Generic )
data WikiTemplate = WikiTemplate
{ wtName :: Text
@@ -48,3 +47,17 @@ instance ToJSON Video where
, "description" .= desc
, "duration" .= duration
]
+
+
+data WikiSummary = WikiSummary
+ { wsTitle :: Text
+ , wsWikbase :: Text
+ , wsPageId :: Int
+ }
+ deriving (Show, Eq, Generic)
+
+instance FromJSON WikiSummary where
+ parseJSON (Object o) =
+ WikiSummary <$> o .: "title" <*> o .: "wikibase_item" <*> o .: "pageid"
+
+instance ToJSON WikiSummary