From 193f0e3c082673df08d7d18116094a9983df9b4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C3=B6ls?= <6608231+Abrynos@users.noreply.github.com> Date: Thu, 16 Nov 2023 21:49:15 +0100 Subject: [PATCH] Use generic ProducesResponseTypeAttribute instead of typeof(...) (#3074) --- .../CatController.cs | 4 +- .../SignInWithSteamController.cs | 6 +-- .../SteamTokenDumperController.cs | 2 +- .../IPC/Controllers/Api/ASFController.cs | 20 +++---- .../IPC/Controllers/Api/BotController.cs | 52 +++++++++---------- .../IPC/Controllers/Api/CommandController.cs | 4 +- .../IPC/Controllers/Api/GitHubController.cs | 22 ++++---- .../IPC/Controllers/Api/IPCBansController.cs | 8 +-- .../IPC/Controllers/Api/NLogController.cs | 10 ++-- .../IPC/Controllers/Api/PluginsController.cs | 2 +- .../IPC/Controllers/Api/StorageController.cs | 6 +-- .../Controllers/Api/StructureController.cs | 4 +- .../Api/TwoFactorAuthenticationController.cs | 20 +++---- .../IPC/Controllers/Api/TypeController.cs | 4 +- 14 files changed, 82 insertions(+), 82 deletions(-) diff --git a/ArchiSteamFarm.CustomPlugins.ExamplePlugin/CatController.cs b/ArchiSteamFarm.CustomPlugins.ExamplePlugin/CatController.cs index c98b026ed..4a415f8bc 100644 --- a/ArchiSteamFarm.CustomPlugins.ExamplePlugin/CatController.cs +++ b/ArchiSteamFarm.CustomPlugins.ExamplePlugin/CatController.cs @@ -39,8 +39,8 @@ public sealed class CatController : ArchiController { /// Fetches URL of a random cat picture. /// [HttpGet] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.OK)] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.ServiceUnavailable)] + [ProducesResponseType>((int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.ServiceUnavailable)] public async Task> CatGet() { if (ASF.WebBrowser == null) { throw new InvalidOperationException(nameof(ASF.WebBrowser)); diff --git a/ArchiSteamFarm.CustomPlugins.SignInWithSteam/SignInWithSteamController.cs b/ArchiSteamFarm.CustomPlugins.SignInWithSteam/SignInWithSteamController.cs index 113cf4bfe..7fb509976 100644 --- a/ArchiSteamFarm.CustomPlugins.SignInWithSteam/SignInWithSteamController.cs +++ b/ArchiSteamFarm.CustomPlugins.SignInWithSteam/SignInWithSteamController.cs @@ -41,9 +41,9 @@ namespace ArchiSteamFarm.CustomPlugins.SignInWithSteam; [Route("/Api/Bot/{botName:required}/SignInWithSteam")] public sealed class SignInWithSteamController : ArchiController { [HttpPost] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.OK)] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.ServiceUnavailable)] + [ProducesResponseType>((int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.BadRequest)] + [ProducesResponseType((int) HttpStatusCode.ServiceUnavailable)] public async Task> Post(string botName, [FromBody] SignInWithSteamRequest request) { ArgumentException.ThrowIfNullOrEmpty(botName); ArgumentNullException.ThrowIfNull(request); diff --git a/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/SteamTokenDumperController.cs b/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/SteamTokenDumperController.cs index 61b5956a2..737444398 100644 --- a/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/SteamTokenDumperController.cs +++ b/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/SteamTokenDumperController.cs @@ -29,7 +29,7 @@ namespace ArchiSteamFarm.OfficialPlugins.SteamTokenDumper; [Route("Api/SteamTokenDumperPlugin")] public sealed class SteamTokenDumperController : ArchiController { [HttpGet(nameof(GlobalConfigExtension))] - [ProducesResponseType(typeof(GlobalConfigExtension), (int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.OK)] [SwaggerOperation(Tags = new[] { nameof(GlobalConfigExtension) })] public ActionResult Get() => Ok(new GlobalConfigExtension()); } diff --git a/ArchiSteamFarm/IPC/Controllers/Api/ASFController.cs b/ArchiSteamFarm/IPC/Controllers/Api/ASFController.cs index 539b84e47..8af8ebefc 100644 --- a/ArchiSteamFarm/IPC/Controllers/Api/ASFController.cs +++ b/ArchiSteamFarm/IPC/Controllers/Api/ASFController.cs @@ -43,8 +43,8 @@ public sealed class ASFController : ArchiController { /// [Consumes("application/json")] [HttpPost("Encrypt")] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.OK)] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)] + [ProducesResponseType>((int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.BadRequest)] public ActionResult ASFEncryptPost([FromBody] ASFEncryptRequest request) { ArgumentNullException.ThrowIfNull(request); @@ -61,7 +61,7 @@ public sealed class ASFController : ArchiController { /// Fetches common info related to ASF as a whole. /// [HttpGet] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.OK)] + [ProducesResponseType>((int) HttpStatusCode.OK)] public ActionResult> ASFGet() { if (ASF.GlobalConfig == null) { throw new InvalidOperationException(nameof(ASF.GlobalConfig)); @@ -79,8 +79,8 @@ public sealed class ASFController : ArchiController { /// [Consumes("application/json")] [HttpPost("Hash")] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.OK)] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)] + [ProducesResponseType>((int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.BadRequest)] public ActionResult ASFHashPost([FromBody] ASFHashRequest request) { ArgumentNullException.ThrowIfNull(request); @@ -98,8 +98,8 @@ public sealed class ASFController : ArchiController { /// [Consumes("application/json")] [HttpPost] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.OK)] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)] + [ProducesResponseType((int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.BadRequest)] public async Task> ASFPost([FromBody] ASFRequest request) { ArgumentNullException.ThrowIfNull(request); @@ -150,7 +150,7 @@ public sealed class ASFController : ArchiController { /// Makes ASF shutdown itself. /// [HttpPost("Exit")] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.OK)] public ActionResult ExitPost() { (bool success, string message) = Actions.Exit(); @@ -161,7 +161,7 @@ public sealed class ASFController : ArchiController { /// Makes ASF restart itself. /// [HttpPost("Restart")] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.OK)] public ActionResult RestartPost() { (bool success, string message) = Actions.Restart(); @@ -172,7 +172,7 @@ public sealed class ASFController : ArchiController { /// Makes ASF update itself. /// [HttpPost("Update")] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.OK)] + [ProducesResponseType>((int) HttpStatusCode.OK)] public async Task>> UpdatePost([FromBody] UpdateRequest request) { ArgumentNullException.ThrowIfNull(request); diff --git a/ArchiSteamFarm/IPC/Controllers/Api/BotController.cs b/ArchiSteamFarm/IPC/Controllers/Api/BotController.cs index 2a1bacc6e..782a0a863 100644 --- a/ArchiSteamFarm/IPC/Controllers/Api/BotController.cs +++ b/ArchiSteamFarm/IPC/Controllers/Api/BotController.cs @@ -44,8 +44,8 @@ public sealed class BotController : ArchiController { /// Deletes all files related to given bots. /// [HttpDelete("{botNames:required}")] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.OK)] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)] + [ProducesResponseType((int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.BadRequest)] public async Task> BotDelete(string botNames) { ArgumentException.ThrowIfNullOrEmpty(botNames); @@ -64,8 +64,8 @@ public sealed class BotController : ArchiController { /// Fetches common info related to given bots. /// [HttpGet("{botNames:required}")] - [ProducesResponseType(typeof(GenericResponse>), (int) HttpStatusCode.OK)] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)] + [ProducesResponseType>>((int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.BadRequest)] public ActionResult BotGet(string botNames) { ArgumentException.ThrowIfNullOrEmpty(botNames); @@ -83,8 +83,8 @@ public sealed class BotController : ArchiController { /// [Consumes("application/json")] [HttpPost("{botNames:required}")] - [ProducesResponseType(typeof(GenericResponse>), (int) HttpStatusCode.OK)] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)] + [ProducesResponseType>>((int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.BadRequest)] public async Task> BotPost(string botNames, [FromBody] BotRequest request) { ArgumentException.ThrowIfNullOrEmpty(botNames); ArgumentNullException.ThrowIfNull(request); @@ -155,8 +155,8 @@ public sealed class BotController : ArchiController { /// Removes BGR output files of given bots. /// [HttpDelete("{botNames:required}/GamesToRedeemInBackground")] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.OK)] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)] + [ProducesResponseType((int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.BadRequest)] public async Task> GamesToRedeemInBackgroundDelete(string botNames) { ArgumentException.ThrowIfNullOrEmpty(botNames); @@ -175,8 +175,8 @@ public sealed class BotController : ArchiController { /// Fetches BGR output files of given bots. /// [HttpGet("{botNames:required}/GamesToRedeemInBackground")] - [ProducesResponseType(typeof(GenericResponse>), (int) HttpStatusCode.OK)] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)] + [ProducesResponseType>>((int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.BadRequest)] public async Task> GamesToRedeemInBackgroundGet(string botNames) { ArgumentException.ThrowIfNullOrEmpty(botNames); @@ -203,8 +203,8 @@ public sealed class BotController : ArchiController { /// [Consumes("application/json")] [HttpPost("{botNames:required}/GamesToRedeemInBackground")] - [ProducesResponseType(typeof(GenericResponse>), (int) HttpStatusCode.OK)] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)] + [ProducesResponseType>>((int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.BadRequest)] public async Task> GamesToRedeemInBackgroundPost(string botNames, [FromBody] BotGamesToRedeemInBackgroundRequest request) { ArgumentException.ThrowIfNullOrEmpty(botNames); ArgumentNullException.ThrowIfNull(request); @@ -241,8 +241,8 @@ public sealed class BotController : ArchiController { /// [Consumes("application/json")] [HttpPost("{botNames:required}/Input")] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.OK)] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)] + [ProducesResponseType((int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.BadRequest)] public async Task> InputPost(string botNames, [FromBody] BotInputRequest request) { ArgumentException.ThrowIfNullOrEmpty(botNames); ArgumentNullException.ThrowIfNull(request); @@ -267,8 +267,8 @@ public sealed class BotController : ArchiController { /// [Consumes("application/json")] [HttpPost("{botNames:required}/Pause")] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.OK)] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)] + [ProducesResponseType((int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.BadRequest)] public async Task> PausePost(string botNames, [FromBody] BotPauseRequest request) { ArgumentException.ThrowIfNullOrEmpty(botNames); ArgumentNullException.ThrowIfNull(request); @@ -293,8 +293,8 @@ public sealed class BotController : ArchiController { /// [Consumes("application/json")] [HttpPost("{botNames:required}/Redeem")] - [ProducesResponseType(typeof(GenericResponse>>), (int) HttpStatusCode.OK)] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)] + [ProducesResponseType>>>((int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.BadRequest)] public async Task> RedeemPost(string botNames, [FromBody] BotRedeemRequest request) { ArgumentException.ThrowIfNullOrEmpty(botNames); ArgumentNullException.ThrowIfNull(request); @@ -332,8 +332,8 @@ public sealed class BotController : ArchiController { /// [Consumes("application/json")] [HttpPost("{botName:required}/Rename")] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.OK)] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)] + [ProducesResponseType((int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.BadRequest)] public async Task> RenamePost(string botName, [FromBody] BotRenameRequest request) { ArgumentException.ThrowIfNullOrEmpty(botName); ArgumentNullException.ThrowIfNull(request); @@ -359,8 +359,8 @@ public sealed class BotController : ArchiController { /// Resumes given bots. /// [HttpPost("{botNames:required}/Resume")] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.OK)] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)] + [ProducesResponseType((int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.BadRequest)] public async Task> ResumePost(string botNames) { ArgumentException.ThrowIfNullOrEmpty(botNames); @@ -379,8 +379,8 @@ public sealed class BotController : ArchiController { /// Starts given bots. /// [HttpPost("{botNames:required}/Start")] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.OK)] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)] + [ProducesResponseType((int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.BadRequest)] public async Task> StartPost(string botNames) { ArgumentException.ThrowIfNullOrEmpty(botNames); @@ -399,8 +399,8 @@ public sealed class BotController : ArchiController { /// Stops given bots. /// [HttpPost("{botNames:required}/Stop")] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.OK)] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)] + [ProducesResponseType((int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.BadRequest)] public async Task> StopPost(string botNames) { ArgumentException.ThrowIfNullOrEmpty(botNames); diff --git a/ArchiSteamFarm/IPC/Controllers/Api/CommandController.cs b/ArchiSteamFarm/IPC/Controllers/Api/CommandController.cs index 47d3dec41..2ef28cfdc 100644 --- a/ArchiSteamFarm/IPC/Controllers/Api/CommandController.cs +++ b/ArchiSteamFarm/IPC/Controllers/Api/CommandController.cs @@ -44,8 +44,8 @@ public sealed class CommandController : ArchiController { /// [Consumes("application/json")] [HttpPost] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.OK)] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)] + [ProducesResponseType>((int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.BadRequest)] public async Task> CommandPost([FromBody] CommandRequest request) { ArgumentNullException.ThrowIfNull(request); diff --git a/ArchiSteamFarm/IPC/Controllers/Api/GitHubController.cs b/ArchiSteamFarm/IPC/Controllers/Api/GitHubController.cs index 8c374eb7a..b2ea4afa5 100644 --- a/ArchiSteamFarm/IPC/Controllers/Api/GitHubController.cs +++ b/ArchiSteamFarm/IPC/Controllers/Api/GitHubController.cs @@ -42,8 +42,8 @@ public sealed class GitHubController : ArchiController { /// This is internal API being utilizied by our ASF-ui IPC frontend. You should not depend on existence of any /Api/WWW endpoints as they can disappear and change anytime. /// [HttpGet("Release")] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.OK)] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.ServiceUnavailable)] + [ProducesResponseType>((int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.ServiceUnavailable)] public async Task> GitHubReleaseGet() { CancellationToken cancellationToken = HttpContext.RequestAborted; @@ -59,9 +59,9 @@ public sealed class GitHubController : ArchiController { /// This is internal API being utilizied by our ASF-ui IPC frontend. You should not depend on existence of any /Api/WWW endpoints as they can disappear and change anytime. /// [HttpGet("Release/{version:required}")] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.OK)] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.ServiceUnavailable)] + [ProducesResponseType>((int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.BadRequest)] + [ProducesResponseType((int) HttpStatusCode.ServiceUnavailable)] public async Task> GitHubReleaseGet(string version) { ArgumentException.ThrowIfNullOrEmpty(version); @@ -94,9 +94,9 @@ public sealed class GitHubController : ArchiController { /// This is internal API being utilizied by our ASF-ui IPC frontend. You should not depend on existence of any /Api/WWW endpoints as they can disappear and change anytime. /// [HttpGet("Wiki/History/{page:required}")] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.OK)] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.ServiceUnavailable)] + [ProducesResponseType>((int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.BadRequest)] + [ProducesResponseType((int) HttpStatusCode.ServiceUnavailable)] public async Task> GitHubWikiHistoryGet(string page) { ArgumentException.ThrowIfNullOrEmpty(page); @@ -115,9 +115,9 @@ public sealed class GitHubController : ArchiController { /// Specifying revision is optional - when not specified, will fetch latest available. If specified revision is invalid, GitHub will automatically fetch the latest revision as well. /// [HttpGet("Wiki/Page/{page:required}")] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.OK)] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.ServiceUnavailable)] + [ProducesResponseType>((int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.BadRequest)] + [ProducesResponseType((int) HttpStatusCode.ServiceUnavailable)] public async Task> GitHubWikiPageGet(string page, [FromQuery] string? revision = null) { ArgumentException.ThrowIfNullOrEmpty(page); diff --git a/ArchiSteamFarm/IPC/Controllers/Api/IPCBansController.cs b/ArchiSteamFarm/IPC/Controllers/Api/IPCBansController.cs index 35b923a31..29a12867b 100644 --- a/ArchiSteamFarm/IPC/Controllers/Api/IPCBansController.cs +++ b/ArchiSteamFarm/IPC/Controllers/Api/IPCBansController.cs @@ -37,7 +37,7 @@ public sealed class IPCBansController : ArchiController { /// Clears the list of all IP addresses currently blocked by ASFs IPC module /// [HttpDelete] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.OK)] public ActionResult Delete() { ApiAuthenticationMiddleware.ClearFailedAuthorizations(); @@ -48,8 +48,8 @@ public sealed class IPCBansController : ArchiController { /// Removes an IP address from the list of addresses currently blocked by ASFs IPC module /// [HttpDelete("{ipAddress:required}")] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.OK)] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)] + [ProducesResponseType((int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.BadRequest)] public ActionResult DeleteSpecific(string ipAddress) { ArgumentException.ThrowIfNullOrEmpty(ipAddress); @@ -70,6 +70,6 @@ public sealed class IPCBansController : ArchiController { /// Gets all IP addresses currently blocked by ASFs IPC module /// [HttpGet] - [ProducesResponseType(typeof(GenericResponse>), (int) HttpStatusCode.OK)] + [ProducesResponseType>>((int) HttpStatusCode.OK)] public ActionResult>> Get() => Ok(new GenericResponse>(ApiAuthenticationMiddleware.GetCurrentlyBannedIPs().Select(static ip => ip.ToString()).ToHashSet())); } diff --git a/ArchiSteamFarm/IPC/Controllers/Api/NLogController.cs b/ArchiSteamFarm/IPC/Controllers/Api/NLogController.cs index 0313224e8..74a7cb45b 100644 --- a/ArchiSteamFarm/IPC/Controllers/Api/NLogController.cs +++ b/ArchiSteamFarm/IPC/Controllers/Api/NLogController.cs @@ -50,9 +50,9 @@ public sealed class NLogController : ArchiController { /// Maximum amount of lines from the log file returned. The respone naturally might have less amount than specified, if you've read whole file already. /// Ending index, used for pagination. Omit it for the first request, then initialize to TotalLines returned, and on every following request subtract count that you've used in the previous request from it until you hit 0 or less, which means you've read whole file already. [HttpGet("File")] - [ProducesResponseType(typeof(GenericResponse>), (int) HttpStatusCode.OK)] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.ServiceUnavailable)] + [ProducesResponseType>>((int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.BadRequest)] + [ProducesResponseType((int) HttpStatusCode.ServiceUnavailable)] public async Task> FileGet(int count = 100, int lastAt = 0) { if (count <= 0) { return BadRequest(new GenericResponse(false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsInvalid, nameof(count)))); @@ -88,8 +88,8 @@ public sealed class NLogController : ArchiController { /// This API endpoint requires a websocket connection. /// [HttpGet] - [ProducesResponseType(typeof(IEnumerable>), (int) HttpStatusCode.OK)] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)] + [ProducesResponseType>>((int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.BadRequest)] public async Task Get(CancellationToken cancellationToken) { if (HttpContext == null) { throw new InvalidOperationException(nameof(HttpContext)); diff --git a/ArchiSteamFarm/IPC/Controllers/Api/PluginsController.cs b/ArchiSteamFarm/IPC/Controllers/Api/PluginsController.cs index 90e63d590..b6287b8ea 100644 --- a/ArchiSteamFarm/IPC/Controllers/Api/PluginsController.cs +++ b/ArchiSteamFarm/IPC/Controllers/Api/PluginsController.cs @@ -32,7 +32,7 @@ namespace ArchiSteamFarm.IPC.Controllers.Api; [Route("Api/Plugins")] public sealed class PluginsController : ArchiController { [HttpGet] - [ProducesResponseType(typeof(GenericResponse>), (int) HttpStatusCode.OK)] + [ProducesResponseType>>((int) HttpStatusCode.OK)] public ActionResult>> PluginsGet() { IReadOnlyCollection activePlugins = PluginsCore.ActivePlugins ?? (IReadOnlyCollection) Array.Empty(); diff --git a/ArchiSteamFarm/IPC/Controllers/Api/StorageController.cs b/ArchiSteamFarm/IPC/Controllers/Api/StorageController.cs index 38e2f1a99..99fbeb37f 100644 --- a/ArchiSteamFarm/IPC/Controllers/Api/StorageController.cs +++ b/ArchiSteamFarm/IPC/Controllers/Api/StorageController.cs @@ -34,7 +34,7 @@ public sealed class StorageController : ArchiController { /// Deletes entry under specified key from ASF's persistent KeyValue JSON storage. /// [HttpDelete] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.OK)] public ActionResult StorageDelete(string key) { ArgumentException.ThrowIfNullOrEmpty(key); @@ -51,7 +51,7 @@ public sealed class StorageController : ArchiController { /// Loads entry under specified key from ASF's persistent KeyValue JSON storage. /// [HttpGet] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.OK)] + [ProducesResponseType>((int) HttpStatusCode.OK)] public ActionResult StorageGet(string key) { ArgumentException.ThrowIfNullOrEmpty(key); @@ -69,7 +69,7 @@ public sealed class StorageController : ArchiController { /// [Consumes("application/json")] [HttpPost] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.OK)] public ActionResult StoragePost(string key, [FromBody] JToken value) { ArgumentException.ThrowIfNullOrEmpty(key); ArgumentNullException.ThrowIfNull(value); diff --git a/ArchiSteamFarm/IPC/Controllers/Api/StructureController.cs b/ArchiSteamFarm/IPC/Controllers/Api/StructureController.cs index 3163b5165..d26cd8aa1 100644 --- a/ArchiSteamFarm/IPC/Controllers/Api/StructureController.cs +++ b/ArchiSteamFarm/IPC/Controllers/Api/StructureController.cs @@ -37,8 +37,8 @@ public sealed class StructureController : ArchiController { /// Structure is defined as a representation of given object in its default state. /// [HttpGet("{structure:required}")] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.OK)] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)] + [ProducesResponseType>((int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.BadRequest)] public ActionResult StructureGet(string structure) { ArgumentException.ThrowIfNullOrEmpty(structure); diff --git a/ArchiSteamFarm/IPC/Controllers/Api/TwoFactorAuthenticationController.cs b/ArchiSteamFarm/IPC/Controllers/Api/TwoFactorAuthenticationController.cs index c2f659490..e3e0b01d6 100644 --- a/ArchiSteamFarm/IPC/Controllers/Api/TwoFactorAuthenticationController.cs +++ b/ArchiSteamFarm/IPC/Controllers/Api/TwoFactorAuthenticationController.cs @@ -42,8 +42,8 @@ public sealed class TwoFactorAuthenticationController : ArchiController { /// Fetches pending 2FA confirmations of given bots, requires ASF 2FA module to be active on them. /// [HttpGet("Confirmations")] - [ProducesResponseType(typeof(GenericResponse>>>), (int) HttpStatusCode.OK)] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)] + [ProducesResponseType>>>>((int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.BadRequest)] public async Task> ConfirmationsGet(string botNames) { ArgumentException.ThrowIfNullOrEmpty(botNames); @@ -70,8 +70,8 @@ public sealed class TwoFactorAuthenticationController : ArchiController { /// [Consumes("application/json")] [HttpPost("Confirmations")] - [ProducesResponseType(typeof(GenericResponse>>>), (int) HttpStatusCode.OK)] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)] + [ProducesResponseType>>>>((int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.BadRequest)] public async Task> ConfirmationsPost(string botNames, [FromBody] TwoFactorAuthenticationConfirmationsRequest request) { ArgumentException.ThrowIfNullOrEmpty(botNames); ArgumentNullException.ThrowIfNull(request); @@ -102,8 +102,8 @@ public sealed class TwoFactorAuthenticationController : ArchiController { /// Deletes the MobileAuthenticator of given bots if an ASF 2FA module is active on them. /// [HttpDelete] - [ProducesResponseType(typeof(GenericResponse>>), (int) HttpStatusCode.OK)] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)] + [ProducesResponseType>>>((int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.BadRequest)] public async Task> Delete(string botNames) { ArgumentException.ThrowIfNullOrEmpty(botNames); @@ -130,8 +130,8 @@ public sealed class TwoFactorAuthenticationController : ArchiController { /// [Consumes("application/json")] [HttpPost] - [ProducesResponseType(typeof(GenericResponse>), (int) HttpStatusCode.OK)] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)] + [ProducesResponseType>>((int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.BadRequest)] public async Task> Post(string botNames, [FromBody] MobileAuthenticator authenticator) { ArgumentException.ThrowIfNullOrEmpty(botNames); ArgumentNullException.ThrowIfNull(authenticator); @@ -158,8 +158,8 @@ public sealed class TwoFactorAuthenticationController : ArchiController { /// Fetches 2FA tokens of given bots, requires ASF 2FA module to be active on them. /// [HttpGet("Token")] - [ProducesResponseType(typeof(GenericResponse>>), (int) HttpStatusCode.OK)] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)] + [ProducesResponseType>>>((int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.BadRequest)] public async Task> TokenGet(string botNames) { ArgumentException.ThrowIfNullOrEmpty(botNames); diff --git a/ArchiSteamFarm/IPC/Controllers/Api/TypeController.cs b/ArchiSteamFarm/IPC/Controllers/Api/TypeController.cs index d66cb3005..9b5059ab9 100644 --- a/ArchiSteamFarm/IPC/Controllers/Api/TypeController.cs +++ b/ArchiSteamFarm/IPC/Controllers/Api/TypeController.cs @@ -42,8 +42,8 @@ public sealed class TypeController : ArchiController { /// Type info is defined as a representation of given object with its fields and properties being assigned to a string value that defines their type. /// [HttpGet("{type:required}")] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.OK)] - [ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)] + [ProducesResponseType>((int) HttpStatusCode.OK)] + [ProducesResponseType((int) HttpStatusCode.BadRequest)] public ActionResult TypeGet(string type) { ArgumentException.ThrowIfNullOrEmpty(type);