Add basic dynamic routes
This commit is contained in:
@@ -74,9 +74,17 @@ instance FromJSON Faculty where
|
||||
<$> v .: "id"
|
||||
<*> v .: "displayName"
|
||||
|
||||
data Lectures = Lectures { unLectures :: [Lecture] }
|
||||
deriving (Show)
|
||||
|
||||
instance FromJSON Lectures where
|
||||
parseJSON = withObject "Lectures" $ \v -> Lectures
|
||||
<$> v .: "lectures"
|
||||
|
||||
data Lecture = Lecture
|
||||
{ lectureId :: Text
|
||||
, lectureDisplayName :: Text
|
||||
, lectureAliases :: [Text]
|
||||
}
|
||||
deriving (Show)
|
||||
|
||||
@@ -84,9 +92,14 @@ instance FromJSON Lecture where
|
||||
parseJSON = withObject "Lecture" $ \v -> Lecture
|
||||
<$> v .: "id"
|
||||
<*> v .: "displayName"
|
||||
<*> v .: "aliases"
|
||||
|
||||
serverUrl = https "api.squeak-test.fsmi.uni-karlsruhe.de"
|
||||
|
||||
getLectures :: Req (GQLReply Lectures)
|
||||
getLectures = responseBody <$> req POST serverUrl (ReqBodyJson $ GQLQuery q) jsonResponse mempty
|
||||
where q = "{ lectures { id displayName aliases } }"
|
||||
|
||||
getDocuments :: Req (GQLReply Documents)
|
||||
getDocuments = responseBody <$> req POST serverUrl (ReqBodyJson $ GQLQuery q) jsonResponse mempty
|
||||
where q = "{ documents(filters: []) { results { id date semester publicComment downloadable faculty { id displayName } lectures { id displayName } } } }"
|
||||
|
||||
Reference in New Issue
Block a user