Commit 6a74498b authored by Mael NICOLAS's avatar Mael NICOLAS

[WIP] Implement basic fq

Todo better type this
parent 5df9762f
...@@ -12,7 +12,7 @@ main :: IO () ...@@ -12,7 +12,7 @@ main :: IO ()
main = do main = do
manager' <- newManager tlsManagerSettings manager' <- newManager tlsManagerSettings
res <- runClientM res <- runClientM
(search ["docid"] (asc "docid")) (search ["docid"] ["docType_s:(THESE OR HDR)"] (asc "docid"))
(mkClientEnv manager' $ BaseUrl Https "api.archives-ouvertes.fr" 443 "") (mkClientEnv manager' $ BaseUrl Https "api.archives-ouvertes.fr" 443 "")
case res of case res of
(Left err) -> print err (Left err) -> print err
......
...@@ -18,6 +18,9 @@ type HALAPI = Search ...@@ -18,6 +18,9 @@ type HALAPI = Search
type Search = "search" type Search = "search"
-- fl determine which fields will be returned it can be a list of fields or * -- fl determine which fields will be returned it can be a list of fields or *
:> QueryParams "fl" Text :> QueryParams "fl" Text
-- TODO: type this monster
-- fq is to filter request
:> QueryParams "fq" Text
-- preatty much clear, (Asc || Desc) + field you want to sort by -- preatty much clear, (Asc || Desc) + field you want to sort by
:> QueryParam "sort" SortField :> QueryParam "sort" SortField
:> Get '[JSON] Response :> Get '[JSON] Response
...@@ -56,5 +59,8 @@ instance FromJSON Doc ...@@ -56,5 +59,8 @@ instance FromJSON Doc
halAPI :: Proxy HALAPI halAPI :: Proxy HALAPI
halAPI = Proxy halAPI = Proxy
search :: [Text] -> Maybe SortField -> ClientM Response search :: [Text]
-> [Text]
-> Maybe SortField
-> ClientM Response
search = client halAPI search = client halAPI
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