Skip to content

Commit

Permalink
New method to get deleted nodes with properties + fix for Node defini…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
YurkinPark authored and mickymiek committed Feb 11, 2025
1 parent 6a43c30 commit 2f8e21b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
24 changes: 24 additions & 0 deletions rest/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@ type CmisObjects struct {
type NodeRes struct {
Entry Node `json:"entry"`
}
type NodesRes struct {
List struct {
Pagination struct {
Count int `json:"count"`
HasMoreItems bool `json:"hasMoreItems"`
TotalItems int `json:"totalItems"`
SkipCount int `json:"skipCount"`
MaxItems int `json:"maxItems"`
} `json:"pagination"`
Entries []NodeRes `json:"entries"`
} `json:"list"`
}
type Copy struct {
TargetParentId string `json:"targetParentId"`
}
Expand All @@ -33,6 +45,18 @@ func (c *Client) GetNodeId(path string, limit int) (string, error) {
return response.Objects[0].Object.Properties.ParentId.Value, nil
}

func (c *Client) GetDeletedNodes() (*NodesRes, error) {
req, err := http.NewRequest("GET", c.getUrl()+"/alfresco/api/-default-/public/alfresco/versions/1/deleted-nodes?include=properties&maxItems=10000", nil)
if err != nil {
return &NodesRes{}, err
}
response := &NodesRes{}
if _, _, err = c.doRequest(req, response); err != nil {
return response, err
}
return response, nil
}

func (c *Client) GetNodeChilds(path string, limit int) (*CmisObjects, error) {
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)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion rest/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ type Node struct {
Id string `json:"id"`
NodeType string `json:"nodeType"`
Properties struct {
Title string `json:cm:title,omitempty`
Title string `json:"cm:title,omitempty"`
Visibility string `json:"st:siteVisiblity,omitempty"`
SitePreset string `json:"st:sitePreset,omitempty"`
Description string `json:"cm:description,omitempty"`
Expand Down

0 comments on commit 2f8e21b

Please sign in to comment.