A contact is a set of information that describes a contact. The contact contains information, such as phone numbers and e-mail addresses.
RFC 2426 vCard MIME Directory Profile defines a format for exchanging contacts. The Contact API refers to this specification to provide a mapping of the specified contact attributes.
A person is a set of information that describes a person. Two different contacts that indicate the same person will have the same person ID. A person has a display contact ID that indicates a contact that represents information of the person. A person is automatically created when a new contact is added.
This API provides functionality to read, create, remove, and update contacts in specific address books. Address books can be obtained using the getAddressBooks() method, which returns an array of AddressBook objects.
For more information on the Contact features, see Contact Guide.
Since: 1.0
enum ContactTextFormat {"VCARD_30"};
Since: 1.0
Currently, vCard v3.0 is the only format supported by the Tizen platform.
enum ContactRelationshipType {"OTHER", "ASSISTANT", "BROTHER", "CHILD", "DOMESTIC_PARTNER", "FATHER", "FRIEND", "MANAGER", "MOTHER", "PARENT", "PARTNER", "REFERRED_BY", "RELATIVE", "SISTER", "SPOUSE", "CUSTOM"};
Since: 2.3
enum ContactInstantMessengerType {"OTHER", "GOOGLE", "WLM", "YAHOO", "FACEBOOK", "ICQ", "AIM", "QQ", "JABBER", "SKYPE", "IRC", "CUSTOM"};
Since: 2.3
[NoInterfaceObject] interface ContactManagerObject { readonly attribute ContactManager contact; };
Tizen implements ContactManagerObject;
Since: 1.0
The tizen.contact object allows access to the Contact API functionality.
[NoInterfaceObject] interface ContactManager { void getAddressBooks(AddressBookArraySuccessCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); AddressBook getUnifiedAddressBook() raises(WebAPIException); AddressBook getDefaultAddressBook() raises(WebAPIException); void addAddressBook(AddressBook addressBook) raises(WebAPIException); void removeAddressBook(AddressBookId addressBookId) raises(WebAPIException); AddressBook getAddressBook(AddressBookId addressBookId) raises(WebAPIException); Person get(PersonId personId) raises(WebAPIException); void update(Person person) raises(WebAPIException); void updateBatch(Person[] persons, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void remove(PersonId personId) raises(WebAPIException); void removeBatch(PersonId[] personIds, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void find(PersonArraySuccessCallback successCallback, optional ErrorCallback? errorCallback, optional AbstractFilter? filter, optional SortMode? sortMode) raises(WebAPIException); long addChangeListener(PersonsChangeCallback successCallback) raises(WebAPIException); void removeChangeListener(long watchId) raises(WebAPIException); };
Since: 1.0
This interface offers a method to retrieve the address books objects. The address book objects can be manipulated with the provided functionalities to add, remove, and update the contained information.
getAddressBooks
void getAddressBooks(AddressBookArraySuccessCallback successCallback, optional ErrorCallback? errorCallback);
Since: 1.0
If the operation completes successfully, the successCallback must be invoked with the phone address book and the SIM address book (if any). Other address books present in the device should also be returned.
If no address book is present, the successCallback will be invoked with an empty array.
The ErrorCallback method is launched with these error types:
Privilege level: public
Privilege: http://tizen.org/privilege/contact.read
Parameters:
Exceptions:
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type NotSupportedError, if the feature is not supported.
Code example:
var addressbook; // Defines the error callback for all the asynchronous calls. function errorCB(err) { console.log( 'The following error occurred: ' + err.name); } function contactsFoundCB(contacts) { // The contact is successfully found. // Tries to change the first name. contacts[0].name.firstName = 'Jeffrey Ross'; try { addressbook.update(contacts[0]); } catch (err) { console.log( 'The following error occurred while updating: ' + err.name); } console.log('First contact was updated'); } // Defines the success callback for retrieving all the // Address Books. function addressBooksCB(addressbooks) { if(addressbooks.length > 0) { addressbook = addressbooks[0]; console.log('The addressbook type is ' + addressbook.type + ' and name ' + addressbook.name); var contact = new tizen.Contact( {name: new tizen.ContactName({firstName:'Jeffrey', lastName:'Hyman', nicknames:['joey ramone']}), emails:[new tizen.ContactEmailAddress('user@domain.com')], phoneNumbers:[new tizen.ContactPhoneNumber('123456789')]}); addressbook.add(contact); // The contact has been successfully added. // Checks whether the added contact can be retrieved from the address book or not. // If the address book is empty, only the item added through saveContact // should be returned. var filter = new tizen.AttributeFilter('name.firstName', 'CONTAINS', 'Jeffrey'); try { addressbook.find(contactsFoundCB, errorCB, filter); } catch (err) { console.log( 'The following error occurred while finding: ' + err.name); } } } // Gets a list of available address books. tizen.contact.getAddressBooks(addressBooksCB, errorCB);
getUnifiedAddressBook
AddressBook getUnifiedAddressBook();
Since: 2.1
The unified address book is a logical address book that represents an aggregation of all address books that are obtained by getAddressBooks() and contains all contacts in the address books. Note that the unified address book does not have an address book ID and it is set to null.
Privilege level: public
Privilege: http://tizen.org/privilege/contact.read
Return value:
AddressBook The unified AddressBook objectExceptions:
with error type SecurityError, if the application does not have the privilege to call this method.
with error type NotSupportedError, if the feature is not supported.
with error type UnknownError in any other error case.
Code example:
var addressbook; // Defines the error callback function errorCB(err) { console.log( 'The following error occurred: ' + err.name); } function contactsFoundCB(contacts) { // The contact has been successfully found. // Tries to change the first name. contacts[0].name.firstName = 'Jeffrey Ross'; try { addressbook.update(contacts[0]); console.log('First contact was updated'); } catch (err) { console.log( 'The following error occurred while updating: ' + err.name); } } // Gets the unified address book. addressbook = tizen.contact.getUnifiedAddressBook(); // Adds a new contact. var contact = new tizen.Contact( {name: new tizen.ContactName({firstName:'Jeffrey', lastName:'Hyman', nicknames:['joey ramone']}), emails:[new tizen.ContactEmailAddress('user@domain.com')], phoneNumbers:[new tizen.ContactPhoneNumber('123456789')]}); try { addressbook.add(contact); } catch (err) { console.log( 'The following error occurred while adding: ' + err.name); } // The contact has been successfully added. // Tries to check whether the added contact can be retrieved from the address book // If the address book is empty, only the item added // through saveContact should be returned. var filter = new tizen.AttributeFiilter('name.firstName', 'CONTAINS', 'Jeffrey'); try { addressbook.find(contactsFoundCB, errorCB, filter); } catch (err) { console.log( 'The following error occurred while finding: ' + err.name); }
getDefaultAddressBook
AddressBook getDefaultAddressBook();
Since: 1.0
The default address book is one of the addressBooks that is the appointed addressbook from platform or operator.
Privilege level: public
Privilege: http://tizen.org/privilege/contact.read
Return value:
AddressBook The default AddressBook objectExceptions:
with error type SecurityError, if the application does not have the privilege to call this method.
with error type NotSupportedError, if the feature is not supported.
with error type UnknownError in any other error case.
Code example:
var addressbook; // Defines the error callback. function errorCB(err) { console.log( 'The following error occurred: ' + err.name); } function contactsFoundCB(contacts) { // The contact has been successfully found. // Tries to change the first name. contacts[0].name.firstName = 'Jeffrey Ross'; try { addressbook.update(contacts[0]); console.log('First contact was updated'); } catch (err) { console.log( 'The following error occurred while updating: ' + err.name); } } // Gets the default address book. addressbook = tizen.contact.getDefaultAddressBook(); // Adds a new contact. var contact = new tizen.Contact( {name: new tizen.ContactName({firstName:'Jeffrey', lastName:'Hyman', nicknames:['joey ramone']}), emails:[new tizen.ContactEmailAddress('user@domain.com')], phoneNumbers:[new tizen.ContactPhoneNumber('123456789')]}); try { addressbook.add(contact); } catch (err) { console.log( 'The following error occurred while adding: ' + err.name); } // The contact has been successfully added. // Checks whether the added contact can be retrieved from the address book. // If the address book is empty, only the item added // through saveContact should be returned. var filter = new tizen.AttributeFiilter('name.firstName', 'CONTAINS', 'Jeffrey'); try { addressbook.find(contactsFoundCB, errorCB, filter); } catch (err) { console.log( 'The following error occurred while finding: ' + err.name); }
addAddressBook
void addAddressBook(AddressBook addressBook);
Since: 2.3
If the addressbook is successfully inserted in the database, the AddressBook object will have its identifier (id attribute) set when the function returns.
Privilege level: public
Privilege: http://tizen.org/privilege/contact.write
Parameters:
Exceptions:
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type NotSupportedError, if the feature is not supported.
with error type UnknownError, if the address book could not be inserted due to an unknown error.
Code example:
var appId = tizen.application.getCurrentApplication().appInfo.id; tizen.account.getAccounts(function(accounts) { var account = accounts[0]; if(account) { var addressbook = new tizen.AddressBook( account.id, 'remote addressbook' ); tizen.contact.addAddressBook(addressbook); } }, function(e) { console.log('Error: ' + e.message); }, appId);
removeAddressBook
void removeAddressBook(AddressBookId addressBookId);
Since: 2.3
Removes the address book in the database that corresponds to the specified identifier. The function will throw an exception if it failed to remove the specified addressbook.
Privilege level: public
Privilege: http://tizen.org/privilege/contact.write
Parameters:
Exceptions:
with error type NotFoundError, if the identifier does not match any address book.
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type InvalidValuesError, if specified addressBookId is an id of default address book.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type NotSupportedError, if the feature is not supported.
with error type UnknownError, if the address book could not be removed due to an unknown error.
Code example:
var appId = tizen.application.getCurrentApplication().appInfo.id; tizen.account.getAccounts(function(accounts) { var account = accounts[0]; if(account) { var addressbook = new tizen.AddressBook( account.id, 'remote addressbook' ); tizen.contact.addAddressBook(addressbook); tizen.contact.removeAddressBook(addressbook.id); } }, function(e) { console.log('Error: ' + e.message); }, appId);
getAddressBook
AddressBook getAddressBook(AddressBookId addressBookId);
Since: 1.0
Privilege level: public
Privilege: http://tizen.org/privilege/contact.read
Parameters:
Return value:
AddressBook The matching AddressBook objectExceptions:
with error type NotFoundError, if there is no address book with the given identifier.
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type InvalidValuesError, if any of the input parameters contain an invalid value.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type NotSupportedError, if the feature is not supported.
with error type UnknownError in case of any other error.
Code example:
var contactRef; // ContactRef supposed to be initialized try { // Retrieves the Contact corresponding to a given ContactRef. var addressBook = tizen.contact.getAddressBook(contactRef.addressBookId); var contact = addressBook.get(contactRef.contactId); console.log("Successfully resolved contact with id: " + contactRef.contactId); } catch(err) { console.log("Error: " + err.name); }
get
Since: 2.0
If the operation completes successfully, it must return the person with the specified identifier.
Privilege level: public
Privilege: http://tizen.org/privilege/contact.read
Parameters:
Return value:
Person The matching Person objectExceptions:
with error type NotFoundError, if there is no person with the given identifier.
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type InvalidValuesError, if any of the input parameters contain an invalid value.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type NotSupportedError, if the feature is not supported.
with error type UnknownError in any other error case.
Code example:
var contactRef; // ContactRef supposed to be initialized try { // Retrieves the Person corresponding to a Contact. var addressBook = tizen.contact.getAddressBook(contactRef.addressBookId); var contact = addressBook.get(contactRef.contactId); var person = tizen.contact.get(contact.personId); console.log("Successfully resolved person with id: " + contact.personId); } catch(err) { console.log("Error: " + err.name); }
update
void update(Person person);
Since: 2.0
Privilege level: public
Privilege: http://tizen.org/privilege/contact.write
Parameters:
Exceptions:
with error type NotFoundError, if the identifier does not match.
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type InvalidValuesError, if any input parameter contains invalid values.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type NotSupportedError, if the feature is not supported.
with error type UnknownError, if the person could not be updated to an unknown error.
Code example:
// Defines the error callback. function errorCB(err) { console.log( 'The following error occurred: ' + err.name); } function personsFoundCB(persons) { // The person has been successfully found. // Tries to change the isFavorite attribute. persons[0].isFavorite = true; try { tizen.contact.update(persons[0]); console.log('First person was updated'); } catch (err) { console.log( 'The following error occurred while updating: ' + err.name); } } try { tizen.contact.find(personsFoundCB, errorCB); } catch (err) { console.log( 'The following error occurred while finding: ' + err.name); }
updateBatch
void updateBatch(Person[] persons, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
Since: 2.0
The ErrorCallback method is launched with these error types:
If the details of any persons cannot be updated, the error callback function that was passed in the invocation will be called.
Privilege level: public
Privilege: http://tizen.org/privilege/contact.write
Parameters:
Exceptions:
with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type NotSupportedError, if this feature is not supported.
Code example:
// Defines the error callback for all the asynchronous calls. function errorCB(err) { console.log('The following error occurred: ' + err.name); } function personsUpdatedCB() { console.log('Contacts were updated'); } function personsFoundCB(persons) { // The person has been successfully found. for(var i = 0; i < persons.length; i++) { persons[i].isFavorite = true; } try { tizen.contact.updateBatch(persons, personsUpdatedCB, errorCB); } catch (err) { console.log('The following error occurred while updating: ' + err.name); } } try { tizen.contact.find(personsFoundCB, errorCB); } catch (err) { console.log('The following error occurred while finding: ' + err.name); }
remove
void remove(PersonId personId);
Since: 2.0
Removes the person that corresponds to the specified identifier and the contacts related to the person as well. This function will throw an exception if it fails to remove the specified person.
Privilege level: public
Privilege: http://tizen.org/privilege/contact.write
Parameters:
Exceptions:
with error type NotFoundError, if the identifier does not match any persons.
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type InvalidValuesError, if any input parameter contains invalid values.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type NotSupportedError, if the feature is not supported.
with error type UnknownError, if the person could not be removed due to an unknown error.
Code example:
// Defines the error callback. function errorCB(err) { console.log('The following error occurred: ' + err.name); } function personsFoundCB(persons) { // The person has been successfully found. if(persons.length > 0) { try { tizen.contact.remove(persons[0].id); console.log('First person was removed'); } catch (err) { console.log('The following error occurred while removing: ' + err.name); } } else { console.log( 'No persons.'); } } try { tizen.contact.find(personsFoundCB, errorCB); } catch (err) { console.log( 'The following error occurred while finding: ' + err.name); }
removeBatch
void removeBatch(PersonId[] personIds, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
Since: 2.0
Removes the persons that correspond to the specified identifiers as well as the contacts related to them.
The ErrorCallback method is launched with these error types:
Privilege level: public
Privilege: http://tizen.org/privilege/contact.write
Parameters:
Exceptions:
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type NotSupportedError, if the feature is not supported.
Code example:
// Defines the error callback. function errorCB(err) { console.log( 'The following error occurred: ' + err.name); } function personsRemovedCB() { console.log('Contacts were removed'); } function personsFoundCB(persons) { // The person has been successfully found. if(persons.length > 2) { try { tizen.contact.removeBatch([persons[0].id, persons[1].id], personsRemovedCB, errorCB); } catch (err) { console.log( 'The following error occurred while removing: ' + err.name); } } else { console.log( 'Not enough persons.'); } } try { tizen.contact.find(personsFoundCB, errorCB); } catch (err) { console.log( 'The following error occurred while finding: ' + err.name); }
find
void find(PersonArraySuccessCallback successCallback, optional ErrorCallback? errorCallback, optional AbstractFilter? filter, optional SortMode? sortMode);
Since: 2.0
If the filter is passed and contains valid values, only those values in the address book that match the filter criteria as specified in the AbstractFilter interface will be returned in the successCallback. If no filter is passed, the filter contains any invalid values, the filter is null or undefined, then the implementation must return the full list of contact items in the successCallback. If no persons are available in the contact DB or no person matches the filter criteria, the successCallback will be invoked with an empty array.
The ErrorCallback method is launched with these error types:
Privilege level: public
Privilege: http://tizen.org/privilege/contact.read
Parameters:
Exceptions:
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type NotSupportedError, if the feature is not supported.
Code example:
// Defines the error callback. function errorCB(err) { console.log( 'The following error occurred: ' + err.name); } // Defines the person search success callback. function personsFoundCB(persons) { console.log(persons.length + ' results found.'); } // Finds all the persons in the contact DB that have the word Ramone in their display name. var filter = new tizen.AttributeFilter('displayName', 'CONTAINS', 'Ramone'); // The persons returned by the find() query will be sorted in the ascending order of their display name. var sortingMode = new tizen.SortMode('displayName', 'ASC'); try { tizen.contact.find(personsFoundCB, errorCB, filter, sortingMode); } catch (err) { console.log( 'The following error occurred while finding: ' + err.name); }
addChangeListener
long addChangeListener(PersonsChangeCallback successCallback);
Since: 2.0
When executed, the implementation must immediately return a subscription identifier that identifies the watch operation. After returning the identifier, the watch operation is started asynchronously.
Privilege level: public
Privilege: http://tizen.org/privilege/contact.read
Parameters:
Return value:
long Identifier used to clear the watch subscription.Exceptions:
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type InvalidValuesError, if any of the input parameters contain an invalid value.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type NotSupportedError, if the feature is not supported.
with error type UnknownError in any other case.
Code example:
var watcherId = 0; // watcher identifier var watcher = { onpersonsadded: function(persons) { console.log(persons.length + ' persons were added'); }, onpersonsupdated: function(persons) { console.log(persons.length + ' persons were updated'); }, onpersonsremoved: function(ids) { console.log(ids.length + ' persons were deleted'); } }; // Registers to be notified when the person changes. watcherId = tizen.contact.addChangeListener(watcher);
removeChangeListener
void removeChangeListener(long watchId);
Since: 2.0
If the watchId argument is valid and corresponds to a subscription already in place, the watch process must immediately stop and no further callbacks MUST be invoked. If the watchId argument is not valid or does not correspond to a valid subscription, the method should return without any further action.
Privilege level: public
Privilege: http://tizen.org/privilege/contact.read
Parameters:
Exceptions:
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type InvalidValuesError, if any of the input parameters contain an invalid value.
with error type NotFoundError, if there is no listener with the given identifier.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type NotSupportedError, if the feature is not supported.
with error type UnknownError in any other error case.
Code example:
var watcherId = 0; // watcher identifier // Receives person changes. var watcher = { onpersonsadded: function(persons) { console.log(persons.length + ' persons were added'); }, onpersonsupdated: function(persons) { console.log(persons.length + ' persons were updated'); }, onpersonsremoved: function(ids) { console.log(ids.length + ' persons were removed'); } }; // Cancels the watch operation. function cancelWatch() { tizen.contact.removeChangeListener(watcherId); } // Registers to be notified of person changes. watcherId = tizen.contact.addChangeListener(watcher);
[Constructor(AccountId accountId, DOMString name)] interface AddressBook { readonly attribute AddressBookId? id; readonly attribute DOMString name; readonly attribute boolean readOnly; readonly attribute AccountId? accountId; Contact get(ContactId id) raises(WebAPIException); void add(Contact contact) raises(WebAPIException); void addBatch(Contact[] contacts, optional ContactArraySuccessCallback? successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void update(Contact contact) raises(WebAPIException); void updateBatch(Contact[] contacts, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void remove(ContactId id) raises(WebAPIException); void removeBatch(ContactId[] ids, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void find(ContactArraySuccessCallback successCallback, optional ErrorCallback? errorCallback, optional AbstractFilter? filter, optional SortMode? sortMode) raises(WebAPIException); long addChangeListener(AddressBookChangeCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void removeChangeListener(long watchId) raises(WebAPIException); ContactGroup getGroup(ContactGroupId groupId) raises(WebAPIException); void addGroup(ContactGroup group) raises(WebAPIException); void updateGroup(ContactGroup group) raises(WebAPIException); void removeGroup(ContactGroupId groupId) raises(WebAPIException); ContactGroup[] getGroups() raises(WebAPIException); };
Since: 1.0
An address book is a collection of contacts and groups. This interface offers the following methods to manage the address book and to manipulate contacts within the address book:
This interface also offers the following methods to manipulate groups within the address book:
Code example:
var appId = tizen.application.getCurrentApplication().appInfo.id; tizen.account.getAccounts(function(accounts) { var account = accounts[0]; if(account) { var addressbook = new tizen.AddressBook( account.id, 'remote addressbook' ); // 'addressbook' variable is not available until it is inserted into database. tizen.contact.addAddressBook(addressbook); } }, function(e) { console.log('Error: ' + e.message); }, appId);
AddressBook(AccountId accountId, DOMString name);
The value of this attribute is null if the address book is the unified address book.
Since: 1.0
Since: 1.0
Some on line address books cannot be edited and will have this flag set to true.
Since: 1.0
Since: 2.3
get
Since: 1.0
Privilege level: public
Privilege: http://tizen.org/privilege/contact.read
Parameters:
Return value:
Contact The matching Contact objectExceptions:
with error type NotFoundError, if there is no contact with the given identifier.
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type InvalidValuesError, if any of the input parameters contain an invalid value.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type NotSupportedError, if the feature is not supported.
with error type UnknownError in any other error case.
Code example:
var contactRef; // ContactRef supposed to be initialized try { // Retrieves the Contact corresponding to a given ContactRef. var addressBook = tizen.contact.getAddressBook(contactRef.addressBookId); var contact = addressBook.get(contactRef.contactId); console.log("Successfully resolved contact with id: " + contactRef.contactId); } catch(err) { console.log("Error: " + err.name); }
add
void add(Contact contact);
Since: 1.0
If the contact is successfully inserted in the addressbook, the Contact object will have its identifier (id attribute) set when the function returns. This operation is done successfully, a new person object is also generated automatically.
If you wish to update an existing contact, call the update() method instead. If you wish to add a copy of an existing Contact object, call the Contact.clone() method first and pass the clone to the add() method.
The contact shall be added to default address book if the address book is the unified address book.
Privilege level: public
Privilege: http://tizen.org/privilege/contact.write
Parameters:
Exceptions:
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type InvalidValuesError, if any input parameter contains invalid values.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type NotSupportedError, if the feature is not supported.
with error type UnknownError, if any other error occurs while trying to insert the contact.
Code example:
var addressbook; // Gets the default address book. addressbook = tizen.contact.getDefaultAddressBook(); try { var contact = new tizen.Contact({name: new tizen.ContactName({firstName:'Jeffrey', lastName:'Hyman', nicknames:['joey ramone']}), emails:[new tizen.ContactEmailAddress('user@domain.com')], phoneNumbers:[new tizen.ContactPhoneNumber('123456789')]}); addressbook.add(contact); console.log('Contact added with id ' + contact.id); } catch (err) { console.log( 'The following error occurred while adding: ' + err.name); }
addBatch
void addBatch(Contact[] contacts, optional ContactArraySuccessCallback? successCallback, optional ErrorCallback? errorCallback);
Since: 1.0
If all the contacts are successfully added to the address book, the success callback will be invoked, passing the list of Contact objects that were added, with their identifier set (id attribute).
The ErrorCallback method is launched with these error types:
If you wish to update an existing contact, call the update() method instead. If you wish to add a copy of an existing Contact object, call Contact.clone() method first and pass the clone to the add() method.
If any of the contacts cannot be added, the error callback function that was passed in the invocation will be called.
The contacts shall be added to local phone address book if the address book is the default address book.
Privilege level: public
Privilege: http://tizen.org/privilege/contact.write
Parameters:
Exceptions:
with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type NotSupportedError, if this feature is not supported.
Code example:
var addressbook; // Defines the error callback function errorCB(err) { console.log( 'The following error occurred: ' + err.name); } // Defines the add contact success callback function contactsAddedCB(contacts) { console.log( contacts.length + ' contact(s) were successfully added to an Address Book' ); }; // Gets the default address book addressbook = tizen.contact.getDefaultAddressBook(); var c1 = new tizen.Contact({name: new tizen.ContactName({firstName:'Jeffrey', lastName:'Hyman', nicknames:['joey ramone']}), emails:[new tizen.ContactEmailAddress('user1@domain.com')], phoneNumbers:[new tizen.ContactPhoneNumber('123456789')]}); var c2 = new tizen.Contact({name: new tizen.ContactName({firstName:'Elton', lastName:'John', nicknames:['El']}), emails:[new tizen.ContactEmailAddress('user2@domain.com')], phoneNumbers:[new tizen.ContactPhoneNumber('987654321')]}); try { addressbook.addBatch([c1, c2], contactsAddedCB, errorCB); } catch (err) { console.log( 'The following error occurred while adding: ' + err.name); }
update
void update(Contact contact);
Since: 1.0
Privilege level: public
Privilege: http://tizen.org/privilege/contact.write
Parameters:
Exceptions:
with error type NotFoundError, if the identifier does not match.
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type InvalidValuesError, if any input parameter contains invalid values.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type NotSupportedError, if the feature is not supported.
with error type UnknownError, if the contact could not be updated to an unknown error.
Code example:
var addressbook; // Defines the error callback function errorCB(err) { console.log( 'The following error occurred: ' + err.name); } function contactsFoundCB(contacts) { // The contact has been successfully found. // Tries to change the first name. contacts[0].name.firstName = 'Christopher'; try { addressbook.update(contacts[0]); console.log('First contact was updated'); } catch (err) { console.log( 'The following error occurred while updating: ' + err.name); } } // Gets the default address book. addressbook = tizen.contact.getDefaultAddressBook(); var filter = new tizen.AttributeFilter('name.firstName', 'CONTAINS', 'Chris'); try { addressbook.find(contactsFoundCB, errorCB, filter); } catch (err) { console.log( 'The following error occurred while finding: ' + err.name); }
updateBatch
void updateBatch(Contact[] contacts, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
Since: 1.0
The ErrorCallback method is launched with these error types:
If any of the contacts could not be updated, the error callback function that was passed in the invocation will be called.
Privilege level: public
Privilege: http://tizen.org/privilege/contact.write
Parameters:
Exceptions:
with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type NotSupportedError, if this feature is not supported.
Code example:
var addressbook; // Defines the error callback for all the asynchronous calls. function errorCB(err) { console.log('The following error occurred: ' + err.name); } function contactsUpdatedCB() { console.log('Contacts were updated'); } function contactsFoundCB(contacts) { // The contact has been successfully found. for(var i = 0; i < contacts.length; i++) { contacts[i].name.firstName = 'Christopher'; } try { addressbook.updateBatch(contacts, contactsUpdatedCB, errorCB); } catch (err) { console.log('The following error occurred while updating: ' + err.name); } } // Gets the default address book. addressbook = tizen.contact.getDefaultAddressBook(); var filter = new tizen.AttributeFilter('name.firstName', 'CONTAINS', 'Chris'); try { addressbook.find(contactsFoundCB, errorCB, filter); } catch (err) { console.log('The following error occurred while finding: ' + err.name); }
remove
void remove(ContactId id);
Since: 1.0
Removes the contact in the address book that corresponds to the specified identifier. This function will throw an exception if it failed to remove the specified contact.
Privilege level: public
Privilege: http://tizen.org/privilege/contact.write
Parameters:
Exceptions:
with error type NotFoundError, if the identifier does not match any contact in the address book.
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type InvalidValuesError, if any input parameter contains invalid values.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type NotSupportedError, if the feature is not supported.
with error type UnknownError, if the contact could not be removed to an unknown error.
Code example:
var addressbook; // Defines the error callback. function errorCB(err) { console.log('The following error occurred: ' + err.name); } function contactsFoundCB(contacts) { // The contact has been successfully found. if(contacts.length > 0) { try { addressbook.remove(contacts[0].id); console.log('First contact was removed'); } catch (err) { console.log('The following error occurred while removing: ' + err.name); } } else { console.log( 'No contacts.'); } } // Gets the default address book. addressbook = tizen.contact.getDefaultAddressBook(); var filter = new tizen.AttributeFilter('name.firstName', 'CONTAINS', 'Chris'); try { addressbook.find(contactsFoundCB, errorCB, filter); } catch (err) { console.log( 'The following error occurred while finding: ' + err.name); }
removeBatch
void removeBatch(ContactId[] ids, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
Since: 1.0
The ErrorCallback method is launched with these error types:
Privilege level: public
Privilege: http://tizen.org/privilege/contact.write
Parameters:
Exceptions:
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type NotSupportedError, if the feature is not supported.
Code example:
var addressbook; // Defines the error callback. function errorCB(err) { console.log( 'The following error occurred: ' + err.name); } function contactsRemovedCB() { console.log('Contacts were removed'); } function contactsFoundCB(contacts) { // The contact has been successfully found. if(contacts.length > 2) { try { addressbook.removeBatch([contacts[0].id, contacts[1].id], contactsRemovedCB, errorCB); } catch (err) { console.log( 'The following error occurred while removing: ' + err.name); } } else { console.log( 'Not enough contacts.'); } } // Gets the default address book. addressbook = tizen.contact.getDefaultAddressBook(); var filter = new tizen.AttributeFilter('name.firstName', 'CONTAINS', 'Chris'); try { addressbook.find(contactsFoundCB, errorCB, filter); } catch (err) { console.log( 'The following error occurred while finding: ' + err.name); }
find
void find(ContactArraySuccessCallback successCallback, optional ErrorCallback? errorCallback, optional AbstractFilter? filter, optional SortMode? sortMode);
Since: 1.0
If the filter is passed and contains valid values, only those values in the address book that match the filter criteria as specified in the AbstractFilter interface will be returned in the successCallback. If no filter is passed, the filter contains any invalid values, the filter is null or undefined, then the implementation MUST return the full list of contact items in the successCallback. If no contacts are available in the address book or no contact matches the filter criteria, the successCallback will be invoked with an empty array.
The ErrorCallback method is launched with these error types:
Privilege level: public
Privilege: http://tizen.org/privilege/contact.read
Parameters:
Exceptions:
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type NotSupportedError, if the feature is not supported.
Code example:
var addressbook; // Defines the error callback. function errorCB(err) { console.log( 'The following error occurred: ' + err.name); } // Defines the contact search success callback. function contactsFoundCB(contacts) { console.log(contacts.length + ' results found.'); } // Gets the default address book. addressbook = tizen.contact.getDefaultAddressBook(); // Finds all contacts in the address book that have "Ramone" in the nick name. var filter = new tizen.AttributeFilter('name.nicknames', 'CONTAINS', 'Ramone'); // The contacts returned by the find() query will be sorted by // ascending last name. var sortingMode = new tizen.SortMode('name.lastName', 'ASC'); try { addressbook.find(contactsFoundCB, errorCB, filter, sortingModes); } catch (err) { console.log( 'The following error occurred while finding: ' + err.name); }
addChangeListener
long addChangeListener(AddressBookChangeCallback successCallback, optional ErrorCallback? errorCallback);
Since: 1.0
When executed, the implementation must immediately return a subscription identifier that identifies the watch operation. After returning the identifier, the watch operation is started asynchronously.
Privilege level: public
Privilege: http://tizen.org/privilege/contact.read
Parameters:
Return value:
long An identifier used to clear the watch subscriptionExceptions:
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type InvalidValuesError, if any of the input parameters contain an invalid value.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type NotSupportedError, if the feature is not supported.
with error type UnknownError in any other case.
Code example:
var watcherId = 0; // watcher identifier var addressbook; // This example assumes addressbook is initialized var watcher = { oncontactsadded: function(contacts) { console.log(contacts.length + ' contacts were added'); }, oncontactsupdated: function(contacts) { console.log(contacts.length + ' contacts were updated'); }, oncontactsremoved: function(ids) { console.log(ids.length + ' contacts were deleted'); } }; // Registers to be notified when the address book changes. watcherId = addressbook.addChangeListener(watcher);
removeChangeListener
void removeChangeListener(long watchId);
Since: 1.0
If the watchId argument is valid and corresponds to a subscription already in place, the watch process MUST immediately stop and no further callbacks MUST be invoked. If the watchId argument is not valid or does not correspond to a valid subscription, the method should return without any further action.
Privilege level: public
Privilege: http://tizen.org/privilege/contact.read
Parameters:
Exceptions:
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type InvalidValuesError, if any of the input parameters contain an invalid value.
with error type NotFoundError, if there is no listener with the given identifier.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type NotSupportedError, if the feature is not supported.
with error type UnknownError in any other error case.
Code example:
var watcherId = 0; // watcher identifier var addressbook; // This example assumes addressbook is initialized // Receives address book changes. var watcher = { oncontactsadded: function(contacts) { console.log(contacts.length + ' contacts were added'); }, oncontactsupdated: function(contacts) { console.log(contacts.length + ' contacts were updated'); }, oncontactsremoved: function(ids) { console.log(ids.length + ' contacts were removed'); } }; // Cancels the watch operation. function cancelWatch() { addressbook.removeChangeListener(watcherId); } // Registers to be notified when the address book changes. watcherId = addressbook.addChangeListener(watcher);
getGroup
ContactGroup getGroup(ContactGroupId groupId);
Since: 2.0
Privilege level: public
Privilege: http://tizen.org/privilege/contact.read
Parameters:
Return value:
ContactGroup The matching ContactGroup objectExceptions:
with error type NotFoundError, if there is no contact with the given identifier.
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type InvalidValuesError, if any of the input parameters contain an invalid value.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type NotSupportedError, if the feature is not supported.
with error type UnknownError in any other error case.
Code example:
try { // Retrieves the Person corresponding to a Contact. var addressBook = tizen.contact.getAddressBook(contactRef.addressBookId); var contact = addressBook.get(contactRef.contactId); var group = addressBook.getGroup(contact.groupIds[0].id); console.log("Successfully resolved group with id: " + contact.groupIds[0].id); } catch(err) { console.log("Error: " + err.name); }
addGroup
void addGroup(ContactGroup group);
Since: 2.0
If the group is successfully inserted in the addressbook, the Group object will have its identifier (id attribute) set when the function returns.
The group shall be added to local phone address book if the address book is the default address book.
Privilege level: public
Privilege: http://tizen.org/privilege/contact.write
Parameters:
Exceptions:
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type InvalidValuesError, if any input parameter contains invalid values.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type NotSupportedError, if the feature is not supported.
with error type UnknownError, if any other error occurs while trying to insert the contact.
Code example:
var addressbook; // Gets the address book. var addressbook = tizen.contact.getDefaultAddressBook(); try { var group = new tizen.ContactGroup('Company'); addressbook.addGroup(group); console.log('Group added with id ' + group.id); } catch (err) { console.log( 'The following error occurred while adding: ' + err.name); }
updateGroup
void updateGroup(ContactGroup group);
Since: 2.0
Privilege level: public
Privilege: http://tizen.org/privilege/contact.write
Parameters:
Exceptions:
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type InvalidValuesError, if any input parameter contains invalid values.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type NotSupportedError, if the feature is not supported.
with error type UnknownError, if the group could not be updated to an unknown error.
Code example:
var addressbook; // Gets the address book. var addressbook = tizen.contact.getDefaultAddressBook(); try { groups = addressbook.getGroups(); groups[0].name = 'Friends'; addressbook.updateGroup(groups[0]); console.log('First group was updated'); } catch (err) { console.log( 'The following error occurred while adding: ' + err.name); }
removeGroup
void removeGroup(ContactGroupId groupId);
Since: 2.0
Removes the group in the address book that corresponds to the specified identifier. This method will throw an exception if it failed to remove the specified group.
Privilege level: public
Privilege: http://tizen.org/privilege/contact.write
Parameters:
Exceptions:
with error type NotFoundError, if the identifier does not match any contact in the address book.
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type InvalidValuesError, if any input parameter contains invalid values.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type NotSupportedError, if the feature is not supported.
with error type UnknownError, if the group could not be removed to an unknown error.
Code example:
var addressbook; // Gets the default address book. var addressbook = tizen.contact.getDefaultAddressBook(); try { groups = addressbook.getGroups(); addressbook.removeGroup(groups[0].id); console.log('First group was removed'); } catch (err) { console.log( 'The following error occurred while finding: ' + err.name); }
getGroups
ContactGroup[] getGroups();
Since: 2.0
Privilege level: public
Privilege: http://tizen.org/privilege/contact.read
Return value:
ContactGroup[] The array of ContactGroup object from this address bookExceptions:
with error type NotFoundError, if the identifier does not match any contact in the address book.
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type InvalidValuesError, if any input parameter contains invalid values.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type NotSupportedError, if the feature is not supported.
with error type UnknownError, if the group could not be retrieved due to an unknown error.
Code example:
var addressbook; // Gets the default address book. var addressbook = tizen.contact.getDefaultAddressBook(); try { groups = addressbook.getGroups(); console.log('Number of groups is ' + groups.length); } catch (err) { console.log( 'The following error occurred while finding: ' + err.name); }
[NoInterfaceObject] interface Person { readonly attribute PersonId id; readonly attribute DOMString displayName; readonly attribute long contactCount; readonly attribute boolean hasPhoneNumber; readonly attribute boolean hasEmail; attribute boolean isFavorite; attribute DOMString? photoURI; attribute DOMString? ringtoneURI; attribute ContactId displayContactId; void link(PersonId personId) raises(WebAPIException); Person unlink(ContactId contactId) raises(WebAPIException); };
Since: 2.0
Since: 2.0
Since: 2.0
Since: 2.0
Since: 2.0
Since: 2.0
Indicates whether the person was marked as Favorite.
By default, this attribute is set to false.
Since: 2.0
This attribute is used to store a URI that points to an image that can represent the person object. This attribute only contains a local file URI. Person's photoURI is bounded to linked contacts' valid photoURI. It means that if photoURI exists, it cannot become null and except the linked contact's photoURI, any other file cannot be set as photoURI.
By default, this attribute is set to null.
Since: 2.0
By default, this attribute is initialized to null. This attribute only contains a local file URI.
Since: 2.0
The contact, this value is indicating, is used to show detailed information of the person.
Since: 2.0
link
void link(PersonId personId);
Since: 2.0
Person is a meta object which aggregates contacts and to make a person, user should combine related contacts. For this operation, link method is provided. If "Person A" is linked to "Person B", contacts related to "Person A" are aggregated to "Person B". After this function returns, the target "Person A" is removed from DB.
Privilege level: public
Privilege: http://tizen.org/privilege/contact.write
Parameters:
Exceptions:
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type InvalidValuesError, if any input parameter contains invalid values.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type NotSupportedError, if the feature is not supported.
with error type UnknownError, if any other error occurs while trying to insert the contact.
Code example:
// Defines the error callback for all the asynchronous calls. function errorCB(err) { console.log( 'The following error occurred: ' + err.name); } function personsFoundCB(persons) { // The persons have been successfully found. try { persons[0].link(persons[1].id); console.log('Second person was merged to the first person.'); } catch (err) { console.log( 'The following error occurred while updating: ' + err.name); } } try { tizen.contact.find(personsFoundCB, errorCB); } catch (err) { console.log( 'The following error occurred while adding: ' + err.name); }
unlink
Since: 2.0
Person is aggregated contacts and if a user wants to detach one contact from person, unlink method is provided. Unlink is basically detaching a contact object from linked contacts so only a contact ID linked to the person can be used as the input parameter. This function returns a newly created Person object that indicates the separated contact.
Privilege level: public
Privilege: http://tizen.org/privilege/contact.write
Parameters:
Exceptions:
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type InvalidValuesError, if any input parameter contains invalid values.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type NotSupportedError, if the feature is not supported.
with error type UnknownError, if any other error occurs while trying to insert the contact.
Code example:
var myPersonId = '1'; //ID of modified var addressbook; // Default addressbook var person; // Existing person obtained from addressbook var newPerson; // New person, which will be created during unlink // Defines the error callback. function errorCB(err) { console.log( 'The following error occurred: ' + err.name); } // Defines the contact search success callback. function contactsFoundCB(contacts) { if (contacts.length > 1) { try { // Unlinks the first contact. newPerson = person.unlink(contacts[0].id); } catch (err) { console.log( 'The following error occurred while unlink: ' + err.name); } } else { console.log( 'Not enough contacts '); } } try { // Gets the person. person = tizen.contact.get(myPersonId); // Gets the default address book. addressbook = tizen.contact.getDefaultAddressBook(); // Finds all the contacts in the default address book with personId // as exactly myPersonId. var filter = new tizen.AttributeFilter('personId', 'EXACTLY', myPersonId); addressbook.find(contactsFoundCB, errorCB, filter); } catch (err) { console.log( 'The following error occurred while processing: ' + err.name); }
dictionary ContactInit { ContactName name; ContactAddress[] addresses; DOMString photoURI; ContactPhoneNumber[] phoneNumbers; ContactEmailAddress[] emails; ContactInstantMessenger[] messengers; ContactRelationship[] relationships; Date birthday; ContactAnniversary[] anniversaries; ContactOrganization[] organizations; DOMString[] notes; ContactWebSite[] urls; DOMString ringtoneURI; DOMString messageAlertURI; DOMString vibrationURI; ContactGroupId[] groupIds; };
Since: 1.0
This dictionary is used to input parameters when contacts are created.
[Constructor(optional ContactInit? ContactInitDict), Constructor(DOMString stringRepresentation)] interface Contact { readonly attribute ContactId? id; readonly attribute PersonId? personId; readonly attribute AddressBookId? addressBookId; readonly attribute Date? lastUpdated; readonly attribute boolean isFavorite; attribute ContactName? name setraises(WebAPIException); attribute ContactAddress[] addresses setraises(WebAPIException); attribute DOMString? photoURI setraises(WebAPIException); attribute ContactPhoneNumber[] phoneNumbers setraises(WebAPIException); attribute ContactEmailAddress[] emails setraises(WebAPIException); attribute ContactInstantMessenger[] messengers; attribute ContactRelationship[] relationships; attribute Date? birthday setraises(WebAPIException); attribute ContactAnniversary[] anniversaries setraises(WebAPIException); attribute ContactOrganization[] organizations setraises(WebAPIException); attribute DOMString[] notes setraises(WebAPIException); attribute ContactWebSite[] urls setraises(WebAPIException); attribute DOMString? ringtoneURI setraises(WebAPIException); attribute DOMString? messageAlertURI; attribute DOMString? vibrationURI; attribute ContactGroupId[] groupIds setraises(WebAPIException); DOMString convertToString(optional ContactTextFormat? format) raises(WebAPIException); Contact clone() raises(WebAPIException); };
Since: 1.0
Code example:
// Gets the default address book. var addressbook = tizen.contact.getDefaultAddressBook(); var contact = null; try { contact = new tizen.Contact( "BEGIN:VCARD\n"+ "VERSION:3.0\n"+ "N:Gump;Forrest\n"+ "FN:Forrest Gump\n"+ "ORG:Bubba Gump Shrimp Co.\n"+ "TITLE:Shrimp Man\n"+ "TEL;WORK:(111) 555-1212\n"+ "TEL;HOME:(404) 555-1212\n"+ "EMAIL;WORK;PREF:forrestgump@example.com\n"+ "END:VCARD"); } catch (err) { console.log( 'The following error occurred while converting: ' + err.name); } try { if (contact) { addressbook.add(contact); console.log('Contact was added with ID ' + contact.id); } } catch (err) { console.log( 'The following error occurred while adding: ' + err.name); }
Contact(optional ContactInit? ContactInitDict);
Contact(DOMString stringRepresentation);
By default, this attribute is set to null.
Since: 1.0
By default, this attribute is set to null.
Since: 2.0
Since: 2.0
Specifies revision information about the contact.
By default, this attribute is set to null. Initially, once a contact is added to an address book, this value is the same as the creation date. For more details, see RFC 2426, Section 3.6.4.
Since: 1.0
This value is associated with the isFavorite attribute of Person that this contact indicates.
By default, this attribute is set to false.
Since: 1.0
Code example:
if (contact.isFavorite) { // ... }
Since: 1.0
By default, this attribute is set to an empty array.
Since: 1.0
Code example:
var contactInit = {}; var contactAddr = new tizen.ContactAddres({streetAddress:'Gran Via, 32', postalCode:'50013', city:'Zaragoza', country:'ES'}); contactInit.addresses = [contactAddr];
This attribute is used to store a URI that points to an image that can represent the contact object. This attribute only contains a local file URI. See RFC 2426, Section 3.1.4.
By default, this attribute is set to null.
Since: 1.0
Code example:
var contactInit = {}; tizen.filesystem.resolve('images/mypicture.jpg', function(imageFile) { contactInit.photoURI = imageFile.toURI(); });
By default, this attribute is set to an empty array.
Since: 1.0
Code example:
var contactInit = {}; var phoneNumber = new tizen.ContactPhoneNumber('123456789'); contactInit.phoneNumbers = [phoneNumber];
By default, this attribute is set to an empty array.
Since: 1.0
Code example:
var contactInit = {}; var email = new tizen.ContactEmailAddress('deedee@ramones.com'); contactInit.emails = [email];
By default, this attribute is set to an empty array.
Since: 2.3
Code example:
var contactInit = {}; var messenger = new tizen.ContactInstantMessenger('user@example.com'); contactInit.messengers = [messenger];
The direction of relationship is: contact (owner of relationship) is a relationship type to relative name.
By default, this attribute is set to an empty array.
Since: 2.3
Code example:
var contactInit = {}; // Contact is brother of 'Anna'. var relationship = new tizen.ContactRelationship('Anna', "BROTHER"); contactInit.relationships = [relationship];
Date specification of the birthday of the contact (see RFC 2426 Section 3.1.5).
By default, this attribute is set to null.
Since: 1.0
Code example:
var contactInit = {}; contactInit.birthday = new Date(1996, 4, 15);
Defines arbitrary anniversaries for the contact (in addition to the birthday).
By default, this attribute is set to an empty array.
Since: 1.0
Code example:
var contactInit = {}; var marriage_anniv = new tizen.ContactAnniversary(new Date(1976, 11, 2), 'Marriage'); contactInit.anniversaries = [marriage_anniv];
Contains information related to the contact's company or organization.
For more details, see RFC 2426, Section 3.5.
Since: 1.0
To specify supplemental information or a comment related to the contact.
For more details, see RFC 2426, Section 3.6.2.
Since: 2.0
By default, this attribute is initialized to an empty array.
In case multiple URLs are available, the first one is the default one. For more details, see RFC 2426, Section 3.6.8.
Since: 1.0
To specify a custom ringtone for the contact.
By default, this attribute is initialized to null. This attribute only contains a local file URI scheme; For more details, see RFC 2426, Section 3.6.6.
Since: 1.0
By default, this attribute is initialized to null. This attribute only contains a local file URI.
Since: 2.3
Vibration patterns in .ivt files are accepted. If an invalid file is set the default vibration alert will be used.
By default, this attribute is initialized to null. This attribute only contains a local file URI.
Since: 2.3
To associate groups to the contact.
By default, this attribute is initialized to an empty array.
In case multiple categories are available, the first one is the default one. See RFC 2426, Section 3.6.1.
Since: 2.0
convertToString
DOMString convertToString(optional ContactTextFormat? format);
Since: 1.0
A textual representation for the contact will be generated and returned synchronously. The export format is set via the format parameter.
Parameters:
Return value:
DOMString The string representation of the Contact itemExceptions:
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type SecurityError, if the functionality is not allowed.
with error type NotSupportedError, if the feature is not supported.
with error type UnknownError in any other error case.
Code example:
var addressbook; // Defines the error callback. function errorCB(err) { console.log( 'The following error occurred: ' + err.name); } // Defines the contact find success callback. function contactsFoundCB(contacts) { try { // Converts the first contact to vCard 3.0 format. var vcard = contacts[0].convertToString("VCARD_30"); console.log('textual representation of the contact is: ' + vcard); } catch (err) { console.log( 'The following error occurred while converting: ' + err.name); } } // Gets the default address book. addressbook = tizen.contact.getDefaultAddressBook(); // Finds all contacts in the address book whose first name contains the string 'Chris'. var filter = new tizen.AttributeFilter('firstName', 'CONTAINS', 'Chris'); try { addressbook.find(contactsFoundCB, errorCB, filter); } catch (err) { console.log( 'The following error occurred while finding: ' + err.name); }
clone
Contact clone();
Since: 1.0
Creates a clone of the Contact object, detached from any address book.
The Contact object returned by the clone() method will have its identifier set to null and will be detached from any address book.
Return value:
Contact A new clone of the Contact objectExceptions:
with error type SecurityError, if the functionality is not allowed.
with error type NotSupportedError, if the feature is not supported.
with error type UnknownError in any other error case.
Code example:
// Gets the default address book. var addressbook = tizen.contact.getDefaultAddressBook(); var bob = new tizen.Contact(); bob.name = new tizen.ContactName({firstName:'Bob', lastName:'Smith'}); addressbook.add(bob); var alice = bob.clone(); contact.name.firstName = "Alice"; // Bob's wife addressbook.add(alice);
[Constructor(AddressBookId addressBookId, ContactId contactId)] interface ContactRef { attribute AddressBookId addressBookId; attribute ContactId contactId; };
Since: 1.0
It contains both the identifier of the address book which the contact is in, and the contact identifier within this address book.
This interface is used by other APIs to uniquely and globally identify contacts.
ContactRef(AddressBookId addressBookId, ContactId contactId);
Since: 1.0
Since: 1.0
dictionary ContactNameInit { DOMString prefix; DOMString suffix; DOMString firstName; DOMString middleName; DOMString lastName; DOMString[] nicknames; DOMString phoneticFirstName; DOMString phoneticMiddleName; DOMString phoneticLastName; };
Since: 1.0
See the ContactName interface for more information about the members.
[Constructor(optional ContactNameInit? nameInitDict)] interface ContactName { attribute DOMString? prefix; attribute DOMString? suffix; attribute DOMString? firstName; attribute DOMString? middleName; attribute DOMString? lastName; attribute DOMString[] nicknames; attribute DOMString? phoneticFirstName; attribute DOMString? phoneticMiddleName; attribute DOMString? phoneticLastName; readonly attribute DOMString? displayName; };
Since: 1.0
ContactName(optional ContactNameInit? nameInitDict);
By default, this attribute is initialized to null. See also RFC 2426, Section 3.1.1.
Since: 1.0
Code example:
contact.name.prefix = "Dr.";
By default, this attribute is initialized to null. See also RFC 2426, Section 3.1.1.
Since: 2.0
Code example:
contact.name.suffix = "Jr.";
By default, this attribute is initialized to null. See also RFC 2426, Section 3.1.1.
Since: 1.0
Code example:
contact.name.firstName = 'Douglas';
By default, this attribute is initialized to null. See also RFC 2426, Section 3.1.1.
Since: 1.0
Code example:
contact.name.middleName = 'Glenn';
By default, this attribute is initialized to null. See also RFC 2426, Section 3.1.1.
Since: 1.0
Code example:
contact.name.lastName = 'Colvin';
The nickname is a name used instead of, or in addition to, the given name of a contact, place, or thing. It can also be used to specify a familiar form of a proper name.
By default, this attribute is initialized to an empty array.
In case multiple nicknames are available the first one is the default. See RFC 2426, Section 3.1.3.
Since: 1.0
Code example:
contact.name.nickNames = ['Dee Dee'];
Describes how the first name should be pronounced. This is very important in some languages, such as Japanese, because the same 'Kanji' may have several pronunciations.
By default, this attribute is set to null.
Since: 2.0
Describes how the middle name should be pronounced. This is very important in some languages, such as Japanese, because the same 'Kanji' may have several pronunciations.
By default, this attribute is set to null.
Since: 2.3
Describes how the last name should be pronounced. This is very important in some languages, such as Japanese, because the same 'Kanji' may have several pronunciations.
By default, this attribute is set to null.
Since: 2.0
The string which can be displayed to identify the contact. It is composed of the first and last names if available, otherwise, it will fall back to the most adequate field available to identify the contact (such as nickname).
By default, this attribute is set to null. Initially, once a contact is added to an address book, this value is composed.
Since: 1.0
dictionary ContactOrganizationInit { DOMString name; DOMString department; DOMString title; DOMString role; DOMString logoURI; };
Since: 1.0
See ContactOrganization interface for information about members.
[Constructor(optional ContactOrganizationInit? orgInitDict)] interface ContactOrganization { attribute DOMString? name; attribute DOMString? department; attribute DOMString? title; attribute DOMString? role; attribute DOMString? logoURI; };
Since: 1.0
By default, each of the attributes of this interface are null.
For more details, see RFC 2426, Section 3.5.
Code example:
var organization = new tizen.ContactOrganization({name: "Nice Company", role: "SW Engineer"});
ContactOrganization(optional ContactOrganizationInit? orgInitDict);
For more details, see RFC 2426, Section 3.5.5.
Since: 1.0
For more details, see RFC 2426, Section 3.5.5.
Since: 1.0
To specify the job title, functional position or function (such as 'Director, Research and Development').
For more details, see RFC 2426, Section 3.5.1.
Since: 1.0
For more details, see RFC 2426, Section 3.5.2.
Since: 1.0
To specify a graphic image of a logo associated with an organization. This attribute only contains file URI Scheme; remote pictures could be loaded to local with Download API. For more details, see RFC 2426, Section 3.5.3.
Since: 1.0
[Constructor(DOMString url, optional DOMString type)] interface ContactWebSite { attribute DOMString url; attribute DOMString type; };
Since: 1.0
For more details, see RFC 2426, Section 3.6.8.
Code example:
var contactInit = {} var blog = new tizen.ContactWebSite('http://www.domain.com', 'BLOG'); contactInit.urls = [blog];
ContactWebSite(DOMString url, optional DOMString type);
Since: 1.0
At least the following values must be supported:
By default, this attribute is set to HOMEPAGE.
Since: 1.0
[Constructor(Date date, optional DOMString? label)] interface ContactAnniversary { attribute Date date; attribute DOMString? label; };
Since: 1.0
Code example:
var contactInit = {} var marriage_anniv = new tizen.ContactAnniversary(new Date(1976, 11, 2), 'Marriage'); contactInit.anniversaries = [marriage_anniv];
ContactAnniversary(Date date, optional DOMString? label);
Since: 1.0
By default, this attribute is set to null.
Since: 1.0
dictionary ContactAddressInit { DOMString country; DOMString region; DOMString city; DOMString streetAddress; DOMString additionalInformation; DOMString postalCode; boolean isDefault; DOMString[] types; DOMString label; };
Since: 1.0
See ContactAddress interface for more information about the members.
[Constructor(optional ContactAddressInit? addressInitDict)] interface ContactAddress { attribute DOMString? country; attribute DOMString? region; attribute DOMString? city; attribute DOMString? streetAddress; attribute DOMString? additionalInformation; attribute DOMString? postalCode; attribute boolean isDefault; attribute DOMString[] types; attribute DOMString? label; };
Since: 1.0
Except isDefault and types attributes, each of the attributes of this interface are set to null by default.
For more details, see RFC 2426, Section 3.2.1.
Code example:
var contactInit = {}; var contactAddress = new tizen.ContactAddress({streetAddress:'Gran Via, 32', postalCode:'50013', city:'Zaragoza', country:'ES', types:['WORK']}); contactInit.contactAddress = [contactAddress];
ContactAddress(optional ContactAddressInit? addressInitDict);
It is recommended that the country is specified using the two-letter [ISO 3166-1] code.
Since: 1.0
For example, State (United States) or Province (Spain).
Since: 1.0
Since: 1.0
Since: 1.0
Since: 1.0
Since: 1.0
Indicates whether the address was marked as default for the contact. The only one among addresses for a person can have default property, so that this attribute might be changed without explicit modification according to the policy of platform.
It deals with the 'pref' TYPE on RFC 2426, Section 3.2.1.
By default, this attribute is set to false.
Since: 2.0
For more details, see RFC 2426, Section 3.2.1.
At least the following values must be supported:
By default, this attribute is set to HOME.
Since: 1.0
Remark : "OTHER" and "CUSTOM" types are added since Tizen 2.3.
By default, this attribute is initialized to null.
Since: 2.3
[Constructor(DOMString number, optional DOMString[] types, optional boolean isDefault)] interface ContactPhoneNumber { attribute DOMString number; attribute boolean isDefault; attribute DOMString[] types; attribute DOMString? label; };
Since: 1.0
This interface provides the phone number and the type of number such as work, home and car or the device subtype such as fax, fixed and mobile. When searching by phoneNumber, matchflag "CONTAINS" provides a result set which is retrieved from normalized phoneNumber as searching value.
For more details, see RFC 2426, Section 3.3.1
Code example:
var contactInit = {}; var phoneNumber = new tizen.ContactPhoneNumber('123456789', ['WORK','VOICE'], true); contactInit.phoneNumbers = [phoneNumber];
ContactPhoneNumber(DOMString number, optional DOMString[] types, optional boolean isDefault);
Since: 1.0
Indicates whether the phone number was marked as default for the contact. Only one phone number for a person can have the default property, so that this attribute might be changed without explicit modification according to the policy of platform.
It deals with the 'pref' TYPE on RFC 2426, Section 3.3.1
By default, this attribute is set to false.
Since: 2.0
Specifies the intended use of the phone number.
At least the following values must be supported:
Since: 1.0
Remark : "ASSISTANT", "OTHER" and "CUSTOM" types are added since Tizen 2.3.
By default, this attribute is initialized to null.
Since: 2.3
[Constructor(DOMString email, optional DOMString[] types, optional boolean isDefault)] interface ContactEmailAddress { attribute DOMString email; attribute boolean isDefault; attribute DOMString[] types; attribute DOMString? label; };
Since: 1.0
For more details, see RFC 2426, Section 3.3.2.
Code example:
var contactInit = {}; var email = new tizen.ContactEmailAddress('user@domain.com', ['WORK']); contactInit.emails = [email];
ContactEmailAddress(DOMString email, optional DOMString[] types, optional boolean isDefault);
Since: 1.0
Indicates whether the email address was marked as default for the contact. Only one email address for a person can have the default property, so that this attribute might be changed without explicit modification according to the policy of platform.
It deals with the 'pref' TYPE on RFC 2426, Section 3.3.2
By default, this attribute is set to false.
Since: 2.0
Specifies the intended use of the email address.
At least the following values must be supported:
By default, this attribute is set to WORK.
Since: 1.0
Remark : "OTHER" and "CUSTOM" types are added since Tizen 2.3.
By default, this attribute is initialized to null.
Since: 2.3
[Constructor(DOMString imAddress, optional ContactInstantMessengerType? type)] interface ContactInstantMessenger { attribute DOMString imAddress; attribute ContactInstantMessengerType type; attribute DOMString? label; };
Since: 2.3
Code example:
var contactInit = {}; var messenger = new tizen.ContactInstantMessenger('user@domain.com', 'GOOGLE'); contactInit.messengers = [messenger];
ContactInstantMessenger(DOMString imAddress, optional ContactInstantMessengerType? type);
Since: 2.3
By default, this attribute is set to "OTHER".
Since: 2.3
By default, this attribute is initialized to null.
Since: 2.3
[Constructor(DOMString name, optional DOMString? ringtoneURI, optional DOMString? photoURI)] interface ContactGroup { readonly attribute ContactGroupId? id; readonly attribute AddressBookId? addressBookId; attribute DOMString name; attribute DOMString? ringtoneURI; attribute DOMString? photoURI; readonly attribute DOMString readOnly; };
Since: 2.0
Code example:
var addressbook = null; var group = null; var ringtones = null; // Defines the error callback for all the asynchronous calls. function errorCB(err) { console.log( 'The following error occurred: ' + err.name); } // Defines the success callback for retrieving all the // Address Books. function addressBooksCB(addressbooks) { addressbook = addressbooks[0]; try { group = new tizen.ContactGroup('Family', ringtones.resolve('ring.mp3').toURI()); } catch (err) { console.log( 'The following error occurred while converting: ' + err.name); } try { if (group) { addressbook.addGroup(group); console.log('Group was added with ID ' + group.id); } } catch (err) { console.log( 'The following error occurred while adding: ' + err.name); } } tizen.filesystem.resolve("ringtones", function(dir) { ringtones = dir; tizen.contact.getAddressBooks(addressBooksCB, errorCB); });
ContactGroup(DOMString name, optional DOMString? ringtoneURI, optional DOMString? photoURI);
By default, this attribute is set to null.
Since: 2.0
By default, this attribute is set to null.
Since: 2.0
Since: 2.0
To specify a custom ringtone for a group.
By default, this attribute is initialized to null. This attribute only contains a local file URI.
Since: 2.0
By default, this attribute is set to null.
Since: 2.0
By default, this attribute is set to false.
Since: 2.0
[Constructor(DOMString relativeName, optional ContactRelationshipType? type)] interface ContactRelationship { attribute DOMString relativeName; attribute ContactRelationshipType type; attribute DOMString? label; };
Since: 2.3
The direction of relationship is: contact (owner of relationship) is a relationship type to relative name. See code example below.
Code example:
var contactInit = {}; // Contact is brother of 'Anna' var relationship = new tizen.ContactRelationship('Anna', 'BROTHER'); contactInit.relationships = [relationship];
ContactRelationship(DOMString relativeName, optional ContactRelationshipType? type);
Since: 2.3
By default, this attribute is set to "OTHER".
Since: 2.3
By default, this attribute is initialized to null.
Since: 2.3
[Callback=FunctionOnly, NoInterfaceObject] interface PersonArraySuccessCallback { void onsuccess(Person[] persons); };
Since: 2.0
The success callback that takes an array of persons as an input argument. It is used in the asynchronous operation to get or save a list of persons.
onsuccess
void onsuccess(Person[] persons);
Since: 2.0
Parameters:
[Callback=FunctionOnly, NoInterfaceObject] interface ContactArraySuccessCallback { void onsuccess(Contact[] contacts); };
Since: 1.0
The success callback that takes an array of contacts as an input argument. It is used in the asynchronous operation to get or save a list of contacts.
onsuccess
void onsuccess(Contact[] contacts);
Since: 1.0
Parameters:
[Callback=FunctionOnly, NoInterfaceObject] interface AddressBookArraySuccessCallback { void onsuccess(AddressBook[] addressbooks); };
Since: 1.0
The success callback takes an array of AddressBooks as an input argument. It is used in the asynchronous operation to get address books.
onsuccess
void onsuccess(AddressBook[] addressbooks);
Since: 1.0
Parameters:
[Callback, NoInterfaceObject] interface AddressBookChangeCallback { void oncontactsadded(Contact[] contacts); void oncontactsupdated(Contact[] contacts); void oncontactsremoved(ContactId[] contactIds); };
Since: 1.0
This interface specifies a set of functions that will be invoked every time an address book change occurs (contact addition/update/deletion).
oncontactsadded
void oncontactsadded(Contact[] contacts);
Since: 1.0
Parameters:
oncontactsupdated
void oncontactsupdated(Contact[] contacts);
Since: 1.0
Parameters:
oncontactsremoved
void oncontactsremoved(ContactId[] contactIds);
Since: 1.0
Parameters:
[Callback, NoInterfaceObject] interface PersonsChangeCallback { void onpersonsadded(Person[] persons); void onpersonsupdated(Person[] persons); void onpersonsremoved(PersonId[] personIds); };
Since: 2.0
This interface specifies a set of functions that will be invoked every time person list change occurs (person addition/update/deletion).
onpersonsadded
void onpersonsadded(Person[] persons);
Since: 2.0
Parameters:
onpersonsupdated
void onpersonsupdated(Person[] persons);
Since: 2.0
Parameters:
onpersonsremoved
void onpersonsremoved(PersonId[] personIds);
Since: 2.0
Parameters:
module Contact { typedef DOMString AddressBookId; typedef DOMString ContactId; typedef DOMString PersonId; typedef DOMString ContactGroupId; enum ContactTextFormat {"VCARD_30"}; enum ContactRelationshipType {"OTHER", "ASSISTANT", "BROTHER", "CHILD", "DOMESTIC_PARTNER", "FATHER", "FRIEND", "MANAGER", "MOTHER", "PARENT", "PARTNER", "REFERRED_BY", "RELATIVE", "SISTER", "SPOUSE", "CUSTOM"}; enum ContactInstantMessengerType {"OTHER", "GOOGLE", "WLM", "YAHOO", "FACEBOOK", "ICQ", "AIM", "QQ", "JABBER", "SKYPE", "IRC", "CUSTOM"}; [NoInterfaceObject] interface ContactManagerObject { readonly attribute ContactManager contact; }; Tizen implements ContactManagerObject; [NoInterfaceObject] interface ContactManager { void getAddressBooks(AddressBookArraySuccessCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); AddressBook getUnifiedAddressBook() raises(WebAPIException); AddressBook getDefaultAddressBook() raises(WebAPIException); void addAddressBook(AddressBook addressBook) raises(WebAPIException); void removeAddressBook(AddressBookId addressBookId) raises(WebAPIException); AddressBook getAddressBook(AddressBookId addressBookId) raises(WebAPIException); Person get(PersonId personId) raises(WebAPIException); void update(Person person) raises(WebAPIException); void updateBatch(Person[] persons, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void remove(PersonId personId) raises(WebAPIException); void removeBatch(PersonId[] personIds, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void find(PersonArraySuccessCallback successCallback, optional ErrorCallback? errorCallback, optional AbstractFilter? filter, optional SortMode? sortMode) raises(WebAPIException); long addChangeListener(PersonsChangeCallback successCallback) raises(WebAPIException); void removeChangeListener(long watchId) raises(WebAPIException); }; [Constructor(AccountId accountId, DOMString name)] interface AddressBook { readonly attribute AddressBookId? id; readonly attribute DOMString name; readonly attribute boolean readOnly; readonly attribute AccountId? accountId; Contact get(ContactId id) raises(WebAPIException); void add(Contact contact) raises(WebAPIException); void addBatch(Contact[] contacts, optional ContactArraySuccessCallback? successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void update(Contact contact) raises(WebAPIException); void updateBatch(Contact[] contacts, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void remove(ContactId id) raises(WebAPIException); void removeBatch(ContactId[] ids, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void find(ContactArraySuccessCallback successCallback, optional ErrorCallback? errorCallback, optional AbstractFilter? filter, optional SortMode? sortMode) raises(WebAPIException); long addChangeListener(AddressBookChangeCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void removeChangeListener(long watchId) raises(WebAPIException); ContactGroup getGroup(ContactGroupId groupId) raises(WebAPIException); void addGroup(ContactGroup group) raises(WebAPIException); void updateGroup(ContactGroup group) raises(WebAPIException); void removeGroup(ContactGroupId groupId) raises(WebAPIException); ContactGroup[] getGroups() raises(WebAPIException); }; [NoInterfaceObject] interface Person { readonly attribute PersonId id; readonly attribute DOMString displayName; readonly attribute long contactCount; readonly attribute boolean hasPhoneNumber; readonly attribute boolean hasEmail; attribute boolean isFavorite; attribute DOMString? photoURI; attribute DOMString? ringtoneURI; attribute ContactId displayContactId; void link(PersonId personId) raises(WebAPIException); Person unlink(ContactId contactId) raises(WebAPIException); }; dictionary ContactInit { ContactName name; ContactAddress[] addresses; DOMString photoURI; ContactPhoneNumber[] phoneNumbers; ContactEmailAddress[] emails; ContactInstantMessenger[] messengers; ContactRelationship[] relationships; Date birthday; ContactAnniversary[] anniversaries; ContactOrganization[] organizations; DOMString[] notes; ContactWebSite[] urls; DOMString ringtoneURI; DOMString messageAlertURI; DOMString vibrationURI; ContactGroupId[] groupIds; }; [Constructor(optional ContactInit? ContactInitDict), Constructor(DOMString stringRepresentation)] interface Contact { readonly attribute ContactId? id; readonly attribute PersonId? personId; readonly attribute AddressBookId? addressBookId; readonly attribute Date? lastUpdated; readonly attribute boolean isFavorite; attribute ContactName? name setraises(WebAPIException); attribute ContactAddress[] addresses setraises(WebAPIException); attribute DOMString? photoURI setraises(WebAPIException); attribute ContactPhoneNumber[] phoneNumbers setraises(WebAPIException); attribute ContactEmailAddress[] emails setraises(WebAPIException); attribute ContactInstantMessenger[] messengers; attribute ContactRelationship[] relationships; attribute Date? birthday setraises(WebAPIException); attribute ContactAnniversary[] anniversaries setraises(WebAPIException); attribute ContactOrganization[] organizations setraises(WebAPIException); attribute DOMString[] notes setraises(WebAPIException); attribute ContactWebSite[] urls setraises(WebAPIException); attribute DOMString? ringtoneURI setraises(WebAPIException); attribute DOMString? messageAlertURI; attribute DOMString? vibrationURI; attribute ContactGroupId[] groupIds setraises(WebAPIException); DOMString convertToString(optional ContactTextFormat? format) raises(WebAPIException); Contact clone() raises(WebAPIException); }; [Constructor(AddressBookId addressBookId, ContactId contactId)] interface ContactRef { attribute AddressBookId addressBookId; attribute ContactId contactId; }; dictionary ContactNameInit { DOMString prefix; DOMString suffix; DOMString firstName; DOMString middleName; DOMString lastName; DOMString[] nicknames; DOMString phoneticFirstName; DOMString phoneticMiddleName; DOMString phoneticLastName; }; [Constructor(optional ContactNameInit? nameInitDict)] interface ContactName { attribute DOMString? prefix; attribute DOMString? suffix; attribute DOMString? firstName; attribute DOMString? middleName; attribute DOMString? lastName; attribute DOMString[] nicknames; attribute DOMString? phoneticFirstName; attribute DOMString? phoneticMiddleName; attribute DOMString? phoneticLastName; readonly attribute DOMString? displayName; }; dictionary ContactOrganizationInit { DOMString name; DOMString department; DOMString title; DOMString role; DOMString logoURI; }; [Constructor(optional ContactOrganizationInit? orgInitDict)] interface ContactOrganization { attribute DOMString? name; attribute DOMString? department; attribute DOMString? title; attribute DOMString? role; attribute DOMString? logoURI; }; [Constructor(DOMString url, optional DOMString type)] interface ContactWebSite { attribute DOMString url; attribute DOMString type; }; [Constructor(Date date, optional DOMString? label)] interface ContactAnniversary { attribute Date date; attribute DOMString? label; }; dictionary ContactAddressInit { DOMString country; DOMString region; DOMString city; DOMString streetAddress; DOMString additionalInformation; DOMString postalCode; boolean isDefault; DOMString[] types; DOMString label; }; [Constructor(optional ContactAddressInit? addressInitDict)] interface ContactAddress { attribute DOMString? country; attribute DOMString? region; attribute DOMString? city; attribute DOMString? streetAddress; attribute DOMString? additionalInformation; attribute DOMString? postalCode; attribute boolean isDefault; attribute DOMString[] types; attribute DOMString? label; }; [Constructor(DOMString number, optional DOMString[] types, optional boolean isDefault)] interface ContactPhoneNumber { attribute DOMString number; attribute boolean isDefault; attribute DOMString[] types; attribute DOMString? label; }; [Constructor(DOMString email, optional DOMString[] types, optional boolean isDefault)] interface ContactEmailAddress { attribute DOMString email; attribute boolean isDefault; attribute DOMString[] types; attribute DOMString? label; }; [Constructor(DOMString imAddress, optional ContactInstantMessengerType? type)] interface ContactInstantMessenger { attribute DOMString imAddress; attribute ContactInstantMessengerType type; attribute DOMString? label; }; [Constructor(DOMString name, optional DOMString? ringtoneURI, optional DOMString? photoURI)] interface ContactGroup { readonly attribute ContactGroupId? id; readonly attribute AddressBookId? addressBookId; attribute DOMString name; attribute DOMString? ringtoneURI; attribute DOMString? photoURI; readonly attribute DOMString readOnly; }; [Constructor(DOMString relativeName, optional ContactRelationshipType? type)] interface ContactRelationship { attribute DOMString relativeName; attribute ContactRelationshipType type; attribute DOMString? label; }; [Callback=FunctionOnly, NoInterfaceObject] interface PersonArraySuccessCallback { void onsuccess(Person[] persons); }; [Callback=FunctionOnly, NoInterfaceObject] interface ContactArraySuccessCallback { void onsuccess(Contact[] contacts); }; [Callback=FunctionOnly, NoInterfaceObject] interface AddressBookArraySuccessCallback { void onsuccess(AddressBook[] addressbooks); }; [Callback, NoInterfaceObject] interface AddressBookChangeCallback { void oncontactsadded(Contact[] contacts); void oncontactsupdated(Contact[] contacts); void oncontactsremoved(ContactId[] contactIds); }; [Callback, NoInterfaceObject] interface PersonsChangeCallback { void onpersonsadded(Person[] persons); void onpersonsupdated(Person[] persons); void onpersonsremoved(PersonId[] personIds); }; };