
#################################################
**Cassandane::TestEntity::DataType::ContactCard**
#################################################


****
NAME
****


Cassandane::TestEntity::DataType::ContactCard - the ContactCard entity datatype


***************
FACTORY METHODS
***************



************
create_group
************



.. code-block:: perl

     my $card = $user->contacts->create_group({...});


This is like the generic \ ``create``\  method, but will always set the \ ``kind``\ 
property to "group".


******
create
******


The create method will provide sensible defaults, as usual, but additionally:

If the \ ``name``\  argument is a plain string, it will be promoted to:


.. code-block:: perl

     { full => $name }


...meaning that you don't need to think much about name properties too hard.


****************
INSTANCE METHODS
****************


as_vcard3
=========


This returns a byte string of the ContactCard in vCard 3.0 format, produced by
making a GET request against the CardDAV endpoint.


as_vcard4
=========


This returns a byte string of the ContactCard in vCard 4.0 format, produced by
making a GET request against the CardDAV endpoint.


as_vcard3_struct
================


This method returns a data structure representing the parsed vCard of this
card, which will be fetched from the server, requesting version 3.0.  The parse
will be the 0th object returned by a parse with `Text::VCardFast <https://metacpan.org/pod/Text::VCardFast>`_.


as_vcard3_struct
================


This is identical to as_vcard4_struct, but request vCard v4.0.


add_member
==========



.. code-block:: perl

     $card->add_member($card_or_uid);


This method must be called on a group-kind card.  Otherwise, an exception will
be raised.

This will add the given UID to the group's members.  If the argument was a
contact card instance, that card's UID will be added.


create_member
=============



.. code-block:: perl

     $group_card->create_member({ ... });


This method is sugar for creating a new card (using the given hashref, if any,
as properties) and then adding it to the group card.


