2 Module : Gargantext.API.Node.Get
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
10 Polymorphic Get Node API
14 {-# LANGUAGE TemplateHaskell #-}
15 {-# LANGUAGE TypeOperators #-}
16 {-# OPTIONS_GHC -fno-warn-orphans #-}
18 module Gargantext.API.Node.Get
21 -- import Gargantext.API.Admin.Settings (HasSettings)
22 -- import Servant.Job.Async (JobFunction(..), serveJobsAPI)
23 -- import Test.QuickCheck (elements)
24 -- import Gargantext.Database.Action.Flow.Types (FlowCmdM)
27 import GHC.Generics (Generic)
28 import Gargantext.API.Prelude
29 import Gargantext.Database.Admin.Types.Node
30 import Gargantext.Database.Query.Table.Node (JSONB{-, getNodeWith-})
31 import Gargantext.Prelude
33 import Test.QuickCheck.Arbitrary
35 ------------------------------------------------------------------------
36 type API a = Summary "Polymorphic Get Node Endpoint"
37 :> ReqBody '[JSON] GetNodeParams
38 :> Get '[JSON] (Node a)
40 ------------------------------------------------------------------------
41 data GetNodeParams = GetNodeParams { node_id :: NodeId
42 , nodetype :: NodeType
46 ----------------------------------------------------------------------
47 api :: forall proxy a.
51 ) => proxy a -> UserId -> NodeId -> GargServer (API a)
52 api _p _uId _nId (GetNodeParams _nId' _nt) = undefined
54 ------------------------------------------------------------------------
55 instance FromJSON GetNodeParams where
56 parseJSON = genericParseJSON (defaultOptions { sumEncoding = ObjectWithSingleField })
58 instance ToJSON GetNodeParams where
59 toJSON = genericToJSON (defaultOptions { sumEncoding = ObjectWithSingleField })
61 instance ToSchema GetNodeParams
62 instance Arbitrary GetNodeParams where
63 arbitrary = GetNodeParams <$> arbitrary <*> arbitrary
65 ------------------------------------------------------------------------