* @copyright 2021 DIGITAL RETAIL TECHNOLOGIES SL * @license https://opensource.org/licenses/MIT The MIT License * * Don't forget to prefix your containers with your own identifier * to avoid any conflicts with others containers. */ class RetailcrmApiSinceIdRequest extends RetailcrmApiPaginatedRequest { private $currentSinceId; protected function buildParams($placeholderParams, $currentPage = null) { if (null !== $this->currentSinceId) { $placeholderParams[0]['sinceId'] = $this->currentSinceId; if (isset($placeholderParams[0]['startDate'])) { unset($placeholderParams[0]['startDate']); } } return parent::buildParams($placeholderParams, 1); } protected function getNextPageNumber($page, $response) { $resultData = $response[$this->dataKey]; $lastRecord = end($resultData); if (isset($lastRecord['id'])) { $this->currentSinceId = $lastRecord['id']; } return $page + 1; } }