{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE DeriveGeneric #-}
module Gargantext.API.Routes.Named.Tree (
-- * Routes types
NodeTreeAPI(..)
, TreeFlatAPI(..)
) where
import Data.Text (Text)
import GHC.Generics
import Gargantext.Core.Types.Main
import Gargantext.Database.Admin.Types.Node
import Servant
data NodeTreeAPI mode = NodeTreeAPI
{ nodeTreeEp :: mode :- QueryParams "type" NodeType :> Get '[JSON] (Tree NodeTree)
, firstLevelEp :: mode :- "first-level" :> QueryParams "type" NodeType :> Get '[JSON] (Tree NodeTree)
} deriving Generic
data TreeFlatAPI mode = TreeFlatAPI
{ getNodesEp :: mode :- QueryParams "type" NodeType :> QueryParam "query" Text :> Get '[JSON] [NodeTree]
} deriving Generic
-
Alfredo Di Napoli authored
This big commit adds a separate module hierarchy for Servant named routes (see https://www.tweag.io/blog/2022-02-24-named-routes/ ) which will make working with servant endpoints more pleasant (especially when it comes to emitted errors). This still doesn't do anything to wire the routes to the concrete handlers.
4477c6c7