sync-collection for client

This commit is contained in:
AlmogBaku
2020-03-29 15:08:48 +03:00
committed by Simon Ser
parent 25df841e2b
commit 9e23289610
4 changed files with 105 additions and 0 deletions

View File

@@ -190,3 +190,25 @@ func (c *Client) Options(path string) (classes map[string]bool, methods map[stri
methods = parseCommaSeparatedSet(resp.Header["Allow"], true)
return classes, methods, nil
}
// SyncCollection perform a `sync-collection` REPORT operation on a resource
func (c *Client) SyncCollection(path, syncToken string, level Depth, limit *Limit, prop *Prop) (*Multistatus, error) {
q := SyncCollectionQuery{
SyncToken: syncToken,
SyncLevel: string(level),
Limit: limit,
Prop: prop,
}
req, err := c.NewXMLRequest("REPORT", path, &q)
if err != nil {
return nil, err
}
ms, err := c.DoMultiStatus(req)
if err != nil {
return nil, err
}
return ms, nil
}