/** * Segment.Delete API * * @param array $params * @return array API result descriptor * @see civicrm_api3_create_success * @see civicrm_api3_create_error * @throws API_Exception */ function civicrm_api3_segment_delete($params) { if (array_key_exists('id', $params)) { return civicrm_api3_create_success(CRM_Contactsegment_BAO_Segment::deleteById($params['id']), $params, 'Segment', 'Delete'); } else { throw new API_Exception('Id is a mandatory param when deleting a segment', 'mandatory_id_missing', 010); } }