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() {
|
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}
|
b := &cos.BaseURL{BucketURL: u}
|
||||||
c := cos.NewClient(b, &http.Client{
|
c := cos.NewClient(b, &http.Client{
|
||||||
Transport: &cos.AuthorizationTransport{
|
Transport: &cos.AuthorizationTransport{
|
||||||
@@ -68,7 +68,10 @@ func main() {
|
|||||||
uploadPart(c, name, uploadID, blockSize, i)
|
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 {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -94,14 +94,15 @@ type ObjectListPartsResult struct {
|
|||||||
// ListParts 用来查询特定分块上传中的已上传的块。
|
// ListParts 用来查询特定分块上传中的已上传的块。
|
||||||
//
|
//
|
||||||
// https://www.qcloud.com/document/product/436/7747
|
// 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)
|
u := fmt.Sprintf("/%s?uploadId=%s", encodeURIComponent(name), uploadID)
|
||||||
var res ObjectListPartsResult
|
var res ObjectListPartsResult
|
||||||
sendOpt := sendOptions{
|
sendOpt := sendOptions{
|
||||||
baseURL: s.client.BaseURL.BucketURL,
|
baseURL: s.client.BaseURL.BucketURL,
|
||||||
uri: u,
|
uri: u,
|
||||||
method: http.MethodGet,
|
method: http.MethodGet,
|
||||||
result: &res,
|
result: &res,
|
||||||
|
optQuery: opt,
|
||||||
}
|
}
|
||||||
resp, err := s.client.send(ctx, &sendOpt)
|
resp, err := s.client.send(ctx, &sendOpt)
|
||||||
return &res, resp, err
|
return &res, resp, err
|
||||||
|
|||||||
Reference in New Issue
Block a user