Skip to content

Commit 9abe32d

Browse files
nickygerritsenvmcj
authored andcommitted
Add provider data to API info.
1 parent 1732f9c commit 9abe32d

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

webapp/src/Controller/API/GeneralInfoController.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace App\Controller\API;
44

55
use App\DataTransferObject\ApiInfo;
6+
use App\DataTransferObject\ApiInfoProvider;
67
use App\DataTransferObject\ApiVersion;
78
use App\DataTransferObject\DomJudgeApiInfo;
89
use App\DataTransferObject\ExtendedContestStatus;
@@ -99,6 +100,10 @@ public function getInfoAction(
99100
version: self::CCS_SPEC_API_VERSION,
100101
versionUrl: self::CCS_SPEC_API_URL,
101102
name: 'DOMjudge',
103+
provider: new ApiInfoProvider(
104+
name: 'DOMjudge',
105+
version: $this->getParameter('domjudge.version'),
106+
),
102107
domjudge: $domjudge
103108
);
104109
}

webapp/src/DataTransferObject/ApiInfo.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public function __construct(
1010
public readonly string $version,
1111
public readonly string $versionUrl,
1212
public readonly string $name,
13+
public readonly ?ApiInfoProvider $provider,
1314
#[Serializer\Exclude(if: '!object.domjudge')]
1415
public readonly ?DomJudgeApiInfo $domjudge,
1516
) {}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace App\DataTransferObject;
4+
5+
use JMS\Serializer\Annotation as Serializer;
6+
7+
class ApiInfoProvider
8+
{
9+
public function __construct(
10+
public readonly string $name,
11+
public readonly string $version,
12+
#[Serializer\Exclude(if: '!object.buildDate')]
13+
public readonly ?string $buildDate = null,
14+
) {}
15+
}

0 commit comments

Comments
 (0)