made this thingi work \o/

This commit is contained in:
2024-09-13 04:01:21 +02:00
parent 27fc4b9f99
commit 99417ef9ec
5 changed files with 211 additions and 87 deletions

View File

@@ -6,12 +6,14 @@ use Redmine\Client\Psr18Client;
use GuzzleHttp\Client as GuzzleClient;
use GuzzleHttp\Psr7\HttpFactory as GuzzleHttpFactory;
use Redmine\Api;
use Redmine\Client\Client;
use Redmine\Http\HttpClient;
use Redmine\Http\Request;
use Redmine\Http\Response;
use Symfony\Contracts\Cache\ItemInterface;
use Symfony\Contracts\Cache\TagAwareCacheInterface;
use Symfony\Component\DependencyInjection\Attribute\AsAlias;
#[AsAlias(id: 'redmine.api', public: true)]
final class RedmineClient
final class RedmineClient implements Client, HttpClient
{
private ?Psr18Client $client = null;
@@ -54,8 +56,58 @@ final class RedmineClient
return $this->client;
}
public function request(Request $request): Response
{
return $this->getClient()->request($request);
}
public function getApi(string $name): Api
{
return $this->getClient()->getApi($name);
}
public function startImpersonateUser(string $username): void
{
$this->getClient()->startImpersonateUser($username);
}
public function stopImpersonateUser(): void
{
$this->getClient()->stopImpersonateUser();
}
public function requestGet(string $path): bool
{
return $this->getClient()->requestGet($path);
}
public function requestPost(string $path, string $body): bool
{
return $this->getClient()->requestPost($path, $body);
}
public function requestPut(string $path, string $body): bool
{
return $this->getClient()->requestPut($path, $body);
}
public function requestDelete(string $path): bool
{
return $this->getClient()->requestDelete($path);
}
public function getLastResponseStatusCode(): int
{
return $this->getClient()->getLastResponseStatusCode();
}
public function getLastResponseContentType(): string
{
return $this->getClient()->getLastResponseContentType();
}
public function getLastResponseBody(): string
{
return $this->getClient()->getLastResponseBody();
}
}