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' --- cmd/web/docs/swagger.json | 335 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 335 insertions(+) create mode 100644 cmd/web/docs/swagger.json (limited to 'cmd/web/docs/swagger.json') diff --git a/cmd/web/docs/swagger.json b/cmd/web/docs/swagger.json new file mode 100644 index 0000000..f8f360e --- /dev/null +++ b/cmd/web/docs/swagger.json @@ -0,0 +1,335 @@ +{ + "swagger": "2.0", + "info": { + "description": "The steam exporter is designed to make it easy to export steam games across the network.", + "title": "Steam Exporter API", + "contact": { + "name": "Mitchell Riedstra", + "url": "https://riedstra.dev/steam-export", + "email": "steam-export@riedstra.dev" + }, + "license": { + "name": "ISC", + "url": "https://opensource.org/licenses/ISC" + }, + "version": "1.0" + }, + "host": "localhost:8899", + "basePath": "/api/v1", + "paths": { + "/lib/game/{game}": { + "get": { + "description": "Streams a tarball of the game including the ACF file down\nto the client machine", + "consumes": [ + "application/json" + ], + "produces": [ + "application/tar" + ], + "tags": [ + "all", + "game" + ], + "summary": "Handles downloading of a game", + "parameters": [ + { + "type": "string", + "description": "Name of the videogame", + "name": "game", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "" + } + } + }, + "delete": { + "description": "Handle deletion of a game", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "all", + "game" + ], + "summary": "Delete a videogame", + "parameters": [ + { + "type": "string", + "description": "Name of the videogame", + "name": "game", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "Game was deleted", + "schema": { + "$ref": "#/definitions/main.respStatus" + } + }, + "400": { + "description": "Bad request, most likely no game supplied", + "schema": { + "$ref": "#/definitions/main.respError" + } + }, + "404": { + "description": "Game not found", + "schema": { + "$ref": "#/definitions/main.respError" + } + }, + "409": { + "description": "Another operation is currently running", + "schema": { + "$ref": "#/definitions/main.respError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/main.respError" + } + } + } + } + }, + "/lib/games": { + "get": { + "description": "Returns a list of all currently installed and available games", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "all", + "game" + ], + "summary": "Get available games", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/steam.Game" + } + } + } + } + } + }, + "/lib/install": { + "post": { + "description": "Attemps to install a game from the provided URI\nIt tries to be smart about it, http, https, or a location\non disk are supported.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "all", + "game" + ], + "summary": "Installs a game", + "parameters": [ + { + "type": "string", + "description": "URI to fetch from", + "name": "url", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/main.respStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/main.respError" + } + } + } + } + }, + "/lib/path": { + "post": { + "description": "If no other operatoins are currently running this will change\nthe path in which the current library is pointed. Implies a\nrefresh.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "all", + "library" + ], + "summary": "Set library path to new location on disk", + "parameters": [ + { + "type": "string", + "description": "Path on disk to search for a steam library", + "name": "path", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/main.respStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/main.respError" + } + } + } + } + }, + "/lib/refresh": { + "post": { + "description": "if no other actions are running on the library it will trigger a\nrefre", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "all", + "library" + ], + "summary": "Refresh the current steam library", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/main.respStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/main.respError" + } + } + } + } + }, + "/share-link": { + "get": { + "description": "The URL returned is a best effort guess at what your internal\nnetwork IP is, on Windows this involves automatically using\nthe IP from the interface associated with your default route.\nOn other platforms this involves simply returning the first\nsane looking IP address with no regard for anything else.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "all", + "information" + ], + "summary": "Return share link", + "responses": { + "200": { + "description": "URL to currently running server", + "schema": { + "type": "string" + } + } + } + } + }, + "/version": { + "get": { + "description": "Returns the version of the server", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "all" + ], + "summary": "Return the version string", + "responses": { + "200": { + "description": "Version string", + "schema": { + "type": "string" + } + } + } + } + } + }, + "definitions": { + "main.respError": { + "type": "object", + "properties": { + "error": { + "type": "string", + "example": "Descriptive Error message" + } + } + }, + "main.respStatus": { + "type": "object", + "properties": { + "status": { + "type": "string", + "example": "OK" + } + } + }, + "steam.Game": { + "type": "object", + "properties": { + "LibraryPath": { + "type": "string", + "example": "C:\\Program Files (x86)\\Steam\\steamapps" + }, + "Name": { + "type": "string", + "example": "Doom" + }, + "Size": { + "type": "integer", + "example": 12345 + } + } + } + }, + "securityDefinitions": { + "ApiKeyAuth": { + "type": "apiKey", + "name": "Authorization", + "in": "header" + }, + "BasicAuth": { + "type": "basic" + } + } +} \ No newline at end of file -- cgit v1.2.3