From ced348a58f99419a6e14f62bfd81e5d26bd9586c Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 18 Jan 2024 13:37:21 +0100 Subject: [PATCH] webdav: move ConditionalMatch to webdav.go It's not an XML element. --- elements.go | 21 --------------------- webdav.go | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/elements.go b/elements.go index f1f2d7f..70f9e9b 100644 --- a/elements.go +++ b/elements.go @@ -30,24 +30,3 @@ type groupMembership struct { XMLName xml.Name `xml:"DAV: group-membership"` Hrefs []internal.Href `xml:"href"` } - -// ConditionalMatch represents the value of a conditional header -// according to RFC 2068 section 14.25 and RFC 2068 section 14.26 -// The (optional) value can either be a wildcard or an ETag. -type ConditionalMatch string - -func (val ConditionalMatch) IsSet() bool { - return val != "" -} - -func (val ConditionalMatch) IsWildcard() bool { - return val == "*" -} - -func (val ConditionalMatch) ETag() (string, error) { - var e internal.ETag - if err := e.UnmarshalText([]byte(val)); err != nil { - return "", err - } - return string(e), nil -} diff --git a/webdav.go b/webdav.go index a3d1d77..e691ac5 100644 --- a/webdav.go +++ b/webdav.go @@ -5,6 +5,8 @@ package webdav import ( "time" + + "github.com/emersion/go-webdav/internal" ) // FileInfo holds information about a WebDAV file. @@ -25,3 +27,24 @@ type CopyOptions struct { type MoveOptions struct { NoOverwrite bool } + +// ConditionalMatch represents the value of a conditional header +// according to RFC 2068 section 14.25 and RFC 2068 section 14.26 +// The (optional) value can either be a wildcard or an ETag. +type ConditionalMatch string + +func (val ConditionalMatch) IsSet() bool { + return val != "" +} + +func (val ConditionalMatch) IsWildcard() bool { + return val == "*" +} + +func (val ConditionalMatch) ETag() (string, error) { + var e internal.ETag + if err := e.UnmarshalText([]byte(val)); err != nil { + return "", err + } + return string(e), nil +}