]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Text/Corpus/API.hs
Merge branch 'dev' into dev-list-charts
[gargantext.git] / src / Gargantext / Text / Corpus / API.hs
1 {-|
2 Module : Gargantext.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 {-# LANGUAGE InstanceSigs #-}
13
14 module Gargantext.Text.Corpus.API
15 ( ExternalAPIs(..)
16 , Query
17 , Limit
18 , get
19 , externalAPIs
20 )
21 where
22
23 import Data.Maybe
24 import Gargantext.API.Admin.Orchestrator.Types (ExternalAPIs(..), externalAPIs)
25 import Gargantext.Core (Lang(..))
26 import Gargantext.Database.Admin.Types.Hyperdata (HyperdataDocument(..))
27 import Gargantext.Prelude
28 import qualified Gargantext.Text.Corpus.API.Hal as HAL
29 import qualified Gargantext.Text.Corpus.API.Isidore as ISIDORE
30 import qualified Gargantext.Text.Corpus.API.Istex as ISTEX
31 import qualified Gargantext.Text.Corpus.API.Pubmed as PUBMED
32
33 -- | Get External API metadata main function
34 get :: ExternalAPIs
35 -> Lang
36 -> Query
37 -> Maybe Limit
38 -> IO [HyperdataDocument]
39 get PubMed _la q l = PUBMED.get q l -- EN only by default
40 get HAL la q l = HAL.get la q l
41 get IsTex la q l = ISTEX.get la q l
42 get Isidore la q l = ISIDORE.get la (fromIntegral <$> l) (Just q) Nothing
43 get _ _ _ _ = undefined
44
45 -- | Some Sugar for the documentation
46 type Query = PUBMED.Query
47 type Limit = PUBMED.Limit
48