/** * Dispatch the request for this operation and process the response asynchronously. * Allows you to modify the request before it is sent. * * @return \GithubService\Model\GistStarred * @param \Amp\Artax\Request $request The request to be processed * @param callable $callable The callable that processes the response */ public function dispatchAsync(\Amp\Artax\Request $request, callable $callable) { return $this->api->executeAsync($request, $this, $callable); }
/** * @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); }