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