1 | <?php |
||
19 | abstract class AbstractService |
||
20 | { |
||
21 | /** |
||
22 | * @var ConnectionInterface |
||
23 | */ |
||
24 | private $connection; |
||
25 | |||
26 | /** |
||
27 | * @param ConnectionInterface $connection |
||
28 | */ |
||
29 | public function __construct(ConnectionInterface $connection) |
||
33 | |||
34 | /** |
||
35 | * @return ConnectionInterface |
||
36 | */ |
||
37 | protected function getConnection(): ConnectionInterface |
||
41 | |||
42 | /** |
||
43 | * Calls the API with signed session. |
||
44 | * |
||
45 | * @param string $method |
||
46 | * @param array $params |
||
47 | * @param SessionInterface|null $session |
||
48 | * @param string $requestMethod |
||
49 | * |
||
50 | * @throws ApiException |
||
51 | * @throws NotFoundException |
||
52 | * |
||
53 | * @return array |
||
54 | */ |
||
55 | final protected function signedCall(string $method, array $params = [], SessionInterface $session = null, $requestMethod = 'GET'): array |
||
67 | |||
68 | /** |
||
69 | * Calls the API unsigned. |
||
70 | * |
||
71 | * @param string $method |
||
72 | * @param array $params |
||
73 | * @param string $requestMethod |
||
74 | * |
||
75 | * @throws ApiException |
||
76 | * @throws NotFoundException |
||
77 | * |
||
78 | * @return array |
||
79 | */ |
||
80 | final protected function unsignedCall(string $method, array $params = [], $requestMethod = 'GET'): array |
||
92 | } |
||
93 |