/**
  * Create a new mail list for the customer
  * 
  * The $data param must contain following indexed arrays:
  * -> customer
  * -> company
  * 
  * @param array $data
  * @return MailWizzApi_Http_Response
  */
 public function create(array $data)
 {
     if (isset($data['customer']['password'])) {
         $data['customer']['confirm_password'] = $data['customer']['password'];
     }
     if (isset($data['customer']['email'])) {
         $data['customer']['confirm_email'] = $data['customer']['email'];
     }
     if (empty($data['customer']['timezone'])) {
         $data['customer']['timezone'] = 'UTC';
     }
     $client = new MailWizzApi_Http_Client(array('method' => MailWizzApi_Http_Client::METHOD_POST, 'url' => $this->config->getApiUrl('customers'), 'paramsPost' => $data));
     return $response = $client->request();
 }
 /**
  * Get segments from a certain mail list
  * 
  * Note, the results returned by this endpoint can be cached.
  * 
  * @param string $listUid
  * @param integer $page
  * @param integer $perPage
  * @return MailWizzApi_Http_Response
  */
 public function getSegments($listUid, $page = 1, $perPage = 10)
 {
     $client = new MailWizzApi_Http_Client(array('method' => MailWizzApi_Http_Client::METHOD_GET, 'url' => $this->config->getApiUrl(sprintf('lists/%s/segments', $listUid)), 'paramsGet' => array('page' => (int) $page, 'per_page' => (int) $perPage), 'enableCache' => true));
     return $response = $client->request();
 }
 /**
  * Delete existing campaign for the customer
  * 
  * @param string $campaignUid
  * @return MailWizzApi_Http_Response
  */
 public function delete($campaignUid)
 {
     $client = new MailWizzApi_Http_Client(array('method' => MailWizzApi_Http_Client::METHOD_DELETE, 'url' => $this->config->getApiUrl(sprintf('campaigns/%s', $campaignUid))));
     return $response = $client->request();
 }
 /**
  * Get all available country zones
  * 
  * Note, the results returned by this endpoint can be cached.
  * 
  * @param integer $countryId
  * @param integer $page
  * @param integer $perPage
  * @return MailWizzApi_Http_Response
  */
 public function getZones($countryId, $page = 1, $perPage = 10)
 {
     $client = new MailWizzApi_Http_Client(array('method' => MailWizzApi_Http_Client::METHOD_GET, 'url' => $this->config->getApiUrl(sprintf('countries/%d/zones', $countryId)), 'paramsGet' => array('page' => (int) $page, 'per_page' => (int) $perPage), 'enableCache' => true));
     return $response = $client->request();
 }
 /**
  * Get fields from a certain mail list
  * 
  * Note, the results returned by this endpoint can be cached.
  * 
  * @param string $listUid
  * @return MailWizzApi_Http_Response
  */
 public function getFields($listUid)
 {
     $client = new MailWizzApi_Http_Client(array('method' => MailWizzApi_Http_Client::METHOD_GET, 'url' => $this->config->getApiUrl(sprintf('lists/%s/fields', $listUid)), 'paramsGet' => array(), 'enableCache' => true));
     return $response = $client->request();
 }
 /**
  * Search in a list gor given subscriber by email address
  * 
  * @param string $listUid
  * @param string $emailAddress
  * @return MailWizzApi_Http_Response
  */
 public function emailSearch($listUid, $emailAddress)
 {
     $client = new MailWizzApi_Http_Client(array('method' => MailWizzApi_Http_Client::METHOD_GET, 'url' => $this->config->getApiUrl(sprintf('lists/%s/subscribers/search-by-email', (string) $listUid)), 'paramsGet' => array('EMAIL' => (string) $emailAddress)));
     return $response = $client->request();
 }