Added support for the new mailing list property 'reply_preference'

This commit is contained in:
Justin Sims 2020-06-08 17:05:29 -04:00 committed by David Garcia
parent 4641cf735f
commit e5ff7d84ec
2 changed files with 10 additions and 1 deletions

View File

@ -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);

View File

@ -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;