webdav

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a WebDAV HTTP client for file-level operations.

func MakeClient

func MakeClient(cfg *Config) *Client

MakeClient creates a WebDAV client from the given configuration.

func (*Client) Delete

func (client *Client) Delete(fileURL string) (err error)

Delete removes the resource at the given URL.

func (*Client) Get

func (client *Client) Get(fileURL string) (content []byte, etag string, err error)

Get retrieves the content of a file at the given URL.

func (*Client) List

func (client *Client) List(collectionURL string) (resources []Resource, err error)

List performs a PROPFIND on the given collection URL and returns the contained resources.

func (*Client) Mkcol

func (client *Client) Mkcol(collectionURL string) (err error)

Mkcol creates a new collection (directory) at the given URL.

func (*Client) Put

func (client *Client) Put(fileURL string, content []byte, etag string, contentType string) (err error)

Put creates or updates a file at the given URL. If etag is non-empty, the request uses If-Match for conditional update. The contentType parameter sets the Content-Type header; if empty, defaults to "application/octet-stream".

type Config

type Config struct {
	URL      string
	Username string
	Password string
}

Config holds WebDAV connection parameters.

type Resource

type Resource struct {
	Href        string
	DisplayName string
	ContentType string
	ETag        string
	Size        int64
	IsDir       bool
}

Resource represents a file or collection returned by PROPFIND.

Source Files

  • main.go

Jump to

Keyboard shortcuts

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