-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Handle notification entity serialization (#92)
- Loading branch information
1 parent
841c416
commit b55854f
Showing
18 changed files
with
249 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* |------ | ||
* | ! Generated code ! | ||
* | Altering this code will result in changes being overwritten | | ||
* |-------------------------------------------------------------|. | ||
*/ | ||
|
||
namespace Paddle\SDK\Notifications\Entities; | ||
|
||
class UndefinedEntity implements Entity, \JsonSerializable | ||
{ | ||
public function __construct( | ||
public readonly array $data, | ||
) { | ||
} | ||
|
||
public static function from(array $data): self | ||
{ | ||
return new self($data); | ||
} | ||
|
||
public function jsonSerialize(): \stdClass | ||
{ | ||
return (object) $this->data; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Paddle\SDK\Notifications\Events; | ||
|
||
use Paddle\SDK\Entities\Event; | ||
use Paddle\SDK\Entities\Event\EventTypeName; | ||
use Paddle\SDK\Notifications\Entities\Entity; | ||
use Paddle\SDK\Notifications\Entities\UndefinedEntity; | ||
|
||
final class UndefinedEvent extends Event | ||
{ | ||
private function __construct( | ||
string $eventId, | ||
EventTypeName $eventType, | ||
\DateTimeInterface $occurredAt, | ||
public readonly UndefinedEntity $entity, | ||
string|null $notificationId, | ||
) { | ||
parent::__construct($eventId, $eventType, $occurredAt, $entity, $notificationId); | ||
} | ||
|
||
/** | ||
* @param UndefinedEntity $data | ||
*/ | ||
public static function fromEvent( | ||
string $eventId, | ||
EventTypeName $eventType, | ||
\DateTimeInterface $occurredAt, | ||
Entity $data, | ||
string|null $notificationId = null, | ||
): static { | ||
return new self($eventId, $eventType, $occurredAt, $data, $notificationId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.