示例#1
0
        public void ProductUpdateTest()
        {
            var product = new Wl.Wish.Entities.Request.ProductToUpdate();

            product.brand            = "Jeep Commandor";
            product.description      = "Bracelets Type: Strand Bracelets Gender: Unisex Clasp Type: Easy-hook Material: Stone Metals Type: Zinc Alloy Length: 18cm-18.5cm and we can make custom size of the bracelets Setting Type: None Style: Classic Shape\\pattern: Round Chain Type: Link Chain Fine or Fashion: Fashion Item Type: Bracelets Color:: Black Size:: 8mm Material:: Lava stone beads is_customized: Yes Unit Type: piece Package Weight: 0.040kg (0.09lb.) Package Size: 15cm x 15cm x 5cm (5.91in x 5.91in x 1.97in)";
            product.id               = "59006434d594f17a412090f3";
            product.name             = "2016 New 18k Iced Out Gold Plated Gold Gunmetal MICRO JESUS PIECE Mini Pendant Chain Hip Hop Necklace gift(Color: Gold) 【neo golden】";
            product.tags             = "elegant,perfect,attractive";
            product.landing_page_url = "http://weilan.com/p/s-1i889efedfe";

            var clientId    = "58f046f3f186cf290caf2098";
            var accessToken = "f3239c9554b4435da31fbdcf9c86c509";
            var clientSec   = "6c0031ccaf5743918c9f78bb84c9e8b2";
            var preAuthCode = "1585f7dbdc6649be89069456b25d7416";
            var redirectUri = "https://weilan.com/WishApi/LuckJewShop.html";

            Wl.Wish.Product.Containers.AccessTokenContainer.Register(clientId: clientId, clientSecret: clientSec, accessToken: accessToken, expiresIn: 2592000, expiryTime: 1495700389, refreshToken: "48afe8b1683e421785c4438f32901f29", redirectUri: redirectUri, appName: "Instant shop");
            var result = Wl.Wish.Product.CommonAPIs.CommonApi.ProductUpdate(clientId: clientId, accessToken: accessToken, product: product, sessionType: SessionType.Sandbox);


            Console.Write(result);
        }
示例#2
0
        /// <summary>
        /// 通过 product_id 或 parent_sku 更新商品
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="product"></param>
        /// <param name="sessionType"></param>
        /// <returns></returns>
        public static async Task <ProductResultBase> ProductUpdateAsync(string clientId, string accessToken, Wl.Wish.Entities.Request.ProductToUpdate product, SessionType sessionType = SessionType.Prod)
        {
            return(await ApiHandlerWrapper.TryCommonApiAsync(token =>
            {
                var url =
                    string.Format("{0}/api/v2/product/update",
                                  sessionType == SessionType.Sandbox ? Wl.Wish.Config.RequestUriRootSandbox : Wl.Wish.Config.RequestUriRoot);

                var result = Wl.Wish.CommonAPIs.CommonJsonSend.SendAsync <ProductResultBase>(token, url, product, CommonJsonSendType.POST);
                return result;
            }, clientId, accessToken, sessionType));
        }