1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* MIT License |
5
|
|
|
* For full license information, please view the LICENSE file that was distributed with this source code. |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Adapter\Asset; |
9
|
|
|
|
10
|
|
|
use Akeneo\PimEnterprise\ApiClient\AkeneoPimEnterpriseClientInterface; |
11
|
|
|
use Psr\Http\Message\ResponseInterface; |
12
|
|
|
|
13
|
|
|
class AssetReferenceFileApiAdapter implements AssetReferenceFileApiAdapterInterface |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* @var \Akeneo\PimEnterprise\ApiClient\AkeneoPimEnterpriseClientInterface |
17
|
|
|
*/ |
18
|
|
|
protected $akeneoPimClient; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @param \Akeneo\PimEnterprise\ApiClient\AkeneoPimEnterpriseClientInterface $akeneoPimClient |
22
|
|
|
*/ |
23
|
|
|
public function __construct(AkeneoPimEnterpriseClientInterface $akeneoPimClient) |
24
|
|
|
{ |
25
|
|
|
$this->akeneoPimClient = $akeneoPimClient; |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @param string $assetCode |
30
|
|
|
* @param string $localeCode |
31
|
|
|
* |
32
|
|
|
* @return array |
33
|
|
|
*/ |
34
|
|
|
public function getFromLocalizableAsset(string $assetCode, string $localeCode): array |
35
|
|
|
{ |
36
|
|
|
return $this->akeneoPimClient |
37
|
|
|
->getAssetReferenceFileApi() |
38
|
|
|
->getFromLocalizableAsset($assetCode, $localeCode); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @param string $assetCode |
43
|
|
|
* |
44
|
|
|
* @return array |
45
|
|
|
*/ |
46
|
|
|
public function getFromNotLocalizableAsset(string $assetCode): array |
47
|
|
|
{ |
48
|
|
|
return $this->akeneoPimClient |
49
|
|
|
->getAssetReferenceFileApi() |
50
|
|
|
->getFromNotLocalizableAsset($assetCode); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @param string $assetCode |
55
|
|
|
* @param string $localeCode |
56
|
|
|
* |
57
|
|
|
* @return \Psr\Http\Message\ResponseInterface |
58
|
|
|
*/ |
59
|
|
|
public function downloadFromLocalizableAsset(string $assetCode, string $localeCode): ResponseInterface |
60
|
|
|
{ |
61
|
|
|
return $this->akeneoPimClient |
62
|
|
|
->getAssetReferenceFileApi() |
63
|
|
|
->downloadFromLocalizableAsset($assetCode, $localeCode); |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @param string $assetCode |
68
|
|
|
* |
69
|
|
|
* @return \Psr\Http\Message\ResponseInterface |
70
|
|
|
*/ |
71
|
|
|
public function downloadFromNotLocalizableAsset(string $assetCode): ResponseInterface |
72
|
|
|
{ |
73
|
|
|
return $this->akeneoPimClient |
74
|
|
|
->getAssetReferenceFileApi() |
75
|
|
|
->downloadFromNotLocalizableAsset($assetCode); |
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
|