aboutsummaryrefslogtreecommitdiff
path: root/steam/status.go
diff options
context:
space:
mode:
Diffstat (limited to 'steam/status.go')
-rw-r--r--steam/status.go26
1 files changed, 14 insertions, 12 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,