public function Client::queueAssetDownload in Media: Acquia DAM 8
Queue custom asset conversions for download.
This is a 2 step process: 1. Queue assets. 2. Download From Queue.
This step will allow users to queue an asset for download by specifying an AssetID and a Preset ID or custom conversion parameters. If a valid PresetID is defined, the other conversions parameters will be ignored (format, resolution, size, orientation, colorspace).
Parameters
array|int $assetIDs: A single or list of asset IDs.
array $options: Asset preset or conversion options.
Return value
array An array of response data.
Throws
\GuzzleHttp\Exception\GuzzleException
\cweagans\webdam\Exception\InvalidCredentialsException
File
- src/
Client.php, line 298
Class
- Client
- Overridden implementation of the cweagans php-webdam-client.
Namespace
Drupal\media_acquiadamCode
public function queueAssetDownload($assetIDs, array $options) {
$this
->checkAuth();
if (!is_array($assetIDs)) {
$assetIDs = [
$assetIDs,
];
}
$data = [
'items' => [],
];
foreach ($assetIDs as $assetID) {
$data['items'][] = [
'id' => $assetID,
] + $options;
}
$response = $this->client
->request('POST', $this->baseUrl . '/assets/queuedownload', [
'headers' => $this
->getDefaultHeaders(),
RequestOptions::JSON => $data,
]);
$response = json_decode((string) $response
->getBody(), TRUE);
return $response;
}