34 lines
711 B
PHP
34 lines
711 B
PHP
<?php
|
|
namespace Sdk\Wallet;
|
|
use GuzzleHttp\Client;
|
|
|
|
class Http
|
|
{
|
|
protected Client $httpClient;
|
|
|
|
function __construct($client)
|
|
{
|
|
$this->httpClient = $client;
|
|
}
|
|
|
|
function getClient()
|
|
{
|
|
return $this->httpClient;
|
|
}
|
|
|
|
function get(string $endpoint, array $data = [])
|
|
{
|
|
$stream = (string)$this->getClient()->get($endpoint, ['query' => $data])->getBody();
|
|
$body = json_decode($stream, false);
|
|
return $body;
|
|
}
|
|
|
|
function post(string $endpoint, array $data = [])
|
|
{
|
|
$stream = (string)$this->getClient()->post($endpoint, ['json' => $data])->getBody();
|
|
$body = json_decode($stream, false);
|
|
return $body;
|
|
}
|
|
|
|
}
|