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

59 lines
1.3 KiB
Go
Raw Normal View History

2021-07-30 18:25:18 +08:00
package apk
import (
"encoding/json"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
)
const (
VERSION = "2021-07-30"
)
var HOST requests.Host = requests.Host{
Default: "c.api.gaore.com",
Func: func(s string) string {
var a = map[string]string{
requests.RELEASE: "c.api.gaore.com",
requests.PRE: "c.api.gaore.com",
requests.TEST: "c.api.gaore.com",
}
return a[s]
},
}
type Client struct {
sdk.Client
}
func NewClient() (client *Client) {
client = &Client{}
client.InitWithAccessKey("", "", "")
return
}
//打包任务添加优先级
func (c *Client) AddApkTop(req *AddTopRequest) (response *AddTopResponse, err error) {
response = CreateAddTopResponse()
err = c.DoAction(req, response)
return
}
//添加打包任务
func (c *Client) AddApk(req *AddApkRequest) (response *AddApkResponse, err error) {
response = CreateAddApkResponse()
err = c.DoAction(req, response)
return
}
//清除cdn
func (c *Client) RefreshApkR(req *RefreshApkRequest) (response *RefreshApkResponse, err error) {
response = CreateRefreshApkResponse()
if len(req.CdnUrlArray) > 0 {
cdnurls, _ := json.Marshal(req.CdnUrlArray)
req.cdnUrls = string(cdnurls)
}
err = c.DoAction(req, response)
return
}