forked from muxinc/mux-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlist-assets.php
27 lines (24 loc) · 902 Bytes
/
list-assets.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
require_once(__DIR__ . '/../assert.php');
require_once 'vendor/autoload.php';
// Authentication Setup
$config = MuxPhp\Configuration::getDefaultConfiguration()
->setUsername(getenv('MUX_TOKEN_ID'))
->setPassword(getenv('MUX_TOKEN_SECRET'));
// API Client Initialization
$assetsApi = new MuxPhp\Api\AssetsApi(
new GuzzleHttp\Client(),
$config
);
// List Assets
try {
$result = $assetsApi->listAssets();
echo "Listing Assets in account: \n\n";
foreach ($result->getData() as $asset) {
print("Asset ID: " . $asset->getId() . "\n");
print("Status: " . $asset->getStatus() . "\n");
print("Duration: " . $asset->getDuration() . "\n\n");
}
} catch (Exception $e) {
echo 'Exception when calling AssetsApi->listAssets: ', $e->getMessage(), PHP_EOL;
}