/** * @param DateTime|null $timeFrom Statuses that occurred after specified date (you can use either $timeFrom or $publishedFrom, not both) * @param DateTime|null $publishedFrom Statuses published in the API after specified date (you can use either $timeFrom or $publishedFrom, not both) * @param string|null $shopId * @param string|null $apiKey * @param int|null $limit * @param int|null $offset * @param int|null $statusId * @return GetStatusHistoryResponse */ public function getStatusHistory(DateTime $timeFrom = null, DateTime $publishedFrom = null, $shopId = null, $apiKey = null, $limit = null, $offset = null, $statusId = null) { $resource = Resource::STATUSHISTORY; $shop = isset($shopId) ? $shopId : $this->shopId; $key = isset($apiKey) ? $apiKey : $this->apiKey; $queryStringParams = [StatusHistoryAttr::QS_TIME_FROM => isset($timeFrom) ? $timeFrom->format('YmdHis') : null, StatusHistoryAttr::QS_PUBLISHED_FROM => isset($publishedFrom) ? $publishedFrom->format('YmdHis') : null, StatusHistoryAttr::QS_STATUS_ID => $statusId, StatusHistoryAttr::QS_LIMIT => $limit, StatusHistoryAttr::QS_OFFSET => $offset]; $queryString = http_build_query($queryStringParams); if (mb_strlen($queryString) > 0) { $resource .= '?' . $queryString; } $requestEnvelope = new RequestEnvelope(null, $resource, Method::GET, $shop, $key); $requestEnvelopeWithHeaders = $this->attachBasicHeadersToRequest($requestEnvelope); $connectorResponse = $this->connector->sendRequest($requestEnvelopeWithHeaders); $formattedResponse = $this->formatter->formatGetStatusHistoryResponse($connectorResponse); return $formattedResponse; }