* @copyright 2013 http://www.mailwizz.com/
 */
// require the setup which has registered the autoloader
require_once dirname(__FILE__) . '/setup.php';
// CREATE THE ENDPOINT
$endpoint = new MailWizzApi_Endpoint_Campaigns();
/*===================================================================================*/
// GET ALL ITEMS
$response = $endpoint->getCampaigns($pageNumber = 1, $perPage = 10);
// DISPLAY RESPONSE
echo '<pre>';
print_r($response->body);
echo '</pre>';
/*===================================================================================*/
// GET ONE ITEM
$response = $endpoint->getCampaign('CAMPAIGN-UNIQUE-ID');
// DISPLAY RESPONSE
echo '<pre>';
print_r($response->body);
echo '</pre>';
/*===================================================================================*/
// CREATE CAMPAIGN
$response = $endpoint->create(array('name' => 'My API Campaign', 'from_name' => 'John Doe', 'subject' => 'Hey, i am testing the campaigns via API', 'reply_to' => '*****@*****.**', 'send_at' => date('Y-m-d H:i:s', strtotime('+1 hour')), 'list_uid' => 'LIST-UNIQUE-ID', 'segment_uid' => 'SEGMENT-UNIQUE-ID', 'template' => array('content' => file_get_contents(dirname(__FILE__) . '/template-example.html'), 'inline_css' => 'no')));
// DISPLAY RESPONSE
echo '<hr /><pre>';
print_r($response->body);
echo '</pre>';
/*===================================================================================*/
// UPDATE CAMPAIGN
$response = $endpoint->update('CAMPAIGN-UNIQUE-ID', array('name' => 'My API Campaign UPDATED', 'from_name' => 'John Doe', 'subject' => 'Hey, i am testing the campaigns via API', 'reply_to' => '*****@*****.**', 'send_at' => date('Y-m-d H:i:s', strtotime('+1 hour')), 'list_uid' => 'LIST-UNIQUE-ID', 'segment_uid' => 'SEGMENT-UNIQUE-ID', 'template' => array('content' => file_get_contents(dirname(__FILE__) . '/template-example.html'), 'inline_css' => 'no')));
// DISPLAY RESPONSE