/// <summary> /// Gets the category tree. /// </summary> /// <param name="param"></param> /// <returns></returns> public Task <Tree <Category, string> > GetCategoriesTreeAsync(GetCategoriesParam param) { if (param == null) { throw new ArgumentNullException(nameof(param)); } if (string.IsNullOrWhiteSpace(param.Scope)) { throw new ArgumentException(GetMessageOfNullWhiteSpace(nameof(param.Scope)), nameof(param)); } return(GetCategoriesTreeAsync(param.Scope)); }
/// <summary> /// Gets the category tree. /// </summary> /// <param name="param"></param> /// <returns></returns> public Task <Tree <Category, string> > GetCategoriesTreeAsync(GetCategoriesParam param) { if (param == null) { throw new ArgumentNullException("param"); } if (string.IsNullOrWhiteSpace(param.Scope)) { throw new ArgumentException("param.Scope may not be null or whitespace", "param"); } return(GetCategoriesTreeAsync(param.Scope)); }
/// <summary> /// Gets the categories. /// </summary> /// <param name="param">The parameter.</param> /// <returns>List of categories.</returns> public async virtual Task <List <Category> > GetCategoriesAsync(GetCategoriesParam param) { if (param == null) { throw new ArgumentNullException("param"); } if (string.IsNullOrWhiteSpace(param.Scope)) { throw new ArgumentException(ArgumentNullMessageFormatter.FormatErrorMessage("Scope"), "param"); } var cacheKey = new CacheKey(CacheConfigurationCategoryNames.Category) { Scope = param.Scope }; var result = await CacheProvider.GetOrAddAsync(cacheKey, () => OvertureClient.SendAsync(new GetCategoriesV2Request { ScopeId = param.Scope })); return(result?.Categories); }
/// <summary> /// Gets the categories. /// </summary> /// <param name="param">The parameter.</param> /// <returns>List of categories.</returns> public virtual async Task <List <Category> > GetCategoriesAsync(GetCategoriesParam param) { if (param == null) { throw new ArgumentNullException(nameof(param)); } if (string.IsNullOrWhiteSpace(param.Scope)) { throw new ArgumentException(GetMessageOfNullWhiteSpace(nameof(param.Scope)), nameof(param)); } var cacheKey = new CacheKey(CacheConfigurationCategoryNames.Category) { Scope = param.Scope }; var result = await CacheProvider.GetOrAddAsync(cacheKey, () => OvertureClient.SendAsync(new GetCategoriesV2Request { ScopeId = param.Scope })).ConfigureAwait(false); return(result?.Categories); }