7
0
gaore-common-sdk-go/services/jedi/client.go

49 lines
1.1 KiB
Go
Raw Normal View History

2020-08-03 20:48:58 +08:00
package jedi
2020-08-11 18:16:37 +08:00
import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
2020-08-11 18:16:37 +08:00
"strings"
)
2020-08-03 20:48:58 +08:00
2020-08-04 12:23:34 +08:00
const (
VERSION = "2020-09-24"
2020-08-04 12:23:34 +08:00
)
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]
},
}
2020-08-03 20:48:58 +08:00
type Client struct {
sdk.Client
}
2020-08-04 12:23:34 +08:00
func (c *Client) SendSms(req *SendSmsRequest) (response *SendSmsResponse, err error) {
2020-08-11 18:16:37 +08:00
if req.ParamsArray != nil && len(req.ParamsArray) > 0 {
req.Params = strings.Join(req.ParamsArray, ",,,")
}
2020-08-04 12:23:34 +08:00
response = CreateSendSmsResponse()
err = c.DoAction(req, response)
return
}
func NewClientWithAccessKey(accesskey, secrect, source string) (client *Client, err error) {
client = &Client{}
2020-08-04 21:14:06 +08:00
err = client.InitWithAccessKey(accesskey, secrect, source)
2020-08-04 12:23:34 +08:00
return
2020-08-03 20:48:58 +08:00
}
func NewClientWithAliAppcode(accesskey, secrect string, env ...string) (client *Client, err error) {
client = &Client{}
err = client.InitWithAliAppcode(accesskey, secrect, env...)
return
}