public async Task <PriceGuide> GetPriceGuideAsync(ItemType type, string no, int colorId = 0, PriceGuideType?priceGuideType = null, Condition?condition = null, string?countryCode = null, string?region = null, string?currencyCode = null) { var typeString = type.GetStringValueOrDefault(); var builder = new UriBuilder(new Uri(_baseUri, $"items/{typeString}/{no}/price")); var query = HttpUtility.ParseQueryString(builder.Query); query["color_id"] = colorId.ToString(); query.AddIfNotNull("guide_type", priceGuideType, pg => pg !.ToString().ToLower()); query.AddIfNotNull("new_or_used", condition, c => c !.GetStringValueOrDefault()); query.AddIfNotNull("country_code", countryCode); query.AddIfNotNull("region", region); query.AddIfNotNull("currency_code", currencyCode); builder.Query = query.ToString(); var url = builder.ToString(); var method = HttpMethod.Get; var responseBody = await ExecuteRequest(builder.ToString(), method); var data = ParseResponse <PriceGuide>(responseBody, 200, url, method); return(data); }
public async Task <KnownColor[]> GetKnownColorsAsync(ItemType type, string no) { var typeString = type.GetStringValueOrDefault(); var url = new Uri(_baseUri, $"items/{typeString}/{no}/colors").ToString(); var method = HttpMethod.Get; var responseBody = await ExecuteRequest(url, method); var data = ParseResponse <KnownColor[]>(responseBody, 200, url, method); return(data); }
public async Task <CatalogImage> GetItemImageAsync(ItemType type, string no, int colorId) { var typeString = type.GetStringValueOrDefault(); var url = new Uri(_baseUri, $"items/{typeString}/{no}/images/{colorId}").ToString(); var method = HttpMethod.Get; var responseBody = await ExecuteRequest(url, method); var data = ParseResponse <CatalogImage>(responseBody, 200, url, method); return(data); }
public async Task <Subset[]> GetSubsetsAsync(ItemType type, string no, int colorId = 0, bool?includeOriginalBox = null, bool?includeInstruction = null, bool?breakMinifigs = null, bool?breakSubsets = null) { var typeString = type.GetStringValueOrDefault(); var builder = new UriBuilder(new Uri(_baseUri, $"items/{typeString}/{no}/subsets")); var query = HttpUtility.ParseQueryString(builder.Query); query["color_id"] = colorId.ToString(); query.AddIfNotNull("box", includeOriginalBox); query.AddIfNotNull("instruction", includeInstruction); query.AddIfNotNull("break_minifigs", breakMinifigs); query.AddIfNotNull("break_subsets", breakSubsets); builder.Query = query.ToString(); var url = builder.ToString(); var method = HttpMethod.Get; var responseBody = await ExecuteRequest(builder.ToString(), method); var data = ParseResponse <Subset[]>(responseBody, 200, url, method); return(data); }