Commit 1602ca38 authored by Mudada's avatar Mudada

update resolver version, ServantError~>ClientError

parent bf57642f
...@@ -8,21 +8,20 @@ import Data.Text ...@@ -8,21 +8,20 @@ import Data.Text
import Network.HTTP.Client (newManager) import Network.HTTP.Client (newManager)
import Network.HTTP.Client.TLS (tlsManagerSettings) import Network.HTTP.Client.TLS (tlsManagerSettings)
import Servant.Client (BaseUrl(..), Scheme(..), ClientM, ServantError, import Servant.Client (BaseUrl(..), Scheme(..), ClientM, ClientError, runClientM, mkClientEnv)
runClientM, mkClientEnv)
import HAL.Client import HAL.Client
import HAL.Doc import HAL.Doc
runHalAPIClient :: ClientM (Response Doc) -> IO (Either ServantError (Response Doc)) runHalAPIClient :: ClientM (Response Doc) -> IO (Either ClientError (Response Doc))
runHalAPIClient cmd = do runHalAPIClient cmd = do
manager' <- newManager tlsManagerSettings manager' <- newManager tlsManagerSettings
runClientM cmd (mkClientEnv manager' $ BaseUrl Https "api.archives-ouvertes.fr" 443 "") runClientM cmd (mkClientEnv manager' $ BaseUrl Https "api.archives-ouvertes.fr" 443 "")
runStructureRequest :: Maybe Text -> IO (Either ServantError (Response Doc)) runStructureRequest :: Maybe Text -> IO (Either ClientError (Response Doc))
runStructureRequest rq = runStructureRequest rq =
runHalAPIClient $ structure def rq (Just 10000) runHalAPIClient $ structure def rq (Just 10000)
runSearchRequest :: [Text] -> IO (Either ServantError (Response Doc)) runSearchRequest :: [Text] -> IO (Either ClientError (Response Doc))
runSearchRequest rq = runSearchRequest rq =
runHalAPIClient $ search def rq Nothing Nothing Nothing runHalAPIClient $ search def rq Nothing Nothing Nothing
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
# #
# resolver: ./custom-snapshot.yaml # resolver: ./custom-snapshot.yaml
# resolver: https://example.com/snapshots/2018-01-01.yaml # resolver: https://example.com/snapshots/2018-01-01.yaml
resolver: lts-13.10 resolver: lts-14.1
# User packages to be built. # User packages to be built.
# Various formats can be used as shown in the example below. # Various formats can be used as shown in the example below.
......
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