Skip to content

Commit 3a58a38

Browse files
committedFeb 27, 2023
feat: ListChildren ShowAll query parameter
1 parent fdedd64 commit 3a58a38

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed
 

‎boolean.go

+16
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,19 @@ func (b Bool) MarshalJSON() ([]byte, error) {
3636

3737
return json.Marshal(v)
3838
}
39+
40+
func (b Bool) String() string {
41+
if b {
42+
return "true"
43+
}
44+
45+
return "false"
46+
}
47+
48+
func (b Bool) FormatURL() string {
49+
if b {
50+
return "1"
51+
}
52+
53+
return "0"
54+
}

‎link_folder.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"github.com/go-resty/resty/v2"
1010
)
1111

12-
func (c *Client) ListChildren(ctx context.Context, shareID, linkID string) ([]Link, error) {
12+
func (c *Client) ListChildren(ctx context.Context, shareID, linkID string, all bool) ([]Link, error) {
1313
var res struct {
1414
Links []Link
1515
}
@@ -22,6 +22,7 @@ func (c *Client) ListChildren(ctx context.Context, shareID, linkID string) ([]Li
2222
SetQueryParams(map[string]string{
2323
"Page": strconv.Itoa(page),
2424
"PageSize": strconv.Itoa(maxPageSize),
25+
"ShowAll": Bool(all).FormatURL(),
2526
}).
2627
SetResult(&res).
2728
Get("/drive/shares/" + shareID + "/folders/" + linkID + "/children")

‎link_types.go

+11
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ type Link struct {
2121
Name string // Encrypted file name
2222
Hash string // HMAC of name encrypted with parent hash key
2323
Size int64
24+
State LinkState
2425
MIMEType string
2526

2627
CreateTime int64 // Link creation time
@@ -35,6 +36,16 @@ type Link struct {
3536
FolderProperties *FolderProperties
3637
}
3738

39+
type LinkState int
40+
41+
const (
42+
LinkStateDraft LinkState = iota
43+
LinkStateActive
44+
LinkStateTrashed
45+
LinkStateDeleted
46+
LinkStateRestoring
47+
)
48+
3849
func (l Link) GetName(parentNodeKR, addrKR *crypto.KeyRing) (string, error) {
3950
encName, err := crypto.NewPGPMessageFromArmored(l.Name)
4051
if err != nil {

0 commit comments

Comments
 (0)
Please sign in to comment.