function __construct()
 {
     defined('API_HOST_URL') or define('API_HOST_URL', "http://api.nbos.in/");
     defined('API_CLIENT_ID') or define('API_CLIENT_ID', "NBOSConsole-app-client");
     defined('API_CLIENT_SECRET') or define('API_CLIENT_SECRET', "NBOSConsole-app-secret");
     defined('API_MODULE_CLIENT_ID') or define('API_MODULE_CLIENT_ID', API_CLIENT_ID);
     defined('API_MODULE_CLIENT_SECRET') or define('API_MODULE_CLIENT_SECRET', API_CLIENT_SECRET);
     ApiBase::$fields = $_POST + $_GET;
     if (defined('API_CLIENT_ID') && defined('API_CLIENT_SECRET')) {
         $this->setClient(API_CLIENT_ID, API_CLIENT_SECRET);
     } else {
         if (defined('API_CLIENT_ID')) {
             $this->setClient(API_CLIENT_ID);
         }
     }
     $this->rest = new Rest();
     if (!empty($_SESSION['api_token'])) {
         $this->token = $_SESSION['api_token'];
         $this->rest->setHttpHeader("Authorization", $this->token->token_type . " " . $this->token->access_token);
     }
 }
 function __construct()
 {
     parent::__construct();
 }
 public function validateResponse($response)
 {
     NBOS\core\ApiBase::$error = null;
     NBOS\core\ApiBase::$message = null;
     if (isset($response->errors)) {
         NBOS\core\ApiBase::setErrors($response->errors);
     } else {
         if (isset($response->error_description)) {
             NBOS\core\ApiBase::setError($response->error_description);
         } else {
             if (isset($response->message)) {
                 if ($this->last_http_code == 200) {
                     NBOS\core\ApiBase::setMessage($response->message);
                 } else {
                     NBOS\core\ApiBase::setError($response->message);
                 }
             }
         }
     }
     return $response;
 }