@@ -0,0 +1,37 @@ | |||
package apk | |||
import ( | |||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" | |||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses" | |||
) | |||
type AddApkRequest struct { | |||
*requests.RpcRequest | |||
List string `position:"Body" field:"list" default:"[]" ` | |||
} | |||
type AddApkResponse struct { | |||
*responses.BaseResponse | |||
Code int `json:"code"` | |||
Status bool `json:"status"` | |||
Msg string `json:"msg"` | |||
Data struct { | |||
Count int `json:"count"` | |||
} `json:"data"` | |||
} | |||
func CreateAddApkRequest() (req *AddApkRequest) { | |||
req = &AddApkRequest{ | |||
RpcRequest: &requests.RpcRequest{}, | |||
} | |||
req.InitWithApiInfo(HOST, VERSION, "/api/apk/add") | |||
req.Method = requests.POST | |||
return | |||
} | |||
func CreateAddApkResponse() (response *AddApkResponse) { | |||
response = &AddApkResponse{ | |||
BaseResponse: &responses.BaseResponse{}, | |||
} | |||
return | |||
} |
@@ -0,0 +1,35 @@ | |||
package apk | |||
import ( | |||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" | |||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses" | |||
) | |||
type AddTopRequest struct { | |||
*requests.RpcRequest | |||
Id int `position:"Body" field:"id" default:"0" ` | |||
Top int `position:"Body" field:"top" default:"0"` | |||
} | |||
type AddTopResponse struct { | |||
*responses.BaseResponse | |||
Code int `json:"code"` | |||
Status bool `json:"status"` | |||
Msg string `json:"msg"` | |||
} | |||
func CreateAddTopRequest() (req *AddTopRequest) { | |||
req = &AddTopRequest{ | |||
RpcRequest: &requests.RpcRequest{}, | |||
} | |||
req.InitWithApiInfo(HOST, VERSION, "/api/apk/AddTop") | |||
req.Method = requests.POST | |||
return | |||
} | |||
func CreateAddTopResponse() (response *AddTopResponse) { | |||
response = &AddTopResponse{ | |||
BaseResponse: &responses.BaseResponse{}, | |||
} | |||
return | |||
} |
@@ -0,0 +1,58 @@ | |||
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 | |||
} |
@@ -0,0 +1,20 @@ | |||
package apk | |||
import ( | |||
"fmt" | |||
"testing" | |||
"time" | |||
) | |||
func TestClient_GetUserInfo(t *testing.T) { | |||
c := NewClient() | |||
req := CreateRefreshApkRequest() | |||
req.CdnUrlArray = []string{"https://download.abc086.com/lyzzflb_ylh_ez1/lyzzflb_ylh_ez1_490809.apk"} | |||
req.SetReadTimeout(60 * time.Second) | |||
resp, err := c.RefreshApkR(req) | |||
fmt.Println(req) | |||
fmt.Println(resp) | |||
fmt.Println(err) | |||
} |
@@ -0,0 +1,36 @@ | |||
package apk | |||
import ( | |||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" | |||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses" | |||
) | |||
type RefreshApkRequest struct { | |||
*requests.RpcRequest | |||
cdnUrls string `position:"Body" field:"cdn_urls" default:"[]" ` | |||
CdnUrlArray []string | |||
} | |||
type RefreshApkResponse struct { | |||
*responses.BaseResponse | |||
Code int `json:"code"` | |||
Status bool `json:"status"` | |||
Msg string `json:"msg"` | |||
Data map[string]string `json:"data"` | |||
} | |||
func CreateRefreshApkRequest() (req *RefreshApkRequest) { | |||
req = &RefreshApkRequest{ | |||
RpcRequest: &requests.RpcRequest{}, | |||
} | |||
req.InitWithApiInfo(HOST, VERSION, "/api/apk/refresh") | |||
req.Method = requests.POST | |||
return | |||
} | |||
func CreateRefreshApkResponse() (response *RefreshApkResponse) { | |||
response = &RefreshApkResponse{ | |||
BaseResponse: &responses.BaseResponse{}, | |||
} | |||
return | |||
} |