From 77cec899f12e101feb5c432d78440165d51cb533 Mon Sep 17 00:00:00 2001 From: allyans3 Date: Mon, 14 Dec 2020 17:20:25 +0200 Subject: [PATCH] New DMarket Api fix --- README.md | 2 +- src/Requests/MarketItems.php | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 6451878..9f17bac 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ $options = [ 'priceTo' => 0, // 0 if from -Inf to +Inf 'treeFilters' => '', 'types' => 'dmarket', // ['dmarket', 'p2p'] - 'offset' => 0, + 'cursor' => '', 'limit' => 100, 'currency' => 'USD', 'platform' => 'browser', diff --git a/src/Requests/MarketItems.php b/src/Requests/MarketItems.php index b608e6a..d3a26e0 100644 --- a/src/Requests/MarketItems.php +++ b/src/Requests/MarketItems.php @@ -7,19 +7,19 @@ class MarketItems extends Request implements RequestInterface { - const URL = 'https://trading.dmarket.com/exchange/v1/market/items?gameId=%s&title=%s¤cy=%s&orderBy=%s&orderDir=%s&priceFrom=%s&priceTo=%s&treeFilters=%s&types=%s&offset=%s&limit=%s&platform=%s&isLoggedIn=%s'; + const URL = 'https://trading.dmarket.com/exchange/v1/market/items?gameId=%s&title=%s¤cy=%s&orderBy=%s&orderDir=%s&priceFrom=%s&priceTo=%s&treeFilters=%s&types=%s&cursor=%s&limit=%s&platform=%s&isLoggedIn=%s'; private string $gameId; + private string $title = ''; + private string $currency = 'USD'; private string $orderBy = 'best_deals'; private string $orderDir = 'desc'; - private string $title = ''; private int $priceFrom = 0; private int $priceTo = 0; private string $treeFilters = ''; private string $types = 'dmarket'; - private int $offset = 0; + private string $cursor = ''; private int $limit = 100; - private string $currency = 'USD'; private string $platform = 'browser'; private bool $isLoggedIn = true; @@ -34,8 +34,8 @@ public function __construct($gameId, $options = []) public function getUrl() { return sprintf(self::URL, $this->gameId, $this->title, $this->currency, $this->orderBy, $this->orderDir, - $this->priceFrom, $this->priceTo, $this->treeFilters, $this->types, $this->offset, $this->limit, - $this->platform, $this->isLoggedIn); + $this->priceFrom, $this->priceTo, $this->treeFilters, $this->types, $this->cursor, $this->limit, + $this->platform, $this->isLoggedIn); } public function call($options = [], $proxy = []) @@ -57,7 +57,7 @@ private function setOptions($options) $this->priceTo = $options['priceTo'] ?? $this->priceTo; $this->treeFilters = $options['treeFilters'] ?? $this->treeFilters; $this->types = $options['types'] ?? $this->types; - $this->offset = $options['offset'] ?? $this->offset; + $this->cursor = $options['cursor'] ?? $this->cursor; $this->limit = $options['limit'] ?? $this->limit; $this->currency = $options['currency'] ?? $this->currency; $this->platform = $options['platform'] ?? $this->platform;