42 lines
1.0 KiB
PHP
42 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace bird\classes;
|
|
|
|
require_once WD . '/classes/bird.php';
|
|
require_once WD . '/modules/bird/traits/bird_endpoint_builder_t.php';
|
|
|
|
use bird\traits\bird_endpoint_builder_t;
|
|
use classes\bird;
|
|
|
|
abstract class bird_api_client
|
|
{
|
|
use bird_endpoint_builder_t;
|
|
|
|
protected bird $bird;
|
|
|
|
public function __construct(bird $bird)
|
|
{
|
|
$this->bird = $bird;
|
|
}
|
|
|
|
protected function get(string $endpoint, array $query = []): array|object|null
|
|
{
|
|
return $this->bird->sendGetRequest($endpoint, $query);
|
|
}
|
|
|
|
protected function post(string $endpoint, array $payload = []): array|object|null
|
|
{
|
|
return $this->bird->sendPostRequest($endpoint, $payload);
|
|
}
|
|
|
|
protected function patch(string $endpoint, array $payload = []): array|object|null
|
|
{
|
|
return $this->bird->sendPatchRequest($endpoint, $payload);
|
|
}
|
|
|
|
protected function delete(string $endpoint, array $query = []): array|object|null
|
|
{
|
|
return $this->bird->sendDeleteRequest($endpoint, $query);
|
|
}
|
|
}
|