diff options
| author | Mitchell Riedstra <mitch@riedstra.dev> | 2021-08-24 22:25:40 -0400 |
|---|---|---|
| committer | Mitchell Riedstra <mitch@riedstra.dev> | 2021-08-24 22:25:40 -0400 |
| commit | 0fc3eda77004f41c5f0a804028da2d90b0373ea7 (patch) | |
| tree | edf6d74e6a2b7140350eab1e40d0fbf70e10f87c /steam | |
| parent | f4fcd237b2d0eb950fc15a8af1fb0894b6ad6359 (diff) | |
| download | steam-export-0fc3eda77004f41c5f0a804028da2d90b0373ea7.tar.gz steam-export-0fc3eda77004f41c5f0a804028da2d90b0373ea7.tar.xz | |
Another development snapshot. Updated license. Added Swagger documentation--embedded! Note about 'swaggo'
Diffstat (limited to 'steam')
| -rw-r--r-- | steam/status.go | 26 | ||||
| -rw-r--r-- | steam/steam.go | 6 |
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_:.]`) |
