Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
johannessteu committed Sep 30, 2020
0 parents commit 8d9d631
Show file tree
Hide file tree
Showing 12 changed files with 666 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Classes/Exception/MailJetInvalidContactDataException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

declare(strict_types=1);

namespace t3n\MailJetAdapter\Exception;

use Neos\Flow\Exception;

class MailJetInvalidContactDataException extends Exception
{
}
11 changes: 11 additions & 0 deletions Classes/Exception/MailJetRequestException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

declare(strict_types=1);

namespace t3n\MailJetAdapter\Exception;

use Neos\Flow\Exception;

class MailJetRequestException extends Exception
{
}
38 changes: 38 additions & 0 deletions Classes/Factory/MailJetFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

declare(strict_types=1);

namespace t3n\MailJetAdapter\Factory;

use Mailjet\Client;
use Neos\Flow\Annotations as Flow;

/**
* @Flow\Scope("singleton")
*/
class MailJetFactory
{
/**
* @Flow\InjectConfiguration(path="mailjet.clientConfiguration")
*
* @var string[]
*/
protected $clientConfiguration;

/**
* @var Client|null
*/
protected $client = null;

public function createClient(): Client
{
if ($this->client !== null) {
return $this->client;
}

$client = new Client($this->clientConfiguration['apiKey'], $this->clientConfiguration['apiSecret'], (bool) $this->clientConfiguration['liveMode'], ['version' => $this->clientConfiguration['apiVersion']]);
$this->client = $client;

return $client;
}
}
193 changes: 193 additions & 0 deletions Classes/Model/Contact.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
<?php

declare(strict_types=1);

namespace t3n\MailJetAdapter\Model;

use Doctrine\Common\Collections\ArrayCollection;
use t3n\MailJetAdapter\ValueObject\MailJetContactEmail;
use t3n\MailJetAdapter\ValueObject\MailJetContactIdentifier;

class Contact
{
/**
* @var MailJetContactIdentifier
*/
protected $identifier;

/**
* @var MailJetContactEmail
*/
protected $email;

/**
* @var \DateTime
*/
protected $createdAt;

/**
* @var string
*/
protected $name;

/**
* @var int
*/
protected $deliveredCount;

/**
* @var bool;
*/
protected $isOptInPending;

/**
* @var \DateTime|null
*/
protected $lastActivityAt;

/**
* @var \DateTime|null
*/
protected $lastUpdateAt;

/**
* @var bool
*/
protected $isSpamComplaining;

/**
* @var \DateTime|null
*/
protected $exclusionFromCampaignsUpdatedAt;

/**
* @var bool
*/
protected $isExcludedFromCampaigns;

/**
* @var ArrayCollection<ContactData>
*/
protected $contactData;

public function __construct(MailJetContactIdentifier $identifier)
{
$this->identifier = $identifier;
$this->contactData = new ArrayCollection();
}

public function getIdentifier(): MailJetContactIdentifier
{
return $this->identifier;
}

public function getEmail(): MailJetContactEmail
{
return $this->email;
}

public function setEmail(MailJetContactEmail $email): void
{
$this->email = $email;
}

public function getCreatedAt(): \DateTime
{
return $this->createdAt;
}

public function setCreatedAt(\DateTime $createdAt): void
{
$this->createdAt = $createdAt;
}

public function getName(): string
{
return $this->name;
}

public function setName(string $name): void
{
$this->name = $name;
}

public function getDeliveredCount(): int
{
return $this->deliveredCount;
}

public function setDeliveredCount(int $deliveredCount): void
{
$this->deliveredCount = $deliveredCount;
}

public function isOptInPending(): bool
{
return $this->isOptInPending;
}

public function setIsOptInPending(bool $isOptInPending): void
{
$this->isOptInPending = $isOptInPending;
}

public function getLastActivityAt(): ?\DateTime
{
return $this->lastActivityAt;
}

public function setLastActivityAt(?\DateTime $lastActivityAt): void
{
$this->lastActivityAt = $lastActivityAt;
}

public function getLastUpdateAt(): ?\DateTime
{
return $this->lastUpdateAt;
}

public function setLastUpdateAt(?\DateTime $lastUpdateAt): void
{
$this->lastUpdateAt = $lastUpdateAt;
}

public function isSpamComplaining(): bool
{
return $this->isSpamComplaining;
}

public function setIsSpamComplaining(bool $isSpamComplaining): void
{
$this->isSpamComplaining = $isSpamComplaining;
}

public function getExclusionFromCampaignsUpdatedAt(): ?\DateTime
{
return $this->exclusionFromCampaignsUpdatedAt;
}

public function setExclusionFromCampaignsUpdatedAt(?\DateTime $exclusionFromCampaignsUpdatedAt): void
{
$this->exclusionFromCampaignsUpdatedAt = $exclusionFromCampaignsUpdatedAt;
}

public function isExcludedFromCampaigns(): bool
{
return $this->isExcludedFromCampaigns;
}

public function setIsExcludedFromCampaigns(bool $isExcludedFromCampaigns): void
{
$this->isExcludedFromCampaigns = $isExcludedFromCampaigns;
}

public function getContactData(): ArrayCollection
{
return $this->contactData;
}

public function setContactData(ArrayCollection $contactData): void
{
$this->contactData = $contactData;
}
}
44 changes: 44 additions & 0 deletions Classes/Model/ContactData.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

declare(strict_types=1);

namespace t3n\MailJetAdapter\Model;

class ContactData
{
/**
* @var string
*/
protected $name;

/**
* @var mixed
*/
protected $value;

public function getName(): string
{
return $this->name;
}

public function setName(string $name): void
{
$this->name = $name;
}

/**
* @return mixed
*/
public function getValue()
{
return $this->value;
}

/**
* @param mixed $value
*/
public function setValue($value): void
{
$this->value = $value;
}
}
Loading

0 comments on commit 8d9d631

Please sign in to comment.