Skip to content

Commit 1bbf891

Browse files
Automatically update PHP SDK
1 parent c3bf8ac commit 1bbf891

11 files changed

Lines changed: 52 additions & 291 deletions

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "trophy/php",
3-
"version": "1.0.7",
3+
"version": "1.0.8",
44
"description": "Trophy PHP Library",
55
"keywords": [
66
"trophy",

src/Traits/BaseAchievementResponse.php

Lines changed: 0 additions & 40 deletions
This file was deleted.

src/Types/AchievementCompletionResponse.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ class AchievementCompletionResponse extends JsonSerializableType
1414
public string $completionId;
1515

1616
/**
17-
* @var ApiAchievementResponse $achievement
17+
* @var AchievementResponse $achievement
1818
*/
1919
#[JsonProperty('achievement')]
20-
public ApiAchievementResponse $achievement;
20+
public AchievementResponse $achievement;
2121

2222
/**
2323
* @param array{
2424
* completionId: string,
25-
* achievement: ApiAchievementResponse,
25+
* achievement: AchievementResponse,
2626
* } $values
2727
*/
2828
public function __construct(
Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use DateTime;
88
use Trophy\Core\Types\Date;
99

10-
class BaseAchievementResponse extends JsonSerializableType
10+
class AchievementResponse extends JsonSerializableType
1111
{
1212
/**
1313
* @var string $id The unique ID of the achievement.
@@ -28,24 +28,52 @@ class BaseAchievementResponse extends JsonSerializableType
2828
public ?string $badgeUrl;
2929

3030
/**
31-
* @var ?string $key The key used to reference this achievement in the API.
31+
* @var ?DateTime $achievedAt The date and time the achievement was completed, in ISO 8601 format.
32+
*/
33+
#[JsonProperty('achievedAt'), Date(Date::TYPE_DATETIME)]
34+
public ?DateTime $achievedAt;
35+
36+
/**
37+
* @var ?string $key The key used to reference this achievement in the API (only applicable if trigger = 'api')
3238
*/
3339
#[JsonProperty('key')]
3440
public ?string $key;
3541

3642
/**
37-
* @var ?DateTime $achievedAt The date and time the achievement was completed, in ISO 8601 format.
43+
* @var ?int $streakLength The length of the streak required to complete the achievement (only applicable if trigger = 'streak')
3844
*/
39-
#[JsonProperty('achievedAt'), Date(Date::TYPE_DATETIME)]
40-
public ?DateTime $achievedAt;
45+
#[JsonProperty('streakLength')]
46+
public ?int $streakLength;
47+
48+
/**
49+
* @var ?string $metricId The ID of the metric associated with this achievement (only applicable if trigger = 'metric')
50+
*/
51+
#[JsonProperty('metricId')]
52+
public ?string $metricId;
53+
54+
/**
55+
* @var ?float $metricValue The value of the metric required to complete the achievement (only applicable if trigger = 'metric')
56+
*/
57+
#[JsonProperty('metricValue')]
58+
public ?float $metricValue;
59+
60+
/**
61+
* @var ?string $metricName The name of the metric associated with this achievement (only applicable if trigger = 'metric')
62+
*/
63+
#[JsonProperty('metricName')]
64+
public ?string $metricName;
4165

4266
/**
4367
* @param array{
4468
* id: string,
4569
* name: string,
4670
* badgeUrl?: ?string,
47-
* key?: ?string,
4871
* achievedAt?: ?DateTime,
72+
* key?: ?string,
73+
* streakLength?: ?int,
74+
* metricId?: ?string,
75+
* metricValue?: ?float,
76+
* metricName?: ?string,
4977
* } $values
5078
*/
5179
public function __construct(
@@ -54,8 +82,12 @@ public function __construct(
5482
$this->id = $values['id'];
5583
$this->name = $values['name'];
5684
$this->badgeUrl = $values['badgeUrl'] ?? null;
57-
$this->key = $values['key'] ?? null;
5885
$this->achievedAt = $values['achievedAt'] ?? null;
86+
$this->key = $values['key'] ?? null;
87+
$this->streakLength = $values['streakLength'] ?? null;
88+
$this->metricId = $values['metricId'] ?? null;
89+
$this->metricValue = $values['metricValue'] ?? null;
90+
$this->metricName = $values['metricName'] ?? null;
5991
}
6092

6193
/**

src/Types/ApiAchievementResponse.php

Lines changed: 0 additions & 48 deletions
This file was deleted.

src/Types/EventResponse.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ class EventResponse extends JsonSerializableType
2727
public float $total;
2828

2929
/**
30-
* @var ?array<EventResponseMetricsItem> $achievements Changes to achievements as a result of this event.
30+
* @var ?array<AchievementResponse> $achievements Achievements completed as a result of this event.
3131
*/
32-
#[JsonProperty('achievements'), ArrayType([EventResponseMetricsItem::class])]
32+
#[JsonProperty('achievements'), ArrayType([AchievementResponse::class])]
3333
public ?array $achievements;
3434

3535
/**
@@ -43,7 +43,7 @@ class EventResponse extends JsonSerializableType
4343
* eventId: string,
4444
* metricId: string,
4545
* total: float,
46-
* achievements?: ?array<EventResponseMetricsItem>,
46+
* achievements?: ?array<AchievementResponse>,
4747
* currentStreak?: ?IncrementMetricStreakResponse,
4848
* } $values
4949
*/

src/Types/EventResponseMetricsItem.php

Lines changed: 0 additions & 52 deletions
This file was deleted.

src/Types/MetricAchievementResponse.php

Lines changed: 0 additions & 72 deletions
This file was deleted.

src/Types/MetricResponse.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ class MetricResponse extends JsonSerializableType
3939
public float $current;
4040

4141
/**
42-
* @var array<MetricAchievementResponse> $achievements A list of the metric's achievements and the user's progress towards each.
42+
* @var array<AchievementResponse> $achievements A list of the metric's achievements and the user's progress towards each.
4343
*/
44-
#[JsonProperty('achievements'), ArrayType([MetricAchievementResponse::class])]
44+
#[JsonProperty('achievements'), ArrayType([AchievementResponse::class])]
4545
public array $achievements;
4646

4747
/**
@@ -51,7 +51,7 @@ class MetricResponse extends JsonSerializableType
5151
* name: string,
5252
* status: value-of<MetricStatus>,
5353
* current: float,
54-
* achievements: array<MetricAchievementResponse>,
54+
* achievements: array<AchievementResponse>,
5555
* } $values
5656
*/
5757
public function __construct(

0 commit comments

Comments
 (0)