diff --git a/4r-api/Api/Types.hs b/4r-api/Api/Types.hs index a82ceea..1d368c8 100644 --- a/4r-api/Api/Types.hs +++ b/4r-api/Api/Types.hs @@ -19,6 +19,11 @@ import Data.HashMap.Strict qualified as M import Web.FormUrlEncoded (Form (Form), ToForm (toForm)) data GetSections = GetSections + deriving stock (Eq) + +instance Hashable GetSections where + hashWithSalt = const + instance ToForm GetSections where toForm GetSections = Form $ M.fromList [("type", ["sections"]), ("key", ["anon"])] @@ -31,6 +36,11 @@ instance NFData Section instance FromJSON Section data GetTopics = GetTopics + deriving stock (Eq) + +instance Hashable GetTopics where + hashWithSalt = const + instance ToForm GetTopics where toForm GetTopics = Form $ M.fromList [("type", ["threads"]), ("key", ["anon"])] @@ -42,7 +52,10 @@ data TopicInfo = TopicInfo instance NFData TopicInfo instance FromJSON TopicInfo -data GetTopic = GetTopic {topic_id :: Integer} +newtype GetTopic = GetTopic {topic_id :: Integer} + deriving stock (Eq) + deriving newtype (Hashable) + instance ToForm GetTopic where toForm GetTopic{topic_id} = Form $