1 | <?php |
||
7 | trait MakesHttpRequests |
||
8 | { |
||
9 | /** @var Api */ |
||
10 | public $api; |
||
11 | |||
12 | /** @var string */ |
||
13 | public $serviceName; |
||
14 | |||
15 | /** |
||
16 | * @param string $method |
||
17 | * @param string $uri |
||
18 | * @param array $parameters |
||
19 | * @return array |
||
20 | * @throws Exceptions\ForbiddenException |
||
21 | * @throws Exceptions\NotFoundException |
||
22 | */ |
||
23 | public function callService(string $method, string $uri, array $parameters = null): array |
||
34 | |||
35 | /** |
||
36 | * @param string $uri |
||
37 | * |
||
38 | * @param array|null $parameters |
||
39 | * @return mixed |
||
40 | * @throws Exceptions\ForbiddenException |
||
41 | * @throws Exceptions\NotFoundException |
||
42 | */ |
||
43 | protected function get(string $uri, array $parameters = null): array |
||
47 | |||
48 | /** |
||
49 | * @param string $uri |
||
50 | * @param array|null $parameters |
||
51 | * @return mixed |
||
52 | * @throws Exceptions\ForbiddenException |
||
53 | * @throws Exceptions\NotFoundException |
||
54 | */ |
||
55 | protected function post(string $uri, array $parameters = null): array |
||
59 | |||
60 | /** |
||
61 | * @param string $uri |
||
62 | * @param array|null $parameters |
||
63 | * @return mixed |
||
64 | * @throws Exceptions\ForbiddenException |
||
65 | * @throws Exceptions\NotFoundException |
||
66 | */ |
||
67 | protected function put(string $uri, array $parameters = null): array |
||
71 | |||
72 | /** |
||
73 | * @param string $uri |
||
74 | * @param array|null $parameters |
||
75 | * @return mixed |
||
76 | * @throws Exceptions\ForbiddenException |
||
77 | * @throws Exceptions\NotFoundException |
||
78 | */ |
||
79 | protected function delete(string $uri, array $parameters = null): array |
||
83 | } |
||
84 |