2023-02-21 20:46:05 +08:00
|
|
|
package jedi
|
|
|
|
|
|
|
|
import (
|
2023-02-21 20:58:53 +08:00
|
|
|
"golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk"
|
|
|
|
"golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/requests"
|
2023-02-21 20:46:05 +08:00
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
VERSION = "2020-09-24"
|
|
|
|
)
|
|
|
|
|
|
|
|
var HOST requests.Host = requests.Host{
|
|
|
|
Default: "jedi.api.gaore.com",
|
|
|
|
Func: func(s string) string {
|
|
|
|
var a = map[string]string{
|
|
|
|
requests.RELEASE: "jedi.api.gaore.com",
|
|
|
|
requests.PRE: "jedi.api.gaore.com",
|
|
|
|
requests.TEST: "jedi.oapi.gaore.com",
|
|
|
|
}
|
|
|
|
return a[s]
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
type Client struct {
|
|
|
|
sdk.Client
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *Client) SendSms(req *SendSmsRequest) (response *SendSmsResponse, err error) {
|
|
|
|
if req.ParamsArray != nil && len(req.ParamsArray) > 0 {
|
|
|
|
req.Params = strings.Join(req.ParamsArray, ",,,")
|
|
|
|
}
|
|
|
|
response = CreateSendSmsResponse()
|
|
|
|
err = c.DoAction(req, response)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewClientWithAccessKey(accesskey, secrect, source string) (client *Client, err error) {
|
|
|
|
client = &Client{}
|
|
|
|
err = client.InitWithAccessKey(accesskey, secrect, source)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewClientWithAliAppcode(accesskey, secrect string, env ...string) (client *Client, err error) {
|
|
|
|
client = &Client{}
|
|
|
|
err = client.InitWithAliAppcode(accesskey, secrect, env...)
|
|
|
|
return
|
|
|
|
}
|