lib/client.js
function(url, properties, depth, headers) {

        if(typeof depth === "undefined") {
            depth = '0';
        }

        // depth header must be a string, in case a number was passed in
        depth = '' + depth;

        headers = headers || {};

        headers['Depth'] = depth;
        headers['Content-Type'] = 'application/xml; charset=utf-8';

        var body =
            '<?xml version="1.0"?>\n' +
            '<d:propfind ';
        var namespace;
        for (namespace in this.xmlNamespaces) {
            body += ' xmlns:' + this.xmlNamespaces[namespace] + '="' + namespace + '"';
        }
        body += '>\n' +
            '  <d:prop>\n';

        for(var ii in properties) {
            if (!properties.hasOwnProperty(ii)) {
                continue;
            }

            var property = this.parseClarkNotation(properties[ii]);
            if (this.xmlNamespaces[property.namespace]) {
                body+='    <' + this.xmlNamespaces[property.namespace] + ':' + property.name + ' />\n';
            } else {
                body+='    <x:' + property.name + ' xmlns:x="' + property.namespace + '" />\n';
            }

        }
        body+='  </d:prop>\n';
        body+='</d:propfind>';

        return this.request('PROPFIND', url, headers, body).then(
            function(result) {

                if (depth === '0') {
                    return {
                        status: result.status,
                        body: result.body[0],
                        xhr: result.xhr
                    };
                } else {
                    return {
                        status: result.status,
                        body: result.body,
                        xhr: result.xhr
                    };
                }

            }.bind(this)
        );

    }
function(url, properties, depth, headers) {

        if(typeof depth === "undefined") {
            depth = '0';
        }

        // depth header must be a string, in case a number was passed in
        depth = '' + depth;

        headers = headers || {};

        headers['Depth'] = depth;
        headers['Content-Type'] = 'application/xml; charset=utf-8';

        var body =
            '<?xml version="1.0"?>\n' +
            '<d:propfind ';
        var namespace;
        for (namespace in this.xmlNamespaces) {
            body += ' xmlns:' + this.xmlNamespaces[namespace] + '="' + namespace + '"';
        }
        body += '>\n' +
            '  <d:prop>\n';

        for(var ii in properties) {
            if (!properties.hasOwnProperty(ii)) {
                continue;
            }

            var property = this.parseClarkNotation(properties[ii]);
            if (this.xmlNamespaces[property.namespace]) {
                body+='    <' + this.xmlNamespaces[property.namespace] + ':' + property.name + ' />\n';
            } else {
                body+='    <x:' + property.name + ' xmlns:x="' + property.namespace + '" />\n';
            }

        }
        body+='  </d:prop>\n';
        body+='</d:propfind>';

        return this.request('PROPFIND', url, headers, body).then(
            function(result) {

                if (depth === '0') {
                    return {
                        status: result.status,
                        body: result.body[0],
                        xhr: result.xhr
                    };
                } else {
                    return {
                        status: result.status,
                        body: result.body,
                        xhr: result.xhr
                    };
                }

            }.bind(this)
        );

    }
function ( url , properties , depth , headers ) { if ( typeof depth === "undefined" ) { depth = '0' ; } // depth header must be a string, in case a number was passed in depth = '' + depth ; headers = headers || { } ; headers [ 'Depth' ] = depth ; headers [ 'Content-Type' ] = 'application/xml; charset=utf-8' ; var body = '<?xml version="1.0"?>\n' + '<d:propfind ' ; var namespace ; for ( namespace in this . xmlNamespaces ) { body += ' xmlns:' + this . xmlNamespaces [ namespace ] + '="' + namespace + '"' ; } body += '>\n' + '  <d:prop>\n' ; for ( var ii in properties ) { if ( ! properties . hasOwnProperty ( ii ) ) { continue ; } var property = this . parseClarkNotation ( properties [ ii ] ) ; if ( this . xmlNamespaces [ property . namespace ] ) { body += '    <' + this . xmlNamespaces [ property . namespace ] + ':' + property . name + ' />\n' ; } else { body += '    <x:' + property . name + ' xmlns:x="' + property . namespace + '" />\n' ; } } body += '  </d:prop>\n' ; body += '</d:propfind>' ; return this . request ( 'PROPFIND' , url , headers , body ) . then ( function ( result ) { if ( depth === '0' ) { return { status : result . status , body : result . body [ 0 ] , xhr : result . xhr } ; } else { return { status : result . status , body : result . body , xhr : result . xhr } ; } } . bind ( this ) ) ; }
Generates a propFind request.

@param {string} url Url to do the propfind request on
@param {Array} properties List of properties to retrieve.
@param {string} depth "0", "1" or "infinity"
@param {Object} [headers] headers
@return {Promise}
Generates a propFind request .