func()

in umeng-push-20220225/client/client.go [3151:3261]


func (client *Client) SendByAliasWithOptions(tmpReq *SendByAliasRequest, headers map[string]*string, runtime *util.RuntimeOptions) (_result *SendByAliasResponse, _err error) {
	_err = util.ValidateModel(tmpReq)
	if _err != nil {
		return _result, _err
	}
	request := &SendByAliasShrinkRequest{}
	openapiutil.Convert(tmpReq, request)
	if !tea.BoolValue(util.IsUnset(tmpReq.AndroidPayload)) {
		request.AndroidPayloadShrink = openapiutil.ArrayToStringWithSpecifiedStyle(tmpReq.AndroidPayload, tea.String("AndroidPayload"), tea.String("json"))
	}

	if !tea.BoolValue(util.IsUnset(tmpReq.AndroidShortPayload)) {
		request.AndroidShortPayloadShrink = openapiutil.ArrayToStringWithSpecifiedStyle(tmpReq.AndroidShortPayload, tea.String("AndroidShortPayload"), tea.String("json"))
	}

	if !tea.BoolValue(util.IsUnset(tmpReq.ChannelProperties)) {
		request.ChannelPropertiesShrink = openapiutil.ArrayToStringWithSpecifiedStyle(tmpReq.ChannelProperties, tea.String("ChannelProperties"), tea.String("json"))
	}

	if !tea.BoolValue(util.IsUnset(tmpReq.HarmonyPayload)) {
		request.HarmonyPayloadShrink = openapiutil.ArrayToStringWithSpecifiedStyle(tmpReq.HarmonyPayload, tea.String("HarmonyPayload"), tea.String("json"))
	}

	if !tea.BoolValue(util.IsUnset(tmpReq.IosPayload)) {
		request.IosPayloadShrink = openapiutil.ArrayToStringWithSpecifiedStyle(tmpReq.IosPayload, tea.String("IosPayload"), tea.String("json"))
	}

	if !tea.BoolValue(util.IsUnset(tmpReq.Policy)) {
		request.PolicyShrink = openapiutil.ArrayToStringWithSpecifiedStyle(tmpReq.Policy, tea.String("Policy"), tea.String("json"))
	}

	body := map[string]interface{}{}
	if !tea.BoolValue(util.IsUnset(request.Alias)) {
		body["Alias"] = request.Alias
	}

	if !tea.BoolValue(util.IsUnset(request.AliasType)) {
		body["AliasType"] = request.AliasType
	}

	if !tea.BoolValue(util.IsUnset(request.AndroidPayloadShrink)) {
		body["AndroidPayload"] = request.AndroidPayloadShrink
	}

	if !tea.BoolValue(util.IsUnset(request.AndroidShortPayloadShrink)) {
		body["AndroidShortPayload"] = request.AndroidShortPayloadShrink
	}

	if !tea.BoolValue(util.IsUnset(request.ChannelPropertiesShrink)) {
		body["ChannelProperties"] = request.ChannelPropertiesShrink
	}

	if !tea.BoolValue(util.IsUnset(request.Description)) {
		body["Description"] = request.Description
	}

	if !tea.BoolValue(util.IsUnset(request.HarmonyPayloadShrink)) {
		body["HarmonyPayload"] = request.HarmonyPayloadShrink
	}

	if !tea.BoolValue(util.IsUnset(request.IosPayloadShrink)) {
		body["IosPayload"] = request.IosPayloadShrink
	}

	if !tea.BoolValue(util.IsUnset(request.PolicyShrink)) {
		body["Policy"] = request.PolicyShrink
	}

	if !tea.BoolValue(util.IsUnset(request.ProductionMode)) {
		body["ProductionMode"] = request.ProductionMode
	}

	if !tea.BoolValue(util.IsUnset(request.ReceiptType)) {
		body["ReceiptType"] = request.ReceiptType
	}

	if !tea.BoolValue(util.IsUnset(request.ReceiptUrl)) {
		body["ReceiptUrl"] = request.ReceiptUrl
	}

	if !tea.BoolValue(util.IsUnset(request.ThirdPartyId)) {
		body["ThirdPartyId"] = request.ThirdPartyId
	}

	if !tea.BoolValue(util.IsUnset(request.CallbackParams)) {
		body["callbackParams"] = request.CallbackParams
	}

	req := &openapi.OpenApiRequest{
		Headers: headers,
		Body:    openapiutil.ParseToMap(body),
	}
	params := &openapi.Params{
		Action:      tea.String("SendByAlias"),
		Version:     tea.String("2022-02-25"),
		Protocol:    tea.String("HTTPS"),
		Pathname:    tea.String("/SendByAlias"),
		Method:      tea.String("POST"),
		AuthType:    tea.String("AK"),
		Style:       tea.String("ROA"),
		ReqBodyType: tea.String("formData"),
		BodyType:    tea.String("json"),
	}
	_result = &SendByAliasResponse{}
	_body, _err := client.CallApi(params, req, runtime)
	if _err != nil {
		return _result, _err
	}
	_err = tea.Convert(_body, &_result)
	return _result, _err
}