NAME

Net::CardDAVTalk - A library for talking to CardDAV servers

VERSION

Version 0.06

SYNOPSIS

This module maps from CardDAV to an old version of the FastMail API. It's mostly useful as an example of how to talk CardDAV and for the Cyrus IMAP test suite Cassandane.

use Net::CardDAVTalk;

my $foo = Net::CardDAVTalk->new();
...

SUBROUTINES/METHODS

$class->new()

Takes the same arguments as Net::DAVTalk and adds the single namespace:

C => 'urn:ietf:params:xml:ns:carddav'

$self->NewAddressBook($Path, %Args)

Creates a new addressbook collection. Requires the full path (unlike Net::CalDAVTalk, which creates paths by UUID) and takes a single argument, the name:

e.g.

$CardDAV->NewAddressBook("Default", name => "Addressbook");

$self->DeleteAddressBook($Path)

Deletes the addressbook at the given path

e.g.

$CardDAV->DeleteAddressBook("Shared");

$self->UpdateAddressBook($Path, %Args)

Like 'new', but for an existing addressbook. For now, can only change the name.

e.g.

$CardDAV->UpdateAddressBook("Default", name => "My Happy Addressbook");

$self->GetAddressBook($Path, %Args)

Calls 'GetAddressBooks' with the args, and greps for the one with the matching path.

e.g.

my $AB = $CardDAV->GetAddressBook("Default");

$self->GetAddressBooks(%Args)

Get all the addressbooks on the server. If the arg 'Sync' is true, also requests the DAV:sync-token and returns it as syncToken in the addressbook hash.

Returns an arrayref of hashrefs

e.g.

my $ABs = $CardDAV->GetAddressBooks(Sync => 1);
foreach my $AB (@$ABs) {
    say "$AB->{path}: $AB->{name}";
}

$Self->NewContact($AddressBookPath, $VCard)

Create a new contact from the Net::CardDAVTalk::VCard object, either using its uid field or generating a new UUID and appending .vcf for the filename.

Returns the full path to the card.

NOTE: can also be used for a kind: group v4 style group.

$self->DeleteContact($Path)

Delete the contact at path $Path.

$Self->UpdateContact($Path, $VCard)

Identical to NewContact, but will fail unless there is an existing contact with that path. Also takes the full path instead of just the addressbook path.

NOTE: can also be used for a kind: group v4 style group.

$Self->GetContact($Path)

Fetch a specific contact by path. Returns a Net::CardDAVTalk::VCard object.

$Self->GetContactAndProps($Path, $Props)

Use a multiget to fetch the properties in the arrayref as well as the card content.

Returns the card in scalar context - the card and an array of errors in list context.

$self->GetContacts($Path, $Props, %Args)

Get multiple cards, possibly including props, using both a propfind AND a multiget.

Returns an arrayref of contact and an arrayref of errors (or just the contacts in scalar context again)

$self->GetContactLinks($Path)

Returns a hash of href => etag for every contact URL (type: text/(x-)?vcard) inside the collection at \$Path.

$self->GetContactsMulti($Path, $Urls, $Props)

Does an addressbook-multiget on the \$Path for all the URLs in \$Urls also fetching \$Props on top of the address-data and getetag.

$self->SyncContacts($Path, $Props, %Args)

uses the argument 'syncToken' to find newly added and removed cards from the server. Returns just the added/changed contacts in scalar context, or a list of array of contacts, array of removed, array of errors and the new syncToken as 4 items in list context.

$self->SyncContactLinks($Path, %Args)

uses the argument 'syncToken' to find newly added and removed cards from the server.

Returns a list of:

* Hash of href to etag for added/changed cargs * List of href of removed cards * List of errors * Scalar value of new syncToken

$self->MoveContact($Path, $NewPath)

Move a contact to a new path (usually in a new addressbook) - both paths are card paths.

AUTHOR

Bron Gondwana, <brong at cpan.org>

BUGS

Please report any bugs or feature requests to bug-net-carddavtalk at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-CardDAVTalk. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Net::CardDAVTalk

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2015 FastMail Pty. Ltd.

This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at:

http://www.perlfoundation.org/artistic_license_2_0

Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license.

If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license.

This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder.

This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed.

Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.