/**
  * Gets the relevant data from the Http client.
  *
  * @param TelegramRequest                    $request
  * @param ResponseInterface|PromiseInterface $response
  */
 public function __construct(TelegramRequest $request, $response)
 {
     if ($response instanceof ResponseInterface) {
         $this->httpStatusCode = $response->getStatusCode();
         $this->body = $response->getBody();
         $this->headers = $response->getHeaders();
         $this->decodeBody();
     } elseif ($response instanceof PromiseInterface) {
         $this->httpStatusCode = null;
     } else {
         throw new \InvalidArgumentException('Second constructor argument "response" must be instance of ResponseInterface or PromiseInterface');
     }
     $this->request = $request;
     $this->endPoint = (string) $request->getEndpoint();
 }
 /**
  * Prepares the API request for sending to the client handler.
  *
  * @param TelegramRequest $request
  *
  * @return array
  */
 public function prepareRequest(TelegramRequest $request)
 {
     $url = $this->getBaseBotUrl() . $request->getAccessToken() . '/' . $request->getEndpoint();
     return [$url, $request->getMethod(), $request->getHeaders(), $request->isAsyncRequest()];
 }