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.Types (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)
29 import Test.QuickCheck.Arbitrary
31 import Gargantext.API.Prelude
32 import Gargantext.Database.Admin.Types.Node
33 import Gargantext.Database.Query.Table.Node (JSONB{-, getNodeWith-})
34 import Gargantext.Prelude
36 ------------------------------------------------------------------------
37 type API a = Summary "Polymorphic Get Node Endpoint"
38 :> ReqBody '[JSON] GetNodeParams
39 :> Get '[JSON] (Node a)
41 ------------------------------------------------------------------------
42 data GetNodeParams = GetNodeParams { node_id :: NodeId
43 , nodetype :: NodeType
47 ----------------------------------------------------------------------
48 api :: forall proxy a.
52 ) => proxy a -> UserId -> NodeId -> GargServer (API a)
53 api _p _uId _nId (GetNodeParams _nId' _nt) = undefined
55 ------------------------------------------------------------------------
56 instance FromJSON GetNodeParams where
57 parseJSON = genericParseJSON (defaultOptions { sumEncoding = ObjectWithSingleField })
59 instance ToJSON GetNodeParams where
60 toJSON = genericToJSON (defaultOptions { sumEncoding = ObjectWithSingleField })
62 instance ToSchema GetNodeParams
63 instance Arbitrary GetNodeParams where
64 arbitrary = GetNodeParams <$> arbitrary <*> arbitrary
66 ------------------------------------------------------------------------