Пример #1
0
 /// <summary>
 /// Returns a content item as JSON data.
 /// </summary>
 /// <param name="codename">The codename of a content item.</param>
 /// <param name="parameters">An array that contains zero or more query parameters, for example for projection or depth of linked items.</param>
 /// <returns>The <see cref="JObject"/> instance that represents the content item with the specified codename.</returns>
 public async Task <JObject> GetItemJsonAsync(string codename, params string[] parameters)
 {
     return(await CacheManager.GetOrAddAsync(
                CacheHelper.GetItemJsonKey(codename, parameters),
                () => DeliveryClient.GetItemJsonAsync(codename, parameters),
                response => response != null));
 }
        /// <summary>
        /// Returns a content item as JSON data.
        /// </summary>
        /// <param name="codename">The codename of a content item.</param>
        /// <param name="parameters">An array that contains zero or more query parameters, for example for projection or depth of linked items.</param>
        /// <returns>The <see cref="JObject"/> instance that represents the content item with the specified codename.</returns>
        public async Task <JObject> GetItemJsonAsync(string codename, params string[] parameters)
        {
            var identifierTokens = new List <string> {
                KenticoCloudCacheHelper.CONTENT_ITEM_SINGLE_JSON_IDENTIFIER, codename
            };

            identifierTokens.AddNonNullRange(parameters);

            return(await CacheManager.GetOrCreateAsync(
                       identifierTokens,
                       () => DeliveryClient.GetItemJsonAsync(codename, parameters),
                       response => response == null,
                       GetContentItemSingleJsonDependencies,
                       ProjectOptions.CreateCacheEntriesInBackground));
        }
 public Task <JObject> GetItemJsonAsync(string codename, params string[] parameters)
 {
     return(_client.GetItemJsonAsync(codename, new[] { new LanguageParameter(_language).GetQueryStringParameter() }.Concat(parameters).ToArray()));
 }