aboutsummaryrefslogtreecommitdiff
path: root/steam
diff options
context:
space:
mode:
Diffstat (limited to 'steam')
-rw-r--r--steam/status.go26
-rw-r--r--steam/steam.go6
2 files changed, 17 insertions, 15 deletions
diff --git a/steam/status.go b/steam/status.go
index 9ebf20f..ffb1ac3 100644
--- a/steam/status.go
+++ b/steam/status.go
@@ -39,20 +39,22 @@ type Job struct {
m sync.Mutex
}
+type JobStatusJson struct {
+ Action string `json:"Action" example:"extractHTTP,delete"` // What action is being run?
+ Target *Game `json:"Target" example:"Doom"` // Name of the target game
+ Running bool `json:"Running" example:"false"` // Whether or not the job is running
+ Start *time.Time `json:"Start" example:"1629855616"` // Start time as a unix timestamp
+ Errors []error `json:"Errors"` // List of all errors encountered through the course of the job
+
+ // If applicablle
+ Size *int64 `json:"Size" example:"12345"` // Game size in bytes
+ Transferred *int64 `json:"Transferred" example:"1234"` // Bytes transferred
+ Eta *time.Duration `json:"ETA" example:"1234"` // Time in seconds until it finishes
+}
+
func (j Job) MarshalJSON() ([]byte, error) {
return json.Marshal(
- struct {
- Action string `json:"Action"`
- Target *Game `json:"Target"`
- Running bool `json:"Running"`
- Start *time.Time `json:"Start"`
- Errors []error `json:"Errors"`
-
- // If applicablle
- Size *int64 `json:"Size"`
- Transferred *int64 `json:"Transferred"`
- Eta *time.Duration `json:"ETA"`
- }{
+ &JobStatusJson{
Action: j.action,
Target: j.target,
Running: j.running,
diff --git a/steam/steam.go b/steam/steam.go
index ae69020..03fa51e 100644
--- a/steam/steam.go
+++ b/steam/steam.go
@@ -34,9 +34,9 @@ type Library struct {
// Game represents an actual game in the steam Library. The purpose is only
// to provide info on a game.
type Game struct {
- Name string
- LibraryPath string
- Size int64
+ Name string `json:"Name" example:"Doom"`
+ LibraryPath string `json:"LibraryPath" example:"C:\\Program Files (x86)\\Steam\\steamapps"`
+ Size int64 `json:"Size" example:"12345"`
}
var slugregexp = regexp.MustCompile(`[^-0-9A-Za-z_:.]`)