From 163c7abfb079136f8c92fe1ee124a96538269753 Mon Sep 17 00:00:00 2001 From: Rudger Gravestein Date: Fri, 10 Jun 2022 14:26:05 +0200 Subject: [PATCH] Replace the download function from AssetMediaFileApiInterface by extending the interface with DownloadableResourceInterface --- src/Api/AssetManager/AssetMediaFileApi.php | 2 +- .../AssetManager/AssetMediaFileApiInterface.php | 14 ++------------ 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/Api/AssetManager/AssetMediaFileApi.php b/src/Api/AssetManager/AssetMediaFileApi.php index 8b63ba0e..4ac97f0b 100644 --- a/src/Api/AssetManager/AssetMediaFileApi.php +++ b/src/Api/AssetManager/AssetMediaFileApi.php @@ -28,7 +28,7 @@ public function __construct(ResourceClientInterface $resourceClient, FileSystemI /** * {@inheritdoc} */ - public function download($code): ResponseInterface + public function download(string $code): ResponseInterface { return $this->resourceClient->getStreamedResource(static::MEDIA_FILE_DOWNLOAD_URI, [$code]); } diff --git a/src/Api/AssetManager/AssetMediaFileApiInterface.php b/src/Api/AssetManager/AssetMediaFileApiInterface.php index b62b4998..ced2357c 100644 --- a/src/Api/AssetManager/AssetMediaFileApiInterface.php +++ b/src/Api/AssetManager/AssetMediaFileApiInterface.php @@ -3,22 +3,12 @@ namespace Akeneo\Pim\ApiClient\Api\AssetManager; +use Akeneo\Pim\ApiClient\Api\Operation\DownloadableResourceInterface; use Akeneo\Pim\ApiClient\Exception\HttpException; use Akeneo\Pim\ApiClient\Exception\RuntimeException; -use Psr\Http\Message\ResponseInterface; -interface AssetMediaFileApiInterface +interface AssetMediaFileApiInterface extends DownloadableResourceInterface { - /** - * Downloads an asset media file by its code - * - * @param string $code Code of the media file - * - * @throws HttpException If the request failed. - * - * @return ResponseInterface - */ - public function download($code): ResponseInterface; /** * Creates a new asset media file.