From dde97a0658225db297de42d9c7cbbc324bce360b Mon Sep 17 00:00:00 2001 From: Paul Brinkmeier Date: Tue, 23 Aug 2022 12:54:29 +0200 Subject: [PATCH] Add downloadable field to document --- src/Lisa/Squeak.hs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Lisa/Squeak.hs b/src/Lisa/Squeak.hs index f2595c0..44fff66 100644 --- a/src/Lisa/Squeak.hs +++ b/src/Lisa/Squeak.hs @@ -35,7 +35,7 @@ instance FromJSON GQLError where parseJSON = withObject "GQLError" $ \v -> GQLError <$> v .: "message" -data Documents = Documents { getDocuments :: [Document] } +data Documents = Documents { unDocuments :: [Document] } deriving (Show) instance FromJSON Documents where @@ -49,6 +49,7 @@ data Document = Document , documentPublicComment :: Maybe Text , documentFaculty :: Faculty , documentLectures :: [Lecture] + , documentDownloadable :: Bool } deriving (Show) @@ -60,6 +61,7 @@ instance FromJSON Document where <*> v .: "publicComment" <*> v .: "faculty" <*> v .: "lectures" + <*> v .: "downloadable" data Faculty = Faculty { facultyId :: Text @@ -85,6 +87,6 @@ instance FromJSON Lecture where serverUrl = https "api.squeak-test.fsmi.uni-karlsruhe.de" -getLectures :: Req (GQLReply Documents) -getLectures = responseBody <$> req POST serverUrl (ReqBodyJson $ GQLQuery q) jsonResponse mempty - where q = "{ documents(filters: []) { results { id date semester publicComment faculty { id displayName } lectures { id displayName } } } }" +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 } } } }"