| @@ -1,0 +1,44 @@ | ||
| 1 | +<?php | |
| 2 | + | |
| 3 | +declare(strict_types=1); | |
| 4 | + | |
| 5 | +namespace Metricool\Http\Endpoints\Responses; | |
| 6 | + | |
| 7 | +class AnalyticsResponse extends Response | |
| 8 | +{ | |
| 9 | + /** | |
| 10 | + * Sets the totals to be shown in the response | |
| 11 | + * @see \Metricool\Services\AnalyticsService::getTotals() | |
| 12 | + */ | |
| 13 | + public array $totals = []; | |
| 14 | + /** | |
| 15 | + * Sets the totals to be shown in the response | |
| 16 | + * @see \Metricool\Services\AnalyticsService::getTimelineData() | |
| 17 | + */ | |
| 18 | + public array $timelineData = []; | |
| 19 | + | |
| 20 | + public function setTotals(array $totals): self | |
| 21 | + { | |
| 22 | + $this->totals = $totals; | |
| 23 | + | |
| 24 | + return $this; | |
| 25 | + } | |
| 26 | + | |
| 27 | + public function setTimelineData(array $timelineData): self | |
| 28 | + { | |
| 29 | + $this->timelineData = $timelineData; | |
| 30 | + | |
| 31 | + return $this; | |
| 32 | + } | |
| 33 | + | |
| 34 | + /** | |
| 35 | + * @inheritDoc | |
| 36 | + */ | |
| 37 | + public function body(): array | |
| 38 | + { | |
| 39 | + return [ | |
| 40 | + 'totals' => $this->totals, | |
| 41 | + 'timelineData' => $this->timelineData, | |
| 42 | + ]; | |
| 43 | + } | |
| 44 | +} | |