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

55 lines
1.3 KiB
Go

package jedi
import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
"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 (c *Client) Test(req *DemoTestRequest) (response *DemoTestResponse, err error) {
response = CreateDemoTestResponse()
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
}