in resellertrade-20191227/client/client.go [3098:3296]
func (client *Client) CreateCouponTemplateWithOptions(request *CreateCouponTemplateRequest, runtime *util.RuntimeOptions) (_result *CreateCouponTemplateResponse, _err error) {
_err = util.ValidateModel(request)
if _err != nil {
return _result, _err
}
body := map[string]interface{}{}
if !tea.BoolValue(util.IsUnset(request.ActivitySite)) {
body["ActivitySite"] = request.ActivitySite
}
if !tea.BoolValue(util.IsUnset(request.Bid)) {
body["Bid"] = request.Bid
}
if !tea.BoolValue(util.IsUnset(request.CertainMoney)) {
body["CertainMoney"] = request.CertainMoney
}
if !tea.BoolValue(util.IsUnset(request.ClientType)) {
body["ClientType"] = request.ClientType
}
if !tea.BoolValue(util.IsUnset(request.CommodityType)) {
body["CommodityType"] = request.CommodityType
}
if !tea.BoolValue(util.IsUnset(request.ControlType)) {
body["ControlType"] = request.ControlType
}
if !tea.BoolValue(util.IsUnset(request.CouponAmount)) {
body["CouponAmount"] = request.CouponAmount
}
if !tea.BoolValue(util.IsUnset(request.CouponEndTime)) {
body["CouponEndTime"] = request.CouponEndTime
}
if !tea.BoolValue(util.IsUnset(request.CouponFixedType)) {
body["CouponFixedType"] = request.CouponFixedType
}
if !tea.BoolValue(util.IsUnset(request.CouponStartTime)) {
body["CouponStartTime"] = request.CouponStartTime
}
if !tea.BoolValue(util.IsUnset(request.CouponType)) {
body["CouponType"] = request.CouponType
}
bodyFlat := map[string]interface{}{}
if !tea.BoolValue(util.IsUnset(request.Currency)) {
bodyFlat["Currency"] = request.Currency
}
if !tea.BoolValue(util.IsUnset(request.Description)) {
body["Description"] = request.Description
}
if !tea.BoolValue(util.IsUnset(request.DiscountRate)) {
body["DiscountRate"] = request.DiscountRate
}
if !tea.BoolValue(util.IsUnset(request.EndTime)) {
body["EndTime"] = request.EndTime
}
if !tea.BoolValue(util.IsUnset(request.ExtendsMap)) {
bodyFlat["ExtendsMap"] = request.ExtendsMap
}
if !tea.BoolValue(util.IsUnset(request.FromApp)) {
body["FromApp"] = request.FromApp
}
if !tea.BoolValue(util.IsUnset(request.ItemCodeSet)) {
body["ItemCodeSet"] = request.ItemCodeSet
}
if !tea.BoolValue(util.IsUnset(request.Market)) {
body["Market"] = request.Market
}
if !tea.BoolValue(util.IsUnset(request.MarketType)) {
body["MarketType"] = request.MarketType
}
if !tea.BoolValue(util.IsUnset(request.MaxRelease)) {
body["MaxRelease"] = request.MaxRelease
}
if !tea.BoolValue(util.IsUnset(request.MessageId)) {
body["MessageId"] = request.MessageId
}
if !tea.BoolValue(util.IsUnset(request.Name)) {
body["Name"] = request.Name
}
if !tea.BoolValue(util.IsUnset(request.Operator)) {
body["Operator"] = request.Operator
}
if !tea.BoolValue(util.IsUnset(request.OrderTypeSet)) {
body["OrderTypeSet"] = request.OrderTypeSet
}
if !tea.BoolValue(util.IsUnset(request.PerLimitNum)) {
body["PerLimitNum"] = request.PerLimitNum
}
if !tea.BoolValue(util.IsUnset(request.PromotionId)) {
body["PromotionId"] = request.PromotionId
}
if !tea.BoolValue(util.IsUnset(request.Reason)) {
body["Reason"] = request.Reason
}
if !tea.BoolValue(util.IsUnset(request.RelativeSecond)) {
body["RelativeSecond"] = request.RelativeSecond
}
if !tea.BoolValue(util.IsUnset(request.RequestId)) {
body["RequestId"] = request.RequestId
}
if !tea.BoolValue(util.IsUnset(request.SelectionIdSet)) {
body["SelectionIdSet"] = request.SelectionIdSet
}
if !tea.BoolValue(util.IsUnset(request.SellerId)) {
body["SellerId"] = request.SellerId
}
if !tea.BoolValue(util.IsUnset(request.Site)) {
body["Site"] = request.Site
}
if !tea.BoolValue(util.IsUnset(request.SpId)) {
body["SpId"] = request.SpId
}
if !tea.BoolValue(util.IsUnset(request.StartTime)) {
body["StartTime"] = request.StartTime
}
if !tea.BoolValue(util.IsUnset(request.Type)) {
body["Type"] = request.Type
}
if !tea.BoolValue(util.IsUnset(request.UniversalType)) {
body["UniversalType"] = request.UniversalType
}
if !tea.BoolValue(util.IsUnset(request.UpperLimit)) {
body["UpperLimit"] = request.UpperLimit
}
if !tea.BoolValue(util.IsUnset(request.UsageCount)) {
body["UsageCount"] = request.UsageCount
}
if !tea.BoolValue(util.IsUnset(request.UseScene)) {
body["UseScene"] = request.UseScene
}
if !tea.BoolValue(util.IsUnset(request.UserPkAmount)) {
body["UserPkAmount"] = request.UserPkAmount
}
if !tea.BoolValue(util.IsUnset(request.ValidityType)) {
body["ValidityType"] = request.ValidityType
}
body = tea.ToMap(body,
openapiutil.Query(bodyFlat))
req := &openapi.OpenApiRequest{
Body: openapiutil.ParseToMap(body),
}
params := &openapi.Params{
Action: tea.String("CreateCouponTemplate"),
Version: tea.String("2019-12-27"),
Protocol: tea.String("HTTPS"),
Pathname: tea.String("/"),
Method: tea.String("POST"),
AuthType: tea.String("AK"),
Style: tea.String("RPC"),
ReqBodyType: tea.String("formData"),
BodyType: tea.String("json"),
}
_result = &CreateCouponTemplateResponse{}
_body, _err := client.CallApi(params, req, runtime)
if _err != nil {
return _result, _err
}
_err = tea.Convert(_body, &_result)
return _result, _err
}