Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
GIGABAIT93 committed Jan 19, 2023
1 parent 9c443ec commit b673590
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 6 deletions.
58 changes: 52 additions & 6 deletions src/Client/Server/Network.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
3 changes: 3 additions & 0 deletions src/PteroApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -22,6 +23,7 @@ class PteroAPI
protected $client;

public $servers;
public $databases;
public $locations;
public $allocations;
public $users;
Expand All @@ -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);
Expand Down

0 comments on commit b673590

Please sign in to comment.