Add downloadable field to document
This commit is contained in:
parent
3afe4b5ff9
commit
dde97a0658
@ -35,7 +35,7 @@ instance FromJSON GQLError where
|
|||||||
parseJSON = withObject "GQLError" $ \v -> GQLError
|
parseJSON = withObject "GQLError" $ \v -> GQLError
|
||||||
<$> v .: "message"
|
<$> v .: "message"
|
||||||
|
|
||||||
data Documents = Documents { getDocuments :: [Document] }
|
data Documents = Documents { unDocuments :: [Document] }
|
||||||
deriving (Show)
|
deriving (Show)
|
||||||
|
|
||||||
instance FromJSON Documents where
|
instance FromJSON Documents where
|
||||||
@ -49,6 +49,7 @@ data Document = Document
|
|||||||
, documentPublicComment :: Maybe Text
|
, documentPublicComment :: Maybe Text
|
||||||
, documentFaculty :: Faculty
|
, documentFaculty :: Faculty
|
||||||
, documentLectures :: [Lecture]
|
, documentLectures :: [Lecture]
|
||||||
|
, documentDownloadable :: Bool
|
||||||
}
|
}
|
||||||
deriving (Show)
|
deriving (Show)
|
||||||
|
|
||||||
@ -60,6 +61,7 @@ instance FromJSON Document where
|
|||||||
<*> v .: "publicComment"
|
<*> v .: "publicComment"
|
||||||
<*> v .: "faculty"
|
<*> v .: "faculty"
|
||||||
<*> v .: "lectures"
|
<*> v .: "lectures"
|
||||||
|
<*> v .: "downloadable"
|
||||||
|
|
||||||
data Faculty = Faculty
|
data Faculty = Faculty
|
||||||
{ facultyId :: Text
|
{ facultyId :: Text
|
||||||
@ -85,6 +87,6 @@ instance FromJSON Lecture where
|
|||||||
|
|
||||||
serverUrl = https "api.squeak-test.fsmi.uni-karlsruhe.de"
|
serverUrl = https "api.squeak-test.fsmi.uni-karlsruhe.de"
|
||||||
|
|
||||||
getLectures :: Req (GQLReply Documents)
|
getDocuments :: Req (GQLReply Documents)
|
||||||
getLectures = responseBody <$> req POST serverUrl (ReqBodyJson $ GQLQuery q) jsonResponse mempty
|
getDocuments = responseBody <$> req POST serverUrl (ReqBodyJson $ GQLQuery q) jsonResponse mempty
|
||||||
where q = "{ documents(filters: []) { results { id date semester publicComment faculty { id displayName } lectures { id displayName } } } }"
|
where q = "{ documents(filters: []) { results { id date semester publicComment downloadable faculty { id displayName } lectures { id displayName } } } }"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user