mirror of
https://github.com/retailcrm/mailgun-php.git
synced 2024-11-29 16:36:07 +03:00
Added support for the new mailing list property 'reply_preference'
This commit is contained in:
parent
4641cf735f
commit
e5ff7d84ec
@ -63,18 +63,20 @@ class MailingList extends HttpApi
|
|||||||
*
|
*
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function create(string $address, string $name = null, string $description = null, string $accessLevel = 'readonly')
|
public function create(string $address, string $name = null, string $description = null, string $accessLevel = 'readonly', string $replyPreference = 'list')
|
||||||
{
|
{
|
||||||
Assert::stringNotEmpty($address);
|
Assert::stringNotEmpty($address);
|
||||||
Assert::nullOrStringNotEmpty($name);
|
Assert::nullOrStringNotEmpty($name);
|
||||||
Assert::nullOrStringNotEmpty($description);
|
Assert::nullOrStringNotEmpty($description);
|
||||||
Assert::oneOf($accessLevel, ['readonly', 'members', 'everyone']);
|
Assert::oneOf($accessLevel, ['readonly', 'members', 'everyone']);
|
||||||
|
Assert::oneOf($replyPreference, ['list', 'sender']);
|
||||||
|
|
||||||
$params = [
|
$params = [
|
||||||
'address' => $address,
|
'address' => $address,
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'description' => $description,
|
'description' => $description,
|
||||||
'access_level' => $accessLevel,
|
'access_level' => $accessLevel,
|
||||||
|
'reply_preference' => $replyPreference
|
||||||
];
|
];
|
||||||
|
|
||||||
$response = $this->httpPost('/v3/lists', $params);
|
$response = $this->httpPost('/v3/lists', $params);
|
||||||
|
@ -18,6 +18,7 @@ final class MailingList implements ApiResponse
|
|||||||
private $name;
|
private $name;
|
||||||
private $address;
|
private $address;
|
||||||
private $accessLevel;
|
private $accessLevel;
|
||||||
|
private $replyPreference;
|
||||||
private $description;
|
private $description;
|
||||||
private $membersCount;
|
private $membersCount;
|
||||||
private $createdAt;
|
private $createdAt;
|
||||||
@ -28,6 +29,7 @@ final class MailingList implements ApiResponse
|
|||||||
$model->name = $data['name'] ?? null;
|
$model->name = $data['name'] ?? null;
|
||||||
$model->address = $data['address'] ?? null;
|
$model->address = $data['address'] ?? null;
|
||||||
$model->accessLevel = $data['access_level'] ?? null;
|
$model->accessLevel = $data['access_level'] ?? null;
|
||||||
|
$model->replyPreference = $data['reply_preference'] ?? null;
|
||||||
$model->description = $data['description'] ?? null;
|
$model->description = $data['description'] ?? null;
|
||||||
$model->membersCount = (int) ($data['members_count'] ?? 0);
|
$model->membersCount = (int) ($data['members_count'] ?? 0);
|
||||||
$model->createdAt = isset($data['created_at']) ? new \DateTimeImmutable($data['created_at']) : null;
|
$model->createdAt = isset($data['created_at']) ? new \DateTimeImmutable($data['created_at']) : null;
|
||||||
@ -54,6 +56,11 @@ final class MailingList implements ApiResponse
|
|||||||
return $this->accessLevel;
|
return $this->accessLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getReplyPreference(): ?string
|
||||||
|
{
|
||||||
|
return $this->replyPreference;
|
||||||
|
}
|
||||||
|
|
||||||
public function getDescription(): ?string
|
public function getDescription(): ?string
|
||||||
{
|
{
|
||||||
return $this->description;
|
return $this->description;
|
||||||
|
Loading…
Reference in New Issue
Block a user