fix #6: added gowebdav and webdav interface (TODO: webdav tests)

This commit is contained in:
2019-07-14 01:49:50 +02:00
parent bb0b884521
commit 018fc569d3
20 changed files with 1257 additions and 2 deletions

View File

@ -9,6 +9,7 @@ type Client interface {
Shares() Shares
Users() Users
Groups() Groups
WebDav() WebDav
Login(username string, password string) error
Logout() error
}

34
types/webdav.go Normal file
View File

@ -0,0 +1,34 @@
package types
import (
"io"
"os"
)
// WebDav available methods
type WebDav interface {
// ReadDir reads the contents of a remote directory
ReadDir(path string) ([]os.FileInfo, error)
// Stat returns the file stats for a specified path
Stat(path string) (os.FileInfo, error)
// Remove removes a remote file
Remove(path string) error
// RemoveAll removes remote files
RemoveAll(path string) error
// Mkdir makes a directory
Mkdir(path string, _ os.FileMode) error
// MkdirAll like mkdir -p, but for webdav
MkdirAll(path string, _ os.FileMode) error
// Rename moves a file from A to B
Rename(oldpath, newpath string, overwrite bool) error
// Copy copies a file from A to B
Copy(oldpath, newpath string, overwrite bool) error
// Read reads the contents of a remote file
Read(path string) ([]byte, error)
// ReadStream reads the stream for a given path
ReadStream(path string) (io.ReadCloser, error)
// Write writes data to a given path
Write(path string, data []byte, _ os.FileMode) error
// WriteStream writes a stream
WriteStream(path string, stream io.Reader, _ os.FileMode) error
}