@@ -108,6 +108,11 @@ class Server extends Model
108108 */
109109 public $ labels ;
110110
111+ /**
112+ * @var array
113+ */
114+ public $ volumes ;
115+
111116 /**
112117 *
113118 *
@@ -138,6 +143,7 @@ public function setAdditionalData($data)
138143 $ this ->outgoingTraffic = $ data ->outgoing_traffic ?: null ;
139144 $ this ->ingoingTraffic = $ data ->ingoing_traffic ?: null ;
140145 $ this ->includedTraffic = $ data ->included_traffic ?: null ;
146+ $ this ->volumes = property_exists ($ data , 'volumes ' ) ? $ data ->volumes : [];
141147 $ this ->protection = $ data ->protection ?: Protection::parse ($ data ->protection );
142148 $ this ->labels = $ data ->labels ;
143149 return $ this ;
@@ -168,7 +174,7 @@ public function powerOn(): APIResponse
168174 if (!HetznerAPIClient::hasError ($ response )) {
169175 return APIResponse::create ([
170176 'action ' => Action::parse (json_decode ((string )$ response ->getBody ())->action )
171- ]);
177+ ], $ response -> getHeaders () );
172178 }
173179 }
174180
@@ -185,7 +191,7 @@ public function softReboot(): APIResponse
185191 if (!HetznerAPIClient::hasError ($ response )) {
186192 return APIResponse::create ([
187193 'action ' => Action::parse (json_decode ((string )$ response ->getBody ())->action )
188- ]);
194+ ], $ response -> getHeaders () );
189195 }
190196 }
191197
@@ -202,7 +208,7 @@ public function reset(): APIResponse
202208 if (!HetznerAPIClient::hasError ($ response )) {
203209 return APIResponse::create ([
204210 'action ' => Action::parse (json_decode ((string )$ response ->getBody ())->action )
205- ]);
211+ ], $ response -> getHeaders () );
206212 }
207213 }
208214
@@ -219,7 +225,7 @@ public function shutdown(): APIResponse
219225 if (!HetznerAPIClient::hasError ($ response )) {
220226 return APIResponse::create ([
221227 'action ' => Action::parse (json_decode ((string )$ response ->getBody ())->action )
222- ]);
228+ ], $ response -> getHeaders () );
223229 }
224230 }
225231
@@ -236,7 +242,7 @@ public function powerOff(): APIResponse
236242 if (!HetznerAPIClient::hasError ($ response )) {
237243 return APIResponse::create ([
238244 'action ' => Action::parse (json_decode ((string )$ response ->getBody ())->action )
239- ]);
245+ ], $ response -> getHeaders () );
240246 }
241247 }
242248
@@ -255,7 +261,7 @@ public function resetRootPassword(): APIResponse
255261 return APIResponse::create ([
256262 'action ' => Action::parse ($ payload ->action ),
257263 'root_password ' => $ payload ->root_password
258- ]);
264+ ], $ response -> getHeaders () );
259265 }
260266 }
261267
@@ -281,7 +287,7 @@ public function enableRescue($type = 'linux64', $ssh_keys = []): APIResponse
281287 return APIResponse::create ([
282288 'action ' => Action::parse ($ payload ->action ),
283289 'root_password ' => $ payload ->root_password
284- ]);
290+ ], $ response -> getHeaders () );
285291 }
286292 }
287293
@@ -298,7 +304,7 @@ public function disableRescue(): APIResponse
298304 if (!HetznerAPIClient::hasError ($ response )) {
299305 return APIResponse::create ([
300306 'action ' => Action::parse (json_decode ((string )$ response ->getBody ())->action )
301- ]);
307+ ], $ response -> getHeaders () );
302308 }
303309 }
304310
@@ -325,7 +331,7 @@ public function createImage(string $description = '', string $type = 'snapshot')
325331 return APIResponse::create ([
326332 'action ' => Action::parse ($ payload ->action ),
327333 'image ' => Image::parse ($ payload ->image )
328- ]);
334+ ], $ response -> getHeaders () );
329335 }
330336 }
331337
@@ -347,7 +353,7 @@ public function rebuildFromImage(Image $image): APIResponse
347353 if (!HetznerAPIClient::hasError ($ response )) {
348354 return APIResponse::create ([
349355 'action ' => Action::parse (json_decode ((string )$ response ->getBody ())->action )
350- ]);
356+ ], $ response -> getHeaders () );
351357 }
352358 }
353359
@@ -371,29 +377,24 @@ public function changeType(ServerType $serverType, bool $upgradeDisk = false): A
371377 if (!HetznerAPIClient::hasError ($ response )) {
372378 return APIResponse::create ([
373379 'action ' => Action::parse (json_decode ((string )$ response ->getBody ())->action )
374- ]);
380+ ], $ response -> getHeaders () );
375381 }
376382 }
377383
378384 /**
379385 * Enables and configures the automatic daily backup option for the server. Enabling automatic backups will increase the price of the server by 20%
380386 *
381387 * @see https://docs.hetzner.cloud/#resources-server-actions-post-11
382- * @param string|null $backupWindow
383388 * @return APIResponse
384389 * @throws \LKDev\HetznerCloud\APIException
385390 */
386391 public function enableBackups (string $ backupWindow = null ): APIResponse
387392 {
388- $ response = $ this ->httpClient ->post ($ this ->replaceServerIdInUri ('servers/{id}/actions/enable_backup ' ), [
389- 'json ' => [
390- 'backup_window ' => $ backupWindow ,
391- ],
392- ]);
393+ $ response = $ this ->httpClient ->post ($ this ->replaceServerIdInUri ('servers/{id}/actions/enable_backup ' ));
393394 if (!HetznerAPIClient::hasError ($ response )) {
394395 return APIResponse::create ([
395396 'action ' => Action::parse (json_decode ((string )$ response ->getBody ())->action )
396- ]);
397+ ], $ response -> getHeaders () );
397398 }
398399 }
399400
@@ -410,7 +411,7 @@ public function disableBackups(): APIResponse
410411 if (!HetznerAPIClient::hasError ($ response )) {
411412 return APIResponse::create ([
412413 'action ' => Action::parse (json_decode ((string )$ response ->getBody ())->action )
413- ]);
414+ ], $ response -> getHeaders () );
414415 }
415416 }
416417
@@ -432,7 +433,7 @@ public function attachISO(ISO $iso): APIResponse
432433 if (!HetznerAPIClient::hasError ($ response )) {
433434 return APIResponse::create ([
434435 'action ' => Action::parse (json_decode ((string )$ response ->getBody ())->action )
435- ]);
436+ ], $ response -> getHeaders () );
436437 }
437438 }
438439
@@ -449,7 +450,7 @@ public function detachISO(): APIResponse
449450 if (!HetznerAPIClient::hasError ($ response )) {
450451 return APIResponse::create ([
451452 'action ' => Action::parse (json_decode ((string )$ response ->getBody ())->action )
452- ]);
453+ ], $ response -> getHeaders () );
453454 }
454455 }
455456
@@ -473,7 +474,7 @@ public function changeReverseDNS(string $ip, string $dnsPtr): APIResponse
473474 if (!HetznerAPIClient::hasError ($ response )) {
474475 return APIResponse::create ([
475476 'action ' => Action::parse (json_decode ((string )$ response ->getBody ())->action )
476- ]);
477+ ], $ response -> getHeaders () );
477478 }
478479 }
479480
@@ -505,7 +506,7 @@ public function delete(): APIResponse
505506 if (!HetznerAPIClient::hasError ($ response )) {
506507 return APIResponse::create ([
507508 'action ' => Action::parse (json_decode ((string )$ response ->getBody ())->action )
508- ]);
509+ ], $ response -> getHeaders () );
509510 }
510511 }
511512
@@ -527,7 +528,7 @@ public function update(array $data)
527528 if (!HetznerAPIClient::hasError ($ response )) {
528529 return APIResponse::create ([
529530 'server ' => Server::parse (json_decode ((string )$ response ->getBody ())->server )
530- ]);
531+ ], $ response -> getHeaders () );
531532 }
532533 }
533534
@@ -561,7 +562,7 @@ public function requestConsole(): APIResponse
561562 'action ' => Action::parse ($ payload ->action ),
562563 'wss_url ' => $ payload ->wss_url ,
563564 'password ' => $ payload ->password
564- ]);
565+ ], $ response -> getHeaders () );
565566 }
566567 }
567568
@@ -585,7 +586,7 @@ public function changeProtection(bool $delete = true, bool $rebuild = true): API
585586 if (!HetznerAPIClient::hasError ($ response )) {
586587 return APIResponse::create ([
587588 'action ' => Action::parse (json_decode ((string )$ response ->getBody ())->action )
588- ]);
589+ ], $ response -> getHeaders () );
589590 }
590591 }
591592
0 commit comments