mirror of
https://github.com/1f349/go-webdav.git
synced 2024-12-22 16:24:14 +00:00
caldav: add supported-calendar-component-set field
This commit is contained in:
parent
6401d9ed45
commit
25dfbaf95e
@ -10,10 +10,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Calendar struct {
|
type Calendar struct {
|
||||||
Path string
|
Path string
|
||||||
Name string
|
Name string
|
||||||
Description string
|
Description string
|
||||||
MaxResourceSize int64
|
MaxResourceSize int64
|
||||||
|
SupportedComponentSet []string
|
||||||
}
|
}
|
||||||
|
|
||||||
type CalendarCompRequest struct {
|
type CalendarCompRequest struct {
|
||||||
|
@ -55,6 +55,7 @@ func (c *Client) FindCalendars(calendarHomeSet string) ([]Calendar, error) {
|
|||||||
internal.DisplayNameName,
|
internal.DisplayNameName,
|
||||||
calendarDescriptionName,
|
calendarDescriptionName,
|
||||||
maxResourceSizeName,
|
maxResourceSizeName,
|
||||||
|
supportedCalendarComponentSetName,
|
||||||
)
|
)
|
||||||
ms, err := c.ic.Propfind(calendarHomeSet, internal.DepthOne, propfind)
|
ms, err := c.ic.Propfind(calendarHomeSet, internal.DepthOne, propfind)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -94,11 +95,22 @@ func (c *Client) FindCalendars(calendarHomeSet string) ([]Calendar, error) {
|
|||||||
return nil, fmt.Errorf("carddav: max-resource-size must be a positive integer")
|
return nil, fmt.Errorf("carddav: max-resource-size must be a positive integer")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var supportedCompSet supportedCalendarComponentSet
|
||||||
|
if err := resp.DecodeProp(&supportedCompSet); err != nil && !internal.IsNotFound(err) {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
compNames := make([]string, 0, len(supportedCompSet.Comp))
|
||||||
|
for _, comp := range supportedCompSet.Comp {
|
||||||
|
compNames = append(compNames, comp.Name)
|
||||||
|
}
|
||||||
|
|
||||||
l = append(l, Calendar{
|
l = append(l, Calendar{
|
||||||
Path: path,
|
Path: path,
|
||||||
Name: dispName.Name,
|
Name: dispName.Name,
|
||||||
Description: desc.Description,
|
Description: desc.Description,
|
||||||
MaxResourceSize: maxResSize.Size,
|
MaxResourceSize: maxResSize.Size,
|
||||||
|
SupportedComponentSet: compNames,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user