Commit 652a05b2 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[API] function name.

parent e3945410
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
module Main where module Main where
import Isidore.Client import Isidore
import Network.HTTP.Client (newManager)
import Network.HTTP.Client.TLS (tlsManagerSettings)
import Servant.Client
main :: IO () main :: IO ()
main = do main = getMetadataWith "sociologie" (Just 10) >>= print
manager' <- newManager tlsManagerSettings
res <- runClientM main2 :: IO ()
(clientIsidore main2 = getMetadataWithAuthor "durkheim" (Just 10) >>= print
(Just 10)
(Just "poison")
(Nothing))
(mkClientEnv manager' $ BaseUrl Https "api.isidore.science" 443 "resource")
case res of
(Left err) -> print err
(Right val) -> print val
-- This file has been generated from package.yaml by hpack version 0.28.2. cabal-version: 1.12
-- This file has been generated from package.yaml by hpack version 0.31.2.
-- --
-- see: https://github.com/sol/hpack -- see: https://github.com/sol/hpack
-- --
-- hash: 37b28b3c7df7f52e571a3f00f87a54ca95eb656d9c0fbfe562bacbfcccb6ab6d -- hash: 20866216943d8b360cc259814098391c4718e607e203a9e6d286b6df51fecf0b
name: crawlerIsidore name: crawlerIsidore
version: 0.1.0.0 version: 0.1.0.0
...@@ -15,10 +17,9 @@ copyright: 2019 CNRS/IMT ...@@ -15,10 +17,9 @@ copyright: 2019 CNRS/IMT
license: BSD3 license: BSD3
license-file: LICENSE license-file: LICENSE
build-type: Simple build-type: Simple
cabal-version: >= 1.10
extra-source-files: extra-source-files:
ChangeLog.md
README.md README.md
ChangeLog.md
source-repository head source-repository head
type: git type: git
......
...@@ -33,6 +33,13 @@ type Limit = Int ...@@ -33,6 +33,13 @@ type Limit = Int
type TextQuery = Text type TextQuery = Text
type AuthorQuery = Text type AuthorQuery = Text
getMetadataWith :: Text -> Maybe Int -> IO (Either ServantError Content)
getMetadataWith q l = get l (Just q) Nothing
getMetadataWithAuthor :: Text -> Maybe Int -> IO (Either ServantError Content)
getMetadataWithAuthor q l = get l Nothing (Just q)
get :: Maybe Limit get :: Maybe Limit
-> Maybe TextQuery -> Maybe TextQuery
-> Maybe AuthorQuery -> Maybe AuthorQuery
......
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