mirror of
https://github.com/retailcrm/mailgun-php.git
synced 2024-11-29 08:26:06 +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
|
||||
*/
|
||||
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::nullOrStringNotEmpty($name);
|
||||
Assert::nullOrStringNotEmpty($description);
|
||||
Assert::oneOf($accessLevel, ['readonly', 'members', 'everyone']);
|
||||
Assert::oneOf($replyPreference, ['list', 'sender']);
|
||||
|
||||
$params = [
|
||||
'address' => $address,
|
||||
'name' => $name,
|
||||
'description' => $description,
|
||||
'access_level' => $accessLevel,
|
||||
'reply_preference' => $replyPreference
|
||||
];
|
||||
|
||||
$response = $this->httpPost('/v3/lists', $params);
|
||||
|
@ -18,6 +18,7 @@ final class MailingList implements ApiResponse
|
||||
private $name;
|
||||
private $address;
|
||||
private $accessLevel;
|
||||
private $replyPreference;
|
||||
private $description;
|
||||
private $membersCount;
|
||||
private $createdAt;
|
||||
@ -28,6 +29,7 @@ final class MailingList implements ApiResponse
|
||||
$model->name = $data['name'] ?? null;
|
||||
$model->address = $data['address'] ?? null;
|
||||
$model->accessLevel = $data['access_level'] ?? null;
|
||||
$model->replyPreference = $data['reply_preference'] ?? null;
|
||||
$model->description = $data['description'] ?? null;
|
||||
$model->membersCount = (int) ($data['members_count'] ?? 0);
|
||||
$model->createdAt = isset($data['created_at']) ? new \DateTimeImmutable($data['created_at']) : null;
|
||||
@ -54,6 +56,11 @@ final class MailingList implements ApiResponse
|
||||
return $this->accessLevel;
|
||||
}
|
||||
|
||||
public function getReplyPreference(): ?string
|
||||
{
|
||||
return $this->replyPreference;
|
||||
}
|
||||
|
||||
public function getDescription(): ?string
|
||||
{
|
||||
return $this->description;
|
||||
|
Loading…
Reference in New Issue
Block a user