Readd gpodder stubs
This commit is contained in:
parent
68c6f8234e
commit
df30ff2318
@ -15,6 +15,12 @@
|
||||
"psalm:check": "psalm.phar --threads=1 --no-cache --show-info=true",
|
||||
"psalm:fix": "psalm.phar --no-cache --alter --issues=InvalidReturnType,InvalidNullableReturnType,MissingParamType,InvalidFalsableReturnType"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"OCA\\RePod\\": "lib/",
|
||||
"OCA\\GPodderSync\\": "stubs/OCA/GPodderSync/"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"platform": {
|
||||
"php": "8.0"
|
||||
|
@ -10,6 +10,7 @@
|
||||
>
|
||||
<projectFiles>
|
||||
<directory name="lib" />
|
||||
<directory name="stubs" />
|
||||
<ignoreFiles>
|
||||
<directory name="vendor" />
|
||||
</ignoreFiles>
|
||||
|
44
stubs/OCA/GPodderSync/Core/EpisodeAction/EpisodeAction.php
Normal file
44
stubs/OCA/GPodderSync/Core/EpisodeAction/EpisodeAction.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OCA\GPodderSync\Core\EpisodeAction;
|
||||
|
||||
/**
|
||||
* @psalm-type EpisodeActionType = array{
|
||||
* podcast: string,
|
||||
* episode: string,
|
||||
* action: string,
|
||||
* timestamp: string,
|
||||
* started: int,
|
||||
* position: int,
|
||||
* total: int,
|
||||
* guid: ?string,
|
||||
* id: int
|
||||
* }
|
||||
*/
|
||||
interface EpisodeAction
|
||||
{
|
||||
public function getPodcast(): string;
|
||||
|
||||
public function getEpisode(): string;
|
||||
|
||||
public function getAction(): string;
|
||||
|
||||
public function getTimestamp(): string;
|
||||
|
||||
public function getStarted(): int;
|
||||
|
||||
public function getPosition(): int;
|
||||
|
||||
public function getTotal(): int;
|
||||
|
||||
public function getGuid(): ?string;
|
||||
|
||||
public function getId(): int;
|
||||
|
||||
/**
|
||||
* @return EpisodeActionType
|
||||
*/
|
||||
public function toArray(): array;
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OCA\GPodderSync\Core\EpisodeAction;
|
||||
|
||||
interface EpisodeActionReader
|
||||
{
|
||||
/**
|
||||
* @param array $episodeActionsArray []
|
||||
* @return EpisodeAction[]
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function fromArray(array $episodeActionsArray): array;
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OCA\GPodderSync\Core\EpisodeAction;
|
||||
|
||||
interface EpisodeActionSaver
|
||||
{
|
||||
public function saveEpisodeActions(array $episodeActionsArray, string $userId): array;
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OCA\GPodderSync\Core\PodcastData;
|
||||
|
||||
/**
|
||||
* @psalm-type PodcastActionCountsType = array{
|
||||
* delete: int,
|
||||
* download: int,
|
||||
* flattr: int,
|
||||
* new: int,
|
||||
* play: int
|
||||
* }
|
||||
*/
|
||||
interface PodcastActionCounts extends \JsonSerializable
|
||||
{
|
||||
public function incrementAction(string $action): void;
|
||||
|
||||
/**
|
||||
* @return PodcastActionCountsType
|
||||
*/
|
||||
public function toArray(): array;
|
||||
|
||||
/**
|
||||
* @return PodcastActionCountsType
|
||||
*/
|
||||
public function jsonSerialize(): array;
|
||||
}
|
57
stubs/OCA/GPodderSync/Core/PodcastData/PodcastData.php
Normal file
57
stubs/OCA/GPodderSync/Core/PodcastData/PodcastData.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OCA\GPodderSync\Core\PodcastData;
|
||||
|
||||
/**
|
||||
* @psalm-type PodcastDataType = array{
|
||||
* title: ?string,
|
||||
* author: ?string,
|
||||
* link: ?string,
|
||||
* description: ?string,
|
||||
* imageUrl: ?string,
|
||||
* fetchedAtUnix: int,
|
||||
* imageBlob: ?string
|
||||
* }
|
||||
*/
|
||||
interface PodcastData extends \JsonSerializable
|
||||
{
|
||||
public function __toString(): string;
|
||||
|
||||
/**
|
||||
* @throws \Exception if the XML data could not be parsed
|
||||
*/
|
||||
public static function parseRssXml(string $xmlString, ?int $fetchedAtUnix = null): PodcastData;
|
||||
|
||||
public function getTitle(): ?string;
|
||||
|
||||
public function getAuthor(): ?string;
|
||||
|
||||
public function getLink(): ?string;
|
||||
|
||||
public function getDescription(): ?string;
|
||||
|
||||
public function getImageUrl(): ?string;
|
||||
|
||||
public function getFetchedAtUnix(): ?int;
|
||||
|
||||
public function getImageBlob(): ?string;
|
||||
|
||||
public function setImageBlob(?string $blob): void;
|
||||
|
||||
/**
|
||||
* @return PodcastDataType
|
||||
*/
|
||||
public function toArray(): array;
|
||||
|
||||
/**
|
||||
* @return PodcastDataType
|
||||
*/
|
||||
public function jsonSerialize(): array;
|
||||
|
||||
/**
|
||||
* @param PodcastDataType $data
|
||||
*/
|
||||
public static function fromArray(array $data): PodcastData;
|
||||
}
|
16
stubs/OCA/GPodderSync/Core/PodcastData/PodcastDataReader.php
Normal file
16
stubs/OCA/GPodderSync/Core/PodcastData/PodcastDataReader.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OCA\GPodderSync\Core\PodcastData;
|
||||
|
||||
interface PodcastDataReader
|
||||
{
|
||||
public function getCachedOrFetchPodcastData(string $url, string $userId): ?PodcastData;
|
||||
|
||||
public function fetchPodcastData(string $url, string $userId): ?PodcastData;
|
||||
|
||||
public function tryGetCachedPodcastData(string $url): ?PodcastData;
|
||||
|
||||
public function trySetCachedPodcastData(string $url, PodcastData $data): bool;
|
||||
}
|
33
stubs/OCA/GPodderSync/Core/PodcastData/PodcastMetrics.php
Normal file
33
stubs/OCA/GPodderSync/Core/PodcastData/PodcastMetrics.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OCA\GPodderSync\Core\PodcastData;
|
||||
|
||||
/**
|
||||
* @psalm-type PodcastMetricsType = array{
|
||||
* url: string,
|
||||
* listenedSeconds: int,
|
||||
* actionCounts: PodcastActionCounts
|
||||
* }
|
||||
*/
|
||||
interface PodcastMetrics extends \JsonSerializable
|
||||
{
|
||||
public function getUrl(): string;
|
||||
|
||||
public function getActionCounts(): PodcastActionCounts;
|
||||
|
||||
public function getListenedSeconds(): int;
|
||||
|
||||
public function addListenedSeconds(int $seconds): void;
|
||||
|
||||
/**
|
||||
* @return PodcastMetricsType
|
||||
*/
|
||||
public function toArray(): array;
|
||||
|
||||
/**
|
||||
* @return PodcastMetricsType
|
||||
*/
|
||||
public function jsonSerialize(): array;
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OCA\GPodderSync\Core\PodcastData;
|
||||
|
||||
interface PodcastMetricsReader
|
||||
{
|
||||
/**
|
||||
* @return PodcastMetrics[]
|
||||
*/
|
||||
public function metrics(string $userId): array;
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OCA\GPodderSync\Core\SubscriptionChange;
|
||||
|
||||
interface SubscriptionChange
|
||||
{
|
||||
public function __toString(): string;
|
||||
|
||||
public function isSubscribed(): bool;
|
||||
|
||||
public function getUrl(): string;
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OCA\GPodderSync\Core\SubscriptionChange;
|
||||
|
||||
interface SubscriptionChangeRequestParser
|
||||
{
|
||||
/**
|
||||
* @return SubscriptionChange[]
|
||||
*/
|
||||
public function createSubscriptionChangeList(array $urlsSubscribed, array $urlsUnsubscribed): array;
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OCA\GPodderSync\Core\SubscriptionChange;
|
||||
|
||||
interface SubscriptionChangeSaver
|
||||
{
|
||||
public function saveSubscriptionChanges(array $urlsSubscribed, array $urlsUnsubscribed, string $userId): void;
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OCA\GPodderSync\Core\SubscriptionChange;
|
||||
|
||||
interface SubscriptionChangesReader
|
||||
{
|
||||
/**
|
||||
* @return SubscriptionChange[]
|
||||
*/
|
||||
public static function mapToSubscriptionsChanges(array $urls, bool $subscribed): array;
|
||||
}
|
Loading…
Reference in New Issue
Block a user