Commit 5549c456 authored by Mael NICOLAS's avatar Mael NICOLAS

Missed to push this file

parent 9807287e
{-# LANGUAGE OverloadedStrings #-}
module HAL where
import Data.Default (def)
import Data.Text
import Network.HTTP.Client (newManager)
import Network.HTTP.Client.TLS (tlsManagerSettings)
import Servant.Client (BaseUrl(..), Scheme(..), ClientM, ServantError,
runClientM, mkClientEnv)
import HAL.Client
import HAL.Doc
runHalAPIClient :: ClientM (Response Doc) -> IO (Either ServantError (Response Doc))
runHalAPIClient cmd = do
manager' <- newManager tlsManagerSettings
runClientM cmd (mkClientEnv manager' $ BaseUrl Https "api.archives-ouvertes.fr" 443 "")
runStructureRequest :: Maybe Text -> IO (Either ServantError (Response Doc))
runStructureRequest rq =
runHalAPIClient $ structure def rq (Just 10000)
runSearchRequest :: [Text] -> IO (Either ServantError (Response Doc))
runSearchRequest rq =
runHalAPIClient $ search def rq Nothing Nothing Nothing
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