2017-08-26 23:08:11 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Repositories\Daemon;
|
|
|
|
|
2018-01-06 00:27:47 +00:00
|
|
|
use Psr\Http\Message\ResponseInterface;
|
2017-08-26 23:08:11 +00:00
|
|
|
use Pterodactyl\Contracts\Repository\Daemon\CommandRepositoryInterface;
|
|
|
|
|
|
|
|
class CommandRepository extends BaseRepository implements CommandRepositoryInterface
|
|
|
|
{
|
|
|
|
/**
|
2018-01-06 00:27:47 +00:00
|
|
|
* Send a command to a server.
|
|
|
|
*
|
|
|
|
* @param string $command
|
|
|
|
* @return \Psr\Http\Message\ResponseInterface
|
2018-05-13 16:19:35 +00:00
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException
|
2017-08-26 23:08:11 +00:00
|
|
|
*/
|
2018-01-06 00:27:47 +00:00
|
|
|
public function send(string $command): ResponseInterface
|
2017-08-26 23:08:11 +00:00
|
|
|
{
|
2017-10-01 02:00:24 +00:00
|
|
|
return $this->getHttpClient()->request('POST', 'server/command', [
|
2017-08-26 23:08:11 +00:00
|
|
|
'json' => [
|
|
|
|
'command' => $command,
|
|
|
|
],
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|