1 | <?php |
||
21 | class RestClient |
||
22 | { |
||
23 | const USER_AGENT = 'PHP-KSQLClient'; |
||
24 | |||
25 | /** @var string */ |
||
26 | private $serverAddress; |
||
27 | |||
28 | /** @var array<string, string> */ |
||
29 | private $properties = []; |
||
30 | |||
31 | /** @var ClientInterface */ |
||
32 | private $client; |
||
33 | |||
34 | /** @var bool */ |
||
35 | private $hasUserCredentials = false; |
||
36 | |||
37 | /** @var AuthCredential */ |
||
38 | private $authCredential; |
||
39 | |||
40 | /** @var array */ |
||
41 | private $options = []; |
||
42 | |||
43 | /** |
||
44 | * RestClient constructor. |
||
45 | * |
||
46 | * @param string $serverAddress |
||
47 | * @param array $properties |
||
48 | * @param ClientInterface|null $client |
||
49 | */ |
||
50 | public function __construct( |
||
59 | |||
60 | /** |
||
61 | * build GuzzleHttp Client |
||
62 | * |
||
63 | * @return ClientInterface |
||
64 | */ |
||
65 | protected function buildClient(): ClientInterface |
||
74 | |||
75 | /** |
||
76 | * @param AuthCredential $authCredential |
||
77 | */ |
||
78 | public function setAuthCredentials(AuthCredential $authCredential): void |
||
83 | |||
84 | /** |
||
85 | * @return null|AuthCredential |
||
86 | */ |
||
87 | public function getAuthCredentials(): ?AuthCredential |
||
91 | |||
92 | /** |
||
93 | * @return string |
||
94 | */ |
||
95 | public function getServerAddress(): string |
||
99 | |||
100 | /** |
||
101 | * @param string $serverAddress |
||
102 | */ |
||
103 | public function setServerAddress(string $serverAddress): void |
||
107 | |||
108 | /** |
||
109 | * @param QueryInterface $query |
||
110 | * @param int $timeout |
||
111 | * @param bool $debug |
||
112 | * |
||
113 | * @return AbstractResult|null |
||
114 | * @throws \GuzzleHttp\Exception\GuzzleException |
||
115 | */ |
||
116 | public function requestQuery( |
||
149 | |||
150 | /** |
||
151 | * @param QueryInterface $query |
||
152 | * @param int $timeout |
||
153 | * @param bool $debug |
||
154 | * |
||
155 | * @return array |
||
156 | */ |
||
157 | protected function getOptions( |
||
168 | |||
169 | /** |
||
170 | * @param array $options |
||
171 | */ |
||
172 | public function setOptions(array $options): void |
||
176 | } |
||
177 |