-
Notifications
You must be signed in to change notification settings - Fork 0
/
entity.go
117 lines (96 loc) · 2.84 KB
/
entity.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
113
114
115
116
117
package web
import (
"github.com/kofuk/premises/common/entity"
)
type ErrorCode int
const (
ErrBadRequest ErrorCode = iota + 1 // 1
ErrInternal // 2
ErrCredential // 3
ErrServerRunning // 4
ErrServerNotRunning // 5
ErrRemote // 6
ErrInvalidConfig // 7
ErrPasswordRule // 8
ErrDupUserName // 9
ErrRequiresAuth // 10
ErrBackup // 11
)
const (
InfoErrRunnerPrepare entity.InfoCode = iota + 100 // 100
InfoErrRunnerStop // 101
InfoErrDNS // 102
)
type ErrorResponse struct {
Success bool `json:"success"`
ErrorCode ErrorCode `json:"errorCode"`
}
type SuccessfulResponse[T any] struct {
Success bool `json:"success"`
Data T `json:"data"`
}
type SessionState struct {
NeedsChangePassword bool `json:"needsChangePassword"`
}
type SessionData struct {
LoggedIn bool `json:"loggedIn"`
UserName string `json:"userName"`
}
type MCVersion struct {
Name string `json:"name"`
IsStable bool `json:"isStable"`
Channel string `json:"channel"`
ReleaseDate string `json:"releaseDate"`
}
type PasswordCredential struct {
UserName string `json:"userName"`
Password string `json:"password"`
}
type BackupGeneration struct {
Gen string `json:"gen"`
ID string `json:"id"`
Timestamp int `json:"timestamp"`
}
type WorldBackup struct {
WorldName string `json:"worldName"`
Generations []BackupGeneration `json:"generations"`
}
type UpdatePassword struct {
Password string `json:"password"`
NewPassword string `json:"newPassword"`
}
type SystemInfo struct {
PremisesVersion string `json:"premisesVersion"`
HostOS string `json:"hostOs"`
}
type WorldInfo struct {
Version string `json:"version"`
WorldName string `json:"worldName"`
Seed string `json:"seed"`
}
const (
EvStopped entity.EventCode = iota + 100 // 100
EvCreateRunner // 101
EvWaitConn // 102
EvConnLost // 103
EvStopRunner // 104
)
type PageCode int
const (
PageLaunch PageCode = iota + 1 // 1
PageLoading // 2
PageRunning // 3
)
type StandardMessage struct {
EventCode entity.EventCode `json:"eventCode"`
Progress int `json:"progress"`
PageCode PageCode `json:"pageCode"`
}
type InfoMessage struct {
InfoCode entity.InfoCode `json:"infoCode"`
IsError bool `json:"isError"`
}
type SysstatMessage struct {
CPUUsage float64 `json:"cpuUsage"`
Time int64 `json:"time"`
}