/// <summary> /// Gets a strongly typed content item by its codename. By default, retrieves one level of linked items. /// </summary> /// <typeparam name="T">Type of the model. (Or <see cref="object"/> if the return type is not yet known.)</typeparam> /// <param name="codename">The codename of a content item.</param> /// <param name="parameters">A collection of query parameters, for example, for projection or setting the depth of linked items.</param> /// <returns>The <see cref="DeliveryItemResponse{T}"/> instance that contains the content item with the specified codename.</returns> public async Task <IDeliveryItemResponse <T> > GetItemAsync <T>(string codename, IEnumerable <IQueryParameter> parameters = null) { if (string.IsNullOrEmpty(codename)) { throw new ArgumentException("Entered item codename is not valid.", nameof(codename)); } var endpointUrl = UrlBuilder.GetItemUrl(codename, parameters); var response = await GetDeliveryResponseAsync(endpointUrl); var content = await response.GetJsonContentAsync(); var model = await ModelProvider.GetContentItemModelAsync <T>(content["item"], content["modular_content"]); return(new DeliveryItemResponse <T>(response, model, await GetLinkedItemsAsync(content))); }