-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4f46bba
commit 77a427f
Showing
12 changed files
with
389 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
namespace Mailosaur\Models; | ||
|
||
|
||
class Preview | ||
{ | ||
/** @var string The unique identifier for the email preview. */ | ||
public $id; | ||
|
||
/** @var string The email client the preview was generated with. */ | ||
public $emailClient; | ||
|
||
/** @var bool Whether images were disabled in the preview. */ | ||
public $disableImages; | ||
|
||
public function __construct(\stdClass $data) | ||
{ | ||
if (property_exists($data, 'id')) { | ||
$this->id = $data->id; | ||
} | ||
|
||
if (property_exists($data, 'emailClient')) { | ||
$this->emailClient = $data->emailClient; | ||
} | ||
|
||
if (property_exists($data, 'disableImages')) { | ||
$this->disableImages = $data->disableImages; | ||
} | ||
} | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function __toArray() | ||
{ | ||
$model = array( | ||
'id' => $this->id, | ||
'emailClient' => $this->emailClient, | ||
'disableImages' => $this->disableImages | ||
); | ||
|
||
return $model; | ||
} | ||
|
||
public function toJsonString() | ||
{ | ||
return json_encode($this->__toArray()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<?php | ||
|
||
namespace Mailosaur\Models; | ||
|
||
|
||
class PreviewEmailClient | ||
{ | ||
/** @var string The unique identifier for the email preview. */ | ||
public $id; | ||
|
||
/** @var string The display name of the email client. */ | ||
public $name; | ||
|
||
/** @var string Whether the platform is desktop, mobile, or web-based. */ | ||
public $platformGroup; | ||
|
||
/** @var string The type of platform on which the email client is running. */ | ||
public $platformType; | ||
|
||
/** @var string The platform version number. */ | ||
public $platformVersion; | ||
|
||
/** @var bool Whether images can be disabled when generating previews. */ | ||
public $canDisableImages; | ||
|
||
/** @var string The current status of the email client. */ | ||
public $status; | ||
|
||
public function __construct(\stdClass $data) | ||
{ | ||
if (property_exists($data, 'id')) { | ||
$this->id = $data->id; | ||
} | ||
|
||
if (property_exists($data, 'name')) { | ||
$this->name = $data->name; | ||
} | ||
|
||
if (property_exists($data, 'platformGroup')) { | ||
$this->platformGroup = $data->platformGroup; | ||
} | ||
|
||
if (property_exists($data, 'platformType')) { | ||
$this->platformType = $data->platformType; | ||
} | ||
|
||
if (property_exists($data, 'platformVersion')) { | ||
$this->platformVersion = $data->platformVersion; | ||
} | ||
|
||
if (property_exists($data, 'canDisableImages')) { | ||
$this->canDisableImages = $data->canDisableImages; | ||
} | ||
|
||
if (property_exists($data, 'status')) { | ||
$this->status = $data->status; | ||
} | ||
} | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function __toArray() | ||
{ | ||
$model = array( | ||
'id' => $this->id, | ||
'name' => $this->name, | ||
'platformGroup' => $this->platformGroup, | ||
'platformType' => $this->platformType, | ||
'platformVersion' => $this->platformVersion, | ||
'canDisableImages' => $this->canDisableImages, | ||
'status' => $this->status | ||
); | ||
|
||
return $model; | ||
} | ||
|
||
public function toJsonString() | ||
{ | ||
return json_encode($this->__toArray()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace Mailosaur\Models; | ||
|
||
|
||
class PreviewEmailClientListResult | ||
{ | ||
/** | ||
* @var PreviewEmailClient[] A list of available email clients with which to generate email previews. | ||
*/ | ||
public $items = array(); | ||
|
||
public function __construct(\stdClass $data) | ||
{ | ||
if (property_exists($data, 'items') && is_array($data->items)) { | ||
foreach ($data->items as $item) { | ||
$this->items[] = new PreviewEmailClient($item); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace Mailosaur\Models; | ||
|
||
|
||
class PreviewListResult | ||
{ | ||
/** | ||
* @var Preview[] A list of requested email previews. | ||
*/ | ||
public $items = array(); | ||
|
||
public function __construct(\stdClass $data) | ||
{ | ||
if (property_exists($data, 'items') && is_array($data->items)) { | ||
foreach ($data->items as $item) { | ||
$this->items[] = new Preview($item); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace Mailosaur\Models; | ||
|
||
|
||
class PreviewRequest | ||
{ | ||
/** @var string The email client you wish to generate a preview for. */ | ||
public $emailClient; | ||
|
||
/** @var bool Whether images will be disabled (only if supported by the client). */ | ||
public $disableImages; | ||
|
||
public function __construct($emailClient, $disableImages = false) | ||
{ | ||
$this->emailClient = $emailClient; | ||
$this->disableImages = $disableImages; | ||
} | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function __toArray() | ||
{ | ||
$model = array( | ||
'emailClient' => $this->emailClient, | ||
'disableImages' => $this->disableImages | ||
); | ||
|
||
return $model; | ||
} | ||
|
||
public function toJsonString() | ||
{ | ||
return json_encode($this->__toArray()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
namespace Mailosaur\Models; | ||
|
||
|
||
class PreviewRequestOptions | ||
{ | ||
/** | ||
* @var PreviewRequest[] The list of email preview requests. | ||
*/ | ||
public $previews = array(); | ||
|
||
public function __construct($previews) | ||
{ | ||
$this->previews = $previews; | ||
} | ||
|
||
public function __toArray() | ||
{ | ||
$model = array( | ||
'previews' => $this->previews | ||
); | ||
|
||
return $model; | ||
} | ||
|
||
/** | ||
* Prepare json-serialized string | ||
* | ||
* @return string | ||
*/ | ||
public function toJsonString() | ||
{ | ||
return json_encode($this->__toArray()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace Mailosaur\Operations; | ||
|
||
|
||
use Mailosaur\Models\PreviewEmailClientListResult; | ||
|
||
class Previews extends AOperation | ||
{ | ||
|
||
/** | ||
* <strong>List all email preview clients</strong> | ||
* | ||
* @return PreviewEmailClientListResult | ||
* @throws \Mailosaur\Models\MailosaurException | ||
*/ | ||
public function allEmailClients() | ||
{ | ||
$response = $this->request('api/previews/clients'); | ||
|
||
$response = json_decode($response); | ||
|
||
return new PreviewEmailClientListResult($response); | ||
} | ||
} |
Oops, something went wrong.