caldav: add expand request to client
This commit is contained in:
@@ -79,6 +79,12 @@ type CalendarCompRequest struct {
|
||||
|
||||
AllComps bool
|
||||
Comps []CalendarCompRequest
|
||||
|
||||
Expand *CalendarExpandRequest
|
||||
}
|
||||
|
||||
type CalendarExpandRequest struct {
|
||||
Start, End time.Time
|
||||
}
|
||||
|
||||
type CompFilter struct {
|
||||
|
@@ -154,7 +154,9 @@ func encodeCalendarReq(c *CalendarCompRequest) (*internal.Prop, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
calDataReq := calendarDataReq{Comp: compReq}
|
||||
expandReq := encodeExpandRequest(c.Expand)
|
||||
|
||||
calDataReq := calendarDataReq{Comp: compReq, Expand: expandReq}
|
||||
|
||||
getLastModReq := internal.NewRawXMLElement(internal.GetLastModifiedName, nil, nil)
|
||||
getETagReq := internal.NewRawXMLElement(internal.GetETagName, nil, nil)
|
||||
@@ -213,6 +215,17 @@ func encodeTextMatch(tm *TextMatch) *textMatch {
|
||||
return encoded
|
||||
}
|
||||
|
||||
func encodeExpandRequest(e *CalendarExpandRequest) *expand {
|
||||
if e == nil {
|
||||
return nil
|
||||
}
|
||||
encoded := expand{
|
||||
Start: dateWithUTCTime(e.Start),
|
||||
End: dateWithUTCTime(e.End),
|
||||
}
|
||||
return &encoded
|
||||
}
|
||||
|
||||
func decodeCalendarObjectList(ms *internal.MultiStatus) ([]CalendarObject, error) {
|
||||
addrs := make([]CalendarObject, 0, len(ms.Responses))
|
||||
for _, resp := range ms.Responses {
|
||||
|
@@ -179,7 +179,8 @@ func (t *dateWithUTCTime) MarshalText() ([]byte, error) {
|
||||
type calendarDataReq struct {
|
||||
XMLName xml.Name `xml:"urn:ietf:params:xml:ns:caldav calendar-data"`
|
||||
Comp *comp `xml:"comp,omitempty"`
|
||||
// TODO: expand, limit-recurrence-set, limit-freebusy-set
|
||||
Expand *expand `xml:"expand,omitempty"`
|
||||
// TODO: limit-recurrence-set, limit-freebusy-set
|
||||
}
|
||||
|
||||
// https://tools.ietf.org/html/rfc4791#section-9.6.1
|
||||
@@ -194,6 +195,12 @@ type comp struct {
|
||||
Comp []comp `xml:"comp,omitempty"`
|
||||
}
|
||||
|
||||
type expand struct {
|
||||
XMLName xml.Name `xml:"urn:ietf:params:xml:ns:caldav expand"`
|
||||
Start dateWithUTCTime `xml:"start,attr"`
|
||||
End dateWithUTCTime `xml:"end,attr"`
|
||||
}
|
||||
|
||||
// https://tools.ietf.org/html/rfc4791#section-9.6.4
|
||||
type prop struct {
|
||||
XMLName xml.Name `xml:"urn:ietf:params:xml:ns:caldav prop"`
|
||||
|
Reference in New Issue
Block a user