Skip to content

Commit 2b32dcf

Browse files
authored
Complete the documentation of the php client when downloading a media in v4 (#262)
Complete the documentation of the php client for downloading a media in v4
1 parent 413aa37 commit 2b32dcf

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

content/php-client/resources/PAM/asset-reference-files.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ $product = $client->getAssetReferenceFileApi()->downloadFromLocalizableAsset('ch
5858
file_put_contents('/tmp/chicagoskyline.jpg', $product->getContents());
5959
```
6060

61+
From the v4 of the PHP client, the response is returned instead of the content. It allows getting the filename and the MIME type from the response.
62+
You can get the content this way:
63+
64+
```php
65+
file_put_contents('/tmp/chicagoskyline.jpg', $product->getBody()->getContents());
66+
```
67+
6168
#### Download a reference file of a not localizable asset
6269

6370
```php
@@ -68,6 +75,13 @@ $product = $client->getAssetReferenceFileApi()->downloadFromNotLocalizableAsset(
6875
file_put_contents('/tmp/bridge.jpg', $product->getContents());
6976
```
7077

78+
From the v4 of the PHP client, the response is returned instead of the content. It allows getting the filename and the MIME type from the response.
79+
You can get the content this way:
80+
81+
```php
82+
file_put_contents('/tmp/bridge.jpg', $product->getBody()->getContents());
83+
```
84+
7185
#### Upload an asset reference file for a localizable asset
7286

7387
```php

content/php-client/resources/PAM/asset-variation-files.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ $product = $client->getAssetVariationFileApi()->downloadFromLocalizableAsset('ch
6060
file_put_contents('/tmp/chicagoskyline-mobile.jpg', $product->getContents());
6161
```
6262

63+
From the v4 of the PHP client, the response is returned instead of the content. It allows getting the filename and the MIME type from the response.
64+
You can get the content this way:
65+
66+
```php
67+
file_put_contents('/tmp/chicagoskyline-mobile.jpg', $product->getBody()->getContents());
68+
```
69+
6370
#### Download a variation file of a not localizable asset
6471

6572
```php
@@ -70,6 +77,13 @@ $product = $client->getAssetVariationFileApi()->downloadFromNotLocalizableAsset(
7077
file_put_contents('/tmp/bridge-mobile.jpg', $product->getContents());
7178
```
7279

80+
From the v4 of the PHP client, the response is returned instead of the content. It allows getting the filename and the MIME type from the response.
81+
You can get the content this way:
82+
83+
```php
84+
file_put_contents('/tmp/bridge-mobile.jpg', $product->getBody()->getContents());
85+
```
86+
7387
#### Upload an asset variation file for a localizable asset
7488

7589
```php
@@ -85,3 +99,4 @@ $client = new \Akeneo\Pim\ApiClient\AkeneoPimEnterpriseClientBuilder('http://ake
8599

86100
$client->getAssetVariationFileApi()->uploadForNotLocalizableAsset('/tmp/bridge-mobile.jpg', 'bridge', 'mobile');
87101
```
102+

content/php-client/resources/products/product-media-files.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ $mediaFile = $client->getProductMediaFileApi()->download('code/example');
3333
file_put_contents('/tmp/ziggy.jpg', $product->getContents());
3434
```
3535

36+
From the v4 of the PHP client, the response is returned instead of the content. It allows getting the filename and the MIME type from the response.
37+
You can get the content this way:
38+
39+
```php
40+
file_put_contents('/tmp/bridge.jpg', $product->getBody()->getContents());
41+
```
42+
3643
#### Get a list of media file information
3744

3845
There are two ways of getting media files.

0 commit comments

Comments
 (0)