### Get file information Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0 Fetches FileInfo for a single file. ```go func (c *Client) Stat(ctx context.Context, name string) (*FileInfo, error) ``` -------------------------------- ### Client SyncCollection Method Signature Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0/internal Performs a `sync-collection` REPORT operation on a resource to get changes. ```go func (c *Client) SyncCollection(ctx context.Context, path, syncToken string, level Depth, limit *Limit, prop *Prop) (*MultiStatus, error) ``` -------------------------------- ### Calendar Expansion Request Structure Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0/caldav Specifies the start and end times for expanding calendar events. ```go type CalendarExpandRequest struct { Start, End time.Time } ``` -------------------------------- ### Prop Get Method Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0/internal Retrieves a specific property by its XML name from a Prop struct. ```go func (p *Prop) Get(name xml.Name) *RawXMLValue ``` -------------------------------- ### Create a new directory Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0 Creates a new directory on the WebDAV server. ```go func (c *Client) Mkdir(ctx context.Context, name string) error ``` -------------------------------- ### Client.Mkdir Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0 Creates a new directory. ```APIDOC ## Client.Mkdir ### Description Creates a new directory on the WebDAV server. ### Method Signature ```go func (c *Client) Mkdir(ctx context.Context, name string) error ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **name** (string) - Required - The name of the directory to create. ### Request Example None ### Response #### Success Response (200) Returns an error if the directory creation fails. ### Response Example None ``` -------------------------------- ### LocalFileSystem.Mkdir Source: https://pkg.go.dev/github.com/emersion/go-webdav Creates a new directory at the specified name. It returns an error if the operation failed. ```APIDOC ## LocalFileSystem.Mkdir ### Description Creates a new directory at the specified name. It returns an error if the operation failed. ### Method Mkdir ### Parameters #### Path Parameters - **ctx** (context.Context) - Required - The context for the operation. - **name** (string) - Required - The name of the directory to create. ### Response #### Success Response - **err** (error) - An error if the operation failed. ``` -------------------------------- ### Create an HTTP client with basic authentication Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0 Returns an HTTP client that adds basic authentication to all outgoing requests. If c is nil, http.DefaultClient is used. ```go func HTTPClientWithBasicAuth(c HTTPClient, username, password string) HTTPClient ``` -------------------------------- ### Client.Options Source: https://pkg.go.dev/github.com/emersion/go-webdav/internal Performs an OPTIONS request to discover server capabilities. ```APIDOC ## Client.Options ### Description Performs an OPTIONS request to discover server capabilities. ### Signature ```go func (c *Client) Options(ctx context.Context, path string) (classes map[string]bool, methods map[string]bool, err error) ``` ``` -------------------------------- ### Create CalDAV Backend Supplied HomeSet Source: https://pkg.go.dev/github.com/emersion/go-webdav/caldav Factory function to create a new CalDAV BackendSuppliedHomeSet with the given path. ```go func NewCalendarHomeSet(path string) webdav.BackendSuppliedHomeSet ``` -------------------------------- ### Create BackendSuppliedHomeSet Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0/carddav Creates a new instance of webdav.BackendSuppliedHomeSet for an address book home set. ```go func NewAddressBookHomeSet(path string) webdav.BackendSuppliedHomeSet ``` -------------------------------- ### Client.Create Source: https://pkg.go.dev/github.com/emersion/go-webdav Creates a new file and returns a writer for its contents. ```APIDOC ## func (*Client) Create ### Description Creates a file's contents. ### Signature ```go func (c *Client) Create(ctx context.Context, name string) (io.WriteCloser, error) ``` ``` -------------------------------- ### Client.Mkdir Source: https://pkg.go.dev/github.com/emersion/go-webdav Creates a new directory at the specified path. ```APIDOC ## func (*Client) Mkdir ### Description Creates a new directory. ### Signature ```go func (c *Client) Mkdir(ctx context.Context, name string) error ``` ``` -------------------------------- ### Open and read a file Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0 Fetches a file's contents, returning a ReadCloser. ```go func (c *Client) Open(ctx context.Context, name string) (io.ReadCloser, error) ``` -------------------------------- ### NewPropFindResponse Function Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0/internal Constructs a WebDAV PROPFIND response, processing requested properties using provided PropFindFuncs. ```go func NewPropFindResponse(path string, propfind *PropFind, props map[xml.Name]PropFindFunc) (*Response, error) ``` -------------------------------- ### Create a new file Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0 Creates a new file, returning a WriteCloser to write its contents. ```go func (c *Client) Create(ctx context.Context, name string) (io.WriteCloser, error) ``` -------------------------------- ### NewClient Function Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0/caldav Creates a new CalDAV client instance. ```go func NewClient(c webdav.HTTPClient, endpoint string) (*Client, error) ``` -------------------------------- ### Create a new WebDAV client Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0 Creates a new WebDAV client. If the HTTPClient is nil, http.DefaultClient is used. To use HTTP basic authentication, HTTPClientWithBasicAuth can be used. ```go func NewClient(c HTTPClient, endpoint string) (*Client, error) ``` -------------------------------- ### Client.Open Source: https://pkg.go.dev/github.com/emersion/go-webdav Fetches the contents of a file and returns a reader. ```APIDOC ## func (*Client) Open ### Description Fetches a file's contents. ### Signature ```go func (c *Client) Open(ctx context.Context, name string) (io.ReadCloser, error) ``` ``` -------------------------------- ### CreateOptions struct definition Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0 Options for the Create operation, including conditional headers. ```go type CreateOptions struct { IfMatch ConditionalMatch IfNoneMatch ConditionalMatch } ``` -------------------------------- ### Client.Open Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0 Fetches a file's contents. ```APIDOC ## Client.Open ### Description Opens a file for reading its contents. ### Method Signature ```go func (c *Client) Open(ctx context.Context, name string) (io.ReadCloser, error) ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **name** (string) - Required - The name of the file to open. ### Request Example None ### Response #### Success Response - **io.ReadCloser** (io.ReadCloser) - A reader to read the file's content from. - **error** (error) - An error if the file cannot be opened. ### Response Example None ``` -------------------------------- ### Create Method Signature Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0 Signature for the Create method of LocalFileSystem. Used for creating new files. ```go func (fs LocalFileSystem) Create(ctx context.Context, name string, body io.ReadCloser, opts *CreateOptions) (fi *FileInfo, created bool, err error) ``` -------------------------------- ### FileSystem interface definition Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0 Defines the interface for a WebDAV server backend. ```go type FileSystem interface { Open(ctx context.Context, name string) (io.ReadCloser, error) Stat(ctx context.Context, name string) (*FileInfo, error) ReadDir(ctx context.Context, name string, recursive bool) ([]FileInfo, error) Create(ctx context.Context, name string, body io.ReadCloser, opts *CreateOptions) (fileInfo *FileInfo, created bool, err error) RemoveAll(ctx context.Context, name string, opts *RemoveAllOptions) error Mkdir(ctx context.Context, name string) error Copy(ctx context.Context, name, dest string, options *CopyOptions) (created bool, err error) Move(ctx context.Context, name, dest string, options *MoveOptions) (created bool, err error) } ``` -------------------------------- ### Client.NewClient Source: https://pkg.go.dev/github.com/emersion/go-webdav/internal Creates a new WebDAV client. ```APIDOC ## NewClient ### Description Creates a new WebDAV client. ### Signature ```go func NewClient(c HTTPClient, endpoint string) (*Client, error) ``` ``` -------------------------------- ### LocalFileSystem.Create Source: https://pkg.go.dev/github.com/emersion/go-webdav Creates a new file at the specified name with the given content from the body. It returns file information, a boolean indicating if the file was created, and an error if the operation failed. ```APIDOC ## LocalFileSystem.Create ### Description Creates a new file at the specified name with the given content from the body. It returns file information, a boolean indicating if the file was created, and an error if the operation failed. ### Method Create ### Parameters #### Path Parameters - **ctx** (context.Context) - Required - The context for the operation. - **name** (string) - Required - The name of the file to create. - **body** (io.ReadCloser) - Required - The content of the file. - **opts** (*CreateOptions) - Optional - Options for the create operation. ### Response #### Success Response - **fi** (*FileInfo) - Information about the created file. - **created** (bool) - Indicates if the file was created. - **err** (error) - An error if the operation failed. ``` -------------------------------- ### LocalFileSystem.Open Source: https://pkg.go.dev/github.com/emersion/go-webdav Opens a file at the specified name for reading. It returns a ReadCloser for the file content and an error if the operation failed. ```APIDOC ## LocalFileSystem.Open ### Description Opens a file at the specified name for reading. It returns a ReadCloser for the file content and an error if the operation failed. ### Method Open ### Parameters #### Path Parameters - **ctx** (context.Context) - Required - The context for the operation. - **name** (string) - Required - The name of the file to open. ### Response #### Success Response - **ReadCloser** (io.ReadCloser) - A ReadCloser for the file content. - **err** (error) - An error if the operation failed. ``` -------------------------------- ### ServeHTTP Method Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0/caldav Implements the http.Handler interface for the CalDAV handler. ```go func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) ``` -------------------------------- ### Client.Create Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0 Writes a file's contents. ```APIDOC ## Client.Create ### Description Creates a new file and returns a writer for its contents. ### Method Signature ```go func (c *Client) Create(ctx context.Context, name string) (io.WriteCloser, error) ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **name** (string) - Required - The name of the file to create. ### Request Example None ### Response #### Success Response - **io.WriteCloser** (io.WriteCloser) - A writer to write the file's content to. - **error** (error) - An error if the file creation fails. ### Response Example None ``` -------------------------------- ### Client.Do Source: https://pkg.go.dev/github.com/emersion/go-webdav/internal Executes an HTTP request using the WebDAV client. ```APIDOC ## Client.Do ### Description Executes an HTTP request using the WebDAV client. ### Signature ```go func (c *Client) Do(req *http.Request) (*http.Response, error) ``` ``` -------------------------------- ### Handler.ServeHTTP Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0 Implements http.Handler. ```APIDOC ## Handler.ServeHTTP ### Description Handles incoming HTTP requests for the WebDAV server. ### Method Signature ```go func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **w** (http.ResponseWriter) - Required - The response writer. - **r** (http.Request) - Required - The incoming HTTP request. ### Request Example None ### Response #### Success Response (200) Handles the HTTP request and writes the response. ### Response Example None ``` -------------------------------- ### ServePrincipalOptions Struct Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0 Holds options for the ServePrincipal function, including user principal path and home set configurations. ```go type ServePrincipalOptions struct { CurrentUserPrincipalPath string HomeSets []BackendSuppliedHomeSet Capabilities []Capability } ``` -------------------------------- ### Mkdir Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0 Creates a new directory with the specified name. It returns an error if the operation failed. ```APIDOC ## Mkdir ### Description Creates a new directory with the specified name. It returns an error if the operation failed. ### Method Mkdir ### Signature func (fs LocalFileSystem) Mkdir(ctx context.Context, name string) error ### Parameters - **ctx** (context.Context) - The context for the operation. - **name** (string) - The name of the directory to create. ### Returns - **err** (error) - An error if the operation failed. ``` -------------------------------- ### Client PropFind Method Signature Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0/internal Method signature for performing a PROPFIND request to retrieve properties of a WebDAV resource. ```go func (c *Client) PropFind(ctx context.Context, path string, depth Depth, propfind *PropFind) (*MultiStatus, error) ``` -------------------------------- ### Open Method Signature Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0 Signature for the Open method of LocalFileSystem. Used for opening files for reading. ```go func (fs LocalFileSystem) Open(ctx context.Context, name string) (io.ReadCloser, error) ``` -------------------------------- ### NewClient Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0/caldav Creates a new CalDAV client instance. ```APIDOC ## NewClient ### Description Creates a new CalDAV client instance. ### Signature ```go func NewClient(c webdav.HTTPClient, endpoint string) (*Client, error) ``` ``` -------------------------------- ### LocalFileSystem Source: https://pkg.go.dev/github.com/emersion/go-webdav LocalFileSystem implements the FileSystem interface for the local filesystem. ```APIDOC ## LocalFileSystem ### Description LocalFileSystem implements the FileSystem interface for the local filesystem. ### Methods * **Copy(ctx context.Context, src, dst string, options *CopyOptions) (created bool, err error)**: Copies a file or directory. * **Create(ctx context.Context, name string, body io.ReadCloser, opts *CreateOptions) (fi *FileInfo, created bool, err error)**: Creates a new file. * **Mkdir(ctx context.Context, name string) error**: Creates a new directory. * **Move(ctx context.Context, src, dst string, options *MoveOptions) (created bool, err error)**: Moves a file or directory. * **Open(ctx context.Context, name string) (io.ReadCloser, error)**: Opens a file for reading. * **ReadDir(ctx context.Context, name string, recursive bool) ([]FileInfo, error)**: Reads the contents of a directory. * **RemoveAll(ctx context.Context, name string, opts *RemoveAllOptions) error**: Removes a file or directory and its contents. * **Stat(ctx context.Context, name string) (*FileInfo, error)**: Returns file information for a given path. ``` -------------------------------- ### Client PropFindFlat Method Signature Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0/internal Performs a PROPFIND request with a zero depth to retrieve properties of a single resource. ```go func (c *Client) PropFindFlat(ctx context.Context, path string, propfind *PropFind) (*Response, error) ``` -------------------------------- ### Create Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0 Creates a new file at the specified name with the provided body. It returns file information, a boolean indicating if the file was created, and an error if the operation failed. ```APIDOC ## Create ### Description Creates a new file at the specified name with the provided body. It returns file information, a boolean indicating if the file was created, and an error if the operation failed. ### Method Create ### Signature func (fs LocalFileSystem) Create(ctx context.Context, name string, body io.ReadCloser, opts *CreateOptions) (fi *FileInfo, created bool, err error) ### Parameters - **ctx** (context.Context) - The context for the operation. - **name** (string) - The name of the file to create. - **body** (io.ReadCloser) - The content of the file. - **opts** (*CreateOptions) - Optional settings for the create operation. ### Returns - **fi** (*FileInfo) - Information about the created file. - **created** (bool) - True if the file was created, false otherwise. - **err** (error) - An error if the operation failed. ``` -------------------------------- ### Client.PropFind Source: https://pkg.go.dev/github.com/emersion/go-webdav/internal Performs a PROPFIND request to retrieve properties of a resource. ```APIDOC ## Client.PropFind ### Description Performs a PROPFIND request to retrieve properties of a resource. ### Signature ```go func (c *Client) PropFind(ctx context.Context, path string, depth Depth, propfind *PropFind) (*MultiStatus, error) ``` ``` -------------------------------- ### NewClient Source: https://pkg.go.dev/github.com/emersion/go-webdav Creates a new WebDAV client. If the provided HTTP client is nil, the default HTTP client is used. Basic authentication can be configured using HTTPClientWithBasicAuth. ```APIDOC ## func NewClient ### Description Creates a new WebDAV client. If the HTTPClient is nil, http.DefaultClient is used. To use HTTP basic authentication, HTTPClientWithBasicAuth can be used. ### Signature ```go func NewClient(c HTTPClient, endpoint string) (*Client, error) ``` ``` -------------------------------- ### Read directory contents Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0 Lists files in a directory, with an option for recursive listing. ```go func (c *Client) ReadDir(ctx context.Context, name string, recursive bool) ([]FileInfo, error) ``` -------------------------------- ### Client.ReadDir Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0 Lists files in a directory. ```APIDOC ## Client.ReadDir ### Description Lists the files and directories within a specified directory. ### Method Signature ```go func (c *Client) ReadDir(ctx context.Context, name string, recursive bool) ([]FileInfo, error) ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **name** (string) - Required - The name of the directory to list. - **recursive** (bool) - Required - Whether to list recursively. ### Request Example None ### Response #### Success Response - **[]FileInfo** ([]FileInfo) - A slice of FileInfo structs representing the contents of the directory. - **error** (error) - An error if the directory listing fails. ### Response Example None ``` -------------------------------- ### Client.PropFindFlat Source: https://pkg.go.dev/github.com/emersion/go-webdav/internal Performs a PROPFIND request with zero depth. ```APIDOC ## Client.PropFindFlat ### Description Performs a PROPFIND request with a zero depth. ### Signature ```go func (c *Client) PropFindFlat(ctx context.Context, path string, propfind *PropFind) (*Response, error) ``` ``` -------------------------------- ### Mkdir Method Signature Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0 Signature for the Mkdir method of LocalFileSystem. Used for creating new directories. ```go func (fs LocalFileSystem) Mkdir(ctx context.Context, name string) error ``` -------------------------------- ### LocalFileSystem Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0 Implements the FileSystem interface for a local filesystem. Provides methods for performing WebDAV operations on local files and directories. ```APIDOC ## LocalFileSystem ### Description LocalFileSystem implements the FileSystem interface for a local filesystem. ### Methods * **Copy(ctx context.Context, src, dst string, options *CopyOptions) (created bool, err error)**: Copies a file or directory. * **Create(ctx context.Context, name string, body io.ReadCloser, opts *CreateOptions) (fi *FileInfo, created bool, err error)**: Creates a new file. * **Mkdir(ctx context.Context, name string) error**: Creates a new directory. * **Move(ctx context.Context, src, dst string, options *MoveOptions) (created bool, err error)**: Moves a file or directory. * **Open(ctx context.Context, name string) (io.ReadCloser, error)**: Opens a file for reading. * **ReadDir(ctx context.Context, name string, recursive bool) ([]FileInfo, error)**: Reads the contents of a directory. * **RemoveAll(ctx context.Context, name string, opts *RemoveAllOptions) error**: Removes a file or directory and its contents. * **Stat(ctx context.Context, name string) (*FileInfo, error)**: Gets file information. ``` -------------------------------- ### NewClient Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0 Creates a new WebDAV client. If the HTTPClient is nil, http.DefaultClient is used. To use HTTP basic authentication, HTTPClientWithBasicAuth can be used. ```APIDOC ## NewClient ### Description Creates a new WebDAV client. ### Function Signature ```go func NewClient(c HTTPClient, endpoint string) (*Client, error) ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response - **Client** (*Client) - A pointer to the newly created WebDAV client. - **error** (error) - An error if the client creation fails. ### Response Example None ``` -------------------------------- ### Backend Interface Definition Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0/internal Defines the interface for WebDAV backends, outlining required methods for storage operations. ```go type Backend interface { Options(r *http.Request) (caps []string, allow []string, err error) HeadGet(w http.ResponseWriter, r *http.Request) error PropFind(r *http.Request, pf *PropFind, depth Depth) (*MultiStatus, error) PropPatch(r *http.Request, pu *PropertyUpdate) (*Response, error) Put(w http.ResponseWriter, r *http.Request) error Delete(r *http.Request) error Mkcol(r *http.Request) error Copy(r *http.Request, dest *Href, recursive, overwrite bool) (created bool, err error) Move(r *http.Request, dest *Href, overwrite bool) (created bool, err error) } ``` -------------------------------- ### HTTPClientWithBasicAuth Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0 Creates an HTTP client that uses basic authentication. This is a helper function for configuring the client with credentials. ```APIDOC ## HTTPClientWithBasicAuth ### Description HTTPClientWithBasicAuth returns an HTTPClient that uses basic authentication with the given username and password. ### Function Signature ```go func HTTPClientWithBasicAuth(c HTTPClient, username, password string) HTTPClient ``` ``` -------------------------------- ### Client.DoMultiStatus Source: https://pkg.go.dev/github.com/emersion/go-webdav/internal Executes an HTTP request and expects a MultiStatus response. ```APIDOC ## Client.DoMultiStatus ### Description Executes an HTTP request and expects a MultiStatus response. ### Signature ```go func (c *Client) DoMultiStatus(req *http.Request) (*MultiStatus, error) ``` ``` -------------------------------- ### Client Methods Source: https://pkg.go.dev/github.com/emersion/go-webdav/internal Provides methods for interacting with a WebDAV server, including creating requests, performing operations like PropFind and SyncCollection, and handling responses. ```APIDOC ## func NewClient(c HTTPClient, endpoint string) (*Client, error) ### Description Creates a new WebDAV client. ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - None ### Request Example ```json { "example": "Not applicable for constructor" } ``` ### Response #### Success Response (200) - **Client** (*Client) - A pointer to the newly created Client. - **error** (error) - An error if the client creation fails. #### Response Example ```json { "example": "Not applicable for constructor" } ``` ``` ```APIDOC ## func (c *Client) Do(req *http.Request) (*http.Response, error) ### Description Executes an HTTP request using the client. ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - **req** (*http.Request) - The HTTP request to execute. ### Request Example ```json { "example": "Not applicable for direct method call, use http.NewRequest" } ``` ### Response #### Success Response (200) - **Response** (*http.Response) - The HTTP response from the server. - **error** (error) - An error if the request fails. #### Response Example ```json { "example": "http.Response object" } ``` ``` ```APIDOC ## func (c *Client) DoMultiStatus(req *http.Request) (*MultiStatus, error) ### Description Executes an HTTP request and parses the response as a WebDAV Multi-Status. ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - **req** (*http.Request) - The HTTP request to execute. ### Request Example ```json { "example": "Not applicable for direct method call, use http.NewRequest" } ``` ### Response #### Success Response (200) - **MultiStatus** (*MultiStatus) - The parsed Multi-Status response. - **error** (error) - An error if the request or parsing fails. #### Response Example ```json { "example": "MultiStatus object" } ``` ``` ```APIDOC ## func (c *Client) NewRequest(method string, path string, body io.Reader) (*http.Request, error) ### Description Creates a new HTTP request for the WebDAV client. ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - **method** (string) - The HTTP method (e.g., "GET", "PROPFIND"). - **path** (string) - The path to the resource. - **body** (io.Reader) - An optional request body. ### Request Example ```json { "example": "Not applicable for direct method call" } ``` ### Response #### Success Response (200) - **Request** (*http.Request) - The created HTTP request. - **error** (error) - An error if the request creation fails. #### Response Example ```json { "example": "http.Request object" } ``` ``` ```APIDOC ## func (c *Client) NewXMLRequest(method string, path string, v interface{}) (*http.Request, error) ### Description Creates a new HTTP request with an XML request body, marshaling the provided value. ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - **method** (string) - The HTTP method (e.g., "PROPFIND"). - **path** (string) - The path to the resource. - **v** (interface{}) - The value to marshal into the XML request body. ### Request Example ```json { "example": "Not applicable for direct method call" } ``` ### Response #### Success Response (200) - **Request** (*http.Request) - The created HTTP request. - **error** (error) - An error if the request creation or marshaling fails. #### Response Example ```json { "example": "http.Request object" } ``` ``` ```APIDOC ## func (c *Client) Options(ctx context.Context, path string) (classes map[string]bool, methods map[string]bool, err error) ### Description Performs an HTTP OPTIONS request to discover server capabilities. ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - **ctx** (context.Context) - The request context. - **path** (string) - The path to the resource. ### Request Example ```json { "example": "Not applicable for direct method call" } ``` ### Response #### Success Response (200) - **classes** (map[string]bool) - A map of supported classes. - **methods** (map[string]bool) - A map of supported HTTP methods. - **err** (error) - An error if the request fails. #### Response Example ```json { "example": "map[string]bool{"get": true}, map[string]bool{"OPTIONS": true}, nil" } ``` ``` ```APIDOC ## func (c *Client) PropFind(ctx context.Context, path string, depth Depth, propfind *PropFind) (*MultiStatus, error) ### Description Performs a PROPFIND request to retrieve properties of a resource. ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - **ctx** (context.Context) - The request context. - **path** (string) - The path to the resource. - **depth** (Depth) - The depth of the PROPFIND request. - **propfind** (*PropFind) - The properties to retrieve. ### Request Example ```json { "example": "Not applicable for direct method call" } ``` ### Response #### Success Response (200) - **MultiStatus** (*MultiStatus) - The Multi-Status response containing properties. - **error** (error) - An error if the request fails. #### Response Example ```json { "example": "MultiStatus object" } ``` ``` ```APIDOC ## func (c *Client) PropFindFlat(ctx context.Context, path string, propfind *PropFind) (*Response, error) ### Description Performs a PROPFIND request and returns a single response, suitable for non-collection resources. ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - **ctx** (context.Context) - The request context. - **path** (string) - The path to the resource. - **propfind** (*PropFind) - The properties to retrieve. ### Request Example ```json { "example": "Not applicable for direct method call" } ``` ### Response #### Success Response (200) - **Response** (*Response) - The response containing properties. - **error** (error) - An error if the request fails. #### Response Example ```json { "example": "Response object" } ``` ``` ```APIDOC ## func (c *Client) ResolveHref(p string) *url.URL ### Description Resolves a given Href string into a URL. ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - **p** (string) - The Href string to resolve. ### Request Example ```json { "example": "Not applicable for direct method call" } ``` ### Response #### Success Response (200) - **URL** (*url.URL) - The resolved URL. #### Response Example ```json { "example": "url.URL object" } ``` ``` ```APIDOC ## func (c *Client) SyncCollection(ctx context.Context, path, syncToken string, level Depth, limit *Limit, ...) (*MultiStatus, error) ### Description Performs a SYNC-COLLECTION request to synchronize changes in a collection. ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - **ctx** (context.Context) - The request context. - **path** (string) - The path to the collection. - **syncToken** (string) - The synchronization token. - **level** (Depth) - The depth of the synchronization. - **limit** (*Limit) - An optional limit for the synchronization. ### Request Example ```json { "example": "Not applicable for direct method call" } ``` ### Response #### Success Response (200) - **MultiStatus** (*MultiStatus) - The Multi-Status response containing synchronization information. - **error** (error) - An error if the request fails. #### Response Example ```json { "example": "MultiStatus object" } ``` ``` -------------------------------- ### Open Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0 Opens a file at the specified name for reading. It returns a ReadCloser for the file content and an error if the operation failed. ```APIDOC ## Open ### Description Opens a file at the specified name for reading. It returns a ReadCloser for the file content and an error if the operation failed. ### Method Open ### Signature func (fs LocalFileSystem) Open(ctx context.Context, name string) (io.ReadCloser, error) ### Parameters - **ctx** (context.Context) - The context for the operation. - **name** (string) - The name of the file to open. ### Returns - **io.ReadCloser** - A ReadCloser for the file content. - **err** (error) - An error if the operation failed. ``` -------------------------------- ### Client Options Method Signature Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0/internal Method signature for querying the capabilities and allowed methods of a WebDAV resource. ```go func (c *Client) Options(ctx context.Context, path string) (classes map[string]bool, methods map[string]bool, err error) ``` -------------------------------- ### Copy a file or directory Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0 Copies a file. By default, if the file is a directory, all descendants are recursively copied as well. ```go func (c *Client) Copy(ctx context.Context, name, dest string, options *CopyOptions) error ``` -------------------------------- ### Handler Structure Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0/caldav Handles CalDAV HTTP requests, requiring a backend and a prefix. ```go type Handler struct { Backend Backend Prefix string } ``` -------------------------------- ### Backend Supplied Home Set Interface Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0 BackendSuppliedHomeSet represents CalDAV calendar-home-set or CardDAV addressbook-home-set. It should only be created via specific constructors and is intended for server-side use. ```go type BackendSuppliedHomeSet interface { GetXMLName() xml.Name } ``` -------------------------------- ### Client Methods Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0/internal Provides methods for interacting with a WebDAV server, including creating requests, performing operations like OPTIONS, PROPFIND, and handling responses. ```APIDOC ## Client Methods ### Description This section details the methods available on the `Client` type for interacting with a WebDAV server. ### Methods - `NewClient(c HTTPClient, endpoint string) (*Client, error)`: Creates a new WebDAV client. - `(*Client) Do(req *http.Request) (*http.Response, error)`: Performs an HTTP request. - `(*Client) DoMultiStatus(req *http.Request) (*MultiStatus, error)`: Performs an HTTP request and returns a MultiStatus response. - `(*Client) NewRequest(method string, path string, body io.Reader) (*http.Request, error)`: Creates a new HTTP request. - `(*Client) NewXMLRequest(method string, path string, v interface{}) (*http.Request, error)`: Creates a new XML-encoded HTTP request. - `(*Client) Options(ctx context.Context, path string) (classes map[string]bool, methods map[string]bool, err error)`: Performs an OPTIONS request to discover server capabilities. - `(*Client) PropFind(ctx context.Context, path string, depth Depth, propfind *PropFind) (*MultiStatus, error)`: Performs a PROPFIND request. - `(*Client) PropFindFlat(ctx context.Context, path string, propfind *PropFind) (*Response, error)`: Performs a PROPFIND request with zero depth. - `(*Client) ResolveHref(p string) *url.URL`: Resolves a URL. - `(*Client) SyncCollection(ctx context.Context, path, syncToken string, level Depth, limit *Limit, prop *Prop) (*MultiStatus, error)`: Performs a `sync-collection` REPORT operation. ``` -------------------------------- ### NewPropNamePropFind Function Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0/internal Creates a new PropFind struct configured for 'propname' requests, allowing specific property names to be requested. ```go func NewPropNamePropFind(names ...xml.Name) *PropFind ``` -------------------------------- ### Client Do Method Signature Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0/internal Method signature for performing a generic HTTP request using the WebDAV client. ```go func (c *Client) Do(req *http.Request) (*http.Response, error) ``` -------------------------------- ### PropFind Struct Definition Source: https://pkg.go.dev/github.com/emersion/go-webdav/internal Represents a WebDAV PROPFIND request body. Used to specify which properties to retrieve. ```go type PropFind struct { XMLName xml.Name `xml:"DAV: propfind"` Prop *Prop `xml:"prop,omitempty"` AllProp *struct{} `xml:"allprop,omitempty"` Include *Include `xml:"include,omitempty"` PropName *struct{} `xml:"propname,omitempty"` } ``` -------------------------------- ### CardDAV Client HasSupport Method Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0/carddav Checks if the CardDAV server supports required features. ```go func (c *Client) HasSupport(ctx context.Context) error ``` -------------------------------- ### ServeMultiStatus Source: https://pkg.go.dev/github.com/emersion/go-webdav/internal Sends a WebDAV Multi-Status response. ```APIDOC ## ServeMultiStatus ### Description Sends a WebDAV Multi-Status response. ### Signature ```go func ServeMultiStatus(w http.ResponseWriter, ms *MultiStatus) error ``` ``` -------------------------------- ### Client.Move Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0 Moves a file. ```APIDOC ## Client.Move ### Description Moves a file or directory from one location to another. ### Method Signature ```go func (c *Client) Move(ctx context.Context, name, dest string, options *MoveOptions) error ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **name** (string) - Required - The name of the file or directory to move. - **dest** (string) - Required - The destination path. - **options** (*MoveOptions) - Optional - Options for the move operation. ### Request Example None ### Response #### Success Response (200) Returns an error if the move operation fails. ### Response Example None ``` -------------------------------- ### LocalFileSystem type definition Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0 Implements the FileSystem interface for a local directory. ```go type LocalFileSystem string ``` -------------------------------- ### CardDAV Client MultiGetAddressBook Method Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0/carddav Retrieves multiple address objects from a given path using an AddressBookMultiGet request. ```go func (c *Client) MultiGetAddressBook(ctx context.Context, path string, multiGet *AddressBookMultiGet) ([]AddressObject, error) ``` -------------------------------- ### NewClient Source: https://pkg.go.dev/github.com/emersion/go-webdav/caldav Creates a new CalDAV client instance. It requires an HTTP client and the server endpoint. ```APIDOC ## NewClient ### Description Creates a new CalDAV client instance. It requires an HTTP client and the server endpoint. ### Signature ```go func NewClient(c webdav.HTTPClient, endpoint string) (*Client, error) ``` ``` -------------------------------- ### ServeHTTP Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0/caldav Implements the http.Handler interface for the CalDAV handler. ```APIDOC ## ServeHTTP ### Description Implements http.Handler. Handles CalDAV HTTP requests. ### Signature ```go func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) ``` ``` -------------------------------- ### Client.NewClient Source: https://pkg.go.dev/github.com/emersion/go-webdav/caldav Creates a new CalDAV client. It requires an HTTP client and the CalDAV server endpoint URL. ```APIDOC ## func NewClient ### Description Creates a new CalDAV client. It requires an HTTP client and the CalDAV server endpoint URL. ### Signature ```go func NewClient(c webdav.HTTPClient, endpoint string) (*Client, error) ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response - **Client** (*Client) - A pointer to the newly created CalDAV client. - **error** (error) - An error if the client creation fails. #### Response Example None ``` -------------------------------- ### Href String Method Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0/internal Returns the string representation of an Href. ```go func (h *Href) String() string ``` -------------------------------- ### PropFind Struct Definition Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0/internal Defines the structure for a WebDAV PROPFIND request body, supporting 'prop', 'allprop', 'propname', and 'include' elements. ```go type PropFind struct { XMLName xml.Name `xml:"DAV: propfind"` Prop *Prop `xml:"prop,omitempty"` AllProp *struct{} `xml:"allprop,omitempty"` Include *Include `xml:"include,omitempty"` PropName *struct{} `xml:"propname,omitempty"` } ``` -------------------------------- ### Handler.ServeHTTP Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0/caldav ServeHTTP handles incoming HTTP requests for the CalDAV server. ```APIDOC ## Handler.ServeHTTP ### Description Handles incoming HTTP requests for the CalDAV server. ### Method Handler.ServeHTTP ### Parameters #### Path Parameters - **w** (http.ResponseWriter) - Required - The response writer. - **r** (*http.Request) - Required - The incoming HTTP request. ### Response This method does not return a value, but writes to the http.ResponseWriter. ``` -------------------------------- ### Client Structure Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0/caldav Provides access to a remote CardDAV server, embedding the base webdav.Client. ```go type Client struct { *webdav.Client // contains filtered or unexported fields } ``` -------------------------------- ### Client.Stat Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0 Fetches a FileInfo for a single file. ```APIDOC ## Client.Stat ### Description Retrieves FileInfo for a specific file or directory. ### Method Signature ```go func (c *Client) Stat(ctx context.Context, name string) (*FileInfo, error) ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **name** (string) - Required - The name of the file or directory to get information for. ### Request Example None ### Response #### Success Response - **FileInfo** (*FileInfo) - A FileInfo struct containing details about the file or directory. - **error** (error) - An error if the file information cannot be retrieved. ### Response Example None ``` -------------------------------- ### CopyOptions struct definition Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0 Options for the Copy operation. ```go type CopyOptions struct { NoRecursive bool NoOverwrite bool } ``` -------------------------------- ### LocalFileSystem.Stat Source: https://pkg.go.dev/github.com/emersion/go-webdav Returns information about a file or directory at the specified name. It returns a FileInfo pointer and an error if the operation failed. ```APIDOC ## LocalFileSystem.Stat ### Description Returns information about a file or directory at the specified name. It returns a FileInfo pointer and an error if the operation failed. ### Method Stat ### Parameters #### Path Parameters - **ctx** (context.Context) - Required - The context for the operation. - **name** (string) - Required - The name of the file or directory to stat. ### Response #### Success Response - **fi** (*FileInfo) - A FileInfo pointer with information about the file or directory. - **err** (error) - An error if the operation failed. ``` -------------------------------- ### Depth Constants Source: https://pkg.go.dev/github.com/emersion/go-webdav/internal Defines constants for Depth: DepthZero (resource only), DepthOne (resource and immediate members), and DepthInfinity (resource and all members). ```go const ( // DepthZero indicates that the request applies only to the resource. DepthZero Depth = 0 // DepthOne indicates that the request applies to the resource and its // internal members only. DepthOne Depth = 1 // DepthInfinity indicates that the request applies to the resource and all // of its members. DepthInfinity Depth = -1 ) ``` -------------------------------- ### Client.Move Source: https://pkg.go.dev/github.com/emersion/go-webdav Moves a file or directory from one location to another. ```APIDOC ## func (*Client) Move ### Description Moves a file. ### Signature ```go func (c *Client) Move(ctx context.Context, name, dest string, options *MoveOptions) error ``` ``` -------------------------------- ### Client.NewClient Source: https://pkg.go.dev/github.com/emersion/go-webdav/carddav Creates a new CardDAV client instance. It requires an HTTP client and the endpoint URL of the CardDAV server. ```APIDOC ## NewClient ### Description Creates a new CardDAV client instance. It requires an HTTP client and the endpoint URL of the CardDAV server. ### Signature ```go func NewClient(c webdav.HTTPClient, endpoint string) (*Client, error) ``` ``` -------------------------------- ### Serve MultiStatus Function Signature Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0/internal Function signature for serving a MultiStatus response to an HTTP client. ```go func ServeMultiStatus(w http.ResponseWriter, ms *MultiStatus) error ``` -------------------------------- ### Discover Context URL Function Signature Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0/internal Function signature for discovering CardDAV/CalDAV service URLs via DNS. ```go func DiscoverContextURL(ctx context.Context, service, domain string) (string, error) ``` -------------------------------- ### CardDAV Client QueryAddressBook Method Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0/carddav Queries for address objects within a specified address book based on the provided query. ```go func (c *Client) QueryAddressBook(ctx context.Context, addressBook string, query *AddressBookQuery) ([]AddressObject, error) ``` -------------------------------- ### AddressBook Structure Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0/carddav Represents a CardDAV address book with its path, name, description, and supported data types. ```go type AddressBook struct { Path string Name string Description string MaxResourceSize int64 SupportedAddressData []AddressDataType } ``` -------------------------------- ### Include Struct Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0/internal Represents the 'include' XML element in WebDAV, used in PROPFIND requests to specify properties to be returned. Defined in RFC 4918 section 14.8. ```go type Include struct { XMLName xml.Name Raw []RawXMLValue } ``` -------------------------------- ### CalDAV Server Backend Interface Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0/caldav Defines the interface for a CalDAV server backend, outlining methods for calendar and object management, and user principal operations. ```go type Backend interface { CalendarHomeSetPath(ctx context.Context) (string, error) CreateCalendar(ctx context.Context, calendar *Calendar) error ListCalendars(ctx context.Context) ([]Calendar, error) GetCalendar(ctx context.Context, path string) (*Calendar, error) GetCalendarObject(ctx context.Context, path string, req *CalendarCompRequest) (*CalendarObject, error) ListCalendarObjects(ctx context.Context, path string, req *CalendarCompRequest) ([]CalendarObject, error) QueryCalendarObjects(ctx context.Context, path string, query *CalendarQuery) ([]CalendarObject, error) PutCalendarObject(ctx context.Context, path string, calendar *ical.Calendar, opts *PutCalendarObjectOptions) (*CalendarObject, error) DeleteCalendarObject(ctx context.Context, path string) error webdav.UserPrincipalBackend } ``` -------------------------------- ### DiscoverContextURL Source: https://pkg.go.dev/github.com/emersion/go-webdav/caldav Performs DNS-based CalDAV service discovery as described in RFC 6352 section 11. Returns the URL to the CalDAV server. ```APIDOC ## func DiscoverContextURL ### Description Performs DNS-based CalDAV service discovery as described in RFC 6352 section 11. Returns the URL to the CalDAV server. ### Signature ```go func DiscoverContextURL(ctx context.Context, domain string) (string, error) ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response - **string** (string) - The discovered CalDAV server URL. - **error** (error) - An error if the discovery fails. #### Response Example None ``` -------------------------------- ### Match Address Object with Query Source: https://pkg.go.dev/github.com/emersion/go-webdav%40v0.7.0/carddav Reports whether a given AddressObject matches the specified query. Useful for filtering address book entries. ```go func Match(query *AddressBookQuery, ao *AddressObject) (matched bool, err error) ``` -------------------------------- ### ServeXML Source: https://pkg.go.dev/github.com/emersion/go-webdav/internal Creates an XML encoder for writing WebDAV XML responses. ```APIDOC ## ServeXML ### Description Creates an XML encoder for writing WebDAV XML responses. ### Signature ```go func ServeXML(w http.ResponseWriter) *xml.Encoder ``` ```