1 {-# LANGUAGE DataKinds #-}
2 {-# LANGUAGE DeriveGeneric #-}
3 {-# LANGUAGE TypeOperators #-}
4 {-# LANGUAGE OverloadedStrings #-}
5 {-# LANGUAGE NoImplicitPrelude #-}
8 module Gargantext.Text.Parsers.Isidore where
10 import Data.Text
(Text
)
12 import Gargantext.Prelude
16 import Network.HTTP.Client
(newManager
)
17 import Network.HTTP.Client.TLS
(tlsManagerSettings
)
22 type IsidoreAPI
= "sparql" :> Capture
"query" Text
:> Get
'[JSON] [IsidoreDoc]
26 IsidoreDoc {title :: Maybe Text}
27 deriving (Show, Generic)
30 instance FromJSON IsidoreDoc
31 instance ToJSON IsidoreDoc
33 isidoreDocsApi :: Proxy IsidoreAPI
34 isidoreDocsApi = Proxy
36 isidoreDocs :: ClientM [IsidoreDoc]
37 isidoreDocs = client isidoreDocsApi
39 getIsidoreDocs :: IO [IsidoreDoc]
41 manager' <- newManager tlsManagerSettings
42 res
<- runClientM isidoreDocs $ mkClientEnv manager
' $ BaseUrl Https "https://www.rechercheisidore.fr" 8080 ""
45 Right res' -> pure res
'