-
Notifications
You must be signed in to change notification settings - Fork 0
/
teams.go
66 lines (55 loc) · 1.2 KB
/
teams.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package clickup
import (
"fmt"
"net/http"
)
type TeamsService service
// ClickUp API docs: https://jsapi.apiary.io/apis/clickup20/reference/0/teams/get-teams.html
func (s *TeamsService) Get() (*Teams, *http.Response, error) {
u := fmt.Sprintf("team")
req, err := s.client.NewRequest(http.MethodGet, u, nil)
if err != nil {
return nil, nil, err
}
teams := new(Teams)
resp, err := s.client.Do(req, teams)
if err != nil {
return nil, resp, err
}
return teams, resp, nil
}
type Teams struct {
Teams []Team `json:"teams,omitempty"`
}
type Team struct {
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Color *string `json:"color,omitempty"`
Avatar *string `json:"avatar,omitempty"`
Members []Member `json:"members,omitempty"`
Roles []Role `json:"roles,omitempty"`
}
func (t *Team) GetID() string {
if t == nil || t.ID == nil {
return ""
}
return *t.ID
}
func (t *Team) GetName() string {
if t == nil || t.Name == nil {
return ""
}
return *t.Name
}
func (t *Team) GetColor() string {
if t == nil || t.Color == nil {
return ""
}
return *t.Color
}
func (t *Team) GetAvatar() string {
if t == nil || t.Avatar == nil {
return ""
}
return *t.Avatar
}