From d363e529c06ec8ec28ec446333bf6b49c08a1610 Mon Sep 17 00:00:00 2001 From: Tony Lea Date: Thu, 21 Nov 2024 17:12:09 -0500 Subject: [PATCH] Adding updates to version 2 api --- config/config.php | 2 +- src/Commands/Ping.php | 2 +- src/Tails.php | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/config/config.php b/config/config.php index 2557271..7d95fa6 100644 --- a/config/config.php +++ b/config/config.php @@ -5,7 +5,7 @@ */ return [ 'api_key' => env('TAILS_API_KEY', null), - 'api_endpoint' => 'https://devdojo.com/api/v1', + 'api_endpoint' => 'https://tails.devdojo.com/api/v2', 'webhook_key' => env('TAILS_WEBHOOK_KEY', null), 'webhook_url' => env('TAILS_WEBHOOK_URL', 'tails/webhook'), diff --git a/src/Commands/Ping.php b/src/Commands/Ping.php index e727f60..78e31b0 100644 --- a/src/Commands/Ping.php +++ b/src/Commands/Ping.php @@ -30,7 +30,7 @@ class Ping extends Command */ public function handle() { - $endpoint = config('tails.api_endpoint') . '/tails-ping'; + $endpoint = config('tails.api_endpoint') . '/ping'; $apiKey = config('tails.api_key'); if(is_null($apiKey)){ abort(400, 'Invalid Tails API Key'); diff --git a/src/Tails.php b/src/Tails.php index ac1e293..c56a19a 100644 --- a/src/Tails.php +++ b/src/Tails.php @@ -18,12 +18,13 @@ public static function getResponse($project){ } - $endpoint = config('tails.api_endpoint') . '/tails' . '/' . $project; + $endpoint = config('tails.api_endpoint') . '/' . $project; $apiKey = config('tails.api_key'); if(is_null($apiKey)){ abort(400, 'Invalid Tails API Key'); } $response = Http::withToken( $apiKey )->get($endpoint); + if(!$response->ok()){ self::handleErrorResponse($response); } @@ -37,7 +38,7 @@ public static function getResponse($project){ // function used for the php artisan cache:clear command public static function getCacheArray(){ - $endpoint = config('tails.api_endpoint') . '/tails-clear'; + $endpoint = config('tails.api_endpoint') . '/clear'; $apiKey = config('tails.api_key'); if(is_null($apiKey)){ abort(400, 'Invalid Tails API Key');