Commit cc773005 authored by Mael NICOLAS's avatar Mael NICOLAS

fix#1

search should always be called with `docid` and `label_s` if you don't want more
than this just use `basicSearch`
parent 52fe9140
......@@ -8,11 +8,13 @@ import Servant.Client
import HAL.Client
basicSearch = search ["docid", "label_s"]
main :: IO ()
main = do
manager' <- newManager tlsManagerSettings
res <- runClientM
(search ["docid"] ["docType_s:(THESE OR HDR)"] (asc "docid") (Just 1) (Just 2))
(basicSearch ["docType_s:(THESE OR HDR)"] (asc "docid") (Just 1) (Just 2))
(mkClientEnv manager' $ BaseUrl Https "api.archives-ouvertes.fr" 443 "")
case res of
(Left err) -> print err
......
......@@ -20,12 +20,6 @@ import Control.Lens as L (makeLenses)
type HALAPI = Search :<|> Structure
type Structure = "ref" :> "structure"
:> QueryParam "fq" Text
:> QueryParam "fl" Text
:> QueryParam "rows" Int
:> Get '[JSON] Response
type Search = "search"
-- fl determine which fields will be returned it can be a list of fields or *
:> QueryParams "fl" Text
......@@ -40,6 +34,13 @@ type Search = "search"
:> QueryParam "rows" Int
:> Get '[JSON] Response
type Structure = "ref" :> "structure"
:> QueryParam "fq" Text
:> QueryParam "fl" Text
:> QueryParam "rows" Int
:> Get '[JSON] Response
-- Get's argument type
data SortField = Asc Text | Desc Text
deriving (Show)
......@@ -92,6 +93,8 @@ structure :: Maybe Text -- fq
-> Maybe Text
-> Maybe Int -- rows
-> ClientM Response
-- search should always have at least `docid` and `label_s` in his fl params
search :: [Text] -- fl
-> [Text] -- fq
-> Maybe SortField -- sort
......
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