ProductUpdateRequest.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. using System;
  2. using System.Collections.Generic;
  3. using Top.Api.Response;
  4. using Top.Api.Util;
  5. namespace Top.Api.Request
  6. {
  7. /// <summary>
  8. /// TOP API: taobao.product.update
  9. /// </summary>
  10. public class ProductUpdateRequest : BaseTopRequest<ProductUpdateResponse>, ITopUploadRequest<ProductUpdateResponse>
  11. {
  12. /// <summary>
  13. /// 非关键属性.调用taobao.itemprops.get获取pid,调用taobao.itempropvalues.get获取vid;格式:pid:vid;pid:vid
  14. /// </summary>
  15. public string Binds { get; set; }
  16. /// <summary>
  17. /// 产品描述.最大不超过25000个字符
  18. /// </summary>
  19. public string Desc { get; set; }
  20. /// <summary>
  21. /// 产品主图.最大500K,目前仅支持GIF,JPG
  22. /// </summary>
  23. public FileItem Image { get; set; }
  24. /// <summary>
  25. /// 是否是主图
  26. /// </summary>
  27. public Nullable<bool> Major { get; set; }
  28. /// <summary>
  29. /// 产品名称.最大不超过30个字符
  30. /// </summary>
  31. public string Name { get; set; }
  32. /// <summary>
  33. /// 自定义非关键属性
  34. /// </summary>
  35. public string NativeUnkeyprops { get; set; }
  36. /// <summary>
  37. /// 外部产品ID
  38. /// </summary>
  39. public string OuterId { get; set; }
  40. /// <summary>
  41. /// 产品市场价.精确到2位小数;单位为元.如:200.07
  42. /// </summary>
  43. public string Price { get; set; }
  44. /// <summary>
  45. /// 产品ID
  46. /// </summary>
  47. public Nullable<long> ProductId { get; set; }
  48. /// <summary>
  49. /// 销售属性.调用taobao.itemprops.get获取pid,调用taobao.itempropvalues.get获取vid;格式:pid:vid;pid:vid
  50. /// </summary>
  51. public string SaleProps { get; set; }
  52. #region BaseTopRequest Members
  53. public override string GetApiName()
  54. {
  55. return "taobao.product.update";
  56. }
  57. public override IDictionary<string, string> GetParameters()
  58. {
  59. TopDictionary parameters = new TopDictionary();
  60. parameters.Add("binds", this.Binds);
  61. parameters.Add("desc", this.Desc);
  62. parameters.Add("major", this.Major);
  63. parameters.Add("name", this.Name);
  64. parameters.Add("native_unkeyprops", this.NativeUnkeyprops);
  65. parameters.Add("outer_id", this.OuterId);
  66. parameters.Add("price", this.Price);
  67. parameters.Add("product_id", this.ProductId);
  68. parameters.Add("sale_props", this.SaleProps);
  69. if (this.otherParams != null)
  70. {
  71. parameters.AddAll(this.otherParams);
  72. }
  73. return parameters;
  74. }
  75. public override void Validate()
  76. {
  77. RequestValidator.ValidateMaxLength("image", this.Image, 1048576);
  78. RequestValidator.ValidateRequired("product_id", this.ProductId);
  79. }
  80. #endregion
  81. #region ITopUploadRequest Members
  82. public IDictionary<string, FileItem> GetFileParameters()
  83. {
  84. IDictionary<string, FileItem> parameters = new Dictionary<string, FileItem>();
  85. parameters.Add("image", this.Image);
  86. return parameters;
  87. }
  88. #endregion
  89. }
  90. }