import Test.QuickCheck (elements)
import Test.QuickCheck.Arbitrary (Arbitrary, arbitrary)
-import Gargantext.API.Admin.Auth (withAccess, PathId(..))
+import Gargantext.API.Admin.Auth.Types (PathId(..))
+import Gargantext.API.Admin.Auth (withAccess)
import Gargantext.API.Metrics
-import Gargantext.API.Ngrams (TabType(..), TableNgramsApi, apiNgramsTableCorpus)
+import Gargantext.API.Ngrams (TableNgramsApi, apiNgramsTableCorpus)
+import Gargantext.API.Ngrams.Types (TabType(..))
import Gargantext.API.Node.File
import Gargantext.API.Node.New
import Gargantext.API.Prelude
import Gargantext.Database.Query.Table.NodeNode
import Gargantext.Database.Query.Tree (tree, TreeMode(..))
import Gargantext.Prelude
-import Gargantext.Viz.Phylo.API (PhyloAPI, phyloAPI)
+import Gargantext.Core.Viz.Phylo.API (PhyloAPI, phyloAPI)
import qualified Gargantext.API.Node.Share as Share
import qualified Gargantext.API.Node.Update as Update
import qualified Gargantext.API.Search as Search
import qualified Gargantext.Database.Query.Table.Node.Update as U (update, Update(..))
{-
-import qualified Gargantext.Text.List.Learn as Learn
+import qualified Gargantext.Core.Text.List.Learn as Learn
import qualified Data.Vector as Vec
--}
:<|> "unpublish" :> Share.Unpublish
:<|> "file" :> FileApi
+ :<|> "async" :> FileAsyncApi
-- TODO-ACCESS: check userId CanRenameNode nodeId
-- TODO-EVENTS: NodeRenamed RenameNode or re-use some more general NodeEdited...
-- TODO gather it
:<|> tableApi id'
:<|> apiNgramsTableCorpus id'
-
+
:<|> catApi id'
:<|> Search.api id'
- :<|> Share.api id'
+ :<|> Share.api (RootId $ NodeId uId) id'
-- Pairing Tools
:<|> pairWith id'
:<|> pairs id'
:<|> getPair id'
+ -- VIZ
:<|> scatterApi id'
:<|> chartApi id'
:<|> pieApi id'
:<|> Share.unPublish id'
:<|> fileApi uId id'
+ :<|> fileAsyncApi uId id'
------------------------------------------------------------------------
type TreeAPI = QueryParams "type" NodeType :> Get '[JSON] (Tree NodeTree)
treeAPI :: NodeId -> GargServer TreeAPI
-treeAPI = tree Advanced
+treeAPI = tree TreeAdvanced
------------------------------------------------------------------------
-- | TODO Check if the name is less than 255 char