Browse Source

查询对象接口支持分页

feature_gxh
Sydonian 1 year ago
parent
commit
75f4426fb2
1 changed files with 11 additions and 8 deletions
  1. +11
    -8
      sdks/storage/cdsapi/object.go

+ 11
- 8
sdks/storage/cdsapi/object.go View File

@@ -33,12 +33,13 @@ func (c *Client) Object() *ObjectService {
const ObjectListPathByPath = "/object/listByPath"

type ObjectListByPath struct {
UserID cdssdk.UserID `form:"userID" binding:"required" url:"userID"`
PackageID cdssdk.PackageID `form:"packageID" binding:"required" url:"packageID"`
Path string `form:"path" url:"path"` // 允许为空字符串
IsPrefix bool `form:"isPrefix" url:"isPrefix"`
NoRecursive bool `form:"noRecursive" url:"noRecursive"` // 仅当isPrefix为true时有效,表示仅查询直接属于Prefix下的对象,对于更深的对象,返回它们的公共前缀

UserID cdssdk.UserID `form:"userID" binding:"required" url:"userID" json:"userID"`
PackageID cdssdk.PackageID `form:"packageID" binding:"required" url:"packageID" json:"packageID"`
Path string `form:"path" url:"path" json:"path"` // 允许为空字符串
IsPrefix bool `form:"isPrefix" url:"isPrefix" json:"isPrefix"`
NoRecursive bool `form:"noRecursive" url:"noRecursive" json:"noRecursive"` // 仅当isPrefix为true时有效,表示仅查询直接属于Prefix下的对象,对于更深的对象,返回它们的公共前缀
MaxKeys int `form:"maxKeys" url:"maxKeys" json:"maxKeys"`
ContinuationToken string `form:"continuationToken" url:"continuationToken" json:"continuationToken"` // 用于分页,如果为空字符串,表示从头开始
}

func (r *ObjectListByPath) MakeParam() *sdks.RequestParam {
@@ -46,8 +47,10 @@ func (r *ObjectListByPath) MakeParam() *sdks.RequestParam {
}

type ObjectListByPathResp struct {
CommonPrefixes []string `json:"commonPrefixes"` // 仅在IsPrefix为true且NoRecursive为true时有效,包含更深层对象的shared prefix
Objects []cdssdk.Object `json:"objects"` // 如果IsPrefix为true且NoRecursive为false,则返回所有匹配的对象,否则只返回直接属于Prefix下的对象
CommonPrefixes []string `json:"commonPrefixes"` // 仅在IsPrefix为true且NoRecursive为true时有效,包含更深层对象的shared prefix
Objects []cdssdk.Object `json:"objects"` // 如果IsPrefix为true且NoRecursive为false,则返回所有匹配的对象,否则只返回直接属于Prefix下的对象
IsTruncated bool `json:"isTruncated"` // 是否还有更多对象
NextContinuationToken string `json:"nextContinuationToken"` // 用于分页,如果IsTruncated为true,则下次请求的ContinuationToken为该值
}

func (r *ObjectListByPathResp) ParseResponse(resp *http.Response) error {


Loading…
Cancel
Save