Qore xml Module 2.1.0
Loading...
Searching...
No Matches
WebDavClient::WebDavClient Class Reference

WebDAV client class. More...

#include <WebDavClient.qm.dox.h>

Inherits Qore::HTTPClient.

Public Member Methods

void constructor (hash< auto > opts)
 Creates a WebDavClient object.
 
void setDebug (bool val)
 Enables or disables debug output.
 
list< string > options (string path)
 Gets the supported DAV capabilities.
 
list< hash< WebDavResourceInfo > > list (string path, string depth)
 Lists resources in a directory using PROPFIND.
 
soft< data > get (string path)
 Downloads a file.
 
bool put (soft< string > content_type, string path, data content)
 Uploads a file.
 
void del (string path)
 Deletes a resource.
 
void mkcol (string path)
 Creates a collection (directory)
 
void copyResource (string src, string dest, bool overwrite)
 Copies a resource.
 
void moveResource (string src, string dest, bool overwrite)
 Moves a resource.
 
void unlock (string path, string token)
 Unlocks a resource.
 
bool exists (string path)
 Checks if a resource exists.
 
string resolvePath (string path)
 Resolves a path relative to the base path.
 
list< hash< WebDavResourceInfo > > parsePropfindResponse (auto body)
 Parses a PROPFIND response.
 
hash< WebDavResourceInfoparseResourceResponse (hash< auto > resp)
 Parses a single response element.
 
soft< date > parseDate (soft< string > str)
 Parses a date string.
 

Static Public Member Methods

static hash< auto > getClientOpts (hash< auto > opts)
 Returns HTTPClient options from constructor options.
 

Public Attributes

const auto DefaultTimeout = ...
 Default timeout for operations (30 seconds)
 

Detailed Description

WebDAV client class.

This class provides a WebDAV client implementation based on HTTPClient.

Member Function Documentation

◆ constructor()

void WebDavClient::WebDavClient::constructor ( hash< auto >  opts)

Creates a WebDavClient object.

Parameters
optsa hash of options:
  • url: (required) the WebDAV server URL
  • timeout: (optional) connection/I/O timeout in milliseconds (default: 30000)
  • connect_timeout: (optional) connection timeout in milliseconds
  • proxy: (optional) proxy URL
  • ssl_cert_path: (optional) path to SSL client certificate
  • ssl_key_path: (optional) path to SSL client private key
  • ssl_key_password: (optional) password for SSL private key
  • ssl_verify_cert: (optional) verify server certificate (default: True)

◆ copyResource()

void WebDavClient::WebDavClient::copyResource ( string  src,
string  dest,
bool  overwrite 
)

Copies a resource.

Parameters
srcsource path
destdestination path
overwritewhether to overwrite existing resources (default: True)

◆ del()

void WebDavClient::WebDavClient::del ( string  path)

Deletes a resource.

Parameters
paththe resource path

◆ exists()

bool WebDavClient::WebDavClient::exists ( string  path)

Checks if a resource exists.

Parameters
paththe resource path
Returns
True if the resource exists, False otherwise

◆ get()

soft< data > WebDavClient::WebDavClient::get ( string  path)

Downloads a file.

Parameters
paththe file path
Returns
the file contents as binary data, or NOTHING if not found

◆ list()

list< hash< WebDavResourceInfo > > WebDavClient::WebDavClient::list ( string  path,
string  depth 
)

Lists resources in a directory using PROPFIND.

Parameters
paththe path to list
depth"0" for just the resource, "1" for immediate children, "infinity" for all descendants
Returns
a list of resource information

◆ mkcol()

void WebDavClient::WebDavClient::mkcol ( string  path)

Creates a collection (directory)

Parameters
paththe collection path

◆ moveResource()

void WebDavClient::WebDavClient::moveResource ( string  src,
string  dest,
bool  overwrite 
)

Moves a resource.

Parameters
srcsource path
destdestination path
overwritewhether to overwrite existing resources (default: True)

◆ options()

list< string > WebDavClient::WebDavClient::options ( string  path)

Gets the supported DAV capabilities.

Returns
a list of DAV compliance classes (e.g., "1", "2", "3")

◆ put()

bool WebDavClient::WebDavClient::put ( soft< string >  content_type,
string  path,
data  content 
)

Uploads a file.

Parameters
paththe file path
contentthe file contents
content_typeoptional content type (default: application/octet-stream)
Returns
True if a new resource was created, False if an existing resource was updated

◆ unlock()

void WebDavClient::WebDavClient::unlock ( string  path,
string  token 
)

Unlocks a resource.

Parameters
paththe resource path
tokenthe lock token

The documentation for this class was generated from the following file: