protected function doRequest($type, $endpoint, $params=[])
    {
    	$base = ($this->useSSL) ? "https" : "http";
    	$url = $base . "://" . $this->host . ":" .$this->port.$this->plugin.$endpoint;
	    
		if ($this->useBasicAuth)
            $auth = 'Basic ' . base64_encode($this->basicUser . ':' . $this->basicPwd);
        else
            $auth = $this->secret;
	    
    	$headers = array(
  			'Accept' => 'application/json',
  			'Authorization' => $auth,
            'Content-Type'=>'application/json'
  		);

        $body = json_encode($params);

        try {
        	$result = $this->client->request($type, $url, compact('headers','body'));
        } catch (\Exception $e) {
        	return  ['status'=>false, 'data'=>['message'=>$e->getMessage()]];
        }
	        
        
        if ($result->getStatusCode() == 200 || $result->getStatusCode() == 201) {
            return array('status'=>true, 'data'=>json_decode($result->getBody()));
        }
        return array('status'=>false, 'data'=>json_decode($result->getBody()));
    	
    }