Initial scaffold: project structure, .gitignore, go.mod
This commit is contained in:
88
internal/syncthing/types.go
Normal file
88
internal/syncthing/types.go
Normal file
@@ -0,0 +1,88 @@
|
||||
package syncthing
|
||||
|
||||
import "time"
|
||||
|
||||
// HealthStatus from /rest/noauth/health.
|
||||
type HealthStatus struct {
|
||||
Status string `json:"status"` // "OK"
|
||||
}
|
||||
|
||||
// SystemStatus from /rest/system/status.
|
||||
type SystemStatus struct {
|
||||
MyID string `json:"myID"`
|
||||
Uptime int `json:"uptime"`
|
||||
StartTime time.Time `json:"startTime"`
|
||||
}
|
||||
|
||||
// SystemVersion from /rest/system/version.
|
||||
type SystemVersion struct {
|
||||
Version string `json:"version"`
|
||||
LongVersion string `json:"longVersion"`
|
||||
}
|
||||
|
||||
// ConnectionInfo for a single device from /rest/system/connections.
|
||||
type ConnectionInfo struct {
|
||||
Connected bool `json:"connected"`
|
||||
Paused bool `json:"paused"`
|
||||
Address string `json:"address"`
|
||||
Type string `json:"type"`
|
||||
InBytesTotal int64 `json:"inBytesTotal"`
|
||||
OutBytesTotal int64 `json:"outBytesTotal"`
|
||||
}
|
||||
|
||||
// Connections from /rest/system/connections.
|
||||
type Connections struct {
|
||||
Total ConnectionInfo `json:"total"`
|
||||
Connections map[string]ConnectionInfo `json:"connections"`
|
||||
}
|
||||
|
||||
// FolderConfig from /rest/config folders array.
|
||||
type FolderConfig struct {
|
||||
ID string `json:"id"`
|
||||
Label string `json:"label"`
|
||||
Path string `json:"path"`
|
||||
Paused bool `json:"paused"`
|
||||
}
|
||||
|
||||
// DeviceConfig from /rest/config devices array.
|
||||
type DeviceConfig struct {
|
||||
DeviceID string `json:"deviceID"`
|
||||
Name string `json:"name"`
|
||||
Paused bool `json:"paused"`
|
||||
}
|
||||
|
||||
// FullConfig from /rest/config.
|
||||
type FullConfig struct {
|
||||
Folders []FolderConfig `json:"folders"`
|
||||
Devices []DeviceConfig `json:"devices"`
|
||||
}
|
||||
|
||||
// FolderStatus from /rest/db/status.
|
||||
type FolderStatus struct {
|
||||
State string `json:"state"` // "idle", "scanning", "syncing", "error", etc.
|
||||
StateChanged time.Time `json:"stateChanged"`
|
||||
NeedFiles int `json:"needFiles"`
|
||||
NeedBytes int64 `json:"needBytes"`
|
||||
GlobalFiles int `json:"globalFiles"`
|
||||
GlobalBytes int64 `json:"globalBytes"`
|
||||
LocalFiles int `json:"localFiles"`
|
||||
LocalBytes int64 `json:"localBytes"`
|
||||
Errors int `json:"errors"`
|
||||
PullErrors int `json:"pullErrors"`
|
||||
}
|
||||
|
||||
// Event from /rest/events.
|
||||
type Event struct {
|
||||
ID int `json:"id"`
|
||||
Type string `json:"type"`
|
||||
Time time.Time `json:"time"`
|
||||
Data any `json:"data"`
|
||||
}
|
||||
|
||||
// PendingDevice from /rest/cluster/pending/devices.
|
||||
type PendingDevice struct {
|
||||
DeviceID string `json:"deviceID"`
|
||||
Name string `json:"name"`
|
||||
Time time.Time `json:"time"`
|
||||
Address string `json:"address"`
|
||||
}
|
||||
Reference in New Issue
Block a user