Document every exported symbol and how callers use the library.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -14,6 +14,8 @@ import (
|
||||
)
|
||||
|
||||
// WebDAVRoot is a User Files Root at /remote.php/dav/files/{user}/.
|
||||
// Cred supplies the user id and AppAPI auth headers.
|
||||
// A nil Client uses http.DefaultClient.
|
||||
type WebDAVRoot struct {
|
||||
Cred gonexapp.Credentials
|
||||
Client *http.Client
|
||||
@@ -48,6 +50,10 @@ func (r WebDAVRoot) urlFor(rel string) (string, error) {
|
||||
}
|
||||
|
||||
// OpenFolder opens an existing folder via WebDAV PROPFIND.
|
||||
// It does not create the folder.
|
||||
// It returns an error wrapping ErrNotExist when the server responds 404,
|
||||
// ErrForbidden on 401 or 403, and ErrNotDir when the resource is not a collection.
|
||||
// An invalid rel returns a plain error and does not call the server.
|
||||
func (r WebDAVRoot) OpenFolder(rel string) (Folder, error) {
|
||||
clean := CleanRel(rel)
|
||||
if clean == "" {
|
||||
@@ -63,7 +69,9 @@ func (r WebDAVRoot) OpenFolder(rel string) (Folder, error) {
|
||||
return webdavFolder{root: r, rel: clean}, nil
|
||||
}
|
||||
|
||||
// EnsureFolder creates the folder (and parents) with MKCOL, then opens it.
|
||||
// EnsureFolder creates the folder and missing parents with MKCOL, then opens it.
|
||||
// It returns an error wrapping ErrForbidden on 401 or 403, or a plain error
|
||||
// when rel is invalid or MKCOL fails for another status.
|
||||
func (r WebDAVRoot) EnsureFolder(rel string) (Folder, error) {
|
||||
clean := CleanRel(rel)
|
||||
if clean == "" {
|
||||
|
||||
Reference in New Issue
Block a user