Skip to content

Commit 2f8e21b

Browse files
YurkinParkmickymiek
authored andcommitted
New method to get deleted nodes with properties + fix for Node definition
1 parent 6a43c30 commit 2f8e21b

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

rest/nodes.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@ type CmisObjects struct {
1717
type NodeRes struct {
1818
Entry Node `json:"entry"`
1919
}
20+
type NodesRes struct {
21+
List struct {
22+
Pagination struct {
23+
Count int `json:"count"`
24+
HasMoreItems bool `json:"hasMoreItems"`
25+
TotalItems int `json:"totalItems"`
26+
SkipCount int `json:"skipCount"`
27+
MaxItems int `json:"maxItems"`
28+
} `json:"pagination"`
29+
Entries []NodeRes `json:"entries"`
30+
} `json:"list"`
31+
}
2032
type Copy struct {
2133
TargetParentId string `json:"targetParentId"`
2234
}
@@ -33,6 +45,18 @@ func (c *Client) GetNodeId(path string, limit int) (string, error) {
3345
return response.Objects[0].Object.Properties.ParentId.Value, nil
3446
}
3547

48+
func (c *Client) GetDeletedNodes() (*NodesRes, error) {
49+
req, err := http.NewRequest("GET", c.getUrl()+"/alfresco/api/-default-/public/alfresco/versions/1/deleted-nodes?include=properties&maxItems=10000", nil)
50+
if err != nil {
51+
return &NodesRes{}, err
52+
}
53+
response := &NodesRes{}
54+
if _, _, err = c.doRequest(req, response); err != nil {
55+
return response, err
56+
}
57+
return response, nil
58+
}
59+
3660
func (c *Client) GetNodeChilds(path string, limit int) (*CmisObjects, error) {
3761
req, err := http.NewRequest("GET", c.getUrl()+"/alfresco/api/-default-/public/cmis/versions/1.1/browser/root/"+path+"?maxItems="+strconv.Itoa(limit)+"&cmisselector=children", nil)
3862
if err != nil {

rest/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ type Node struct {
6767
Id string `json:"id"`
6868
NodeType string `json:"nodeType"`
6969
Properties struct {
70-
Title string `json:cm:title,omitempty`
70+
Title string `json:"cm:title,omitempty"`
7171
Visibility string `json:"st:siteVisiblity,omitempty"`
7272
SitePreset string `json:"st:sitePreset,omitempty"`
7373
Description string `json:"cm:description,omitempty"`

0 commit comments

Comments
 (0)