mirror of
https://github.com/ProtonMail/go-proton-api.git
synced 2025-12-23 23:57:50 -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)
|
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"
|
"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 {
|
var res struct {
|
||||||
Links []Link
|
Links []Link
|
||||||
}
|
}
|
||||||
@@ -22,6 +22,7 @@ func (c *Client) ListChildren(ctx context.Context, shareID, linkID string) ([]Li
|
|||||||
SetQueryParams(map[string]string{
|
SetQueryParams(map[string]string{
|
||||||
"Page": strconv.Itoa(page),
|
"Page": strconv.Itoa(page),
|
||||||
"PageSize": strconv.Itoa(maxPageSize),
|
"PageSize": strconv.Itoa(maxPageSize),
|
||||||
|
"ShowAll": Bool(all).FormatURL(),
|
||||||
}).
|
}).
|
||||||
SetResult(&res).
|
SetResult(&res).
|
||||||
Get("/drive/shares/" + shareID + "/folders/" + linkID + "/children")
|
Get("/drive/shares/" + shareID + "/folders/" + linkID + "/children")
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ type Link struct {
|
|||||||
Name string // Encrypted file name
|
Name string // Encrypted file name
|
||||||
Hash string // HMAC of name encrypted with parent hash key
|
Hash string // HMAC of name encrypted with parent hash key
|
||||||
Size int64
|
Size int64
|
||||||
|
State LinkState
|
||||||
MIMEType string
|
MIMEType string
|
||||||
|
|
||||||
CreateTime int64 // Link creation time
|
CreateTime int64 // Link creation time
|
||||||
@@ -35,6 +36,16 @@ type Link struct {
|
|||||||
FolderProperties *FolderProperties
|
FolderProperties *FolderProperties
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type LinkState int
|
||||||
|
|
||||||
|
const (
|
||||||
|
LinkStateDraft LinkState = iota
|
||||||
|
LinkStateActive
|
||||||
|
LinkStateTrashed
|
||||||
|
LinkStateDeleted
|
||||||
|
LinkStateRestoring
|
||||||
|
)
|
||||||
|
|
||||||
func (l Link) GetName(parentNodeKR, addrKR *crypto.KeyRing) (string, error) {
|
func (l Link) GetName(parentNodeKR, addrKR *crypto.KeyRing) (string, error) {
|
||||||
encName, err := crypto.NewPGPMessageFromArmored(l.Name)
|
encName, err := crypto.NewPGPMessageFromArmored(l.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user