public function getFields()
{
// Fetch fields when the method is called for the first time.
if ($this->fields === null) {
$fields = array();
$result = $this->api(self::REQUEST_GET, '/rest/api/2/field', array(), true);
/* set hash key as custom field id */
foreach ($result as $field) {
$fields[$field['id']] = $field;
}
$this->fields = $fields;
}
return $this->fields;
}