Refactor how repositories for the daemon work.

This commit is contained in:
Dane Everitt 2018-01-05 18:27:47 -06:00
parent 5f9fe4a69b
commit d2afc29a80
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
58 changed files with 388 additions and 997 deletions

View file

@ -1,68 +1,65 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Contracts\Repository\Daemon;
use GuzzleHttp\Client;
use Pterodactyl\Models\Node;
use Pterodactyl\Models\Server;
interface BaseRepositoryInterface
{
/**
* Set the node model to be used for this daemon connection.
*
* @param int $id
* @param \Pterodactyl\Models\Node $node
* @return $this
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function setNode($id);
public function setNode(Node $node);
/**
* Return the node model being used.
*
* @return \Pterodactyl\Models\Node
*/
public function getNode();
public function getNode(): Node;
/**
* Set the UUID for the server to be used in the X-Access-Server header for daemon requests.
* Set the Server model to use when requesting information from the Daemon.
*
* @param null|string $server
* @param \Pterodactyl\Models\Server $server
* @return $this
*/
public function setAccessServer($server = null);
public function setServer(Server $server);
/**
* Return the UUID of the server being used in requests.
* Return the Server model.
*
* @return string
* @return \Pterodactyl\Models\Server|null
*/
public function getAccessServer();
public function getServer();
/**
* Set the token to be used in the X-Access-Token header for requests to the daemon.
*
* @param null|string $token
* @param string $token
* @return $this
*/
public function setAccessToken($token = null);
public function setToken(string $token);
/**
* Return the access token being used for requests.
*
* @return string
* @return string|null
*/
public function getAccessToken();
public function getToken();
/**
* Return an instance of the Guzzle HTTP Client to be used for requests.
*
* @param array $headers
* @return \GuzzleHttp\Client
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function getHttpClient(array $headers = []);
public function getHttpClient(array $headers = []): Client;
}