forked from muxinc/mux-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
exercise-filters.php
31 lines (24 loc) · 948 Bytes
/
exercise-filters.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
28
29
30
31
<?php
assert_options(ASSERT_BAIL, true);
require_once 'vendor/autoload.php';
// Exercises all filter operations.
// Authentication Setup
$config = MuxPhp\Configuration::getDefaultConfiguration()
->setUsername(getenv('MUX_TOKEN_ID'))
->setPassword(getenv('MUX_TOKEN_SECRET'));
// API Client Initialization
$filtersApi = new MuxPhp\Api\FiltersApi(
new GuzzleHttp\Client(),
$config
);
// ========== list-filters ==========
$filters = $filtersApi->listFilters();
assert($filters->getData() != null);
assert($filters->getData()->getBasic() != null);
assert($filters->getData()->getAdvanced() != null);
print("list-filters OK ✅\n");
// ========== list-filter-values ==========
$filterValues = $filtersApi->listFilterValues("browser", ["timeframe" => ["7:days"]]);
assert($filters->getData() != null);
print("list-filter-values OK ✅\n");
?>