Exemple #1
0
        private static string GetUrlRequest(AppId.AppName app, int page, string marketHashName, double minPrice, double maxPrice,
                                            SortBy sortBy, SortOrder sortOrder, ThreeChoices hasStickers, ThreeChoices isStattrak, ThreeChoices isSouvenir,
                                            ResultsPerPage resultsPerPage, ThreeChoices tradeDelayedItems)
        {
            Server.UrlCreator urlCreator = new Server.UrlCreator($"https://bitskins.com/api/v1/get_inventory_on_sale/");
            urlCreator.AppendUrl($"&page={page}");
            urlCreator.AppendUrl($"&app_id={(int)app}");
            urlCreator.AppendUrl($"&per_page={(int)resultsPerPage}");

            if (!string.IsNullOrEmpty(marketHashName))
            {
                urlCreator.AppendUrl($"&market_hash_name={marketHashName}");
            }

            if (minPrice > 0)
            {
                urlCreator.AppendUrl($"&min_price={minPrice}");
            }

            if (maxPrice > 0)
            {
                urlCreator.AppendUrl($"&max_price={maxPrice}");
            }

            if (sortBy != SortBy.Not)
            {
                urlCreator.AppendUrl($"&sort_by={SortByToString(sortBy)}");
            }

            if (sortOrder != SortOrder.Not)
            {
                urlCreator.AppendUrl($"&order={SortOrderToString(sortOrder)}");
            }

            if (app == AppId.AppName.CounterStrikGlobalOffensive)
            {
                urlCreator.AppendUrl($"&has_stickers={(int)hasStickers}");
                urlCreator.AppendUrl($"&is_stattrak={(int)isStattrak}");
                urlCreator.AppendUrl($"&is_souvenir={(int)isSouvenir}");
                urlCreator.AppendUrl($"&show_trade_delayed_items={(int)tradeDelayedItems}");
            }

            return(urlCreator.ReadUrl());
        }
Exemple #2
0
        /// <summary>
        /// Allows you to retrieve the BitSkins inventory currently on sale.
        /// This includes items you cannot buy (i.e., items listed for sale by you).
        /// </summary>
        /// <param name="app">Inventory's game id.</param>
        /// <param name="page">Page number.</param>
        /// <param name="marketHashName">Full or partial item name. (optional)</param>
        /// <param name="minPrice">Minimum price. (optional)</param>
        /// <param name="maxPrice">Maximum price. (optional)</param>
        /// <param name="sortBy">{created_at|price}. (optional)</param>
        /// <param name="sortOrder">{desc|asc}. (optional)</param>
        /// <param name="hasStickers">{-1|0|1}. For CS:GO only. (optional)</param>
        /// <param name="isStattrak">{-1|0|1}. For CS:GO only. (optional)</param>
        /// <param name="isSouvenir">{-1|0|1}. For CS:GO only. (optional)</param>
        /// <param name="resultsPerPage">Results per page. Must be either 30, or 480.</param>
        /// <param name="tradeDelayedItems">{-1|0|1}. For CS:GO only. (optional)</param>
        /// <returns>List of items on sale.</returns>
        public static List <ItemOnSale> GetInventoryOnSale(AppId.AppName app, int page, string marketHashName, double minPrice, double maxPrice,
                                                           SortBy sortBy, SortOrder sortOrder, ThreeChoices hasStickers, ThreeChoices isStattrak, ThreeChoices isSouvenir,
                                                           ResultsPerPage resultsPerPage, ThreeChoices tradeDelayedItems)
        {
            CheckParameters(page);
            string urlRequest = GetUrlRequest(app, page, marketHashName, minPrice, maxPrice, sortBy, sortOrder, hasStickers,
                                              isStattrak, isSouvenir, resultsPerPage, tradeDelayedItems);
            string            result      = Server.ServerRequest.RequestServer(urlRequest);
            List <ItemOnSale> itemsOnSale = ReadItemsOnSale(result);

            return(itemsOnSale);
        }