mirror of
https://github.com/ProtonMail/go-proton-api.git
synced 2025-12-23 15:47:52 -05:00
feat: ListChildren ShowAll query parameter
This commit is contained in:
16
boolean.go
16
boolean.go
@@ -36,3 +36,19 @@ func (b Bool) MarshalJSON() ([]byte, error) {
|
||||
|
||||
return json.Marshal(v)
|
||||
}
|
||||
|
||||
func (b Bool) String() string {
|
||||
if b {
|
||||
return "true"
|
||||
}
|
||||
|
||||
return "false"
|
||||
}
|
||||
|
||||
func (b Bool) FormatURL() string {
|
||||
if b {
|
||||
return "1"
|
||||
}
|
||||
|
||||
return "0"
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"github.com/go-resty/resty/v2"
|
||||
)
|
||||
|
||||
func (c *Client) ListChildren(ctx context.Context, shareID, linkID string) ([]Link, error) {
|
||||
func (c *Client) ListChildren(ctx context.Context, shareID, linkID string, all bool) ([]Link, error) {
|
||||
var res struct {
|
||||
Links []Link
|
||||
}
|
||||
@@ -22,6 +22,7 @@ func (c *Client) ListChildren(ctx context.Context, shareID, linkID string) ([]Li
|
||||
SetQueryParams(map[string]string{
|
||||
"Page": strconv.Itoa(page),
|
||||
"PageSize": strconv.Itoa(maxPageSize),
|
||||
"ShowAll": Bool(all).FormatURL(),
|
||||
}).
|
||||
SetResult(&res).
|
||||
Get("/drive/shares/" + shareID + "/folders/" + linkID + "/children")
|
||||
|
||||
@@ -21,6 +21,7 @@ type Link struct {
|
||||
Name string // Encrypted file name
|
||||
Hash string // HMAC of name encrypted with parent hash key
|
||||
Size int64
|
||||
State LinkState
|
||||
MIMEType string
|
||||
|
||||
CreateTime int64 // Link creation time
|
||||
@@ -35,6 +36,16 @@ type Link struct {
|
||||
FolderProperties *FolderProperties
|
||||
}
|
||||
|
||||
type LinkState int
|
||||
|
||||
const (
|
||||
LinkStateDraft LinkState = iota
|
||||
LinkStateActive
|
||||
LinkStateTrashed
|
||||
LinkStateDeleted
|
||||
LinkStateRestoring
|
||||
)
|
||||
|
||||
func (l Link) GetName(parentNodeKR, addrKR *crypto.KeyRing) (string, error) {
|
||||
encName, err := crypto.NewPGPMessageFromArmored(l.Name)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user