diff --git a/src/Client/Server/Network.php b/src/Client/Server/Network.php index 115c5a1..61999d1 100644 --- a/src/Client/Server/Network.php +++ b/src/Client/Server/Network.php @@ -14,12 +14,58 @@ public function __construct(PteroAPI $ptero) $this->endpoint = $ptero->api_type . '/servers'; } - public function set($server_identifier, int $allocation_id, $params) + /** + * Summary of get + * @param string $uuidShort + * @return mixed + */ + public function get(string $uuidShort) { - return $this->ptero->makeRequest( - 'POST', - $this->endpoint . '/' . $server_identifier . '/network/allocations/' . $allocation_id, - $params - ); + return $this->ptero->makeRequest('GET', $this->endpoint . '/' . $uuidShort . '/network/allocations'); + } + + /** + * Summary of set + * @param string $uuidShort + * @param int $allocation_id + * @return mixed + */ + public function set(string $uuidShort, int $allocation_id) + { + return $this->ptero->makeRequest('POST', $this->endpoint . '/' . $uuidShort . '/network/allocations/' . $allocation_id); + } + + /** + * Summary of setNotes + * @param string $uuidShort + * @param int $allocation_id + * @param string $notes + * @return mixed + */ + public function setNotes(string $uuidShort, int $allocation_id, string $notes) + { + return $this->ptero->makeRequest('POST', $this->endpoint . '/' . $uuidShort . '/network/allocations/' . $allocation_id, ['notes' => $notes]); + } + + /** + * Summary of setPrimary + * @param string $uuidShort + * @param int $allocation_id + * @return mixed + */ + public function setPrimary(string $uuidShort, int $allocation_id) + { + return $this->ptero->makeRequest('POST', $this->endpoint . '/' . $uuidShort . '/network/allocations/' . $allocation_id . '/primary'); + } + + /** + * Summary of delete + * @param string $uuidShort + * @param int $allocation_id + * @return mixed + */ + public function delete(string $uuidShort, int $allocation_id) + { + return $this->ptero->makeRequest('DELETE', $this->endpoint . '/' . $uuidShort . '/network/allocations/' . $allocation_id); } } diff --git a/src/PteroApi.php b/src/PteroApi.php index 9ad1f67..b00eee2 100644 --- a/src/PteroApi.php +++ b/src/PteroApi.php @@ -5,6 +5,7 @@ use Gigabait\PteroApi\Aplications\Servers; use Gigabait\PteroApi\Aplications\Locations; use Gigabait\PteroApi\Aplications\Allocations; +use Gigabait\PteroApi\Aplications\Databases; use Gigabait\PteroApi\Aplications\Users; use Gigabait\PteroApi\Aplications\Nests; use Gigabait\PteroApi\Aplications\Eggs; @@ -22,6 +23,7 @@ class PteroAPI protected $client; public $servers; + public $databases; public $locations; public $allocations; public $users; @@ -40,6 +42,7 @@ public function __construct($api_key, $base_url, $api_type = 'application') // Aplications $this->servers = new Servers($this); + $this->databases = new Databases($this); $this->locations = new Locations($this); $this->allocations = new Allocations($this); $this->users = new Users($this);