77use DateTime ;
88use 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 /**
0 commit comments