-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathDefaultInfoService.php
37 lines (29 loc) · 1.07 KB
/
DefaultInfoService.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
declare(strict_types=1);
namespace Inspirum\Balikobot\Service;
use Inspirum\Balikobot\Client\Client;
use Inspirum\Balikobot\Definitions\Method;
use Inspirum\Balikobot\Definitions\Version;
use Inspirum\Balikobot\Model\Account\Account;
use Inspirum\Balikobot\Model\Account\AccountFactory;
use Inspirum\Balikobot\Model\Changelog\ChangelogCollection;
use Inspirum\Balikobot\Model\Changelog\ChangelogFactory;
final class DefaultInfoService implements InfoService
{
public function __construct(
private readonly Client $client,
private readonly AccountFactory $accountFactory,
private readonly ChangelogFactory $changelogFactory,
) {
}
public function getAccountInfo(): Account
{
$response = $this->client->call(Version::V2V1, null, Method::INFO_WHO_AM_I);
return $this->accountFactory->create($response);
}
public function getChangelog(): ChangelogCollection
{
$response = $this->client->call(Version::V2V1, null, Method::CHANGELOG);
return $this->changelogFactory->createCollection($response);
}
}