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
23 import GHC.Generics (Generic)
25 import Test.QuickCheck.Arbitrary
27 import Gargantext.API.Prelude
28 import Gargantext.Database.Admin.Types.Node
29 import Gargantext.Database.Prelude (JSONB)
30 import Gargantext.Prelude
32 ------------------------------------------------------------------------
33 type API a = Summary "Polymorphic Get Node Endpoint"
34 :> ReqBody '[JSON] GetNodeParams
35 :> Get '[JSON] (Node a)
37 ------------------------------------------------------------------------
38 data GetNodeParams = GetNodeParams { node_id :: NodeId
39 , nodetype :: NodeType
43 ----------------------------------------------------------------------
44 api :: forall proxy a.
48 ) => proxy a -> UserId -> NodeId -> GargServer (API a)
49 api _p _uId _nId (GetNodeParams _nId' _nt) = undefined
51 ------------------------------------------------------------------------
52 instance FromJSON GetNodeParams where
53 parseJSON = genericParseJSON (defaultOptions { sumEncoding = ObjectWithSingleField })
55 instance ToJSON GetNodeParams where
56 toJSON = genericToJSON (defaultOptions { sumEncoding = ObjectWithSingleField })
58 instance ToSchema GetNodeParams
59 instance Arbitrary GetNodeParams where
60 arbitrary = GetNodeParams <$> arbitrary <*> arbitrary
62 ------------------------------------------------------------------------