Example #1
0
        static public void Main()
        {
            // Configure API key authorization: api_key
            Configuration.Default.AddApiKey("x-api-key", ExampleConstants.AWS_API_KEY);

            var stockx = new StockXApi();

            stockx.Configuration.BasePath = ExampleConstants.STOCKX_ENDPOINT;

            var login = new LoginRequest(ExampleConstants.STOCKX_USERNAME, ExampleConstants.STOCKX_PASSWORD);

            try
            {
                // Login
                stockx.Login(login);

                // Lookup the supplied product by its product ID
                var marketData = stockx.GetProductMarketData("7f9c67ff-2cd4-4e27-8b64-518900a1bc0b", "air-jordan-1-retro-high-off-white-chicago");

                Console.WriteLine(marketData);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
                Console.WriteLine("Exception when calling StockXApi.GetProductMarketData: " + e.Message);
            }
        }
Example #2
0
        static public void Main()
        {
            // Configure API key authorization: api_key
            Configuration.Default.AddApiKey("x-api-key", ExampleConstants.AWS_API_KEY);

            var stockx = new StockXApi();

            stockx.Configuration.BasePath = ExampleConstants.STOCKX_ENDPOINT;

            var login = new LoginRequest(ExampleConstants.STOCKX_USERNAME, ExampleConstants.STOCKX_PASSWORD);

            try
            {
                // Login and fetch the jwt header for authentication use in the request
                ApiResponse <LoginResponse> result = stockx.LoginWithHttpInfo(login);
                var jwt = result.Headers[ExampleConstants.JWT_HEADER];

                stockx.Configuration.DefaultHeader["jwt-authorization"] = jwt;

                // Find a product with search
                var search = stockx.Search("Jordan Retro Black Cat");

                // Lookup the product's data by its search id
                var firstResultStyle = search.Hits[0].StyleId;

                var productInfo = stockx.LookupProduct(firstResultStyle, "11");

                // Get the market data (highest bids, lowest asks, etc) about the product
                var id          = productInfo.Data[0].Id;
                var productUuid = productInfo.Data[0].Attributes.ProductUuid;

                var marketData = stockx.GetProductMarketData(id, productUuid);

                // Get the highest bid and increment it
                var highestBid = marketData.Market.HighestBid;
                highestBid++;

                // Create a portfolio item request with a higher bid
                var item = new PortfolioRequestPortfolioItem();
                item.Amount          = highestBid.ToString();
                item.SkuUuid         = "bae25b67-a721-4f57-ad5a-79973c7d0a5c";
                item.MatchedWithDate = "2018-12-12T05:00:00+0000";
                item.ExpiresAt       = "2018-12-12T12:39:07+00:00";

                var request = new PortfolioRequest();
                request.PortfolioItem = item;
                request.Customer      = result.Data.Customer;
                request.Timezone      = "America/Detroit";

                // Submit the bid
                var bidResp = stockx.NewPortfolioBid(request);

                Console.WriteLine(bidResp);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
                Console.WriteLine("Exception when creating new highest bid: " + e.Message);
            }
        }
        static public void Main()
        {
            // Configure API key authorization: api_key
            Configuration.Default.AddApiKey("x-api-key", ExampleConstants.AWS_API_KEY);

            var stockx = new StockXApi();

            stockx.Configuration.BasePath = ExampleConstants.STOCKX_ENDPOINT;

            var login = new LoginRequest(ExampleConstants.STOCKX_USERNAME, ExampleConstants.STOCKX_PASSWORD);

            try
            {
                // Login and fetch the jwt header for authentication use in the request
                ApiResponse <LoginResponse> result = stockx.LoginWithHttpInfo(login);
                var jwt = result.Headers[ExampleConstants.JWT_HEADER];

                stockx.Configuration.DefaultHeader["jwt-authorization"] = jwt;

                // Get the customer's open orders
                var openOrders = stockx.GetOpenOrders(result.Data.Customer.Id);

                Console.WriteLine("Open orders: " + openOrders);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
                Console.WriteLine("Exception when calling StockXApi.GetProductById: " + e.Message);
            }
        }
Example #4
0
        static public void Main()
        {
            // Configure API key authorization: api_key
            Configuration.Default.AddApiKey("x-api-key", ExampleConstants.AWS_API_KEY);

            var stockx = new StockXApi();

            stockx.Configuration.BasePath = ExampleConstants.STOCKX_ENDPOINT;

            var login = new LoginRequest(ExampleConstants.STOCKX_USERNAME, ExampleConstants.STOCKX_PASSWORD);

            try
            {
                // Login and fetch the jwt header for authentication use in the request
                ApiResponse <LoginResponse> result = stockx.LoginWithHttpInfo(login);
                var jwt = result.Headers[ExampleConstants.JWT_HEADER];

                stockx.Configuration.DefaultHeader["jwt-authorization"] = jwt;

                var productInfo = stockx.LookupProduct("nike", "7");

                Console.WriteLine(productInfo);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
                Console.WriteLine("Exception when calling StockXApi.LookupProduct: " + e.Message);
            }
        }
Example #5
0
        static public void Main()
        {
            // Configure API key authorization: api_key
            Configuration.Default.AddApiKey("x-api-key", ExampleConstants.AWS_API_KEY);

            var stockx = new StockXApi();

            stockx.Configuration.BasePath = ExampleConstants.STOCKX_ENDPOINT;

            var login = new LoginRequest(ExampleConstants.STOCKX_USERNAME, ExampleConstants.STOCKX_PASSWORD);

            try
            {
                // Login
                stockx.Login(login);

                // Lookup the supplied product by its product ID
                var search = stockx.Search("jeezy");

                Console.WriteLine(search);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
                Console.WriteLine("Exception when calling StockXApi.Search: " + e.Message);
            }
        }
Example #6
0
        static public void Main()
        {
            // Configure API key authorization: api_key
            Configuration.Default.AddApiKey("x-api-key", ExampleConstants.AWS_API_KEY);

            var stockx = new StockXApi();

            stockx.Configuration.BasePath = ExampleConstants.STOCKX_ENDPOINT;

            var login = new LoginRequest(ExampleConstants.STOCKX_USERNAME, ExampleConstants.STOCKX_PASSWORD);

            try
            {
                // Login and fetch the jwt header for authentication use in the request
                ApiResponse <LoginResponse> result = stockx.LoginWithHttpInfo(login);
                var jwt = result.Headers[ExampleConstants.JWT_HEADER];

                stockx.Configuration.DefaultHeader["jwt-authorization"] = jwt;

                var item = new PortfolioRequestPortfolioItem();
                item.Amount          = "25";
                item.SkuUuid         = "bae25b67-a721-4f57-ad5a-79973c7d0a5c";
                item.MatchedWithDate = "2018-12-12T05:00:00+0000";
                item.ExpiresAt       = "2018-12-12T12:39:07+00:00";

                var request = new PortfolioRequest();
                request.PortfolioItem = item;
                request.Customer      = result.Data.Customer;
                request.Timezone      = "America/Detroit";

                // Create a new portfolio bid
                var bidResp = stockx.NewPortfolioBid(request);

                // Print the result of the bid call
                Console.WriteLine(bidResp);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
                Console.WriteLine("Exception when calling StockXApi.NewPortfolioBid: " + e.Message);
            }
        }
Example #7
0
        static public void Main()
        {
            // Configure API key authorization: api_key
            Configuration.Default.AddApiKey("x-api-key", ExampleConstants.AWS_API_KEY);

            var stockx = new StockXApi();

            stockx.Configuration.BasePath = ExampleConstants.STOCKX_ENDPOINT;

            var login = new LoginRequest(ExampleConstants.STOCKX_USERNAME, ExampleConstants.STOCKX_PASSWORD);

            try
            {
                // Attempts to log the user in with a username and password.
                LoginResponse result = stockx.Login(login);

                Console.WriteLine(result.Customer);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
                Console.WriteLine("Exception when calling StockXApi.Login: " + e.Message);
            }
        }