Update server creation data logic

This commit is contained in:
Dane Everitt 2019-11-16 13:33:01 -08:00
parent 2848d182ef
commit 8f0044575f
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
6 changed files with 187 additions and 86 deletions

View file

@ -29,4 +29,26 @@ class DaemonServerRepository extends DaemonRepository
return json_decode($response->getBody()->__toString(), true);
}
/**
* Creates a new server on the Wings daemon.
*
* @param array $data
*
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
*/
public function create(array $data): void
{
Assert::isInstanceOf($this->server, Server::class);
try {
$this->getHttpClient()->post(
'/api/servers', [
'json' => $data,
]
);
} catch (TransferException $exception) {
throw new DaemonConnectionException($exception);
}
}
}