diff options
Diffstat (limited to 'js/dav')
-rw-r--r-- | js/dav/dav.js | 22 | ||||
-rw-r--r-- | js/dav/lib/client.js | 5 | ||||
-rw-r--r-- | js/dav/lib/contacts.js | 18 |
3 files changed, 45 insertions, 0 deletions
diff --git a/js/dav/dav.js b/js/dav/dav.js index 476d35ff..efafcb68 100644 --- a/js/dav/dav.js +++ b/js/dav/dav.js @@ -1476,6 +1476,14 @@ var Client = (function () { return calendars.syncCaldavAccount(account, options); } }, { + key: 'getAddressBook', + value: function getAddressBook() { + var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; + + options.xhr = options.xhr || this.xhr; + return contacts.getAddressBook(options); + } + }, { key: 'createAddressBook', value: function createAddressBook() { var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; @@ -1551,6 +1559,7 @@ exports.Client = Client; Object.defineProperty(exports, '__esModule', { value: true }); +exports.getAddressBook = getAddressBook; exports.createAddressBook = createAddressBook; exports.deleteAddressBook = deleteAddressBook; exports.renameAddressBook = renameAddressBook; @@ -1656,6 +1665,19 @@ var listAddressBooks = _co2['default'].wrap(regeneratorRuntime.mark(function cal })); exports.listAddressBooks = listAddressBooks; + +function getAddressBook(options) { + var addressBookUrl = _url2['default'].resolve(options.url, options.displayName); + var req = request.propfind({ + props: [{ name: 'displayname', namespace: ns.DAV }, { name: 'owner', namespace: ns.DAV }, { name: 'getctag', namespace: ns.CALENDAR_SERVER }, { name: 'resourcetype', namespace: ns.DAV }, { name: 'sync-token', namespace: ns.DAV }, + //{ name: 'groups', namespace: ns.OC }, + { name: 'invite', namespace: ns.OC }], + depth: 1 + }); + + return options.xhr.send(req, addressBookUrl); +} + /** * @return {Promise} promise will resolve when the addressBook has been created. * diff --git a/js/dav/lib/client.js b/js/dav/lib/client.js index 3226d3d8..2846278f 100644 --- a/js/dav/lib/client.js +++ b/js/dav/lib/client.js @@ -73,6 +73,11 @@ export class Client { return calendars.syncCaldavAccount(account, options); } + getAddressBook(options={}) { + options.xhr = options.xhr || this.xhr; + return contacts.getAddressBook(options); + } + createAddressBook(options={}) { options.xhr = options.xhr || this.xhr; return contacts.createAddressBook(options); diff --git a/js/dav/lib/contacts.js b/js/dav/lib/contacts.js index e20acf6b..719eb08e 100644 --- a/js/dav/lib/contacts.js +++ b/js/dav/lib/contacts.js @@ -56,6 +56,24 @@ export let listAddressBooks = co.wrap(function *(account, options) { return addressBooks; }); +export function getAddressBook(options) { + let addressBookUrl = url.resolve(options.url, options.displayName); + var req = request.propfind({ + props: [ + { name: 'displayname', namespace: ns.DAV }, + { name: 'owner', namespace: ns.DAV }, + { name: 'getctag', namespace: ns.CALENDAR_SERVER }, + { name: 'resourcetype', namespace: ns.DAV }, + { name: 'sync-token', namespace: ns.DAV }, + //{ name: 'groups', namespace: ns.OC }, + { name: 'invite', namespace: ns.OC } + ], + depth: 1 + }); + + return options.xhr.send(req, addressBookUrl); +} + /** * @return {Promise} promise will resolve when the addressBook has been created. * |