{-# LANGUAGE TypeOperators #-} module Gargantext.API.Routes.Named.Search ( -- * Routes types SearchAPI(..) -- * API types (appears in the routes) , SearchType(..) , SearchQuery(..) , SearchResult(..) , SearchResultTypes(..) ) where import GHC.Generics (Generic) import Gargantext.API.Search.Types ( SearchQuery(..), SearchType(..), SearchResult(..), SearchResultTypes(..) ) import Gargantext.Core.Types.Query (Limit, Offset) import Gargantext.Database.Query.Facet (OrderBy) import Servant -- TODO-ACCESS: CanSearch? or is it part of CanGetNode -- TODO-EVENTS: No event, this is a read-only query. newtype SearchAPI results mode = SearchAPI { searchEp :: mode :- Summary "Search endpoint" :> ReqBody '[JSON] SearchQuery :> QueryParam "offset" Offset :> QueryParam "limit" Limit :> QueryParam "order" OrderBy :> Post '[JSON] results } deriving Generic