whatsapp 修改Authentication类型的模板

This commit is contained in:
sdk-team
2023-05-08 11:47:55 +00:00
parent 9ad24b2908
commit 3dad76444f
7 changed files with 63 additions and 1 deletions

View File

@@ -1 +1 @@
1.36.1555
1.36.1556

View File

@@ -41,12 +41,18 @@ public:
std::string phoneNumber;
std::string url;
std::string urlType;
std::string signatureHash;
std::string packageName;
std::string autofillText;
bool isOptOut;
};
ButtonsItem buttonsItem;
std::vector<ButtonsItem> buttons;
std::string thumbUrl;
int duration;
std::string fileType;
int codeExpirationMinutes;
bool addSecretRecommendation;
};
CreateChatappTemplateRequest();
~CreateChatappTemplateRequest();

View File

@@ -38,10 +38,23 @@ namespace AlibabaCloud
{
struct Button
{
struct ExtendAttrs
{
std::string action;
std::string nextLanguageCode;
std::string nextTemplateCode;
std::string intentCode;
std::string nextTemplateName;
};
std::string autofillText;
std::string type;
bool isOptOut;
std::string signatureHash;
std::string packageName;
std::string phoneNumber;
std::string text;
std::string urlType;
ExtendAttrs extendAttrs;
std::string url;
};
std::string thumbUrl;
@@ -52,9 +65,11 @@ namespace AlibabaCloud
std::string longitude;
std::string url;
std::string caption;
bool addSecretRecommendation;
std::string locationName;
std::string type;
std::string format;
int codeExpirationMinutes;
std::string fileType;
std::string locationAddress;
std::vector<Component::Button> buttons;

View File

@@ -41,12 +41,18 @@ public:
std::string phoneNumber;
std::string url;
std::string urlType;
std::string signatureHash;
std::string packageName;
std::string autofillText;
bool isOptOut;
};
ButtonsItem buttonsItem;
std::vector<ButtonsItem> buttons;
std::string thumbUrl;
int duration;
std::string fileType;
int codeExpirationMinutes;
bool addSecretRecommendation;
};
ModifyChatappTemplateRequest();
~ModifyChatappTemplateRequest();

View File

@@ -44,10 +44,16 @@ void CreateChatappTemplateRequest::setComponents(const std::vector<CreateChatapp
setBodyParameter(std::string("Components") + "." + std::to_string(dep1 + 1) + ".Buttons." + std::to_string(dep2 + 1) + ".PhoneNumber", components[dep1].buttons[dep2].phoneNumber);
setBodyParameter(std::string("Components") + "." + std::to_string(dep1 + 1) + ".Buttons." + std::to_string(dep2 + 1) + ".Url", components[dep1].buttons[dep2].url);
setBodyParameter(std::string("Components") + "." + std::to_string(dep1 + 1) + ".Buttons." + std::to_string(dep2 + 1) + ".UrlType", components[dep1].buttons[dep2].urlType);
setBodyParameter(std::string("Components") + "." + std::to_string(dep1 + 1) + ".Buttons." + std::to_string(dep2 + 1) + ".SignatureHash", components[dep1].buttons[dep2].signatureHash);
setBodyParameter(std::string("Components") + "." + std::to_string(dep1 + 1) + ".Buttons." + std::to_string(dep2 + 1) + ".PackageName", components[dep1].buttons[dep2].packageName);
setBodyParameter(std::string("Components") + "." + std::to_string(dep1 + 1) + ".Buttons." + std::to_string(dep2 + 1) + ".AutofillText", components[dep1].buttons[dep2].autofillText);
setBodyParameter(std::string("Components") + "." + std::to_string(dep1 + 1) + ".Buttons." + std::to_string(dep2 + 1) + ".IsOptOut", components[dep1].buttons[dep2].isOptOut ? "true" : "false");
}
setBodyParameter(std::string("Components") + "." + std::to_string(dep1 + 1) + ".ThumbUrl", components[dep1].thumbUrl);
setBodyParameter(std::string("Components") + "." + std::to_string(dep1 + 1) + ".Duration", std::to_string(components[dep1].duration));
setBodyParameter(std::string("Components") + "." + std::to_string(dep1 + 1) + ".FileType", components[dep1].fileType);
setBodyParameter(std::string("Components") + "." + std::to_string(dep1 + 1) + ".CodeExpirationMinutes", std::to_string(components[dep1].codeExpirationMinutes));
setBodyParameter(std::string("Components") + "." + std::to_string(dep1 + 1) + ".AddSecretRecommendation", components[dep1].addSecretRecommendation ? "true" : "false");
}
}

View File

@@ -84,6 +84,10 @@ void GetChatappTemplateDetailResult::parse(const std::string &payload)
componentObject.locationName = dataNodeComponentscomponent["LocationName"].asString();
if(!dataNodeComponentscomponent["LocationAddress"].isNull())
componentObject.locationAddress = dataNodeComponentscomponent["LocationAddress"].asString();
if(!dataNodeComponentscomponent["AddSecretRecommendation"].isNull())
componentObject.addSecretRecommendation = dataNodeComponentscomponent["AddSecretRecommendation"].asString() == "true";
if(!dataNodeComponentscomponent["CodeExpirationMinutes"].isNull())
componentObject.codeExpirationMinutes = std::stoi(dataNodeComponentscomponent["CodeExpirationMinutes"].asString());
auto allButtonsNode = dataNodeComponentscomponent["Buttons"]["button"];
for (auto dataNodeComponentscomponentButtonsbutton : allButtonsNode)
{
@@ -98,6 +102,25 @@ void GetChatappTemplateDetailResult::parse(const std::string &payload)
buttonsObject.url = dataNodeComponentscomponentButtonsbutton["Url"].asString();
if(!dataNodeComponentscomponentButtonsbutton["UrlType"].isNull())
buttonsObject.urlType = dataNodeComponentscomponentButtonsbutton["UrlType"].asString();
if(!dataNodeComponentscomponentButtonsbutton["SignatureHash"].isNull())
buttonsObject.signatureHash = dataNodeComponentscomponentButtonsbutton["SignatureHash"].asString();
if(!dataNodeComponentscomponentButtonsbutton["PackageName"].isNull())
buttonsObject.packageName = dataNodeComponentscomponentButtonsbutton["PackageName"].asString();
if(!dataNodeComponentscomponentButtonsbutton["AutofillText"].isNull())
buttonsObject.autofillText = dataNodeComponentscomponentButtonsbutton["AutofillText"].asString();
if(!dataNodeComponentscomponentButtonsbutton["IsOptOut"].isNull())
buttonsObject.isOptOut = dataNodeComponentscomponentButtonsbutton["IsOptOut"].asString() == "true";
auto extendAttrsNode = value["ExtendAttrs"];
if(!extendAttrsNode["NextTemplateCode"].isNull())
buttonsObject.extendAttrs.nextTemplateCode = extendAttrsNode["NextTemplateCode"].asString();
if(!extendAttrsNode["NextTemplateName"].isNull())
buttonsObject.extendAttrs.nextTemplateName = extendAttrsNode["NextTemplateName"].asString();
if(!extendAttrsNode["NextLanguageCode"].isNull())
buttonsObject.extendAttrs.nextLanguageCode = extendAttrsNode["NextLanguageCode"].asString();
if(!extendAttrsNode["Action"].isNull())
buttonsObject.extendAttrs.action = extendAttrsNode["Action"].asString();
if(!extendAttrsNode["IntentCode"].isNull())
buttonsObject.extendAttrs.intentCode = extendAttrsNode["IntentCode"].asString();
componentObject.buttons.push_back(buttonsObject);
}
data_.components.push_back(componentObject);

View File

@@ -44,10 +44,16 @@ void ModifyChatappTemplateRequest::setComponents(const std::vector<ModifyChatapp
setBodyParameter(std::string("Components") + "." + std::to_string(dep1 + 1) + ".Buttons." + std::to_string(dep2 + 1) + ".PhoneNumber", components[dep1].buttons[dep2].phoneNumber);
setBodyParameter(std::string("Components") + "." + std::to_string(dep1 + 1) + ".Buttons." + std::to_string(dep2 + 1) + ".Url", components[dep1].buttons[dep2].url);
setBodyParameter(std::string("Components") + "." + std::to_string(dep1 + 1) + ".Buttons." + std::to_string(dep2 + 1) + ".UrlType", components[dep1].buttons[dep2].urlType);
setBodyParameter(std::string("Components") + "." + std::to_string(dep1 + 1) + ".Buttons." + std::to_string(dep2 + 1) + ".SignatureHash", components[dep1].buttons[dep2].signatureHash);
setBodyParameter(std::string("Components") + "." + std::to_string(dep1 + 1) + ".Buttons." + std::to_string(dep2 + 1) + ".PackageName", components[dep1].buttons[dep2].packageName);
setBodyParameter(std::string("Components") + "." + std::to_string(dep1 + 1) + ".Buttons." + std::to_string(dep2 + 1) + ".AutofillText", components[dep1].buttons[dep2].autofillText);
setBodyParameter(std::string("Components") + "." + std::to_string(dep1 + 1) + ".Buttons." + std::to_string(dep2 + 1) + ".IsOptOut", components[dep1].buttons[dep2].isOptOut ? "true" : "false");
}
setBodyParameter(std::string("Components") + "." + std::to_string(dep1 + 1) + ".ThumbUrl", components[dep1].thumbUrl);
setBodyParameter(std::string("Components") + "." + std::to_string(dep1 + 1) + ".Duration", std::to_string(components[dep1].duration));
setBodyParameter(std::string("Components") + "." + std::to_string(dep1 + 1) + ".FileType", components[dep1].fileType);
setBodyParameter(std::string("Components") + "." + std::to_string(dep1 + 1) + ".CodeExpirationMinutes", std::to_string(components[dep1].codeExpirationMinutes));
setBodyParameter(std::string("Components") + "." + std::to_string(dep1 + 1) + ".AddSecretRecommendation", components[dep1].addSecretRecommendation ? "true" : "false");
}
}