8
8
9
9
namespace PhpBootstrap \Contracts ;
10
10
11
- use League \Fractal \Pagination \Cursor ;
12
- use League \Fractal \TransformerAbstract ;
13
- use Psr \Http \Message \ResponseInterface ;
11
+ use PhpRestfulApiResponse \Contracts \PhpRestfulApiResponse ;
14
12
15
- interface Response extends ResponseInterface
13
+ interface Response extends PhpRestfulApiResponse
16
14
{
17
- /**
18
- * @param $data
19
- * @param $code
20
- * @param array $headers
21
- * @return Response|static
22
- */
23
- public function withArray (array $ data , $ code = 200 , array $ headers = []);
24
15
25
- /**
26
- * @param $data
27
- * @param TransformerAbstract|callable $transformer
28
- * @param int $code
29
- * @param null $resourceKey
30
- * @param array $meta
31
- * @param array $headers
32
- * @return Response
33
- */
34
- public function withItem ($ data , $ transformer , $ code = 200 , $ resourceKey = null , $ meta = [], array $ headers = []);
35
-
36
- /**
37
- * @param $data
38
- * @param TransformerAbstract|callable $transformer
39
- * @param int $code
40
- * @param null $resourceKey
41
- * @param Cursor|null $cursor
42
- * @param array $meta
43
- * @param array $headers
44
- * @return Response
45
- */
46
- public function withCollection ($ data , $ transformer , $ code = 200 , $ resourceKey = null , Cursor $ cursor = null , $ meta = [], array $ headers = []);
47
-
48
- /**
49
- * Generates a response with custom code HTTP header and a given message.
50
- *
51
- * @param $message
52
- * @param $code
53
- * @param array $headers
54
- * @return mixed
55
- */
56
- public function withError ($ message , $ code , array $ headers = []);
57
-
58
- /**
59
- * Generates a response with a 403 HTTP header and a given message.
60
- *
61
- * @param string $message
62
- * @param array $headers
63
- * @return mixed
64
- */
65
- public function errorForbidden ($ message = '' , array $ headers = []);
66
-
67
- /**
68
- * Generates a response with a 500 HTTP header and a given message.
69
- *
70
- * @param string $message
71
- * @param array $headers
72
- * @return mixed
73
- */
74
- public function errorInternalError ($ message = '' , array $ headers = []);
75
-
76
- /**
77
- * Generates a response with a 404 HTTP header and a given message.
78
- *
79
- * @param string $message
80
- * @param array $headers
81
- * @return mixed
82
- */
83
- public function errorNotFound ($ message = '' , array $ headers = []);
84
-
85
- /**
86
- * Generates a response with a 401 HTTP header and a given message.
87
- *
88
- * @param string $message
89
- * @param array $headers
90
- * @return mixed
91
- */
92
- public function errorUnauthorized ($ message = '' , array $ headers = []);
93
-
94
- /**
95
- * Generates a response with a 400 HTTP header and a given message.
96
- *
97
- * @param array $message
98
- * @param array $headers
99
- * @return mixed
100
- */
101
- public function errorWrongArgs (array $ message , array $ headers = []);
102
-
103
- /**
104
- * Generates a response with a 410 HTTP header and a given message.
105
- *
106
- * @param string $message
107
- * @param array $headers
108
- * @return mixed
109
- */
110
- public function errorGone ($ message = '' , array $ headers = []);
111
-
112
- /**
113
- * Generates a response with a 405 HTTP header and a given message.
114
- *
115
- * @param string $message
116
- * @param array $headers
117
- * @return mixed
118
- */
119
- public function errorMethodNotAllowed ($ message = '' , array $ headers = []);
120
-
121
- /**
122
- * Generates a Response with a 431 HTTP header and a given message.
123
- *
124
- * @param string $message
125
- * @param array $headers
126
- * @return mixed
127
- */
128
- public function errorUnwillingToProcess ($ message = '' , array $ headers = []);
129
-
130
- /**
131
- * Generates a Response with a 422 HTTP header and a given message.
132
- *
133
- * @param string $message
134
- * @param array $headers
135
- * @return mixed
136
- */
137
- public function errorUnprocessable ($ message = '' , array $ headers = []);
138
16
}
0 commit comments