public async Task UpdateProductOptionsAsync(List <BigCommerceProductOption> productOptions, CancellationToken token)
        {
            var marker = this.GetMarker();

            await productOptions.DoInBatchAsync(MaxThreadsCount, async productOption =>
            {
                var endpoint    = string.Format("/{0}/variants/{1}", productOption.ProductId, productOption.Id);
                var jsonContent = new { inventory_level = productOption.Quantity }.ToJson();

                var limit = await ActionPolicies.SubmitAsync(marker, endpoint).Get(async() =>
                                                                                   await this._webRequestServices.PutDataAsync(BigCommerceCommand.UpdateProductsV3, endpoint, jsonContent, marker));
                await this.CreateApiDelay(limit, token);                   //API requirement
            });
        }
示例#2
0
        public async Task UpdateProductsAsync(List <BigCommerceProduct> products, CancellationToken token)
        {
            var marker = this.GetMarker();

            await products.DoInBatchAsync(MaxThreadsCount, async product =>
            {
                var endpoint    = ParamsBuilder.CreateProductUpdateEndpoint(product.Id);
                var jsonContent = new { inventory_level = product.Quantity }.ToJson();

                var limit = await ActionPolicies.SubmitAsync(marker, endpoint).Get(async() =>
                                                                                   await this._webRequestServices.PutDataAsync(BigCommerceCommand.UpdateProductV2_OAuth, endpoint, jsonContent, marker));

                await this.CreateApiDelay(limit, token);                   //API requirement
            });
        }