/
types.go
104 lines (92 loc) · 2.86 KB
/
types.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
package houston
// HoustonResponse wraps all houston response structs used for json marashalling
type HoustonResponse struct {
Data struct {
CreateDeployment *Deployment `json:"createDeployment,omitempty"`
CreateToken *AuthUser `json:"createToken,omitempty"`
CreateUser *Token `json:"createUser,omitempty"`
CreateWorkspace *Workspace `json:"createTeam,omitempty"`
DeleteDeployment *Deployment `json:"deleteDeployment,omitempty`
DeleteWorkspace *Workspace `json:"deleteTeam,omitempty"`
GetDeployments []Deployment `json:"deployments,omitempty"`
GetAuthConfig *AuthConfig `json:"authConfig,omitempty"`
GetWorkspace []Workspace `json:"teams,omitempty"`
} `json:"data"`
Errors []Error `json:"errors,omitempty"`
}
type AuthUser struct {
User User `json:"user"`
Token Token `json:"token"`
}
// Decoded defines structure of a houston response Decoded object
type Decoded struct {
ID string `json:"id"`
SU bool `json:"sU"`
Iat int `json:"iat"`
Exp int `json:"exp"`
}
// Deployment defines structure of a houston response Deployment object
type Deployment struct {
Id string `json:"uuid"`
Type string `json:"type"`
Label string `json:"label"`
ReleaseName string `json:"releaseName"`
Version string `json:"version"`
Team string `json:"team"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
// Email
type Email struct {
Address string `json:"address"`
Verified bool `json:"verified"`
Primary bool `json:"primary"`
// created at
// updated at
}
// Error defines struct of a houston response Error object
type Error struct {
Message string `json:"message"`
}
// AuthConfig holds data related to oAuth and basic authentication
type AuthConfig struct {
LocalEnabled bool `json:"localEnabled"`
GoogleEnabled bool `json:"googleEnabled"`
OauthUrl string `json:"googleOAuthUrl"`
}
// Status defines structure of a houston response StatusResponse object
type Status struct {
Success bool `json:"success"`
Message string `json:"message"`
Code string `json:"code"`
Id string `json:"id"`
}
// Token defines structure of a houston response token object
type Token struct {
Value string `json:"value"`
Payload TokenPayload `json:"payload"`
}
type TokenPayload struct {
Uuid string `json:"uuid"`
Iat int `json:"iat"`
Exp int `json:"exp"`
}
type User struct {
Uuid string `json:"uuid"`
Emails []Email `json:"emails"`
Username string `json:"username"`
Status string `json:"status"`
// created at
// updated at
// profile
}
type Workspace struct {
Uuid string `json:"uuid"`
Label string `json:"label"`
Description string `json:"description"`
Active bool `json:"active"`
Users []User `json:"users"`
// groups
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}