]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Core/Text/Corpus/API.hs
[Istex] fix getMetadataScroll call
[gargantext.git] / src / Gargantext / Core / Text / Corpus / API.hs
1 {-|
2 Module : Gargantext.Core.Text.Corpus.API
3 Description : All crawlers of Gargantext in one file.
4 Copyright : (c) CNRS, 2017
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
8 Portability : POSIX
9
10 -}
11
12 module Gargantext.Core.Text.Corpus.API
13 ( ExternalAPIs(..)
14 , Query
15 , Limit
16 , get
17 , externalAPIs
18 ) where
19
20 import Data.Maybe
21 import Gargantext.API.Admin.Orchestrator.Types (ExternalAPIs(..), externalAPIs)
22 import Gargantext.Core (Lang(..))
23 import Gargantext.Database.Admin.Types.Hyperdata (HyperdataDocument(..))
24 import Gargantext.Prelude
25 import qualified Gargantext.Core.Text.Corpus.API.Hal as HAL
26 import qualified Gargantext.Core.Text.Corpus.API.Isidore as ISIDORE
27 import qualified Gargantext.Core.Text.Corpus.API.Istex as ISTEX
28 import qualified Gargantext.Core.Text.Corpus.API.Pubmed as PUBMED
29
30 -- | TODO put in gargantext.init
31 default_limit :: Maybe Integer
32 default_limit = Just 10000
33
34 -- | Get External API metadata main function
35 get :: ExternalAPIs
36 -> Lang
37 -> Query
38 -> Maybe Limit
39 -> IO [HyperdataDocument]
40 get PubMed _la q _l = PUBMED.get q default_limit -- EN only by default
41 get HAL la q _l = HAL.get la q default_limit
42 get IsTex la q _l = ISTEX.get la q default_limit
43 get Isidore la q _l = ISIDORE.get la (fromIntegral <$> default_limit) (Just q) Nothing
44 get _ _ _ _ = undefined
45
46 -- | Some Sugar for the documentation
47 type Query = PUBMED.Query
48 type Limit = PUBMED.Limit