Copyright | (c) CNRS 2017-Present |
---|---|
License | AGPL + CECILL v3 |
Maintainer | team@gargantext.org |
Stability | experimental |
Portability | POSIX |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Gargantext.API.Node
Description
- - TODO-SECURITY: Critical
- - TODO-ACCESS: CanGetNode
- - TODO-EVENTS: No events as this is a read only query. Node API
- ------------------------------------------------------------------
- - TODO-ACCESS: access by admin only.
- - At first let's just have an isAdmin check.
- - Later: check userId CanDeleteNodes Nothing
- - TODO-EVENTS: DeletedNodes [NodeId]
- - {"tag": DeletedNodes, "nodes": [Int*]}
Synopsis
- type NodesAPI = Delete '[JSON] Int
- nodesAPI :: [NodeId] -> GargServer NodesAPI
- type Roots = Get '[JSON] [Node HyperdataUser] :<|> Put '[JSON] Int
- roots :: GargServer Roots
- type NodeAPI a = PolicyChecked (NodeNodeAPI a) :<|> (("rename" :> RenameApi) :<|> (PostNodeApi :<|> (PostNodeAsync :<|> (API :<|> ((ReqBody '[JSON] a :> Put '[JSON] Int) :<|> (("update" :> API) :<|> (Delete '[JSON] Int :<|> (("children" :> ChildrenApi a) :<|> (("table" :> TableApi) :<|> (("ngrams" :> TableNgramsApi) :<|> (("category" :> CatApi) :<|> (("score" :> ScoreApi) :<|> (("search" :> API SearchResult) :<|> (("share" :> API) :<|> (("pairwith" :> PairWith) :<|> (("pairs" :> Pairs) :<|> (("pairing" :> PairingApi) :<|> (("metrics" :> ScatterAPI) :<|> (("chart" :> ChartApi) :<|> (("pie" :> PieApi) :<|> (("tree" :> TreeApi) :<|> (("phylo" :> PhyloAPI) :<|> (("move" :> MoveAPI) :<|> (("unpublish" :> Unpublish) :<|> (("file" :> FileApi) :<|> (("async" :> FileAsyncApi) :<|> (("documents-from-write-nodes" :> API) :<|> API)))))))))))))))))))))))))))
- type RenameApi = Summary " Rename Node" :> (ReqBody '[JSON] RenameNode :> Put '[JSON] [Int])
- type PostNodeApi = Summary " PostNode Node with ParentId as {id}" :> (ReqBody '[JSON] PostNode :> Post '[JSON] [NodeId])
- type ChildrenApi a = Summary " Summary children" :> (QueryParam "type" NodeType :> (QueryParam "offset" Offset :> (QueryParam "limit" Limit :> Get '[JSON] (NodeTableResult a))))
- type NodeNodeAPI a = Get '[JSON] (Node a)
- nodeNodeAPI :: forall proxy a. (JSONB a, ToJSON a) => proxy a -> AuthenticatedUser -> CorpusId -> NodeId -> GargServer (NodeNodeAPI a)
- data RenameNode = RenameNode {}
- type CatApi = Summary " To Categorize NodeNodes: 0 for delete, 1/null neutral, 2 favorite" :> (ReqBody '[JSON] NodesToCategory :> Put '[JSON] [Int])
- data NodesToCategory = NodesToCategory {
- ntc_nodesId :: [NodeId]
- ntc_category :: Int
- catApi :: CorpusId -> GargServer CatApi
- type ScoreApi = Summary " To Score NodeNodes" :> (ReqBody '[JSON] NodesToScore :> Put '[JSON] [Int])
- data NodesToScore = NodesToScore {
- nts_nodesId :: [NodeId]
- nts_score :: Int
- scoreApi :: CorpusId -> GargServer ScoreApi
- type PairingApi = Summary " Pairing API" :> (QueryParam "view" TabType :> (QueryParam "offset" Offset :> (QueryParam "limit" Limit :> (QueryParam "order" OrderBy :> Get '[JSON] [FacetDoc]))))
- type Pairs = Summary "List of Pairs" :> Get '[JSON] [AnnuaireId]
- pairs :: CorpusId -> GargServer Pairs
- type PairWith = Summary "Pair a Corpus with an Annuaire" :> ("annuaire" :> (Capture "annuaire_id" AnnuaireId :> (QueryParam "list_id" ListId :> Post '[JSON] [Int])))
- pairWith :: CorpusId -> GargServer PairWith
- type TreeAPI = (QueryParams "type" NodeType :> Get '[JSON] (Tree NodeTree)) :<|> ("first-level" :> (QueryParams "type" NodeType :> Get '[JSON] (Tree NodeTree)))
- treeAPI :: NodeId -> GargServer TreeAPI
- type TreeFlatAPI = QueryParams "type" NodeType :> (QueryParam "query" Text :> Get '[JSON] [NodeTree])
- treeFlatAPI :: NodeId -> GargServer TreeFlatAPI
- rename :: NodeId -> RenameNode -> Cmd err [Int]
- putNode :: forall err a. (HasNodeError err, HyperdataC a) => NodeId -> a -> Cmd err Int
- type MoveAPI = Summary "Move Node endpoint" :> (Capture "parent_id" ParentId :> Put '[JSON] [Int])
- moveNode :: User -> NodeId -> ParentId -> Cmd err [Int]
- nodeAPI :: forall proxy a. (HyperdataC a, Show a, MimeUnrender JSON a) => proxy a -> AuthenticatedUser -> NodeId -> ServerT (NodeAPI a) (GargM Env BackendInternalError)
Documentation
nodesAPI :: [NodeId] -> GargServer NodesAPI #
Delete Nodes Be careful: really delete nodes Access by admin only
type Roots = Get '[JSON] [Node HyperdataUser] :<|> Put '[JSON] Int #
TODO-ACCESS: access by admin only. At first let's just have an isAdmin check. Later: CanAccessAnyNode or (CanGetAnyNode, CanPutAnyNode) To manage the Users roots TODO-EVENTS: PutNode ? TODO needs design discussion.
roots :: GargServer Roots #
TODO: access by admin only
type NodeAPI a = PolicyChecked (NodeNodeAPI a) :<|> (("rename" :> RenameApi) :<|> (PostNodeApi :<|> (PostNodeAsync :<|> (API :<|> ((ReqBody '[JSON] a :> Put '[JSON] Int) :<|> (("update" :> API) :<|> (Delete '[JSON] Int :<|> (("children" :> ChildrenApi a) :<|> (("table" :> TableApi) :<|> (("ngrams" :> TableNgramsApi) :<|> (("category" :> CatApi) :<|> (("score" :> ScoreApi) :<|> (("search" :> API SearchResult) :<|> (("share" :> API) :<|> (("pairwith" :> PairWith) :<|> (("pairs" :> Pairs) :<|> (("pairing" :> PairingApi) :<|> (("metrics" :> ScatterAPI) :<|> (("chart" :> ChartApi) :<|> (("pie" :> PieApi) :<|> (("tree" :> TreeApi) :<|> (("phylo" :> PhyloAPI) :<|> (("move" :> MoveAPI) :<|> (("unpublish" :> Unpublish) :<|> (("file" :> FileApi) :<|> (("async" :> FileAsyncApi) :<|> (("documents-from-write-nodes" :> API) :<|> API))))))))))))))))))))))))))) #
Node API Types management TODO-ACCESS : access by users No ownership check is needed if we strictly follow the capability model.
CanGetNode (Node, Children, TableApi, TableNgramsApiGet, PairingApi, ChartApi, SearchAPI) CanRenameNode (or part of CanEditNode?) CanCreateChildren (PostNodeApi) CanEditNode / CanPutNode TODO not implemented yet CanDeleteNode CanPatch (TableNgramsApi) CanFavorite CanMoveToTrash
type PostNodeApi = Summary " PostNode Node with ParentId as {id}" :> (ReqBody '[JSON] PostNode :> Post '[JSON] [NodeId]) #
type ChildrenApi a = Summary " Summary children" :> (QueryParam "type" NodeType :> (QueryParam "offset" Offset :> (QueryParam "limit" Limit :> Get '[JSON] (NodeTableResult a)))) #
type NodeNodeAPI a = Get '[JSON] (Node a) #
nodeNodeAPI :: forall proxy a. (JSONB a, ToJSON a) => proxy a -> AuthenticatedUser -> CorpusId -> NodeId -> GargServer (NodeNodeAPI a) #
data RenameNode #
Constructors
RenameNode | |
Instances
Arbitrary RenameNode # | |
Defined in Gargantext.API.Node | |
FromJSON RenameNode # | |
Defined in Gargantext.API.Node | |
ToJSON RenameNode # | |
Defined in Gargantext.API.Node Methods toJSON :: RenameNode -> Value # toEncoding :: RenameNode -> Encoding # toJSONList :: [RenameNode] -> Value # toEncodingList :: [RenameNode] -> Encoding # | |
Generic RenameNode # | |
Defined in Gargantext.API.Node Associated Types type Rep RenameNode :: Type -> Type # | |
ToSchema RenameNode # | |
Defined in Gargantext.API.Node Methods declareNamedSchema :: Proxy RenameNode -> Declare (Definitions Schema) NamedSchema # | |
HasSwagger (WithCustomErrorScheme GargAPI) # | |
Defined in Gargantext.API.Routes | |
type Rep RenameNode # | |
Defined in Gargantext.API.Node type Rep RenameNode = D1 ('MetaData "RenameNode" "Gargantext.API.Node" "gargantext-0.0.7.1.5.3-inplace" 'False) (C1 ('MetaCons "RenameNode" 'PrefixI 'True) (S1 ('MetaSel ('Just "r_name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text))) |
type CatApi = Summary " To Categorize NodeNodes: 0 for delete, 1/null neutral, 2 favorite" :> (ReqBody '[JSON] NodesToCategory :> Put '[JSON] [Int]) #
data NodesToCategory #
Constructors
NodesToCategory | |
Fields
|
Instances
catApi :: CorpusId -> GargServer CatApi #
type ScoreApi = Summary " To Score NodeNodes" :> (ReqBody '[JSON] NodesToScore :> Put '[JSON] [Int]) #
data NodesToScore #
Constructors
NodesToScore | |
Fields
|
Instances
scoreApi :: CorpusId -> GargServer ScoreApi #
type PairingApi = Summary " Pairing API" :> (QueryParam "view" TabType :> (QueryParam "offset" Offset :> (QueryParam "limit" Limit :> (QueryParam "order" OrderBy :> Get '[JSON] [FacetDoc])))) #
pairs :: CorpusId -> GargServer Pairs #
type PairWith = Summary "Pair a Corpus with an Annuaire" :> ("annuaire" :> (Capture "annuaire_id" AnnuaireId :> (QueryParam "list_id" ListId :> Post '[JSON] [Int]))) #
pairWith :: CorpusId -> GargServer PairWith #
type TreeAPI = (QueryParams "type" NodeType :> Get '[JSON] (Tree NodeTree)) :<|> ("first-level" :> (QueryParams "type" NodeType :> Get '[JSON] (Tree NodeTree))) #
treeAPI :: NodeId -> GargServer TreeAPI #
type TreeFlatAPI = QueryParams "type" NodeType :> (QueryParam "query" Text :> Get '[JSON] [NodeTree]) #
treeFlatAPI :: NodeId -> GargServer TreeFlatAPI #
putNode :: forall err a. (HasNodeError err, HyperdataC a) => NodeId -> a -> Cmd err Int #
type MoveAPI = Summary "Move Node endpoint" :> (Capture "parent_id" ParentId :> Put '[JSON] [Int]) #
nodeAPI :: forall proxy a. (HyperdataC a, Show a, MimeUnrender JSON a) => proxy a -> AuthenticatedUser -> NodeId -> ServerT (NodeAPI a) (GargM Env BackendInternalError) #