aboutsummaryrefslogtreecommitdiffhomepage
path: root/routes/actor.php
diff options
context:
space:
mode:
authorwinter2024-12-06 20:43:26 +0000
committerwinter2024-12-06 20:43:26 +0000
commite1ad307b531c27ec6bfaf8b4d018991b0d4a78f3 (patch)
tree4ef08af2b4051d433bb929d5162474ac6777cab1 /routes/actor.php
initial commit
hardcoded functionality mostly!
Diffstat (limited to 'routes/actor.php')
-rw-r--r--routes/actor.php39
1 files changed, 39 insertions, 0 deletions
diff --git a/routes/actor.php b/routes/actor.php
new file mode 100644
index 0000000..230f342
--- /dev/null
+++ b/routes/actor.php
@@ -0,0 +1,39 @@
+<?php
+
+use WpfTest\HttpReturnStatus\NotFound;
+use WpfTest\Router;
+
+Router::getInstance()->mount('/user/:username', function (array $args) {
+ if ($args['username'] != 'winter') {
+ throw new NotFound('i only know about winter');
+ }
+ json_response([ // hardcoded much for testing
+ 'type' => 'actor',
+ 'self' => path_to_uri('/user/winter'),
+ 'created' => '2024-12-06T19:40:00+00:00',
+ 'homepage' => path_to_uri('/winter'),
+ 'handle' => 'winter',
+ 'displayName' => 'winter!',
+ 'bio' => 'winter on php',
+ 'pronouns' => 'it/she',
+ 'automated' => false,
+ 'endpoints' => [
+ 'basicFeed' => path_to_uri('/user/winter/basicFeed')
+ ]
+ ]);
+});
+
+Router::getInstance()->mount('/user/:username/basicFeed', function (array $args) {
+ if ($args['username'] != 'winter') {
+ throw new NotFound('i only know about winter');
+ }
+ json_response([
+ 'page' => 1,
+ 'totalPages' => 1,
+ 'nextPage' => null,
+ 'previousPage' => null,
+ 'items' => [
+ path_to_uri('/post/1')
+ ]
+ ]);
+}); \ No newline at end of file