From 8d168d7657416361c9c49037ed80f7d56b7fe19d Mon Sep 17 00:00:00 2001 From: mertic18 <47573820+mertic18@users.noreply.github.com> Date: Tue, 3 Oct 2023 16:22:45 +0200 Subject: [PATCH] Add AccountEmailSender (#177) --- CHANGELOG.md | 2 ++ src/Endpoint/AccountEmailSendersEndpoint.php | 27 ++++++++++++++++++ src/Endpoint/AccountEndpoint.php | 5 ++++ src/Resource/AccountEmailSender.php | 16 +++++++++++ src/Resource/Branding.php | 2 ++ .../AccountEmailSenderEndpointTest.php | 28 +++++++++++++++++++ tests/Endpoint/AccountEndpointTest.php | 1 + 7 files changed, 81 insertions(+) create mode 100644 src/Endpoint/AccountEmailSendersEndpoint.php create mode 100644 src/Resource/AccountEmailSender.php create mode 100644 tests/Endpoint/AccountEmailSenderEndpointTest.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 21e4fbd..878ccf5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip - Add `envelopeAnonymizeRetention` and `envelopeAnonymizeGroups` to `AccountSecurity` - Add `anonymizeAt` and `anonymizedAt` to `Envelope` - Add anonymize action to `Envelope` +- Add `AccountEmailSendersEndpoint` and `AccountEmailSender` resource + ## [2.1.0] - 2023-07-12 ### Added diff --git a/src/Endpoint/AccountEmailSendersEndpoint.php b/src/Endpoint/AccountEmailSendersEndpoint.php new file mode 100644 index 0000000..774ed7d --- /dev/null +++ b/src/Endpoint/AccountEmailSendersEndpoint.php @@ -0,0 +1,27 @@ + + * @method ListResource list(array $query = []) + * @method AccountEmailSender get(string $id) + */ +class AccountEmailSendersEndpoint extends ResourceEndpoint +{ + /** @use ListEndpointTrait */ + use ListEndpointTrait; + use GetEndpointTrait; + + public function __construct(AccountEndpoint $parent) + { + parent::__construct($parent, '/email-senders', AccountEmailSender::class); + } +} diff --git a/src/Endpoint/AccountEndpoint.php b/src/Endpoint/AccountEndpoint.php index dbf3eb0..97e3ba6 100644 --- a/src/Endpoint/AccountEndpoint.php +++ b/src/Endpoint/AccountEndpoint.php @@ -121,4 +121,9 @@ public function smsSenders(): AccountSmsSendersEndpoint { return new AccountSmsSendersEndpoint($this); } + + public function emailSenders(): AccountEmailSendersEndpoint + { + return new AccountEmailSendersEndpoint($this); + } } diff --git a/src/Resource/AccountEmailSender.php b/src/Resource/AccountEmailSender.php new file mode 100644 index 0000000..3c1661e --- /dev/null +++ b/src/Resource/AccountEmailSender.php @@ -0,0 +1,16 @@ +list(); + self::assertLastRequest('GET', '/api/account/email-senders'); + } + + public function testGet(): void + { + self::endpoint()->get('foo'); + self::assertLastRequest('GET', '/api/account/email-senders/foo'); + } + + protected static function endpoint(): AccountEmailSendersEndpoint + { + return self::dgs()->account()->emailSenders(); + } +} diff --git a/tests/Endpoint/AccountEndpointTest.php b/tests/Endpoint/AccountEndpointTest.php index e785582..a05f26a 100644 --- a/tests/Endpoint/AccountEndpointTest.php +++ b/tests/Endpoint/AccountEndpointTest.php @@ -21,6 +21,7 @@ public function testChildren(): void self::assertDefaultEndpointPath(self::endpoint()->certificates(), '/api/account/certificates'); self::assertDefaultEndpointPath(self::endpoint()->brandings(), '/api/account/brandings'); self::assertDefaultEndpointPath(self::endpoint()->smsSenders(), '/api/account/sms-senders'); + self::assertDefaultEndpointPath(self::endpoint()->emailSenders(), '/api/account/email-senders'); self::assertDefaultEndpointPath(self::endpoint()->messaging(), '/api/account/messaging'); self::assertDefaultEndpointPath(self::endpoint()->signatureScenarios(), '/api/account/signature-scenarios'); self::assertDefaultEndpointPath(self::endpoint()->identifyScenarios(), '/api/account/identify-scenarios');