Exemplo n.º 1
0
        /// <summary>
        /// Update Inventory Variants
        /// <para>Updates product inventory, including total quantity, whether the product is in stock, and whether the product inventory is tracked.</para>
        /// </summary>
        /// <param name="productInventoryItemId">Inventory item id</param>
        /// <param name="variantInventoryRequest">The <see cref="ItemInventoryStatus"/> to update.</param>
        /// <returns>Returns an empty object..</returns>
        public virtual async Task <object> UpdateVariantInventoryStatusAsync(string productInventoryItemId, UpdateInventoryVariantsRequest variantInventoryRequest)
        {
            var         req     = PrepareRequestV2($"inventoryItems/{productInventoryItemId}");
            HttpContent content = null;

            if (variantInventoryRequest != null)
            {
                var body = variantInventoryRequest.ToDictionary();
                content = new JsonContent(body);
            }
            return(await ExecuteRequestAsync <object>(req, new HttpMethod("Patch"), content));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Update Inventory Variants
        /// </summary>
        /// <param name="productInventoryItemId">Inventory item ID.</param>
        /// <param name="request">Inventory variants request.</param>
        /// <returns>The <see cref="VariantInventoryRequestResponse"/>.</returns>
        public virtual async Task <InventoryVariantsResponse> UpdateInventoryVariants(string productInventoryItemId, UpdateInventoryVariantsRequest request)
        {
            var         req     = PrepareRequestV2($"inventoryItems/{productInventoryItemId}");
            HttpContent content = null;

            if (request != null)
            {
                var body = request.ToDictionary();
                content = new JsonContent(body);
            }
            return(await ExecuteRequestAsync <InventoryVariantsResponse>(req, HttpMethod.Post, content));
        }