src/XQueue/Maileon/API/Contacts/ContactsService.php
function synchronizeContacts($contacts, $permission = null, $syncMode = null, $useExternalId = false, $ignoreInvalidContacts = false, $reimportUnsubscribedContacts = true, $overridePermission = true, $updateOnly = false, $preferMaileonId = false)
    {
        $queryParameters = array(
            'permission' => ($permission == null) ? 1 : $permission->getCode(),
            'sync_mode' => ($syncMode == null) ? 2 : $syncMode->getCode(),
            'use_external_id' => ($useExternalId == TRUE) ? "true" : "false",
            'ignore_invalid_contacts' => ($ignoreInvalidContacts == TRUE) ? "true" : "false",
            'reimport_unsubscribed_contacts' => ($reimportUnsubscribedContacts == TRUE) ? "true" : "false",
            'override_permission' => ($overridePermission == TRUE) ? "true" : "false",
            'update_only' => ($updateOnly == TRUE) ? "true" : "false",
            'prefer_maileon_id' => ($preferMaileonId == TRUE) ? "true" : "false"
        );

        $cleanedContacts = new Contacts();
        foreach ($contacts as $contact) {
            $cleanedContact = new Contact($contact->id, $contact->email, null, $contact->external_id, null, $contact->standard_fields, $contact->custom_fields);
            $cleanedContacts->addContact($cleanedContact);
        }

        return $this->post("contacts", $cleanedContacts->toXMLString(), $queryParameters);
    }
function synchronizeContacts($contacts, $permission = null, $syncMode = null, $useExternalId = false, $ignoreInvalidContacts = false, $reimportUnsubscribedContacts = true, $overridePermission = true, $updateOnly = false, $preferMaileonId = false)
    {
        $queryParameters = array(
            'permission' => ($permission == null) ? 1 : $permission->getCode(),
            'sync_mode' => ($syncMode == null) ? 2 : $syncMode->getCode(),
            'use_external_id' => ($useExternalId == TRUE) ? "true" : "false",
            'ignore_invalid_contacts' => ($ignoreInvalidContacts == TRUE) ? "true" : "false",
            'reimport_unsubscribed_contacts' => ($reimportUnsubscribedContacts == TRUE) ? "true" : "false",
            'override_permission' => ($overridePermission == TRUE) ? "true" : "false",
            'update_only' => ($updateOnly == TRUE) ? "true" : "false",
            'prefer_maileon_id' => ($preferMaileonId == TRUE) ? "true" : "false"
        );

        $cleanedContacts = new Contacts();
        foreach ($contacts as $contact) {
            $cleanedContact = new Contact($contact->id, $contact->email, null, $contact->external_id, null, $contact->standard_fields, $contact->custom_fields);
            $cleanedContacts->addContact($cleanedContact);
        }

        return $this->post("contacts", $cleanedContacts->toXMLString(), $queryParameters);
    }
function synchronizeContacts ( $ contacts , $ permission = null , $ syncMode = null , $ useExternalId = false , $ ignoreInvalidContacts = false , $ reimportUnsubscribedContacts = true , $ overridePermission = true , $ updateOnly = false , $ preferMaileonId = false ) { $ queryParameters = array ( 'permission' => ( $ permission == null ) ? 1 : $ permission -> getCode ( ) , 'sync_mode' => ( $ syncMode == null ) ? 2 : $ syncMode -> getCode ( ) , 'use_external_id' => ( $ useExternalId == TRUE ) ? "true" : "false" , 'ignore_invalid_contacts' => ( $ ignoreInvalidContacts == TRUE ) ? "true" : "false" , 'reimport_unsubscribed_contacts' => ( $ reimportUnsubscribedContacts == TRUE ) ? "true" : "false" , 'override_permission' => ( $ overridePermission == TRUE ) ? "true" : "false" , 'update_only' => ( $ updateOnly == TRUE ) ? "true" : "false" , 'prefer_maileon_id' => ( $ preferMaileonId == TRUE ) ? "true" : "false" ) ; $ cleanedContacts = new Contacts ( ) ; foreach ( $ contacts as $ contact ) { $ cleanedContact = new Contact ( $ contact -> id , $ contact -> email , null , $ contact -> external_id , null , $ contact -> standard_fields , $ contact -> custom_fields ) ; $ cleanedContacts -> addContact ( $ cleanedContact ) ; } return $ this -> post ( "contacts" , $ cleanedContacts -> toXMLString ( ) , $ queryParameters ) ; }
Synchronizes a list of contacts with the contacts in the account and returns a detailed report with stats and validation errors.

@param com_maileon_api_contacts_Contacts $contacts
the contacts to synchronize
@param com_maileon_api_contacts_Permission $permission
the permission to set for the contacts
@param com_maileon_api_contacts_SynchronizationMode $syncMode
the sync mode to use
@param string $useExternalId
if set to true, the external id is used as identifier for the contacts.
Otherwise the email address is used as identifier.
@param string $ignoreInvalidContacts
if set to true, invalid contacts are ignored and the synchronization
succeeds for valid contacts.
@param string $reimportUnsubscribedContacts
if set to true, unsubscribed contacts will be imported, if false, they will be ommitted
@param boolean $overridePermission
if set to true the permission of existing and non existing contacts will be overwridden,
if false, the permission will be used for new contacts only and existing contacts will not be influenced.
@param boolean $updateOnly
If true, only existing contacts are updated and no new contacts are created
@param boolean $preferMaileonId
If true, Maileon tries identifying contacts by Maileon-ID, if available. Fallback is always the email address.
@return \em com_maileon_api_MaileonAPIResult
the result object of the API call. The
response XML reports which contacts were successfully synchronized as well as any errors that
might have occurred.
@throws com_maileon_api_MaileonAPIException
if there was a connection problem or a server error occurred
Synchronizes a list of contacts with the contacts in the account and returns a detailed report with stats and validation errors .