示例#1
0
        /// <summary>
        /// Updates the given <see cref="ProductImage"/>.
        /// </summary>
        /// <param name="productId">The id of the product that counted images belong to.</param>
        /// <param name="productImageId">Id of the object being updated.</param>
        /// <param name="image">The <see cref="ProductImage"/> to update.</param>
        /// <returns>The updated <see cref="ProductImage"/>.</returns>
        public virtual async Task <ProductImage> UpdateAsync(long productId, long productImageId, ProductImage image)
        {
            var req     = PrepareRequest($"products/{productId}/images/{productImageId}.json");
            var content = new JsonContent(new
            {
                image = image
            });

            return(await ExecuteRequestAsync <ProductImage>(req, HttpMethod.Put, content, "image"));
        }
示例#2
0
        /// <summary>
        /// Updates the given <see cref="ProductImage"/>.
        /// </summary>
        /// <param name="productId">The id of the product that counted images belong to.</param>
        /// <param name="productImageId">Id of the object being updated.</param>
        /// <param name="image">The <see cref="ProductImage"/> to update.</param>
        /// <param name="cancellationToken">Cancellation Token</param>
        /// <returns>The updated <see cref="ProductImage"/>.</returns>
        public virtual async Task <ProductImage> UpdateAsync(long productId, long productImageId, ProductImage image, CancellationToken cancellationToken = default)
        {
            var req     = PrepareRequest($"products/{productId}/images/{productImageId}.json");
            var content = new JsonContent(new
            {
                image = image
            });
            var response = await ExecuteRequestAsync <ProductImage>(req, HttpMethod.Put, cancellationToken, content, "image");

            return(response.Result);
        }