From 0fc3eda77004f41c5f0a804028da2d90b0373ea7 Mon Sep 17 00:00:00 2001 From: Mitchell Riedstra Date: Tue, 24 Aug 2021 22:25:40 -0400 Subject: Another development snapshot. Updated license. Added Swagger documentation--embedded! Note about 'swaggo' --- steam/status.go | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'steam/status.go') 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, -- cgit v1.2.3