aboutsummaryrefslogtreecommitdiffstats
path: root/lib/caldav/request/propfind.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/caldav/request/propfind.js')
-rw-r--r--lib/caldav/request/propfind.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/caldav/request/propfind.js b/lib/caldav/request/propfind.js
index e54b669..e731b98 100644
--- a/lib/caldav/request/propfind.js
+++ b/lib/caldav/request/propfind.js
@@ -46,6 +46,37 @@
this._props.push(this.template.tag(tagDesc, attr, content));
},
+ /**
+ * Removes property from request.
+ * Must use same arguments as 'prop' to remove prop.
+ *
+ * @param {String|Array} tagDesc tag description.
+ * @param {Object} [attr] optional tag attrs.
+ * @param {Obj} [content] optional content.
+ */
+ removeProp: function(tagDesc, attr, content) {
+ var prop = this.template.tag(tagDesc, attr, content);
+ var idx = this._props.indexOf(prop);
+
+ if (idx !== -1) {
+ this._props.splice(idx, 1);
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * Checks if prop has been added to the request.
+ *
+ * @param {String|Array} tagDesc tag description.
+ * @param {Object} [attr] optional tag attrs.
+ * @param {Obj} [content] optional content.
+ */
+ hasProp: function(tagDesc, attr, content) {
+ var prop = this.template.tag(tagDesc, attr, content);
+ return this._props.indexOf(prop) !== -1;
+ },
+
_createPayload: function() {
var content = this.template.tag('prop', this._props.join(''));
return this.template.render(content);