Help us shape the future of Go! Take the 2026 Go Developer Survey

webdavclnt

package module
v0.0.0-...-560f5fa Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2020 License: MIT Imports: 9 Imported by: 0

README

Draft version. Only for tests.

Basic Usage

Получения значение свойств creationdate и getlastmodified

client := webdavclnt.
		NewClient("connectionString").
		SetLogin("login").
		SetPassword("passw")

propsmap, err := client.PropFind("/webdav/test.txt", "creationdate", "getlastmodified")
if err != nil {
	panic(err)
}

fmt.Printf("%#v\n", propsmap)

Documentation

Overview

Package webdavclnt contains WebDav Http Client.

Author: Yuri Y. Karamani <y.karamani@gmail.com>

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Multistatus

type Multistatus struct {
	Responses []Response `xml:"response"`
}

Multistatus contains PROPFIND response.

type Prop

type Prop struct {
	PropList []PropValue `xml:",any"`
}

Prop contains list of property values.

type PropValue

type PropValue struct {
	XMLName xml.Name `xml:""`
	Value   string   `xml:",chardata"`
}

PropValue contatins properties xml-data.

type Properties

type Properties map[string]string

Properties contains data of WebDAV properties.

type Propstat

type Propstat struct {
	Prop *Prop `xml:"prop"`
}

Propstat contains properties struct.

type Response

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

Response contains part of PROPFIND response.

type WebDavClient

type WebDavClient struct {
	Host      string
	Port      int
	Login     string
	Password  string
	DefFolder string
}

WebDavClient contains WebDAV initialization data.

func NewClient

func NewClient(host string) *WebDavClient

NewClient creates a pointer to an instance of WebDavClient.

func (*WebDavClient) AllPropFind

func (clnt *WebDavClient) AllPropFind(uri string) (map[string]Properties, error)

AllPropFind gets all properties of file at the specified uri.

func (*WebDavClient) Copy

func (clnt *WebDavClient) Copy(uri, destURI string) error

Copy copies a file from uri to destURI.

func (*WebDavClient) Delete

func (clnt *WebDavClient) Delete(uri string) error

Delete removes a file from WebDav storage to the specified uri.

func (*WebDavClient) Exists

func (clnt *WebDavClient) Exists(uri string) (bool, error)

Exists checks if the file or collection exists.

func (*WebDavClient) Get

func (clnt *WebDavClient) Get(uri string) ([]byte, error)

Get gets a file from uri.

func (*WebDavClient) MkCol

func (clnt *WebDavClient) MkCol(uri string) error

MkCol makes new directory (collection).

func (*WebDavClient) Move

func (clnt *WebDavClient) Move(uri, destURI string) error

Move moves a file from uri to destURI.

func (*WebDavClient) PropFind

func (clnt *WebDavClient) PropFind(uri string, props ...string) (map[string]Properties, error)

PropFind gets specific properties of file at the specified uri.

func (*WebDavClient) PropNameFind

func (clnt *WebDavClient) PropNameFind(uri string) (map[string][]string, error)

PropNameFind gets properties names of file at the specified uri.

func (*WebDavClient) Put

func (clnt *WebDavClient) Put(uri string, data io.Reader) error

Put uploads a file into WebDav storage to the specified uri.

func (*WebDavClient) SetDefFolder

func (clnt *WebDavClient) SetDefFolder(defFolder string) *WebDavClient

SetDefFolder sets the value of a field DefFolder, returns a poiner to an instance WebDavClient.

func (*WebDavClient) SetLogin

func (clnt *WebDavClient) SetLogin(login string) *WebDavClient

SetLogin sets the value of a field Login, returns a poiner to an instance WebDavClient.

func (*WebDavClient) SetPassword

func (clnt *WebDavClient) SetPassword(password string) *WebDavClient

SetPassword sets the value of a field Password, returns a poiner to an instance WebDavClient.

func (*WebDavClient) SetPort

func (clnt *WebDavClient) SetPort(port int) *WebDavClient

SetPort sets the value of a field Port, returns a poiner to an instance WebDavClient.

Jump to

Keyboard shortcuts

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