ProductGetRequest.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using System;
  2. using System.Collections.Generic;
  3. using Top.Api.Util;
  4. namespace Top.Api.Request
  5. {
  6. /// <summary>
  7. /// TOP API: taobao.product.get
  8. /// </summary>
  9. public class ProductGetRequest : BaseTopRequest<Top.Api.Response.ProductGetResponse>
  10. {
  11. /// <summary>
  12. /// 商品类目id.调用taobao.itemcats.get获取;必须是叶子类目id,如果没有传product_id,那么cid和props必须要传.
  13. /// </summary>
  14. public Nullable<long> Cid { get; set; }
  15. /// <summary>
  16. /// 需返回的字段列表.可选值:Product数据结构中的所有字段;多个字段之间用","分隔.
  17. /// </summary>
  18. public string Fields { get; set; }
  19. /// <summary>
  20. /// Product的id.两种方式来查看一个产品:1.传入product_id来查询 2.传入cid和props来查询
  21. /// </summary>
  22. public Nullable<long> ProductId { get; set; }
  23. /// <summary>
  24. /// 比如:诺基亚N73这个产品的关键属性列表就是:品牌:诺基亚;型号:N73,对应的PV值就是10005:10027;10006:29729.
  25. /// </summary>
  26. public string Props { get; set; }
  27. #region ITopRequest Members
  28. public override string GetApiName()
  29. {
  30. return "taobao.product.get";
  31. }
  32. public override IDictionary<string, string> GetParameters()
  33. {
  34. TopDictionary parameters = new TopDictionary();
  35. parameters.Add("cid", this.Cid);
  36. parameters.Add("fields", this.Fields);
  37. parameters.Add("product_id", this.ProductId);
  38. parameters.Add("props", this.Props);
  39. if (this.otherParams != null)
  40. {
  41. parameters.AddAll(this.otherParams);
  42. }
  43. return parameters;
  44. }
  45. public override void Validate()
  46. {
  47. RequestValidator.ValidateRequired("fields", this.Fields);
  48. }
  49. #endregion
  50. }
  51. }