Update client API endpoints to not use deprecated function
This commit is contained in:
parent
7543ef085d
commit
b99ea53ca1
8 changed files with 74 additions and 58 deletions
|
@ -2,6 +2,25 @@
|
|||
|
||||
namespace Pterodactyl\Repositories\Wings;
|
||||
|
||||
use Webmozart\Assert\Assert;
|
||||
use Pterodactyl\Models\Server;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class DaemonPowerRepository extends DaemonRepository
|
||||
{
|
||||
/**
|
||||
* Sends a power action to the server instance.
|
||||
*
|
||||
* @param string $action
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
*/
|
||||
public function send(string $action): ResponseInterface
|
||||
{
|
||||
Assert::isInstanceOf($this->server, Server::class);
|
||||
|
||||
return $this->getHttpClient()->post(
|
||||
sprintf('/api/servers/%s/power', $this->server->id),
|
||||
['json' => ['action' => $action]]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue