public function api($method = self::REQUEST_GET, $url, $data = array(), $return_as_array = false, $is_file = false, $debug = false)
{
$result = $this->client->sendRequest($method, $url, $data, $this->getEndpoint(), $this->authentication, $is_file, $debug);
if (strlen($result)) {
$json = json_decode($result, true);
if ($this->options & self::AUTOMAP_FIELDS) {
if (isset($json['issues'])) {
if (!count($this->fields)) {
$this->getFields();
}
foreach ($json['issues'] as $offset => $issue) {
$json['issues'][$offset] = $this->automapFields($issue);
}
}
}
if ($return_as_array) {
return $json;
} else {
return new Result($json);
}
} else {
return false;
}
}