haiwai-common-sdk-go/services/apk/client.go

67 lines
1.5 KiB
Go
Raw Permalink Normal View History

2023-02-21 20:46:05 +08:00
package apk
import (
"encoding/json"
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
)
const (
VERSION = "2021-07-30"
)
var HOST requests.Host = requests.Host{
Default: "c.api.gaore.com",
2023-03-16 20:15:17 +08:00
Func: func(s string, area string) string {
2023-02-21 20:46:05 +08:00
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
}