using System;
using System.Collections.Generic;
using Top.Api.Response;
using Top.Api.Util;
namespace Top.Api.Request
{
///
/// TOP API: taobao.product.add
///
public class ProductAddRequest : BaseTopRequest, ITopUploadRequest
{
///
/// 非关键属性结构:pid:vid;pid:vid.
非关键属性不包含关键属性、销售属性、用户自定义属性、商品属性;
调用taobao.itemprops.get获取pid,调用taobao.itempropvalues.get获取vid.
注:支持最大长度为512字节
///
public string Binds { get; set; }
///
/// 商品类目ID.调用taobao.itemcats.get获取;注意:必须是叶子类目 id.
///
public Nullable Cid { get; set; }
///
/// 用户自定义属性,结构:pid1:value1;pid2:value2,如果有型号,系列等子属性用: 隔开 例如:“20000:优衣库:型号:001;632501:1234”,表示“品牌:优衣库:型号:001;货号:1234”
注:包含所有自定义属性的传入
///
public string CustomerProps { get; set; }
///
/// 产品描述.最大不超过25000个字符
///
public string Desc { get; set; }
///
/// 产品主图片.最大1M,目前仅支持GIF,JPG.
///
public FileItem Image { get; set; }
///
/// 是不是主图
///
public Nullable Major { get; set; }
///
/// 上市时间。目前只支持鞋城类目传入此参数
///
public Nullable MarketTime { get; set; }
///
/// 产品名称,最大30个字符.
///
public string Name { get; set; }
///
/// native_unkeyprops
///
public string NativeUnkeyprops { get; set; }
///
/// 外部产品ID
///
public string OuterId { get; set; }
///
/// 产品市场价.精确到2位小数;单位为元.如:200.07
///
public string Price { get; set; }
///
/// 销售属性值别名。格式为pid1:vid1:alias1;pid1:vid2:alia2。只有少数销售属性值支持传入别名,比如颜色和尺寸
///
public string PropertyAlias { get; set; }
///
/// 关键属性 结构:pid:vid;pid:vid.调用taobao.itemprops.get获取pid,调用taobao.itempropvalues.get获取vid;如果碰到用户自定义属性,请用customer_props.
///
public string Props { get; set; }
///
/// 销售属性结构:pid:vid;pid:vid.调用taobao.itemprops.get获取is_sale_prop=true的pid,调用taobao.itempropvalues.get获取vid.
///
public string SaleProps { get; set; }
///
/// 加入垂直市场,目前只支持以鞋城卖家身份加入名鞋馆(暂时此字段还不起作用,不对外开放)
///
public Nullable VerticalMarket { get; set; }
#region BaseTopRequest Members
public override string GetApiName()
{
return "taobao.product.add";
}
public override IDictionary GetParameters()
{
TopDictionary parameters = new TopDictionary();
parameters.Add("binds", this.Binds);
parameters.Add("cid", this.Cid);
parameters.Add("customer_props", this.CustomerProps);
parameters.Add("desc", this.Desc);
parameters.Add("major", this.Major);
parameters.Add("market_time", this.MarketTime);
parameters.Add("name", this.Name);
parameters.Add("native_unkeyprops", this.NativeUnkeyprops);
parameters.Add("outer_id", this.OuterId);
parameters.Add("price", this.Price);
parameters.Add("property_alias", this.PropertyAlias);
parameters.Add("props", this.Props);
parameters.Add("sale_props", this.SaleProps);
parameters.Add("vertical_market", this.VerticalMarket);
if (this.otherParams != null)
{
parameters.AddAll(this.otherParams);
}
return parameters;
}
public override void Validate()
{
RequestValidator.ValidateMaxLength("binds", this.Binds, 512);
RequestValidator.ValidateRequired("cid", this.Cid);
RequestValidator.ValidateRequired("image", this.Image);
RequestValidator.ValidateMaxLength("image", this.Image, 1048576);
}
#endregion
#region ITopUploadRequest Members
public IDictionary GetFileParameters()
{
IDictionary parameters = new Dictionary();
parameters.Add("image", this.Image);
return parameters;
}
#endregion
}
}