forked from AkihikoITOH/wrike.go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_folder_tree.go
45 lines (35 loc) · 1.18 KB
/
get_folder_tree.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package wrike
import (
"fmt"
"github.com/google/go-querystring/query"
parameters "github.com/wingman131/wrike.go/parameters"
types "github.com/wingman131/wrike.go/types"
)
// GetFolderTree fetches a list of entries required to build a folder tree for the current account.
// For details refer to https://developers.wrike.com/documentation/api/methods/get-folder-tree
func (api *API) GetFolderTree(params *parameters.GetFolderTree) (*types.FolderTree, error) {
path := "/folders"
qp, err := query.Values(params)
if err != nil {
return nil, err
}
data, err := api.get(path, &qp)
if err != nil {
return nil, err
}
return types.NewFolderTreeFromJSON(data)
}
// GetFolderSubtree fetches a list of tree entries for subtree of the folder.
// For details refer to https://developers.wrike.com/documentation/api/methods/get-folder-tree
func (api *API) GetFolderSubtree(id types.FolderID, params *parameters.GetFolderSubtree) (*types.FolderTree, error) {
path := fmt.Sprintf("/folders/%s/folders", id)
qp, err := query.Values(params)
if err != nil {
return nil, err
}
data, err := api.get(path, &qp)
if err != nil {
return nil, err
}
return types.NewFolderTreeFromJSON(data)
}