diff --git a/src/Api/MailingList.php b/src/Api/MailingList.php index 8538629..f20d47e 100644 --- a/src/Api/MailingList.php +++ b/src/Api/MailingList.php @@ -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); diff --git a/src/Model/MailingList/MailingList.php b/src/Model/MailingList/MailingList.php index 801c167..405ab86 100644 --- a/src/Model/MailingList/MailingList.php +++ b/src/Model/MailingList/MailingList.php @@ -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;