Files
wp-donations/includes/Overlay/OverlayDataSource.php
T
shadowdaoandClaude Sonnet 5.5 65082fb2f5 Add OBS overlays (goal, timer, counter, alerts) with ETag polling
Align timer state key with rules engine (timer_ends_at).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-15 08:45:22 -08:00

32 lines
1.0 KiB
PHP

<?php
declare( strict_types=1 );
namespace StreamGoals\Overlay;
/**
* Read-only data the overlay widgets need. Rows are raw associative arrays shaped like the
* sg_* tables; the payload builders do all privacy filtering, so implementations need not.
*/
interface OverlayDataSource {
/** The goal currently shown on stream (status active, newest first), or null. */
public function activeGoal(): ?array;
/** Sum of completed donations for the goal, in minor units (base or total per counts_fees). */
public function raisedMinor( array $goal ): int;
/** Raw sg_state value for a goal key, or null. */
public function stateValue( int $goalId, string $key ): ?string;
/** @return array{label:string,value:int} */
public function counter( int $goalId ): array;
/**
* Donations newer than $sinceId (ascending id, at most $limit rows). With null, return the single
* newest row so the caller can establish a baseline.
*
* @return array<int,array<string,mixed>>
*/
public function donations( ?int $sinceId, int $limit ): array;
}