1 | <?php |
||
26 | class GatewayEndpoint implements GatewayInterface{ |
||
27 | |||
28 | /** |
||
29 | * @var \chillerlan\TinyCurl\Request |
||
30 | */ |
||
31 | protected $request; |
||
32 | |||
33 | /** |
||
34 | * @var \chillerlan\Threema\GatewayOptions |
||
35 | */ |
||
36 | protected $gatewayOptions; |
||
37 | |||
38 | /** |
||
39 | * @var \chillerlan\Threema\Crypto\CryptoInterface |
||
40 | */ |
||
41 | protected $cryptoInterface; |
||
42 | |||
43 | /** |
||
44 | * GatewayEndpoint constructor. |
||
45 | * |
||
46 | * @param \chillerlan\Threema\Crypto\CryptoInterface $cryptoInterface |
||
47 | * @param \chillerlan\Threema\GatewayOptions $gatewayOptions |
||
48 | */ |
||
49 | public function __construct(CryptoInterface $cryptoInterface, GatewayOptions $gatewayOptions){ |
||
57 | |||
58 | /** |
||
59 | * @param string $endpoint |
||
60 | * @param array $params |
||
61 | * @param array $body |
||
62 | * |
||
63 | * @return \chillerlan\TinyCurl\Response\Response |
||
64 | * @throws \chillerlan\Threema\GatewayException |
||
65 | * @throws \chillerlan\TinyCurl\RequestException |
||
66 | */ |
||
67 | protected function getResponse(string $endpoint, array $params = [], array $body = []):Response{ |
||
89 | |||
90 | /** |
||
91 | * @inheritdoc |
||
92 | */ |
||
93 | public function checkCredits():int{ |
||
96 | |||
97 | /** |
||
98 | * @inheritdoc |
||
99 | */ |
||
100 | public function checkCapabilities(string $threemaID):array{ |
||
108 | |||
109 | /** |
||
110 | * @inheritdoc |
||
111 | */ |
||
112 | public function getIdByPhone(string $phoneno):string{ |
||
115 | |||
116 | /** |
||
117 | * @inheritdoc |
||
118 | */ |
||
119 | public function getIdByPhoneHash(string $phonenoHash):string{ |
||
122 | |||
123 | /** |
||
124 | * @inheritdoc |
||
125 | */ |
||
126 | public function getIdByEmail(string $email):string{ |
||
129 | |||
130 | /** |
||
131 | * @inheritdoc |
||
132 | */ |
||
133 | public function getIdByEmailHash(string $emailHash):string{ |
||
136 | |||
137 | /** |
||
138 | * @inheritdoc |
||
139 | */ |
||
140 | public function getPublicKey(string $threemaID):string{ |
||
143 | |||
144 | /** |
||
145 | * @inheritdoc |
||
146 | */ |
||
147 | public function sendSimple(string $to, string $message):string{ |
||
150 | |||
151 | /** |
||
152 | * @inheritdoc |
||
153 | */ |
||
154 | public function sendE2E(string $threemaID, string $box, string $nonce):string{ |
||
157 | |||
158 | /** |
||
159 | * @inheritdoc |
||
160 | */ |
||
161 | public function upload(string $blob):string{ |
||
164 | |||
165 | /** |
||
166 | * @inheritdoc |
||
167 | */ |
||
168 | public function download(string $blobID){ |
||
171 | |||
172 | /** |
||
173 | * @param string $threemaID |
||
174 | * |
||
175 | * @return string |
||
176 | * @throws \chillerlan\Threema\GatewayException |
||
177 | */ |
||
178 | protected function checkThreemaID(string $threemaID):string{ |
||
186 | |||
187 | /** |
||
188 | * @param string $phoneNo |
||
189 | * |
||
190 | * @return string |
||
191 | * @throws \chillerlan\Threema\GatewayException |
||
192 | */ |
||
193 | protected function checkPhoneNo(string $phoneNo):string{ |
||
202 | |||
203 | /** |
||
204 | * @param $email |
||
205 | * |
||
206 | * @return string |
||
207 | * @throws \chillerlan\Threema\GatewayException |
||
208 | */ |
||
209 | protected function checkEmail($email):string{ |
||
218 | |||
219 | /** |
||
220 | * @param string $hash |
||
221 | * |
||
222 | * @return string |
||
223 | * @throws \chillerlan\Threema\GatewayException |
||
224 | */ |
||
225 | protected function checkHash(string $hash):string{ |
||
233 | |||
234 | } |
||
235 |