forked from AkihikoITOH/wrike.go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
query_groups.go
45 lines (35 loc) · 1.02 KB
/
query_groups.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"
)
// QueryGroup fetches a group by id.
// For details refer to https://developers.wrike.com/documentation/api/methods/query-groups
func (api *API) QueryGroup(id string, params *parameters.QueryGroup) (*types.Groups, error) {
path := fmt.Sprintf("/groups/%s", 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.NewGroupsFromJSON(data)
}
// QueryGroups fetches a list of groups.
// For details refer to https://developers.wrike.com/documentation/api/methods/query-groups
func (api *API) QueryGroups(params *parameters.QueryGroups) (*types.Groups, error) {
path := "/groups"
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.NewGroupsFromJSON(data)
}