-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApiResource.php
109 lines (105 loc) · 3.78 KB
/
ApiResource.php
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?php
declare(strict_types=1);
namespace Pandawa\Annotations\Resource;
use Attribute;
use Spiral\Attributes\NamedArgumentConstructor;
/**
* @author Iqbal Maulana <iq.bluejack@gmail.com>
*/
#[Attribute(Attribute::TARGET_CLASS|Attribute::IS_REPEATABLE), NamedArgumentConstructor]
final class ApiResource
{
/**
* @param array{
* resource_key: string,
* default_content_type: string,
* index: array{
* http_code: integer,
* paginate: integer,
* rules: string[],
* filters: array<string, string|array>,
* repository: array{call: string, arguments: array<string, scalar>},
* criteria: list<array{class: string, arguments: array<string, scalar>}>,
* transformer: array{
* class: string,
* context: array{
* available_includes: scalar[],
* default_includes: scalar[],
* available_selects: scalar[],
* default_selects: scalar[],
* }
* },
* serialize: array{context: array}
* },
* show: array{
* http_code: integer,
* rules: string[],
* filters: array<string, string|array>,
* repository: array{call: string, arguments: array<string, scalar>},
* criteria: list<array{class: string, arguments: array<string, scalar>}>,
* transformer: array{
* class: string,
* context: array{
* available_includes: scalar[],
* default_includes: scalar[],
* available_selects: scalar[],
* default_selects: scalar[],
* }
* },
* serialize: array{context: array}
* },
* store: array{
* http_code: integer,
* rules: string[],
* transformer: array{
* class: string,
* context: array{
* available_includes: scalar[],
* default_includes: scalar[],
* available_selects: scalar[],
* default_selects: scalar[],
* }
* },
* serialize: array{context: array}
* },
* update: array{
* http_code: integer,
* rules: string[],
* transformer: array{
* class: string,
* context: array{
* available_includes: scalar[],
* default_includes: scalar[],
* available_selects: scalar[],
* default_selects: scalar[],
* }
* },
* serialize: array{context: array}
* },
* delete: array{
* http_code: integer,
* rules: string[],
* transformer: array{
* class: string,
* context: array{
* available_includes: scalar[],
* default_includes: scalar[],
* available_selects: scalar[],
* default_selects: scalar[],
* }
* },
* serialize: array{context: array}
* }
* } $options
*/
public function __construct(
public readonly string $uri,
public readonly ?string $routeName = null,
public readonly ?string $routeGroup = null,
public readonly array $middleware = [],
public readonly array $only = [],
public readonly array $except = [],
public readonly array $options = [],
) {
}
}