From 859e48ff5ca34fb56ccf7fe906b4f96991e3397b Mon Sep 17 00:00:00 2001 From: Qstick Date: Sat, 3 Dec 2022 23:17:34 -0600 Subject: [PATCH] Update API Docs --- src/Sonarr.Api.V3/System/SystemController.cs | 4 +- src/Sonarr.Api.V3/System/SystemResource.cs | 41 +++++ src/Sonarr.Api.V3/openapi.json | 148 ++++++++++++++++++- src/Sonarr.Http/Ping/PingController.cs | 3 +- 4 files changed, 191 insertions(+), 5 deletions(-) create mode 100644 src/Sonarr.Api.V3/System/SystemResource.cs diff --git a/src/Sonarr.Api.V3/System/SystemController.cs b/src/Sonarr.Api.V3/System/SystemController.cs index bc0632411..549d7d9bf 100644 --- a/src/Sonarr.Api.V3/System/SystemController.cs +++ b/src/Sonarr.Api.V3/System/SystemController.cs @@ -55,9 +55,9 @@ namespace Sonarr.Api.V3.System [HttpGet("status")] [Produces("application/json")] - public object GetStatus() + public SystemResource GetStatus() { - return new + return new SystemResource { AppName = BuildInfo.AppName, InstanceName = _configFileProvider.InstanceName, diff --git a/src/Sonarr.Api.V3/System/SystemResource.cs b/src/Sonarr.Api.V3/System/SystemResource.cs new file mode 100644 index 000000000..d12a7865f --- /dev/null +++ b/src/Sonarr.Api.V3/System/SystemResource.cs @@ -0,0 +1,41 @@ +using System; +using NzbDrone.Common.EnvironmentInfo; +using NzbDrone.Core.Authentication; +using NzbDrone.Core.Update; + +namespace Sonarr.Api.V3.System +{ + public class SystemResource + { + public string AppName { get; set; } + public string InstanceName { get; set; } + public string Version { get; set; } + public DateTime BuildTime { get; set; } + public bool IsDebug { get; set; } + public bool IsProduction { get; set; } + public bool IsAdmin { get; set; } + public bool IsUserInteractive { get; set; } + public string StartupPath { get; set; } + public string AppData { get; set; } + public string OsName { get; set; } + public string OsVersion { get; set; } + public bool IsNetCore { get; set; } + public bool IsLinux { get; set; } + public bool IsOsx { get; set; } + public bool IsWindows { get; set; } + public bool IsDocker { get; set; } + public RuntimeMode Mode { get; set; } + public string Branch { get; set; } + public AuthenticationType Authentication { get; set; } + public Version SqliteVersion { get; set; } + public int MigrationVersion { get; set; } + public string UrlBase { get; set; } + public Version RuntimeVersion { get; set; } + public string RuntimeName { get; set; } + public DateTime StartTime { get; set; } + public string PackageVersion { get; set; } + public string PackageAuthor { get; set; } + public UpdateMechanism PackageUpdateMechanism { get; set; } + public string PackageUpdateMechanismMessage { get; set; } + } +} diff --git a/src/Sonarr.Api.V3/openapi.json b/src/Sonarr.Api.V3/openapi.json index 900204fd2..146fb49d3 100644 --- a/src/Sonarr.Api.V3/openapi.json +++ b/src/Sonarr.Api.V3/openapi.json @@ -4471,7 +4471,14 @@ ], "responses": { "200": { - "description": "Success" + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PingResource" + } + } + } } } } @@ -6236,7 +6243,14 @@ ], "responses": { "200": { - "description": "Success" + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SystemResource" + } + } + } } } } @@ -9200,6 +9214,16 @@ }, "additionalProperties": false }, + "PingResource": { + "type": "object", + "properties": { + "status": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, "PrivacyLevel": { "enum": [ "normal", @@ -10023,6 +10047,14 @@ }, "additionalProperties": false }, + "RuntimeMode": { + "enum": [ + "console", + "service", + "tray" + ], + "type": "string" + }, "SeasonPassResource": { "type": "object", "properties": { @@ -10478,6 +10510,118 @@ ], "type": "string" }, + "SystemResource": { + "type": "object", + "properties": { + "appName": { + "type": "string", + "nullable": true + }, + "instanceName": { + "type": "string", + "nullable": true + }, + "version": { + "type": "string", + "nullable": true + }, + "buildTime": { + "type": "string", + "format": "date-time" + }, + "isDebug": { + "type": "boolean" + }, + "isProduction": { + "type": "boolean" + }, + "isAdmin": { + "type": "boolean" + }, + "isUserInteractive": { + "type": "boolean" + }, + "startupPath": { + "type": "string", + "nullable": true + }, + "appData": { + "type": "string", + "nullable": true + }, + "osName": { + "type": "string", + "nullable": true + }, + "osVersion": { + "type": "string", + "nullable": true + }, + "isNetCore": { + "type": "boolean" + }, + "isLinux": { + "type": "boolean" + }, + "isOsx": { + "type": "boolean" + }, + "isWindows": { + "type": "boolean" + }, + "isDocker": { + "type": "boolean" + }, + "mode": { + "$ref": "#/components/schemas/RuntimeMode" + }, + "branch": { + "type": "string", + "nullable": true + }, + "authentication": { + "$ref": "#/components/schemas/AuthenticationType" + }, + "sqliteVersion": { + "$ref": "#/components/schemas/Version" + }, + "migrationVersion": { + "type": "integer", + "format": "int32" + }, + "urlBase": { + "type": "string", + "nullable": true + }, + "runtimeVersion": { + "$ref": "#/components/schemas/Version" + }, + "runtimeName": { + "type": "string", + "nullable": true + }, + "startTime": { + "type": "string", + "format": "date-time" + }, + "packageVersion": { + "type": "string", + "nullable": true + }, + "packageAuthor": { + "type": "string", + "nullable": true + }, + "packageUpdateMechanism": { + "$ref": "#/components/schemas/UpdateMechanism" + }, + "packageUpdateMechanismMessage": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, "TagDetailsResource": { "type": "object", "properties": { diff --git a/src/Sonarr.Http/Ping/PingController.cs b/src/Sonarr.Http/Ping/PingController.cs index cff0e9bfa..3e0c3594e 100644 --- a/src/Sonarr.Http/Ping/PingController.cs +++ b/src/Sonarr.Http/Ping/PingController.cs @@ -16,7 +16,8 @@ namespace NzbDrone.Http } [HttpGet("/ping")] - public IActionResult GetStatus() + [Produces("application/json")] + public ActionResult GetStatus() { try {