aboutsummaryrefslogtreecommitdiffhomepage
path: root/WpfTest/Model/Actor.php
diff options
context:
space:
mode:
authorwinter2024-12-08 18:04:37 +0000
committerwinter2024-12-08 18:04:37 +0000
commitb00185ddbac9ac3de975a3954f2ede2f24458f6a (patch)
tree265ccaae497e2788ed7de8f6b08a0d5a77ea16dc /WpfTest/Model/Actor.php
parent13647d55bd8085a2b3a686b8aad3b28b0faf693a (diff)
implement notes
Diffstat (limited to 'WpfTest/Model/Actor.php')
-rw-r--r--WpfTest/Model/Actor.php25
1 files changed, 22 insertions, 3 deletions
diff --git a/WpfTest/Model/Actor.php b/WpfTest/Model/Actor.php
index cf8d7ca..eaef99c 100644
--- a/WpfTest/Model/Actor.php
+++ b/WpfTest/Model/Actor.php
@@ -3,9 +3,9 @@ namespace WpfTest\Model;
use WpfTest\Model;
-class Actor extends Model {
- public int $id;
- public string $self;
+class Actor extends Model implements \JsonSerializable {
+ public ?int $id;
+ public string $uri;
public bool $isLocal = false;
public \DateTimeImmutable $created;
public ?\DateTimeImmutable $modified;
@@ -23,4 +23,23 @@ class Actor extends Model {
public static function findLocalByHandle(string $handle): ?self {
return self::findWhere('is_local = true AND handle = ?', [$handle]);
}
+
+ public function jsonSerialize(): array {
+ return [
+ 'type' => 'actor',
+ 'self' => path_to_uri("/user/$this->handle"),
+ 'created' => $this->created?->format('c'),
+ 'modified' => $this->modified?->format('c'),
+ 'homepage' => path_to_uri("/$this->handle"),
+ 'handle' => $this->handle,
+ 'displayName' => $this->displayName,
+ 'bio' => $this->bio,
+ 'pronouns' => $this->pronouns,
+ 'automated' => $this->automated,
+ 'endpoints' => [
+ 'basicFeed' => path_to_uri("/user/$this->handle/basicFeed"),
+ 'fullFeed' => path_to_uri("/user/$this->handle/fullFeed")
+ ]
+ ];
+ }
} \ No newline at end of file