aboutsummaryrefslogtreecommitdiffhomepage
path: root/routes/actor.php
blob: 230f342b3ff2ba616da6e6d3c2f0428ce77722d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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')
        ]
    ]);
});