67 lines
1.5 KiB
Go
67 lines
1.5 KiB
Go
package apk
|
|
|
|
import (
|
|
"encoding/json"
|
|
"golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk"
|
|
"golib.gaore.com/GaoreGo/haiwai-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, area 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
|
|
}
|
|
|
|
// 获取打包日志
|
|
func (c *Client) SearchApk(req *SearchApkRequest) (response *SearchApkResponse, err error) {
|
|
response = CreateSearchApkResponse()
|
|
|
|
err = c.DoAction(req, response)
|
|
return
|
|
}
|