Fix the options param to listparts interface
This commit is contained in:
@@ -43,7 +43,7 @@ func uploadPart(c *cos.Client, name string, uploadID string, blockSize, n int) s
|
||||
}
|
||||
|
||||
func main() {
|
||||
u, _ := url.Parse("https://test-1253846586.cos.ap-guangzhou.myqcloud.com")
|
||||
u, _ := url.Parse("http://alangz-1251668577.cos.ap-guangzhou.myqcloud.com")
|
||||
b := &cos.BaseURL{BucketURL: u}
|
||||
c := cos.NewClient(b, &http.Client{
|
||||
Transport: &cos.AuthorizationTransport{
|
||||
@@ -68,7 +68,10 @@ func main() {
|
||||
uploadPart(c, name, uploadID, blockSize, i)
|
||||
}
|
||||
|
||||
v, _, err := c.Object.ListParts(ctx, name, uploadID)
|
||||
// opt := &cos.ObjectListPartsOptions{
|
||||
// MaxParts: 1,
|
||||
// }
|
||||
v, _, err := c.Object.ListParts(ctx, name, uploadID, nil)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
return
|
||||
|
||||
@@ -94,14 +94,15 @@ type ObjectListPartsResult struct {
|
||||
// ListParts 用来查询特定分块上传中的已上传的块。
|
||||
//
|
||||
// https://www.qcloud.com/document/product/436/7747
|
||||
func (s *ObjectService) ListParts(ctx context.Context, name, uploadID string) (*ObjectListPartsResult, *Response, error) {
|
||||
func (s *ObjectService) ListParts(ctx context.Context, name, uploadID string, opt *ObjectListPartsOptions) (*ObjectListPartsResult, *Response, error) {
|
||||
u := fmt.Sprintf("/%s?uploadId=%s", encodeURIComponent(name), uploadID)
|
||||
var res ObjectListPartsResult
|
||||
sendOpt := sendOptions{
|
||||
baseURL: s.client.BaseURL.BucketURL,
|
||||
uri: u,
|
||||
method: http.MethodGet,
|
||||
result: &res,
|
||||
baseURL: s.client.BaseURL.BucketURL,
|
||||
uri: u,
|
||||
method: http.MethodGet,
|
||||
result: &res,
|
||||
optQuery: opt,
|
||||
}
|
||||
resp, err := s.client.send(ctx, &sendOpt)
|
||||
return &res, resp, err
|
||||
|
||||
Reference in New Issue
Block a user