/** * Determine whether the response should be cached. Override this method to have a * per-operation decision, otherwise the function from the API class will be used. * * @return \GithubService\Model\GistStarred */ public function shouldResponseBeCached(\Amp\Artax\Response $response) { return $this->api->shouldResponseBeCached($response); }
/** * @param Request $request * @param \ArtaxServiceBuilder\Operation $operation * @param callable $callback * @return Promise|void */ public function executeAsync(Request $request, \ArtaxServiceBuilder\Operation $operation, callable $callback) { $rateLimitException = $this->checkRateLimitException(); if ($rateLimitException) { $callback($rateLimitException, null, null); } //We need to wrap the original callback to be able to get the rate limit info $extractRateLimitCallable = function (\Exception $e = null, $processedData, Response $response = null) use($callback, $operation) { $originalResponse = $operation->getOriginalResponse(); if ($originalResponse) { $this->parseRateLimit($originalResponse); } //Call the original callback $callback($e, $processedData, $response); }; parent::executeAsync($request, $operation, $extractRateLimitCallable); }