/**
  * Allow clients to test authentication.
  * @return mixed response from the API call*/
 public function getAuthentications()
 {
     //the base uri for api requests
     $queryBuilder = Configuration::$BASEURI;
     //prepare query string for API call
     $queryBuilder = $queryBuilder . '/authentications';
     //validate and preprocess url
     $queryUrl = APIHelper::cleanUrl($queryBuilder);
     //prepare headers
     $headers = array('user-agent' => 'APIMATIC 2.0', 'Accept' => 'application/json');
     //prepare API request
     $request = Unirest::get($queryUrl, $headers);
     //append custom auth authorization headers
     CustomAuthUtility::appendCustomAuthParams($request);
     //and invoke the API call request to fetch the response
     $response = Unirest::getResponse($request);
     //Error handling using HTTP status codes
     if ($response->code == 401) {
         throw new APIException('You are not authenticated', 401, $response->body);
     } else {
         if ($response->code == 403) {
             throw new APIException('This action needs a valid WSSE header', 403, $response->body);
         } else {
             if ($response->code == 400) {
                 throw new APIException('Http bad request', 400, $response->body);
             } else {
                 if ($response->code < 200 || $response->code > 206) {
                     //[200,206] = HTTP OK
                     throw new APIException("HTTP Response Not OK", $response->code, $response->body);
                 }
             }
         }
     }
     return $response->body;
 }
 /**
  * Create a new Access Token.
  * @param  string        $accountNumber         Required parameter: Account Number
  * @param  TokenForm     $accessTokenForm       Required parameter: TODO: type description here
  * @return mixed response from the API call*/
 public function createAccessTokens($accountNumber, $accessTokenForm)
 {
     //the base uri for api requests
     $queryBuilder = Configuration::$BASEURI;
     //prepare query string for API call
     $queryBuilder = $queryBuilder . '/accounts/{account_number}/access-tokens';
     //process optional query parameters
     APIHelper::appendUrlWithTemplateParameters($queryBuilder, array('account_number' => $accountNumber));
     //validate and preprocess url
     $queryUrl = APIHelper::cleanUrl($queryBuilder);
     //prepare headers
     $headers = array('user-agent' => 'APIMATIC 2.0', 'Accept' => 'application/json', 'content-type' => 'application/json; charset=utf-8');
     //prepare API request
     $request = Unirest::post($queryUrl, $headers, json_encode($accessTokenForm));
     //append custom auth authorization headers
     CustomAuthUtility::appendCustomAuthParams($request);
     //and invoke the API call request to fetch the response
     $response = Unirest::getResponse($request);
     //Error handling using HTTP status codes
     if ($response->code == 401) {
         throw new APIException('You are not authenticated', 401, $response->body);
     } else {
         if ($response->code == 403) {
             throw new APIException('This action needs a valid WSSE header', 403, $response->body);
         } else {
             if ($response->code == 404) {
                 throw new APIException('Resource not found', 404, $response->body);
             } else {
                 if ($response->code == 400) {
                     throw new APIException('Http bad request', 400, $response->body);
                 } else {
                     if ($response->code < 200 || $response->code > 206) {
                         //[200,206] = HTTP OK
                         throw new APIException("HTTP Response Not OK", $response->code, $response->body);
                     }
                 }
             }
         }
     }
     return $response->body;
 }
 /**
  * Allow clients to get a specific region for a specific country
  * @param  string     $countryIso2       Required parameter: Country ISO2
  * @param  string     $regionHandle      Required parameter: Region handle
  * @return mixed response from the API call*/
 public function getRegionsByHandle($countryIso2, $regionHandle)
 {
     //the base uri for api requests
     $queryBuilder = Configuration::$BASEURI;
     //prepare query string for API call
     $queryBuilder = $queryBuilder . '/dids/location/countries/{country_iso2}/regions/{region_handle}';
     //process optional query parameters
     APIHelper::appendUrlWithTemplateParameters($queryBuilder, array('country_iso2' => $countryIso2, 'region_handle' => $regionHandle));
     //validate and preprocess url
     $queryUrl = APIHelper::cleanUrl($queryBuilder);
     //prepare headers
     $headers = array('user-agent' => 'APIMATIC 2.0', 'Accept' => 'application/json');
     //prepare API request
     $request = Unirest::get($queryUrl, $headers);
     //append custom auth authorization headers
     CustomAuthUtility::appendCustomAuthParams($request);
     //and invoke the API call request to fetch the response
     $response = Unirest::getResponse($request);
     //Error handling using HTTP status codes
     if ($response->code == 401) {
         throw new APIException('You are not authenticated', 401, $response->body);
     } else {
         if ($response->code == 403) {
             throw new APIException('This action needs a valid WSSE header', 403, $response->body);
         } else {
             if ($response->code == 404) {
                 throw new APIException('Resource not found', 404, $response->body);
             } else {
                 if ($response->code == 400) {
                     throw new APIException('Http bad request', 400, $response->body);
                 } else {
                     if ($response->code < 200 || $response->code > 206) {
                         //[200,206] = HTTP OK
                         throw new APIException("HTTP Response Not OK", $response->code, $response->body);
                     }
                 }
             }
         }
     }
     return $response->body;
 }