Merge pull request #292 from ControlPanel-gg/ptero_api_limits_increase

increased the limit of most api request to pterodacttyl
This commit is contained in:
AVMG 2021-11-13 11:57:31 +01:00 committed by GitHub
commit f79cb42936
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -14,6 +14,11 @@ use Illuminate\Support\Facades\Http;
class Pterodactyl class Pterodactyl
{ {
/**
* @description per_page option to pull more than the default 50 from pterodactyl
*/
public CONST PER_PAGE = 200;
//TODO: Extend error handling (maybe logger for more errors when debugging) //TODO: Extend error handling (maybe logger for more errors when debugging)
/** /**
@ -43,7 +48,7 @@ class Pterodactyl
*/ */
public static function getEggs(Nest $nest) public static function getEggs(Nest $nest)
{ {
$response = self::client()->get("/application/nests/{$nest->id}/eggs?include=nest,variables"); $response = self::client()->get("/application/nests/{$nest->id}/eggs?include=nest,variables&per_page=" . self::PER_PAGE);
if ($response->failed()) throw self::getException(); if ($response->failed()) throw self::getException();
return $response->json()['data']; return $response->json()['data'];
} }
@ -54,7 +59,7 @@ class Pterodactyl
*/ */
public static function getNodes() public static function getNodes()
{ {
$response = self::client()->get('/application/nodes'); $response = self::client()->get('/application/nodes?per_page=' . self::PER_PAGE);
if ($response->failed()) throw self::getException(); if ($response->failed()) throw self::getException();
return $response->json()['data']; return $response->json()['data'];
} }
@ -65,7 +70,7 @@ class Pterodactyl
*/ */
public static function getNests() public static function getNests()
{ {
$response = self::client()->get('/application/nests'); $response = self::client()->get('/application/nests?per_page=' . self::PER_PAGE);
if ($response->failed()) throw self::getException(); if ($response->failed()) throw self::getException();
return $response->json()['data']; return $response->json()['data'];
} }
@ -76,7 +81,7 @@ class Pterodactyl
*/ */
public static function getLocations() public static function getLocations()
{ {
$response = self::client()->get('/application/locations'); $response = self::client()->get('/application/locations?per_page=' . self::PER_PAGE);
if ($response->failed()) throw self::getException(); if ($response->failed()) throw self::getException();
return $response->json()['data']; return $response->json()['data'];
} }