<?php
$Tool_filter = null;
if(isset($Filter['sort'])) {
	$Tool_filter .= '?collection='.$Filter['sort'];
} 
if(isset($Filter['category'])) {
	$Tool_filter .= '&categories='.$Filter['category'];
}
if(isset($_GET['page'])) {
	$Tool_filter .= '&page='.$_GET['page'];
}
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://catalog.api.gamedistribution.com/api/v2.0/rss/All/?'.$Tool_filter.'&format=json', ['verify' => false]);

// Listings
$Items 		= json_decode($response->getBody(),true);
$Listings = [];
foreach ($Items as $Item) { 
	$Listings[] = [
		'id'			=> $Item['Md5'],
		'api_type'		=> 'gamedistribution',
		'title'			=> $Item['Title'],
		'category'		=> $Filter['category'],
		'category_name'	=> $Item['Category'][0],
		'description'	=> $Item['Description'],
		'control'		=> $Item['Instructions'],
		'image'			=> $Item['Asset'][1],
		'tags'			=> implode(',',$Item['Tag']),
		'width'			=> $Item['Width'],
		'height'		=> $Item['Height'],
		'file'			=> $Item['Url']
	]; 
}   

// Pagination
$Paginations = [];
for ($i=1; $i <=10; $i++) {  
	$Paginations[] = [
		'name'		=> trim($i),
		'url'		=> trim($i)
	];  
}   