Added Progress command, it's still experimental and only works correctly for plex at the moment. do not use it yet.

This commit is contained in:
Abdulmhsen B. A. A
2023-11-10 18:57:19 +03:00
parent e25349f8d1
commit 302f945763
11 changed files with 787 additions and 2 deletions

View File

@@ -19,6 +19,7 @@ use App\Backends\Plex\Action\GetUserToken;
use App\Backends\Plex\Action\Import;
use App\Backends\Plex\Action\InspectRequest;
use App\Backends\Plex\Action\ParseWebhook;
use App\Backends\Plex\Action\Progress;
use App\Backends\Plex\Action\Push;
use App\Backends\Plex\Action\SearchId;
use App\Backends\Plex\Action\SearchQuery;
@@ -259,6 +260,26 @@ class PlexClient implements iClient
return [];
}
public function progress(array $entities, QueueRequests $queue, iDate|null $after = null): array
{
$response = Container::get(Progress::class)(
context: $this->context,
entities: $entities,
queue: $queue,
after: $after
);
if ($response->hasError()) {
$this->logger->log($response->error->level(), $response->error->message, $response->error->context);
}
if (false === $response->isSuccessful()) {
throw new RuntimeException(ag($response->extra, 'message', fn() => $response->error->format()));
}
return [];
}
public function search(string $query, int $limit = 25, array $opts = []): array
{
$response = Container::get(SearchQuery::class)(