public __preparedRequest ( string $type, string $request_type = 'GET', array $params = [], array $data = [], null $retry_throttled = null ) : object | ||
$type | string | Construct type. Url will be generated using this params. Options: store |
$request_type | string | Request type. Options: get, post, put, delete. |
$params | array | Additional parameters for requests as array. |
$data | array | Data will be posted like json. |
$retry_throttled | null | |
return | object |
public function __preparedRequest($type, $request_type = 'GET', $params = array(), $data = array(), $retry_throttled = null)
{
$retry_throttled = $retry_throttled ?: $this->retry_throttled;
$path = $this->__getPath($type, $params);
while (true) {
try {
return $this->request($request_type, $path, $data);
} catch (ThrottledRequestException $exception) {
if ($retry_throttled > 0) {
sleep($exception->getTimeout());
$retry_throttled--;
continue;
} else {
throw $exception;
}
}
}
return null;
}