/**
  * Refreshes an existing authentication ticket for a customer account by providing the refresh token string.
  *
  * @param string $refreshToken Alphanumeric string used for access tokens. This token refreshes access for accounts by generating a new developer or application account authentication ticket after an access token expires.
  * @param string $responseFields Use this field to include those fields which are not included by default.
  * @return MozuClient
  */
 public static function refreshUserAuthTicketClient($refreshToken, $responseFields = null)
 {
     $url = CustomerAuthTicketUrl::refreshUserAuthTicketUrl($refreshToken, $responseFields);
     $mozuClient = new MozuClient();
     $mozuClient->withResourceUrl($url);
     return $mozuClient;
 }
 public static function refreshUserAuthTicket(UserAuthTicket $authTicket)
 {
     try {
         $authentication = AppAuthenticator::getInstance();
         $resourceUrl = CustomerAuthTicketUrl::refreshUserAuthTicketUrl($authTicket->refreshToken, null);
         $client = new Client(['base_uri' => static::getAuthUrl($authTicket->tenantId), 'verify' => false]);
         $headers = ["content-type" => "application/json", Headers::X_VOL_APP_CLAIMS => $authentication->getAppClaim(), Headers::X_VOL_SITE => $authTicket->siteId];
         $body = json_encode($authTicket);
         $promise = $client->requestAsync($resourceUrl->getVerb(), $resourceUrl->getUrl(), ['headers' => $headers, 'body' => $body, 'exceptions' => true]);
         $response = $promise->wait();
         $jsonResp = $response->getBody(true);
         $authResponse = json_decode($jsonResp);
         return static::setUserAuth($authResponse, $authTicket->tenantId, $authTicket->siteId);
     } catch (\Exception $e) {
         HttpHelper::checkError($e);
     }
 }