public function download($id, $template = null, $templateType = 'image', CachePolicy $cachePolicy = null)
        {
            $parameters = [
            'query' => ['template' => $template, 'templateType' => $templateType],
            'body' => json_encode([], JSON_UNESCAPED_UNICODE),
            'headers' => [],
        ];

            $result = $this->get('v1/media/' . $id . '/download', $parameters, $cachePolicy);

            $tmpFile = tmpfile();
            if (false === fwrite($tmpFile, $result)) {
                throw new \RuntimeException('Could not write download data to temporary file!');
            }
            if (false === fseek($tmpFile, 0)) {
                throw new \RuntimeException('Could not reset file pointer of temporary file!');
            }
            $result = $tmpFile;

            return $result;
        }