diff --git a/.build.yml b/.build.yml index c3a3e9e..0bc5cec 100644 --- a/.build.yml +++ b/.build.yml @@ -2,7 +2,7 @@ image: alpine/edge packages: - go sources: - - https://github.com/emersion/go-webdav + - https://github.com/jonyTF/go-webdav tasks: - test: | cd go-webdav diff --git a/README.md b/README.md index a8627c9..006e226 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # go-webdav -[![Go Reference](https://pkg.go.dev/badge/github.com/emersion/go-webdav.svg)](https://pkg.go.dev/github.com/emersion/go-webdav) +[![Go Reference](https://pkg.go.dev/badge/github.com/jonyTF/go-webdav.svg)](https://pkg.go.dev/github.com/jonyTF/go-webdav) A Go library for [WebDAV], [CalDAV] and [CardDAV]. diff --git a/caldav/caldav.go b/caldav/caldav.go index 02705ef..a658f45 100644 --- a/caldav/caldav.go +++ b/caldav/caldav.go @@ -8,8 +8,8 @@ import ( "time" "github.com/emersion/go-ical" - "github.com/emersion/go-webdav" - "github.com/emersion/go-webdav/internal" + "github.com/jonyTF/go-webdav" + "github.com/jonyTF/go-webdav/internal" ) var CapabilityCalendar = webdav.Capability("calendar-access") @@ -79,6 +79,12 @@ type CalendarCompRequest struct { AllComps bool Comps []CalendarCompRequest + + Expand *CalendarExpandRequest +} + +type CalendarExpandRequest struct { + Start, End time.Time } type CompFilter struct { diff --git a/caldav/client.go b/caldav/client.go index e19e84c..7f21470 100644 --- a/caldav/client.go +++ b/caldav/client.go @@ -12,8 +12,8 @@ import ( "time" "github.com/emersion/go-ical" - "github.com/emersion/go-webdav" - "github.com/emersion/go-webdav/internal" + "github.com/jonyTF/go-webdav" + "github.com/jonyTF/go-webdav/internal" ) // DiscoverContextURL performs a DNS-based CardDAV service discovery as @@ -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) @@ -175,6 +177,17 @@ func encodeCompFilter(filter *CompFilter) *compFilter { 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 { diff --git a/caldav/elements.go b/caldav/elements.go index 5759f31..383cf82 100644 --- a/caldav/elements.go +++ b/caldav/elements.go @@ -5,7 +5,7 @@ import ( "fmt" "time" - "github.com/emersion/go-webdav/internal" + "github.com/jonyTF/go-webdav/internal" ) const namespace = "urn:ietf:params:xml:ns:caldav" @@ -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"` diff --git a/caldav/server.go b/caldav/server.go index d3e83b8..e9cd363 100644 --- a/caldav/server.go +++ b/caldav/server.go @@ -13,8 +13,8 @@ import ( "time" "github.com/emersion/go-ical" - "github.com/emersion/go-webdav" - "github.com/emersion/go-webdav/internal" + "github.com/jonyTF/go-webdav" + "github.com/jonyTF/go-webdav/internal" ) // TODO if nothing more Caldav-specific needs to be added this should be merged with carddav.PutAddressObjectOptions diff --git a/carddav/carddav.go b/carddav/carddav.go index ebfd66d..8bcccaa 100644 --- a/carddav/carddav.go +++ b/carddav/carddav.go @@ -7,8 +7,8 @@ import ( "time" "github.com/emersion/go-vcard" - "github.com/emersion/go-webdav" - "github.com/emersion/go-webdav/internal" + "github.com/jonyTF/go-webdav" + "github.com/jonyTF/go-webdav/internal" ) var CapabilityAddressBook = webdav.Capability("addressbook") diff --git a/carddav/carddav_test.go b/carddav/carddav_test.go index 3527a3e..a1af090 100644 --- a/carddav/carddav_test.go +++ b/carddav/carddav_test.go @@ -9,7 +9,7 @@ import ( "testing" "github.com/emersion/go-vcard" - "github.com/emersion/go-webdav" + "github.com/jonyTF/go-webdav" ) type testBackend struct { diff --git a/carddav/client.go b/carddav/client.go index aa6dfce..b6b5830 100644 --- a/carddav/client.go +++ b/carddav/client.go @@ -12,8 +12,8 @@ import ( "time" "github.com/emersion/go-vcard" - "github.com/emersion/go-webdav" - "github.com/emersion/go-webdav/internal" + "github.com/jonyTF/go-webdav" + "github.com/jonyTF/go-webdav/internal" ) // DiscoverContextURL performs a DNS-based CardDAV service discovery as diff --git a/carddav/elements.go b/carddav/elements.go index 6781d30..f2c2db8 100644 --- a/carddav/elements.go +++ b/carddav/elements.go @@ -4,7 +4,7 @@ import ( "encoding/xml" "fmt" - "github.com/emersion/go-webdav/internal" + "github.com/jonyTF/go-webdav/internal" ) const namespace = "urn:ietf:params:xml:ns:carddav" diff --git a/carddav/server.go b/carddav/server.go index 915c49e..83ce435 100644 --- a/carddav/server.go +++ b/carddav/server.go @@ -12,8 +12,8 @@ import ( "strings" "github.com/emersion/go-vcard" - "github.com/emersion/go-webdav" - "github.com/emersion/go-webdav/internal" + "github.com/jonyTF/go-webdav" + "github.com/jonyTF/go-webdav/internal" ) type PutAddressObjectOptions struct { diff --git a/client.go b/client.go index 05cc9f3..1e20c8a 100644 --- a/client.go +++ b/client.go @@ -7,7 +7,7 @@ import ( "net/http" "time" - "github.com/emersion/go-webdav/internal" + "github.com/jonyTF/go-webdav/internal" ) // HTTPClient performs HTTP requests. It's implemented by *http.Client. diff --git a/cmd/webdav-server/main.go b/cmd/webdav-server/main.go index b972adc..4059352 100644 --- a/cmd/webdav-server/main.go +++ b/cmd/webdav-server/main.go @@ -7,7 +7,7 @@ import ( "net/http" "os" - "github.com/emersion/go-webdav" + "github.com/jonyTF/go-webdav" ) func main() { diff --git a/elements.go b/elements.go index 70f9e9b..013d178 100644 --- a/elements.go +++ b/elements.go @@ -3,7 +3,7 @@ package webdav import ( "encoding/xml" - "github.com/emersion/go-webdav/internal" + "github.com/jonyTF/go-webdav/internal" ) var ( diff --git a/fs_local.go b/fs_local.go index 0b9f7aa..ed0d380 100644 --- a/fs_local.go +++ b/fs_local.go @@ -11,7 +11,7 @@ import ( "path/filepath" "strings" - "github.com/emersion/go-webdav/internal" + "github.com/jonyTF/go-webdav/internal" ) // LocalFileSystem implements FileSystem for a local directory. diff --git a/go.mod b/go.mod index 0cf5c45..1d9e8bb 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/emersion/go-webdav +module github.com/jonyTF/go-webdav go 1.13 diff --git a/server.go b/server.go index 3f7ea13..29d8c2b 100644 --- a/server.go +++ b/server.go @@ -9,7 +9,7 @@ import ( "strconv" "strings" - "github.com/emersion/go-webdav/internal" + "github.com/jonyTF/go-webdav/internal" ) // FileSystem is a WebDAV server backend. diff --git a/webdav.go b/webdav.go index e691ac5..21b8ccb 100644 --- a/webdav.go +++ b/webdav.go @@ -6,7 +6,7 @@ package webdav import ( "time" - "github.com/emersion/go-webdav/internal" + "github.com/jonyTF/go-webdav/internal" ) // FileInfo holds information about a WebDAV file.