nextcloud-gpodder/lib/Core/EpisodeAction/EpisodeActionReader.php
Jonathan Flueren 795a9253d2 Adjust EpisodeAction upload to gpodder api, remove String upload
Remove 3rd dimension of POST data by directly accessing request data - a simple EpisodeActions array has to be posted now. This way the api is closer to gpodder.
Additionally, removed EpisodeAction upload as String, so it's now incompatible with older versions
2021-10-06 19:40:52 +02:00

32 lines
658 B
PHP

<?php
declare(strict_types=1);
namespace OCA\GPodderSync\Core\EpisodeAction;
class EpisodeActionReader
{
/**
* @param $episodeActionsArray[]
* @return EpisodeAction[]
*/
public function fromArray(array $episodeActionsArray): array
{
$episodeActions = [];
foreach($episodeActionsArray as $episodeAction) {
$episodeActions[] = new EpisodeAction(
$episodeAction["podcast"],
$episodeAction["episode"],
$episodeAction["action"],
$episodeAction["timestamp"],
$episodeAction["started"],
$episodeAction["position"],
$episodeAction["total"],
$episodeAction["guid"] ?? null,
);
}
return $episodeActions;
}
}