mirror of
https://github.com/ProtonMail/go-proton-api.git
synced 2025-12-23 23:57:50 -05:00
fix: Trash/Delete response structure
This commit is contained in:
@@ -42,13 +42,9 @@ func (c *Client) ListChildren(ctx context.Context, shareID, linkID string, showA
|
|||||||
|
|
||||||
func (c *Client) TrashChildren(ctx context.Context, shareID, linkID string, childIDs ...string) error {
|
func (c *Client) TrashChildren(ctx context.Context, shareID, linkID string, childIDs ...string) error {
|
||||||
var res struct {
|
var res struct {
|
||||||
Responses struct {
|
Responses []struct {
|
||||||
Responses []struct {
|
LinkID string
|
||||||
LinkResponse struct {
|
Response APIError
|
||||||
LinkID string
|
|
||||||
Response APIError
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,9 +61,9 @@ func (c *Client) TrashChildren(ctx context.Context, shareID, linkID string, chil
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, res := range res.Responses.Responses {
|
for _, res := range res.Responses {
|
||||||
if res.LinkResponse.Response.Code != SuccessCode {
|
if res.Response.Code != SuccessCode {
|
||||||
return fmt.Errorf("failed to trash child: %w", res.LinkResponse.Response)
|
return fmt.Errorf("failed to trash child: %w", res.Response)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -77,13 +73,9 @@ func (c *Client) TrashChildren(ctx context.Context, shareID, linkID string, chil
|
|||||||
|
|
||||||
func (c *Client) DeleteChildren(ctx context.Context, shareID, linkID string, childIDs ...string) error {
|
func (c *Client) DeleteChildren(ctx context.Context, shareID, linkID string, childIDs ...string) error {
|
||||||
var res struct {
|
var res struct {
|
||||||
Responses struct {
|
Responses []struct {
|
||||||
Responses []struct {
|
LinkID string
|
||||||
LinkResponse struct {
|
Response APIError
|
||||||
LinkID string
|
|
||||||
Response APIError
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,9 +92,9 @@ func (c *Client) DeleteChildren(ctx context.Context, shareID, linkID string, chi
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, res := range res.Responses.Responses {
|
for _, res := range res.Responses {
|
||||||
if res.LinkResponse.Response.Code != SuccessCode {
|
if res.Response.Code != SuccessCode {
|
||||||
return fmt.Errorf("failed to delete child: %w", res.LinkResponse.Response)
|
return fmt.Errorf("failed to delete child: %w", res.Response)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user