webdav

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package webdav provides access to remote files through WebDAV.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidURL indicates that the configured WebDAV URL is unusable.
	ErrInvalidURL = errors.New("invalid webdav url")
	// ErrAuthentication indicates that the server rejected the credentials.
	ErrAuthentication = errors.New("webdav authentication failed")
	// ErrUnexpectedStatus indicates that the server did not return a WebDAV
	// Multi-Status response.
	ErrUnexpectedStatus = errors.New("unexpected webdav status")
	// ErrInvalidResponse indicates that the server returned invalid WebDAV XML.
	ErrInvalidResponse = errors.New("invalid webdav response")
)

Functions

This section is empty.

Types

type Client

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

Client lists remote WebDAV collections.

func NewClient

func NewClient(config Config) (*Client, error)

NewClient validates config and creates a WebDAV client.

func (*Client) BaseURL

func (c *Client) BaseURL() *url.URL

BaseURL returns a copy of the configured WebDAV root URL.

func (*Client) ReadDir

func (c *Client) ReadDir(ctx context.Context, directory *url.URL) ([]Entry, error)

ReadDir returns the direct children of directory. A nil directory selects the configured WebDAV root.

type Config

type Config struct {
	BaseURL        string
	Username       string
	Password       string
	HTTPClient     *http.Client
	RequestTimeout time.Duration
}

Config configures a WebDAV client.

type Entry

type Entry struct {
	Name         string
	URL          *url.URL
	IsCollection bool
	Size         int64
	ModTime      time.Time
	ETag         string
}

Entry describes a file or collection returned by a WebDAV server.

Jump to

Keyboard shortcuts

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