Commit daeae803 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[API] function name.

parent 6f60c2a4
......@@ -7,9 +7,9 @@ import ISTEX.Client
main :: IO ()
main = do
res <- basicSearch (Just "ia")
res <- getMetadataWith "artificial intelligence" (Just 10)
case res of
(Left err) -> print "Error"
(Right val) -> do
print $ take 5 $ _hits val
print $ take 5 $ _documents_hits val
-- print $ _abstract <$> (_hits val)
......@@ -7,17 +7,17 @@ import Network.HTTP.Client (newManager)
import Network.HTTP.Client.TLS (tlsManagerSettings)
import Servant.Client
import qualified Data.Text as T
import Data.Text (Text)
runIstexAPIClient :: ClientM (Documents) -> IO (Either ClientError Documents)
runIstexAPIClient cmd = do
manager' <- newManager tlsManagerSettings
runClientM cmd (mkClientEnv manager' $ BaseUrl Https "api.istex.fr" 443 "document")
basicSearch :: Maybe T.Text -> IO (Either ClientError Documents)
basicSearch rq = do
getMetadataWith :: Text -> Maybe Int -> IO (Either ClientError Documents)
getMetadataWith q l = do
runIstexAPIClient $
search
(Just "author,title,abstract,publicationDate,refBibs")
(Just 5000)
rq
l
(Just q)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment