go-webdav/webdav.go

51 lines
1017 B
Go
Raw Normal View History

2020-01-21 20:01:18 +00:00
// Package webdav provides a client and server WebDAV filesystem implementation.
//
// WebDAV is defined in RFC 4918.
package webdav
import (
"time"
"github.com/emersion/go-webdav/internal"
)
2024-01-08 13:35:19 +00:00
// FileInfo holds information about a WebDAV file.
type FileInfo struct {
Path string
2020-01-21 21:43:13 +00:00
Size int64
ModTime time.Time
IsDir bool
MIMEType string
ETag string
}
2023-12-15 14:16:01 +00:00
type CopyOptions struct {
NoRecursive bool
NoOverwrite bool
}
2024-01-18 12:25:14 +00:00
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
}