import json


def get_number_of(jdownloader, project_api_address, parameter = None):
	"""
	Posts a request using an instance of JiraDownloader and returns the number of
	a given statistic (e.g. number of issues, number of commits, etc.).

	:param jdownloader: an instance of JiraDownloader.
	:param project_api_address: the address from where the statistic is downloaded.
	:param parameter: an optional parameter for the statistic.
	:returns: the value for the statistic as an absolute number.
	"""
	r = jdownloader.download_request(project_api_address, ["maxResults=1"] if parameter == None else ["maxResults=1", parameter])
	data = json.loads(r.text or r.content) if r.status_code != 204 else {}
	return data["total"]