58 lines
		
	
	
		
			992 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			58 lines
		
	
	
		
			992 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?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');
 | 
						|
    }
 | 
						|
 | 
						|
    public static function propertiesGrowth()
 | 
						|
    {
 | 
						|
        return self::get('/properties/growth');
 | 
						|
    }
 | 
						|
 | 
						|
     public static function propertiesGeo()
 | 
						|
    {
 | 
						|
        return self::get('/properties/geo');
 | 
						|
    }
 | 
						|
 | 
						|
    public static function propertyExtractions(int $id)
 | 
						|
    {
 | 
						|
        return self::get("/property/{$id}/extractions");
 | 
						|
    }
 | 
						|
 | 
						|
    public static function propertyBase(int $id): mixed
 | 
						|
    {
 | 
						|
        return self::get("/property/{$id}/base");
 | 
						|
    }
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
    
 | 
						|
}
 |