webdav

package
v0.52.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 19, 2026 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFailedToCreateDirectory = errors.New("webdav: failed to create directory")
	ErrFailedToWriteFile       = errors.New("webdav: failed to write file")
	ErrFailedToCheckFileExists = errors.New("webdav: failed to check if file exists")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	BaseURL  string
	Username string
	Password string
	// contains filtered or unexported fields
}

func NewClient added in v0.15.0

func NewClient(baseURL, username, password string, httpClient *http.Client) *Client

func (*Client) Exists added in v0.19.2

func (c *Client) Exists(ctx context.Context, remotePath string) (bool, error)

func (*Client) ListDir added in v0.52.0

func (c *Client) ListDir(ctx context.Context, dirPath string) ([]Response, error)

ListDir lists files and directories in the given path

func (*Client) MkDir added in v0.15.0

func (c *Client) MkDir(ctx context.Context, dirPath string) error

func (*Client) ReadFile added in v0.52.0

func (c *Client) ReadFile(ctx context.Context, filePath string) (io.ReadCloser, int64, error)

ReadFile downloads a file and returns a ReadCloser

func (*Client) WriteFile added in v0.15.0

func (c *Client) WriteFile(ctx context.Context, remotePath string, content io.Reader) error

type Multistatus added in v0.52.0

type Multistatus struct {
	XMLName   xml.Name   `xml:"multistatus"`
	Responses []Response `xml:"response"`
}

WebDAV XML structures for PROPFIND response

type Prop added in v0.52.0

type Prop struct {
	ResourceType     ResourceType `xml:"resourcetype"`
	GetContentLength int64        `xml:"getcontentlength"`
	GetLastModified  string       `xml:"getlastmodified"`
	DisplayName      string       `xml:"displayname"`
}

type Propstat added in v0.52.0

type Propstat struct {
	Prop   Prop   `xml:"prop"`
	Status string `xml:"status"`
}

type ResourceType added in v0.52.0

type ResourceType struct {
	Collection *struct{} `xml:"collection"`
}

func (ResourceType) IsCollection added in v0.52.0

func (rt ResourceType) IsCollection() bool

type Response added in v0.52.0

type Response struct {
	Href     string   `xml:"href"`
	Propstat Propstat `xml:"propstat"`
}

type Webdav

type Webdav struct {
	// contains filtered or unexported fields
}

func (*Webdav) Exists added in v0.23.0

func (w *Webdav) Exists(ctx context.Context, storagePath string) bool

func (*Webdav) Init

func (w *Webdav) Init(ctx context.Context, cfg config.StorageConfig) error

func (*Webdav) JoinStoragePath added in v0.11.0

func (w *Webdav) JoinStoragePath(p string) string

func (*Webdav) ListFiles added in v0.52.0

func (w *Webdav) ListFiles(ctx context.Context, dirPath string) ([]storagetypes.FileInfo, error)

ListFiles implements storage.StorageListable

func (*Webdav) Name added in v0.11.0

func (w *Webdav) Name() string

func (*Webdav) OpenFile added in v0.52.0

func (w *Webdav) OpenFile(ctx context.Context, filePath string) (io.ReadCloser, int64, error)

OpenFile implements storage.StorageReadable

func (*Webdav) Save

func (w *Webdav) Save(ctx context.Context, r io.Reader, storagePath string) error

func (*Webdav) Type added in v0.11.0

func (w *Webdav) Type() storenum.StorageType

type WebdavMethod added in v0.20.2

type WebdavMethod string
const (
	WebdavMethodMkcol    WebdavMethod = "MKCOL"
	WebdavMethodPropfind WebdavMethod = "PROPFIND"
	WebdavMethodPut      WebdavMethod = "PUT"
	WebdavMethodGet      WebdavMethod = "GET"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL