Skip to content

Commit

Permalink
Add anonymize action and property values to AccountSecurity.php and E…
Browse files Browse the repository at this point in the history
…nvelope.php (#175)

Co-authored-by: Vladimír Votava <vladimir.votava@digital.cz>
  • Loading branch information
prosteNoBody and Vladimír Votava authored Sep 6, 2023
1 parent d1b4080 commit cb73176
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes will be documented in this file.

Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) principles.

## [Unreleased]
### Added
- Add `envelopeAnonymizeRetention` and `envelopeAnonymizeGroups` to `AccountSecurity`
- Add `anonymizeAt` and `anonymizedAt` to `Envelope`
- Add anonymize action to `Envelope`

## [2.1.0] - 2023-07-12
### Added
- Add `AccountSecurity.auditLogDownloadDefaultUnchecked`
Expand Down
8 changes: 8 additions & 0 deletions src/Endpoint/EnvelopesEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,14 @@ public function discard(Envelope|string $id, array $body = []): Envelope
return $this->makeResource($this->postRequest('/{id}/discard', ['id' => $id, 'json' => $body]));
}

/**
* @param mixed[] $body
*/
public function anonymize(Envelope|string $id, array $body = []): Envelope
{
return $this->makeResource($this->postRequest('/{id}/anonymize', ['id' => $id, 'json' => $body]));
}

public function restore(Envelope|string $id): Envelope
{
return $this->makeResource($this->postRequest('/{id}/restore', ['id' => $id]));
Expand Down
7 changes: 7 additions & 0 deletions src/Resource/AccountSecurity.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ class AccountSecurity extends BaseResource

public int $discardedEnvelopeRetention;

public ?int $envelopeAnonymizeRetention;

/**
* @var array<string>
*/
public array $envelopeAnonymizeGroups;

public bool $continuousSigning;

public bool $auditLogDownloadDefaultUnchecked;
Expand Down
4 changes: 4 additions & 0 deletions src/Resource/Envelope.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ class Envelope extends BaseResource

public ?DateTime $discardedAt = null;

public ?DateTime $anonymizeAt = null;

public ?DateTime $anonymizedAt = null;

/** @var Collection<EnvelopeRecipient> */
public Collection $recipients;

Expand Down
6 changes: 6 additions & 0 deletions tests/Endpoint/EnvelopesEndpointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ public function testDiscard(): void
self::assertLastRequest('POST', '/api/envelopes/foo/discard');
}

public function testAnonymize(): void
{
self::endpoint()->anonymize('foo', ['foo' => 'bar']);
self::assertLastRequest('POST', '/api/envelopes/foo/anonymize');
}

public function testValidate(): void
{
self::endpoint()->validate('foo');
Expand Down

0 comments on commit cb73176

Please sign in to comment.