Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sms API definition can't adapt to Tencent cloud service prefectly #958

Closed
alilestera opened this issue Jul 3, 2023 · 1 comment
Closed

Comments

@alilestera
Copy link
Contributor

This time I working on develop a new component for Tencent cloud sms. But I found a problem between sms API and Tencent cloud sms API. Now I already have a solution idea, so I create this new issue to talk about the idea.

Problem

When we request sms service, we need to set template parameters to it. The template parameters type defined in sms.proto file is a set of key-value pairs which key is string and value is string too.
But in Tencent cloud sms api, it need a slice of strings, instead a set of key-value pairs. When we apply for short message text template, need to use number to decide where the parameter put in, like

// short message content
Verify code: [1], message: [2]

I also checked Alibaba cloud sms docs, not like Tencent cloud sms api, it need a set of key-value pairs instead a slice of strings. So we should not modify the sms.proto file

Solution Idea

We can add a string to metadata in SendSmsWithTemplateRequest to represent the order of keys, like

// keys order in metadata
var keysOrder = "code,msg,other"
// template parameters, a set of key-value pairs in SendSmsWithTemplateRequest
var templateParams = map[string]string{
	"msg":   "okgogogo",
	"code":  "7890",
	"other": "a...",
}
// result = {"7890", "okgogogo", "a..."}

Use commas to separate every key. According the keys order to generate a slice of strings.

Can this solution idea accept?

Reference the issue #830

@github-actions
Copy link

github-actions bot commented Jul 3, 2023

Hi @alilestera,
Thanks for opening an issue! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant