Ejemplo n.º 1
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));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 通过 parent_sku 获得商品
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="productId"></param>
        /// <param name="sessionType"></param>
        /// <returns></returns>
        public static async Task <ProductResult> ProductRetrieveViaSkuAsync(string clientId, string accessToken, string parentSku, SessionType sessionType = SessionType.Prod)
        {
            return(await ApiHandlerWrapper.TryCommonApiAsync(token =>
            {
                var url =
                    string.Format("{0}/api/v2/product?parent_sku={1}&access_token={2}",
                                  sessionType == SessionType.Sandbox ? Wl.Wish.Config.RequestUriRootSandbox : Wl.Wish.Config.RequestUriRoot,
                                  parentSku,
                                  token);

                var result = Wl.Wish.CommonAPIs.CommonJsonSend.SendAsync <ProductResult>(null, url, null, CommonJsonSendType.GET);
                return result;
            }, clientId, accessToken, sessionType));
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 商品上架(异步,通过 parent_sku)
 /// </summary>
 /// <param name="accessToken"></param>
 /// <param name="parentSku"></param>
 /// <param name="sessionType"></param>
 /// <returns></returns>
 public static async Task <ProductResultBase> ProductEnableViaParentSkuAsync(string clientId, string accessToken, string parentSku, SessionType sessionType = SessionType.Prod)
 {
     return(await ApiHandlerWrapper.TryCommonApiAsync(token =>
     {
         var url =
             string.Format("{0}/api/v2/product/enable",
                           sessionType == SessionType.Sandbox ? Wl.Wish.Config.RequestUriRootSandbox : Wl.Wish.Config.RequestUriRoot);
         var data = new
         {
             parent_sku = parentSku
         };
         var result = Wl.Wish.CommonAPIs.CommonJsonSend.SendAsync <ProductResultBase>(token, url, data, CommonJsonSendType.POST);
         return result;
     }, clientId, accessToken, sessionType));
 }