$value) { array_set($structure, $key, $value); } return $this->getHttpClient()->request('POST', 'servers', [ 'json' => $structure, ]); } /** * {@inheritdoc} */ public function update(array $data) { return $this->getHttpClient()->request('PATCH', 'server', [ 'json' => $data, ]); } /** * {@inheritdoc} */ public function reinstall($data = null) { Assert::nullOrIsArray($data, 'First argument passed to reinstall must be null or an array, received %s.'); if (is_null($data)) { return $this->getHttpClient()->request('POST', 'server/reinstall'); } return $this->getHttpClient()->request('POST', 'server/reinstall', [ 'json' => $data, ]); } /** * {@inheritdoc} */ public function rebuild() { return $this->getHttpClient()->request('POST', 'server/rebuild'); } /** * {@inheritdoc} */ public function suspend() { return $this->getHttpClient()->request('POST', 'server/suspend'); } /** * {@inheritdoc} */ public function unsuspend() { return $this->getHttpClient()->request('POST', 'server/unsuspend'); } /** * {@inheritdoc} */ public function delete() { return $this->getHttpClient()->request('DELETE', 'servers'); } /** * {@inheritdoc} */ public function details() { return $this->getHttpClient()->request('GET', 'server'); } /** * {@inheritdoc} */ public function revokeAccessKey($key) { if (is_array($key)) { return $this->getHttpClient()->request('POST', 'keys', [ 'json' => $key, ]); } Assert::stringNotEmpty($key, 'First argument passed to revokeAccessKey must be a non-empty string or array, received %s.'); return $this->getHttpClient()->request('DELETE', 'keys/' . $key); } }