-
Notifications
You must be signed in to change notification settings - Fork 0
/
team.go
59 lines (48 loc) · 1.52 KB
/
team.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
package coolify_sdk
import (
"fmt"
"time"
client "github.com/marconneves/coolify-sdk-go/client"
)
type TeamInstance struct {
client *client.Client
}
type Team struct {
Id int `json:"id"`
Name string `json:"name"`
Description *string `json:"description"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
func (t *TeamInstance) List() (*[]Team, error) {
body, err := t.client.HttpRequest("teams", "GET")
if err != nil {
return nil, err
}
return client.DecodeResponse(body, &[]Team{})
}
func (t *TeamInstance) Get(id int) (*Team, error) {
body, err := t.client.HttpRequest(fmt.Sprintf("teams/%v", id), "GET")
if err != nil {
return nil, err
}
return client.DecodeResponse(body, &Team{})
}
type Member struct {
Id int `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
EmailVerifiedAt *string `json:"email_verified_at"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
TwoFactorConfirmedAt *string `json:"two_factor_confirmed_at"`
ForcePasswordReset bool `json:"force_password_reset"`
MarketingEmails bool `json:"marketing_emails"`
}
func (t *TeamInstance) Members(id int) (*[]Member, error) {
body, err := t.client.HttpRequest(fmt.Sprintf("teams/%v/members", id), "GET")
if err != nil {
return nil, err
}
return client.DecodeResponse(body, &[]Member{})
}