コード例 #1
0
        /// <summary>
        /// Updates the given <see cref="ShopifyProductVariant"/>. Id must not be null.
        /// </summary>
        /// <param name="variant">The variant to update.</param>
        public async Task <ShopifyProductVariant> UpdateAsync(ShopifyProductVariant variant)
        {
            var req = RequestEngine.CreateRequest($"variants/{variant.Id.Value}.json", Method.PUT, "variant");

            req.AddJsonBody(new { variant });

            return(await RequestEngine.ExecuteRequestAsync <ShopifyProductVariant>(_RestClient, req));
        }
コード例 #2
0
        /// <summary>
        /// Updates the given <see cref="ShopifyProductVariant"/>. Id must not be null.
        /// </summary>
        /// <param name="variant">The variant to update.</param>
        public async Task<ShopifyProductVariant> UpdateAsync(ShopifyProductVariant variant)
        {
            var req = RequestEngine.CreateRequest($"variants/{variant.Id.Value}.json", Method.PUT, "variant");

            req.AddJsonBody(new { variant });

            return await RequestEngine.ExecuteRequestAsync<ShopifyProductVariant>(_RestClient, req);
        }
コード例 #3
0
        /// <summary>
        /// Creates a new <see cref="ShopifyProductVariant"/>.
        /// </summary>
        /// <param name="productId">The product that the new variant will belong to.</param>
        /// <param name="variant">A new <see cref="ShopifyProductVariant"/>. Id should be set to null.</param>
        public async Task <ShopifyProductVariant> CreateAsync(long productId, ShopifyProductVariant variant)
        {
            var req = RequestEngine.CreateRequest($"products/{productId}/variants.json", Method.POST, "variant");

            req.AddJsonBody(new { variant });

            return(await RequestEngine.ExecuteRequestAsync <ShopifyProductVariant>(_RestClient, req));
        }
コード例 #4
0
        /// <summary>
        /// Creates a new <see cref="ShopifyProductVariant"/>.
        /// </summary>
        /// <param name="productId">The product that the new variant will belong to.</param>
        /// <param name="variant">A new <see cref="ShopifyProductVariant"/>. Id should be set to null.</param>
        public async Task<ShopifyProductVariant> CreateAsync(long productId, ShopifyProductVariant variant)
        {
            var req = RequestEngine.CreateRequest($"products/{productId}/variants.json", Method.POST, "variant");

            req.AddJsonBody(new { variant });
            
            return await RequestEngine.ExecuteRequestAsync<ShopifyProductVariant>(_RestClient, req);
        }