Skip to content

Commit

Permalink
Add AccountSmsSendersEndpoint and AccountSmsSender resource (#176)
Browse files Browse the repository at this point in the history
* Add `AccountSmsSendersEndpoint` and `AccountSmsSender` resource

* Fix csf and tests
  • Loading branch information
tomasDostalDS authored Oct 2, 2023
1 parent cb73176 commit a22135b
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip

## [Unreleased]
### Added
- Add `AccountSmsSendersEndpoint` and `AccountSmsSender` resource
- Add `envelopeAnonymizeRetention` and `envelopeAnonymizeGroups` to `AccountSecurity`
- Add `anonymizeAt` and `anonymizedAt` to `Envelope`
- Add anonymize action to `Envelope`
Expand Down
5 changes: 5 additions & 0 deletions src/Endpoint/AccountEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,9 @@ public function manageBilling(): AccountManageBilling
{
return $this->createResource($this->postRequest('/manage-billing'), AccountManageBilling::class);
}

public function smsSenders(): AccountSmsSendersEndpoint
{
return new AccountSmsSendersEndpoint($this);
}
}
27 changes: 27 additions & 0 deletions src/Endpoint/AccountSmsSendersEndpoint.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\AccountSmsSender;
use DigitalCz\DigiSign\Resource\ListResource;

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

public function __construct(AccountEndpoint $parent)
{
parent::__construct($parent, '/sms-senders', AccountSmsSender::class);
}
}
16 changes: 16 additions & 0 deletions src/Resource/AccountSmsSender.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 AccountSmsSender 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 @@ -31,4 +31,6 @@ class Branding extends BaseResource

/** @var string[] */
public ?array $signerReturnUrl;

public ?AccountSmsSender $smsSender;
}
1 change: 1 addition & 0 deletions tests/Endpoint/AccountEndpointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public function testChildren(): void
self::assertDefaultEndpointPath(self::endpoint()->users(), '/api/account/users');
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()->messaging(), '/api/account/messaging');
self::assertDefaultEndpointPath(self::endpoint()->signatureScenarios(), '/api/account/signature-scenarios');
self::assertDefaultEndpointPath(self::endpoint()->identifyScenarios(), '/api/account/identify-scenarios');
Expand Down
28 changes: 28 additions & 0 deletions tests/Endpoint/AccountSmsSenderEndpointTest.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\AccountSmsSendersEndpoint
*/
class AccountSmsSenderEndpointTest extends EndpointTestCase
{
public function testList(): void
{
self::endpoint()->list();
self::assertLastRequest('GET', '/api/account/sms-senders');
}

public function testGet(): void
{
self::endpoint()->get('foo');
self::assertLastRequest('GET', '/api/account/sms-senders/foo');
}

protected static function endpoint(): AccountSmsSendersEndpoint
{
return self::dgs()->account()->smsSenders();
}
}

0 comments on commit a22135b

Please sign in to comment.