| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace Metricool\Http\Endpoints\Responses; |
| 6 |
|
| 7 |
class RealtimeResponse extends Response |
| 8 |
{ |
| 9 |
/** |
| 10 |
* @var array $totals The data to be shown in the totals columns |
| 11 |
* @see \Metricool\Services\RealtimeService::getTotals() |
| 12 |
*/ |
| 13 |
public array $totals = []; |
| 14 |
/** |
| 15 |
* @var array $timelineData The data to be shown in the timeline |
| 16 |
* @see \Metricool\Services\RealtimeService::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 $timeline): self |
| 28 |
{ |
| 29 |
$this->timelineData = $timeline; |
| 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 |
} |
| 45 |
|