Пример #1
0
        public Task <JResultsNoRender> SearchAsync(string query = "", int start = 0, int count = 10,
                                                   bool searchInDescriptions = false,
                                                   EApp app = EApp.None, EMarketSort?columnSort = null, ESort?sort = null,
                                                   IDictionary <string, string> custom = null, bool withAuth = false, Proxy proxy = null)
        {
            var request = new RestRequest("/market/search/render/");

            request.AddQueryParameter("query", query);
            request.AddQueryParameter("start", start.ToString());
            request.AddQueryParameter("count", count.ToString());
            request.AddQueryParameter("search_descriptions", (searchInDescriptions ? 1 : 0).ToString());
            request.AddQueryParameter("appid", ((int)app).ToString());
            if (columnSort != null)
            {
                request.AddQueryParameter("sort_column", columnSort.Value.ToString().ToLower());
            }
            if (sort != null)
            {
                request.AddQueryParameter("sort_dir", sort.Value.ToString().ToLower());
            }
            request.AddQueryParameter("norender", "1");

            if (custom != null)
            {
                foreach (var customQuery in custom)
                {
                    request.AddQueryParameter(customQuery.Key, customQuery.Value);
                }
            }

            return(_client.SteamRequestAsync <JResultsNoRender>(request, withAuth, proxy));
        }
Пример #2
0
        public Task <JListings> Listings(EApp app, string hashName, ECurrency currency, int count = 10, bool withAuth = false, Proxy proxy = null)
        {
            var request = new RestRequest($"/market/listings/{(int)app}/{hashName}/render");

            request.AddQueryParameter("currency", ((int)currency).ToString());
            request.AddQueryParameter("count", count.ToString());

            return(_client.SteamRequestAsync <JListings>(request, withAuth, proxy));
        }
Пример #3
0
        public Task <JPriceOverview> PriceOverview(ECurrency currency, EApp app, string hashName, Proxy proxy = null)
        {
            var request = new RestRequest("/market/priceoverview/");

            request.AddQueryParameter("currency", ((int)currency).ToString());
            request.AddQueryParameter("appid", ((int)app).ToString());
            request.AddQueryParameter("market_hash_name", hashName);

            return(_client.SteamRequestAsync <JPriceOverview>(request, false, proxy));
        }
Пример #4
0
        public Task <JCreateOrder> CreateOrder(string hashName, EApp app, ECurrency currency, double totalPrice, int quantity, Proxy proxy = null)
        {
            var request = new RestRequest("/market/createbuyorder/", Method.POST);

            request.AddHeader("Referer", $"https://steamcommunity.com/market/listings/{(int)app}/{hashName}");
            request.AddParameter("sessionid", _client.Auth.Session(), ParameterType.GetOrPost);
            request.AddParameter("currency", (int)currency, ParameterType.GetOrPost);
            request.AddParameter("appid", (int)app, ParameterType.GetOrPost);
            request.AddParameter("market_hash_name", HttpUtility.UrlDecode(hashName), ParameterType.GetOrPost);
            request.AddParameter("price_total", (totalPrice * 100 * quantity).ToString(CultureInfo.InvariantCulture), ParameterType.GetOrPost);
            request.AddParameter("quantity", quantity, ParameterType.GetOrPost);

            return(_client.SteamRequestAsync <JCreateOrder>(request, true, proxy));
        }
Пример #5
0
        public async Task <long?> SpreadID(EApp app, string hashName, Proxy proxy = null)
        {
            var resp = await _client.SteamRequestRawAsync(new RestRequest($"/market/listings/{(int)app}/{hashName}"), false, proxy);

            var doc = new HtmlDocument();

            doc.LoadHtml(resp);

            var spreadMatch = Regex.Match(resp, @"(?<=Market_LoadOrderSpread\()(.*)(?=\);)").Value.Trim();

            if (string.IsNullOrWhiteSpace(spreadMatch))
            {
                throw new SteamException("Spread ID not Found");
            }

            return(long.Parse(spreadMatch));
        }
Пример #6
0
        public async Task <List <MarketHistoryItem> > ItemHistoryAsync(EApp app, string hashName, Proxy proxy = null)
        {
            var request = new RestRequest("/market/pricehistory/");

            request.AddQueryParameter("appid", ((int)app).ToString());
            request.AddQueryParameter("market_hash_name", hashName, false);

            var resp = await _client.SteamRequestAsync <JPriceHistory>(request, true, proxy);

            return(resp.Prices
                   .Select((g, i) => new MarketHistoryItem
            {
                Timestamp = DateTimeOffset.ParseExact(g[0].ToString(), "MMM dd yyyy HH: +0", CultureInfo.InvariantCulture),
                Count = int.Parse(g[2].ToString()),
                Price = Math.Round(double.Parse(g[1].ToString()), 2)
            })
                   .OrderBy(o => o.Timestamp)
                   .ToList());
        }
Пример #7
0
        public ISqlQuery OrderBy(string column, EApp.Core.Query.SortOrder sortOrder)
        {
            this.SqlBuilder.OrderBy(column, sortOrder);

            return this;
        }
Пример #8
0
 public Task <JGemPrice> GemPrice(EApp app, long itemType, int borderColor = 0, Proxy proxy = null)
 {
     return(_client.SteamRequestAsync <JGemPrice>(new RestRequest($"/auction/ajaxgetgoovalueforitemtype/?appid={(int)app}&item_type={itemType}&border_color={borderColor}"), false, proxy));
 }