ConsultancyProject_2_ETL/dashboard/app/Api.php

68 lines
1.2 KiB
PHP
Raw Normal View History

2024-12-18 15:14:13 +01:00
<?php
namespace App;
use Illuminate\Support\Facades\Http;
class Api
{
public function __construct()
{
}
public static function get(string $path, string $query = ''): ?array
{
$endpoint = env('FASTAPI_URI');
$request = $endpoint.$path;
$get = Http::get($request);
if($get->successful()){
return $get->json();
}
return null;
}
public static function propertiesPerRegion()
{
return self::get('/region/properties');
}
2024-12-18 19:52:06 +01:00
public static function propertiesGrowth()
{
return self::get('/properties/growth');
}
public static function propertiesGeo()
{
return self::get('/properties/geo');
}
2024-12-18 15:14:13 +01:00
public static function propertyExtractions(int $id)
{
2024-12-18 19:52:06 +01:00
return self::get("/property/{$id}/extractions");
}
public static function propertyCapacities(int $id)
{
return self::get("/property/{$id}/capacities");
}
2024-12-18 19:52:06 +01:00
public static function propertyBase(int $id): mixed
{
return self::get("/property/{$id}/base");
2024-12-18 15:14:13 +01:00
}
2024-12-20 21:46:54 +01:00
public static function regionCapacities(int $id): mixed
{
return self::get("/region/{$id}/capacities");
}
2024-12-18 15:14:13 +01:00
}