/// <summary> /// Get a specific item by Id /// </summary> /// <param name="id">Id of the item to return</param> /// <returns>Instance of IHackerItem with matching the referenced id.</returns> public async Task <T> GetItemById(int id) { using (HttpClient client = clientFactory.CreateClient()) { // getting item for id from api var itemResponse = await client.GetAsync(apiConfig.AsItemEndpointUrl(id)); itemResponse.EnsureSuccessStatusCode(); // read response var itemResult = await itemResponse.Content.ReadAsStringAsync(); // use the specific mapper to map the item var mappedItem = itemMapper.MapItem(itemResult); if (mappedItem == null) { logger.LogDebug(itemResult); } return(mappedItem); } }