From 86f8378cf140ef70634d2036282b749482f41bdd Mon Sep 17 00:00:00 2001 From: Christoph Polcin Date: Tue, 27 Apr 2021 23:21:33 +0200 Subject: [PATCH] Update API description --- README.md | 55 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 2f80bb2..d5ee780 100644 --- a/README.md +++ b/README.md @@ -184,6 +184,7 @@ included. * [func (c *Client) RemoveAll(path string) error](#Client.RemoveAll) * [func (c *Client) Rename(oldpath, newpath string, overwrite bool) error](#Client.Rename) * [func (c *Client) SetHeader(key, value string)](#Client.SetHeader) + * [func (c *Client) SetInterceptor(interceptor func(method string, rq *http.Request))](#Client.SetInterceptor) * [func (c *Client) SetTimeout(timeout time.Duration)](#Client.SetTimeout) * [func (c *Client) SetTransport(transport http.RoundTripper)](#Client.SetTransport) * [func (c *Client) Stat(path string) (os.FileInfo, error)](#Client.Stat) @@ -254,7 +255,7 @@ func String(r io.Reader) string ``` String pulls a string out of our io.Reader -### type [Authenticator](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=318:437#L27) +### type [Authenticator](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=381:500#L28) ``` go type Authenticator interface { Type() string @@ -297,7 +298,7 @@ func (b *BasicAuth) User() string ``` User holds the BasicAuth username -### type [Client](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=165:294#L17) +### type [Client](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=165:357#L17) ``` go type Client struct { // contains filtered or unexported fields @@ -305,103 +306,109 @@ type Client struct { ``` Client defines our structure -#### func [NewClient](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=949:993#L60) +#### func [NewClient](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=1012:1056#L61) ``` go func NewClient(uri, user, pw string) *Client ``` NewClient creates a new instance of client -#### func (\*Client) [Connect](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=1577:1609#L80) +#### func (\*Client) [Connect](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=1836:1868#L86) ``` go func (c *Client) Connect() error ``` Connect connects to our dav server -#### func (\*Client) [Copy](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=6437:6505#L306) +#### func (\*Client) [Copy](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=6695:6763#L312) ``` go func (c *Client) Copy(oldpath, newpath string, overwrite bool) error ``` Copy copies a file from A to B -#### func (\*Client) [Mkdir](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=5528:5584#L265) +#### func (\*Client) [Mkdir](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=5786:5842#L271) ``` go func (c *Client) Mkdir(path string, _ os.FileMode) error ``` Mkdir makes a directory -#### func (\*Client) [MkdirAll](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=5763:5822#L276) +#### func (\*Client) [MkdirAll](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=6021:6080#L282) ``` go func (c *Client) MkdirAll(path string, _ os.FileMode) error ``` MkdirAll like mkdir -p, but for webdav -#### func (\*Client) [Read](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=6611:6661#L311) +#### func (\*Client) [Read](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=6869:6919#L317) ``` go func (c *Client) Read(path string) ([]byte, error) ``` Read reads the contents of a remote file -#### func (\*Client) [ReadDir](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=2603:2663#L123) +#### func (\*Client) [ReadDir](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=2862:2922#L129) ``` go func (c *Client) ReadDir(path string) ([]os.FileInfo, error) ``` ReadDir reads the contents of a remote directory -#### func (\*Client) [ReadStream](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=6972:7035#L329) +#### func (\*Client) [ReadStream](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=7230:7293#L335) ``` go func (c *Client) ReadStream(path string) (io.ReadCloser, error) ``` ReadStream reads the stream for a given path -#### func (\*Client) [Remove](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=5034:5076#L242) +#### func (\*Client) [Remove](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=5292:5334#L248) ``` go func (c *Client) Remove(path string) error ``` Remove removes a remote file -#### func (\*Client) [RemoveAll](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=5142:5187#L247) +#### func (\*Client) [RemoveAll](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=5400:5445#L253) ``` go func (c *Client) RemoveAll(path string) error ``` RemoveAll removes remote files -#### func (\*Client) [Rename](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=6271:6341#L301) +#### func (\*Client) [Rename](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=6529:6599#L307) ``` go func (c *Client) Rename(oldpath, newpath string, overwrite bool) error ``` Rename moves a file from A to B -#### func (\*Client) [SetHeader](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=1160:1205#L65) +#### func (\*Client) [SetHeader](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=1228:1273#L66) ``` go func (c *Client) SetHeader(key, value string) ``` SetHeader lets us set arbitrary headers for a given client -#### func (\*Client) [SetTimeout](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=1305:1355#L70) +#### func (\*Client) [SetInterceptor](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=1380:1462#L71) +``` go +func (c *Client) SetInterceptor(interceptor func(method string, rq *http.Request)) +``` +SetInterceptor lets us set an arbitrary interceptor for a given client + +#### func (\*Client) [SetTimeout](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=1564:1614#L76) ``` go func (c *Client) SetTimeout(timeout time.Duration) ``` SetTimeout exposes the ability to set a time limit for requests -#### func (\*Client) [SetTransport](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=1448:1506#L75) +#### func (\*Client) [SetTransport](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=1707:1765#L81) ``` go func (c *Client) SetTransport(transport http.RoundTripper) ``` SetTransport exposes the ability to define custom transports -#### func (\*Client) [Stat](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=3990:4045#L190) +#### func (\*Client) [Stat](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=4248:4303#L196) ``` go func (c *Client) Stat(path string) (os.FileInfo, error) ``` Stat returns the file stats for a specified path -#### func (\*Client) [Write](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=7326:7395#L344) +#### func (\*Client) [Write](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=7584:7653#L350) ``` go func (c *Client) Write(path string, data []byte, _ os.FileMode) error ``` Write writes data to a given path -#### func (\*Client) [WriteStream](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=7751:7831#L367) +#### func (\*Client) [WriteStream](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=8009:8089#L373) ``` go func (c *Client) WriteStream(path string, stream io.Reader, _ os.FileMode) error ``` @@ -507,7 +514,7 @@ func (f File) Sys() interface{} ``` Sys ???? -### type [NoAuth](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=481:529#L35) +### type [NoAuth](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=544:592#L36) ``` go type NoAuth struct { // contains filtered or unexported fields @@ -515,25 +522,25 @@ type NoAuth struct { ``` NoAuth structure holds our credentials -#### func (\*NoAuth) [Authorize](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=824:897#L56) +#### func (\*NoAuth) [Authorize](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=887:960#L57) ``` go func (n *NoAuth) Authorize(req *http.Request, method string, path string) ``` Authorize the current request -#### func (\*NoAuth) [Pass](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=742:772#L51) +#### func (\*NoAuth) [Pass](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=805:835#L52) ``` go func (n *NoAuth) Pass() string ``` Pass returns the current password -#### func (\*NoAuth) [Type](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=568:598#L41) +#### func (\*NoAuth) [Type](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=631:661#L42) ``` go func (n *NoAuth) Type() string ``` Type identifies the authenticator -#### func (\*NoAuth) [User](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=654:684#L46) +#### func (\*NoAuth) [User](https://github.com/studio-b12/gowebdav/blob/master/client.go?s=717:747#L47) ``` go func (n *NoAuth) User() string ```