public static async Task<string> GetItemPriceFromWeb(LootItem item) { var client = new HttpClient(); var itemData = Uri.EscapeDataString(item.RawItemText); //var itemData = AhkScriptUrlEscaping(item.RawItemText.Trim()); // https://github.com/trackpete/exiletools-price-macro/blob/master/poe_price_macro.ahk#L168 var ApiPostData = $"v={RunVersion}&itemData={itemData}&league={LeagueName}&showDays={ShowDays}"; var content = new StringContent(ApiPostData); // the current API chokes if the Content-Type header is included. content.Headers.Remove("Content-Type"); HttpResponseMessage response = await client.PostAsync(ApiUrl, content); if(response.IsSuccessStatusCode) { return await response.Content.ReadAsStringAsync(); } else { return $"Error '{response.StatusCode}' retrieving price information. Error message: {await response.Content.ReadAsStringAsync()}"; } }
public LootItemViewModel(LootItem item) { Item = item; }
public LootItemViewModel(string rawItemText) { Item = new LootItem(rawItemText); }