-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.go
112 lines (89 loc) · 2.51 KB
/
models.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
105
106
107
108
109
110
111
112
package vctr
type Permissions int
const (
PermViewLinks Permissions = 1 << (iota + 1)
PermCreateLinks
PermUpdateLinks
PermDeleteLinks
PermViewUsers
PermCreateUsers
PermUpdateUsers
PermDeleteUsers
PermPerformStateChanges
PermCreateApiKey
PermUnset Permissions = -1
PermAdmin Permissions = 2147483647
)
type CountModel struct {
Count int `json:"count"`
}
type EntityModel struct {
client *Client
Guid string `json:"guid"`
Created Time `json:"created"`
}
func (m *EntityModel) hydrate(client *Client) {
m.client = client
}
type UserModel struct {
*EntityModel
UserName string `json:"username"`
Permissions Permissions `json:"permissions"`
LastLogin Time `json:"last_login"`
}
type UserCreateModel struct {
UserName string `json:"username"`
Password string `json:"password"`
Permissions Permissions `json:"permissions"`
}
type UserLoginModel struct {
*UserModel
SessionKey string `json:"session_key"`
}
type UserUpdateModel struct {
UserName string `json:"username"`
Password string `json:"password"`
Permissions Permissions `json:"permissions"`
}
type UserUpdateSelfModel struct {
UserName string `json:"username"`
CurrentPassword string `json:"current_password"`
NewPassword string `json:"new_password"`
}
type LinkModel struct {
*EntityModel
Ident string `json:"ident"`
Destination string `json:"destination"`
Enabled bool `json:"enabled"`
PermanentRedirect bool `json:"permanent_redirect"`
PasswordRequired bool `json:"password_required"`
LastAccess Time `json:"last_access"`
AccessCount int `json:"access_count"`
UniqueAccessCount int `json:"unique_access_count"`
TotalAccessLimit int `json:"total_access_limit"`
Expires Time `json:"expires"`
Creator *UserModel `json:"creator"`
}
type LinkCreateModel struct {
Ident string `json:"ident"`
Destination string `json:"destination"`
Enabled bool `json:"enabled"`
PermanentRedirect bool `json:"permanent_redirect"`
TotalAccessLimit int `json:"total_access_limit"`
Expires Time `json:"expires"`
Password string `json:"password"`
}
type LoginModel struct {
Ident string `json:"ident"`
Password string `json:"password"`
Remember bool `json:"remember"`
}
type ApiKeyModel struct {
*EntityModel
LastAccess Time `json:"last_access"`
AccessCount int `json:"access_count"`
}
type ApiKeyCreatedModel struct {
*ApiKeyModel
Key string `json:"key"`
}