Skip to content

Commit

Permalink
Add AccountEmailSender (#177)
Browse files Browse the repository at this point in the history
  • Loading branch information
mertic18 authored Oct 3, 2023
1 parent ef3d8bd commit 8d168d7
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 27 additions & 0 deletions src/Endpoint/AccountEmailSendersEndpoint.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

declare(strict_types=1);

namespace DigitalCz\DigiSign\Endpoint;

use DigitalCz\DigiSign\Endpoint\Traits\GetEndpointTrait;
use DigitalCz\DigiSign\Endpoint\Traits\ListEndpointTrait;
use DigitalCz\DigiSign\Resource\AccountEmailSender;
use DigitalCz\DigiSign\Resource\ListResource;

/**
* @extends ResourceEndpoint<AccountEmailSender>
* @method ListResource<AccountEmailSender> list(array $query = [])
* @method AccountEmailSender get(string $id)
*/
class AccountEmailSendersEndpoint extends ResourceEndpoint
{
/** @use ListEndpointTrait<AccountEmailSender> */
use ListEndpointTrait;
use GetEndpointTrait;

public function __construct(AccountEndpoint $parent)
{
parent::__construct($parent, '/email-senders', AccountEmailSender::class);
}
}
5 changes: 5 additions & 0 deletions src/Endpoint/AccountEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,9 @@ public function smsSenders(): AccountSmsSendersEndpoint
{
return new AccountSmsSendersEndpoint($this);
}

public function emailSenders(): AccountEmailSendersEndpoint
{
return new AccountEmailSendersEndpoint($this);
}
}
16 changes: 16 additions & 0 deletions src/Resource/AccountEmailSender.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

declare(strict_types=1);

namespace DigitalCz\DigiSign\Resource;

use DigitalCz\DigiSign\Resource\Traits\EntityResourceTrait;

class AccountEmailSender extends BaseResource
{
use EntityResourceTrait;

public string $name;

public ?string $createdBy;
}
2 changes: 2 additions & 0 deletions src/Resource/Branding.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,6 @@ class Branding extends BaseResource
public ?array $signerReturnUrl;

public ?AccountSmsSender $smsSender;

public ?AccountEmailSender $emailSender;
}
28 changes: 28 additions & 0 deletions tests/Endpoint/AccountEmailSenderEndpointTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

declare(strict_types=1);

namespace DigitalCz\DigiSign\Endpoint;

/**
* @covers \DigitalCz\DigiSign\Endpoint\AccountEmailSendersEndpoint
*/
class AccountEmailSenderEndpointTest extends EndpointTestCase
{
public function testList(): void
{
self::endpoint()->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();
}
}
1 change: 1 addition & 0 deletions tests/Endpoint/AccountEndpointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 8d168d7

Please sign in to comment.