Giter VIP home page Giter VIP logo

aliexpresssdk's Introduction

AliExpressSDK


       由于速卖通api已经更新至 https://developers.aliexpress.com/doc.htm
       当前sdk已经不适应

阿里速卖通开放平台SDK C#版本 http://open.aliexpress.com/

使用例子

           var client = new SDK.Platform.AliExpressApi.AliExpressClient("appKey", "appSecret", "accessToken");
           var order = client.FindOrderById(11111);

扩展重写

       public class CustomAliExpressClient : SDK.Platform.AliExpressApi.AliExpressClient
       {
           public CustomAliExpressClient(string appKey, string appSecret, string accessToken = null, bool _throw = true)
               : base(appKey, appSecret, accessToken, _throw)
           {
               //this.StrClient
           }
           //重写 或 自定义方法,属性
           public override ApiFindOrderByIdResponse FindOrderById(long orderId)
           {
               return base.FindOrderById(orderId);

               //解析方法1,使用SDK现有的解析方法
               //SDK解析结果正确时,推荐使用
               var model = this.ModelClient.FindOrderById(orderId);
               return model;

               //解析方法2,使用SDK现有的 json 获取,自定义对象解析
               // SDK 获取 json 结果正确,但是解析对象错误,或不能满足需求时,推荐使用
               var json = this.StrClient.api_findOrderById(orderId);
               var customModel = Newtonsoft.Json.JsonConvert.DeserializeObject<ApiFindOrderByIdResponse>(json);
               return customModel;

               //解析方法2,使用SDK现有的签名及请求,其他自定义
               var dic = new Dictionary<string, object>();
               dic.Add(SDK.Platform.AliExpressApi.AliExpressClient.fieldAccessToken, this.AccessToken);//用户授权令牌
               dic.Add("orderId", orderId);
               dic.Add("fieldList", null);
               dic.Add("extInfoBitFlag", null);
               var json2 = this.PostWebRequest(SDK.Platform.AliExpressApi.AliExpressClient.openapiIP, this.AppKey, SDK.Platform.AliExpressApi.AliExpressClient.Url + "api.findOrderById", isFile: false, stream: null, paramDic: dic, paramIsSign: true, paramIscon: true);
               var customModel2 = Newtonsoft.Json.JsonConvert.DeserializeObject<ApiFindOrderByIdResponse>(json2);
               return customModel2;

               //使用 System.Net.Http.HttpClient 获取数据
               var str1 = this.PostAsync<string, ApiFindOrderByIdResponse>("http://www.qq.com", "test");
           }
       }

aliexpresssdk's People

Contributors

mccj avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

leoinsinging

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.