$configV3->getBaseUrl(), 'timeout' => $configV3->get('api.timeout'), 'headers' => [ 'Content-Type' => 'application/json', 'Accept' => 'application/json' ] ]; $collectionPath = __DIR__ . '/' . $configV3->get('postman_collection'); $testRunner = new TestRunner($collectionPath, $config); // Get campaign ID from URL or use default $campaignId = $_GET['campaign_id'] ?? '9697ffb1cc07b7c90ca0ea44ac44d3f6b01efa96'; $folderResults = null; $assetResults = null; $error = null; if ($_GET['action'] === 'get_folders') { try { $apiClient = new ApiClient(); $apiClient->setBaseUrl($configV3->getBaseUrl()); $oauth2Handler = new ReflectionProperty($testRunner, 'oauth2Handler'); $oauth2Handler->setAccessible(true); $oauth2HandlerInstance = $oauth2Handler->getValue($testRunner); if ($oauth2HandlerInstance) { $apiClient->setHeader('Authorization', $oauth2HandlerInstance->getAuthHeader()); } // Get folders $request = [ 'method' => 'GET', 'url' => "/v6/folders/{$campaignId}/children?load_type=metadata" ]; $response = $apiClient->executeRequest($request); if ($response['success']) { $folderResults = json_decode($response['body'], true); } else { $error = "Failed to get folders: " . ($response['error'] ?? 'Unknown error'); } } catch (Exception $e) { $error = $e->getMessage(); } } if ($_GET['action'] === 'get_assets' && isset($_GET['folder_id'])) { try { $folderId = $_GET['folder_id']; $apiClient = new ApiClient(); $apiClient->setBaseUrl($configV3->getBaseUrl()); $oauth2Handler = new ReflectionProperty($testRunner, 'oauth2Handler'); $oauth2Handler->setAccessible(true); $oauth2HandlerInstance = $oauth2Handler->getValue($testRunner); if ($oauth2HandlerInstance) { $apiClient->setHeader('Authorization', $oauth2HandlerInstance->getAuthHeader()); } // Get assets from folder $request = [ 'method' => 'GET', 'url' => "/v6/folders/{$folderId}/children?load_type=metadata" ]; $response = $apiClient->executeRequest($request); if ($response['success']) { $assetResults = json_decode($response['body'], true); } else { $error = "Failed to get assets: " . ($response['error'] ?? 'Unknown error'); } } catch (Exception $e) { $error = $e->getMessage(); } } $oauth2Status = $testRunner->getOAuth2Status(); ?>
Campaign Asset ID: = htmlspecialchars($campaignId) ?>
Found = count($folders) ?> folder(s)
Asset ID: = htmlspecialchars($folder['asset_id']) ?>
Type: = htmlspecialchars($folder['data_type'] ?? 'N/A') ?>
Get Assets from This Folder= htmlspecialchars(json_encode($folderResults, JSON_PRETTY_PRINT)) ?>
Found = count($assets) ?> asset(s)
✅ CORRECT Asset ID: = htmlspecialchars($asset['asset_id']) ?>
Type: = htmlspecialchars($asset['data_type'] ?? 'N/A') ?>
MIME Type: = htmlspecialchars($asset['mime_type'] ?? 'N/A') ?>
File Size: = number_format($asset['file_size']) ?> bytes
Test Download This Asset= htmlspecialchars(json_encode($assetResults, JSON_PRETTY_PRINT)) ?>