public async Task <ApiResponse <List <Asset> > > GetDocumentsAsync(int brandId, string metadataKey = null, string metadataValue = null, AssetDetailType assetDetail = AssetDetailType.IncludeOnlyDefaultWithMetadata) { return(await GetAssetAsync(brandId, AssetType.documents, metadataKey, metadataValue, assetDetail)); }
public async Task <ApiResponse <List <Asset> > > GetAssetAsync(int brandId, AssetType assetType, string metadataKey = null, string metadataValue = null, AssetDetailType assetDetail = AssetDetailType.IncludeOnlyDefaultWithMetadata) { Validator.For(brandId, "brandId").IsGreaterThanOrEqual(1); string path = string.Format("/catalog/brands/{0}/{1}?", brandId, assetType); if (!string.IsNullOrEmpty(metadataKey) && !string.IsNullOrEmpty(metadataValue)) { path += string.Format("metadataKey={0}&metadataValue={1}&", metadataKey, metadataValue); } else if (!string.IsNullOrEmpty(metadataKey) || !string.IsNullOrEmpty(metadataValue)) { Validator.For(metadataKey, "metadataKey").IsNotNullOrEmpty(); Validator.For(metadataValue, "metadataValue").IsNotNullOrEmpty(); } path += string.Format("assetDetail={0}", (int)assetDetail); using (var response = await Client.GetAsync(path).ConfigureAwait(false)) { return(await response.Content.ReadAsAsync <ApiResponse <List <Asset> > >().ConfigureAwait(false)); } }
public async Task <ApiResponse <ShoppingCartWithItems> > GetAsync(Guid shoppingCartUniqueKey, Location location = null, bool includeItemStaticProperties = true, bool includeItemDynamicProperties = false, bool includeCategoryMetadata = false, AssetDetailType imageAssetDetail = AssetDetailType.None, AssetDetailType videoAssetDetail = AssetDetailType.None, AssetDetailType documentAssetDetail = AssetDetailType.None, string metadataKey = null, string metadataValue = null) { ValidatePIIToken(); string path = string.Format("/pii/shoppingcart?shoppingCartUniqueKey={0}&", shoppingCartUniqueKey); if (location != null) { Validator.For(location.Longitude, "Longitude").InRange(-180, 180); Validator.For(location.Latitude, "Latitude").InRange(-90, 90); path += string.Format("longitude={0}&latitude={1}&", location.Longitude, location.Latitude); } path += string.Format("includeItemStaticProperties={0}&includeItemDynamicProperties={1}&includeCategoryMetadata={2}&imageAssetDetail={3}&videoAssetDetail={4}&documentAssetDetail={5}", includeItemStaticProperties, includeItemDynamicProperties, includeCategoryMetadata, (int)imageAssetDetail, (int)videoAssetDetail, (int)documentAssetDetail); if (!string.IsNullOrEmpty(metadataKey) && !string.IsNullOrEmpty(metadataValue)) { path += string.Format("&metadataKey={0}&metadataValue={1}", metadataKey, metadataValue); } else if (!string.IsNullOrEmpty(metadataKey) || !string.IsNullOrEmpty(metadataValue)) { Validator.For(metadataKey, "metadataKey").IsNotNullOrEmpty(); Validator.For(metadataValue, "metadataValue").IsNotNullOrEmpty(); } using (var response = await Client.GetAsync(path).ConfigureAwait(false)) { return(await response.Content.ReadAsAsync <ApiResponse <ShoppingCartWithItems> >().ConfigureAwait(false)); } }
public async Task <ApiResponse <SingleItemSearchResult <Item> > > GetAsync(int id, bool includeItemInStoreMetadata = false, bool includeItemStaticProperties = true, bool includeItemDynamicProperties = true, AssetDetailType imageAssetDetail = AssetDetailType.None, AssetDetailType videoAssetDetail = AssetDetailType.None, AssetDetailType documentAssetDetail = AssetDetailType.None) { Validator.For(id, "id").IsGreaterThanOrEqual(1); string path = string.Format("/catalog/item/{0}?includeItemStaticProperties={1}&includeItemDynamicProperties={2}&imageAssetDetail={3}&videoAssetDetail={4}&documentAssetDetail={5}&includeItemInStoreMetadata={6}", id, includeItemStaticProperties, includeItemDynamicProperties, (int)imageAssetDetail, (int)videoAssetDetail, (int)documentAssetDetail, includeItemInStoreMetadata); using (var response = await Client.GetAsync(path).ConfigureAwait(false)) { return(await response.Content.ReadAsAsync <ApiResponse <SingleItemSearchResult <Item> > >().ConfigureAwait(false)); } }
public async Task <ApiResponse <List <Category> > > GetSubCategoriesAsync(int parentCategoryId, bool includeMetadata, AssetDetailType imageAssetDetail, AssetDetailType videoAssetDetail, AssetDetailType documentAssetDetail) { Validator.For(parentCategoryId, "parentCategoryId").IsGreaterThanOrEqual(1); string path = string.Format("/catalog/categories?parentCategoryId={0}&includeMetadata={1}&imageAssetDetail={2}&videoAssetDetail={3}&documentAssetDetail={4}", parentCategoryId, includeMetadata, (int)imageAssetDetail, (int)videoAssetDetail, (int)documentAssetDetail); using (var response = await Client.GetAsync(path).ConfigureAwait(false)) { return(await response.Content.ReadAsAsync <ApiResponse <List <Category> > >().ConfigureAwait(false)); } }
public async Task <ApiResponse <CategoryTree <CategoryTreeItem> > > GetCategoryTreeAsync(bool includeMetadata, AssetDetailType imageAssetDetail, AssetDetailType videoAssetDetail, AssetDetailType documentAssetDetail) { string path = string.Format("/catalog/categories?includeMetadata={0}&imageAssetDetail={1}&videoAssetDetail={2}&documentAssetDetail={3}", includeMetadata, (int)imageAssetDetail, (int)videoAssetDetail, (int)documentAssetDetail); using (var response = await Client.GetAsync(path).ConfigureAwait(false)) { return(await response.Content.ReadAsAsync <ApiResponse <CategoryTree <CategoryTreeItem> > >().ConfigureAwait(false)); } }