From fe6da0ee155ed321d1652196c5a7f67a3f5eee52 Mon Sep 17 00:00:00 2001 From: AVMG20 Date: Sat, 13 Nov 2021 11:56:34 +0100 Subject: [PATCH] increased the limit of most api request to pterodacttyl --- app/Classes/Pterodactyl.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/Classes/Pterodactyl.php b/app/Classes/Pterodactyl.php index 1904ed8f..710fbb12 100644 --- a/app/Classes/Pterodactyl.php +++ b/app/Classes/Pterodactyl.php @@ -14,6 +14,11 @@ use Illuminate\Support\Facades\Http; 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) /** @@ -43,7 +48,7 @@ class Pterodactyl */ 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(); return $response->json()['data']; } @@ -54,7 +59,7 @@ class Pterodactyl */ 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(); return $response->json()['data']; } @@ -65,7 +70,7 @@ class Pterodactyl */ 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(); return $response->json()['data']; } @@ -76,7 +81,7 @@ class Pterodactyl */ 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(); return $response->json()['data']; }