<?php
$Tool_filter = null;
if(isset($Filter['category'])) {
	$Tool_filter .= '&category='.$Filter['category'];
}
if(isset($Filter['sort'])) {
	$Tool_filter .= '&order='.$Filter['sort'];
}
if(isset($Filter['limit'])) {
	$Tool_filter .= '&num='.$Filter['limit'];
}
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://games.gamepix.com/games?sid='.get($Settings,'data.gamepix','api').$Tool_filter, ['verify' => false]);

// Listings
$Items 		= json_decode($response->getBody(),true);
$Listings = [];
foreach ($Items['data'] as $Item) { 
	$Listings[] = [
		'id'			=> $Item['id'],
		'api_type'		=> 'gamepix',
		'title'			=> $Item['title'],
		'category_name'	=> $Item['category'],
		'description'	=> $Item['description'],
		'control'		=> null,
		'image'			=> str_replace('small', 'medium', $Item['thumbnailUrl']),
		'tags'			=> null,
		'width'			=> $Item['width'],
		'height'		=> $Item['height'],
		'file'			=> $Item['url']
	]; 
}   
