mirror of
https://github.com/JustArchiNET/ArchiSteamFarm
synced 2024-11-10 15:14:41 +00:00
Misc
This commit is contained in:
parent
cd28845d7b
commit
50eafb42ed
7 changed files with 23 additions and 23 deletions
|
@ -41,7 +41,7 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
|
|||
/// Fetches common info related to ASF as a whole.
|
||||
/// </summary>
|
||||
[HttpGet]
|
||||
[SwaggerResponse(200, type: typeof(GenericResponse<ASFResponse>))]
|
||||
[ProducesResponseType(typeof(GenericResponse<ASFResponse>), 200)]
|
||||
public ActionResult<GenericResponse<ASFResponse>> ASFGet() {
|
||||
uint memoryUsage = (uint) GC.GetTotalMemory(false) / 1024;
|
||||
|
||||
|
@ -60,7 +60,7 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
|
|||
/// </summary>
|
||||
[Consumes("application/json")]
|
||||
[HttpPost]
|
||||
[SwaggerResponse(200, type: typeof(GenericResponse))]
|
||||
[ProducesResponseType(typeof(GenericResponse), 200)]
|
||||
public async Task<ActionResult<GenericResponse>> ASFPost([FromBody] ASFRequest request) {
|
||||
if (request == null) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(request));
|
||||
|
@ -88,7 +88,7 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
|
|||
/// Makes ASF shutdown itself.
|
||||
/// </summary>
|
||||
[HttpPost("Exit")]
|
||||
[SwaggerResponse(200, type: typeof(GenericResponse))]
|
||||
[ProducesResponseType(typeof(GenericResponse), 200)]
|
||||
public ActionResult<GenericResponse> ExitPost() {
|
||||
(bool success, string output) = Actions.Exit();
|
||||
return Ok(new GenericResponse(success, output));
|
||||
|
@ -98,7 +98,7 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
|
|||
/// Makes ASF restart itself.
|
||||
/// </summary>
|
||||
[HttpPost("Restart")]
|
||||
[SwaggerResponse(200, type: typeof(GenericResponse))]
|
||||
[ProducesResponseType(typeof(GenericResponse), 200)]
|
||||
public ActionResult<GenericResponse> RestartPost() {
|
||||
(bool success, string output) = Actions.Restart();
|
||||
return Ok(new GenericResponse(success, output));
|
||||
|
@ -108,7 +108,7 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
|
|||
/// Makes ASF update itself.
|
||||
/// </summary>
|
||||
[HttpPost("Update")]
|
||||
[SwaggerResponse(200, type: typeof(GenericResponse<Version>))]
|
||||
[ProducesResponseType(typeof(GenericResponse<Version>), 200)]
|
||||
public async Task<ActionResult<GenericResponse<Version>>> UpdatePost() {
|
||||
(bool success, Version version) = await Actions.Update().ConfigureAwait(false);
|
||||
return Ok(new GenericResponse<Version>(success, version));
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
|
|||
/// Deletes all files related to given bots.
|
||||
/// </summary>
|
||||
[HttpDelete("{botNames:required}")]
|
||||
[SwaggerResponse(200, type: typeof(GenericResponse))]
|
||||
[ProducesResponseType(typeof(GenericResponse), 200)]
|
||||
public async Task<ActionResult<GenericResponse>> BotDelete(string botNames) {
|
||||
if (string.IsNullOrEmpty(botNames)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(botNames));
|
||||
|
@ -63,7 +63,7 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
|
|||
/// Fetches common info related to given bots.
|
||||
/// </summary>
|
||||
[HttpGet("{botNames:required}")]
|
||||
[SwaggerResponse(200, type: typeof(GenericResponse<IDictionary<string, Bot>>))]
|
||||
[ProducesResponseType(typeof(GenericResponse<IDictionary<string, Bot>>), 200)]
|
||||
public ActionResult<GenericResponse<IDictionary<string, Bot>>> BotGet(string botNames) {
|
||||
if (string.IsNullOrEmpty(botNames)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(botNames));
|
||||
|
@ -83,7 +83,7 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
|
|||
/// </summary>
|
||||
[Consumes("application/json")]
|
||||
[HttpPost("{botName:required}")]
|
||||
[SwaggerResponse(200, type: typeof(GenericResponse))]
|
||||
[ProducesResponseType(typeof(GenericResponse), 200)]
|
||||
public async Task<ActionResult<GenericResponse>> BotPost(string botName, [FromBody] BotRequest request) {
|
||||
if (string.IsNullOrEmpty(botName) || (request == null)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(botName) + " || " + nameof(request));
|
||||
|
@ -121,7 +121,7 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
|
|||
/// Removes BGR output files of given bots.
|
||||
/// </summary>
|
||||
[HttpDelete("{botNames:required}/GamesToRedeemInBackground")]
|
||||
[SwaggerResponse(200, type: typeof(GenericResponse))]
|
||||
[ProducesResponseType(typeof(GenericResponse), 200)]
|
||||
public async Task<ActionResult<GenericResponse>> GamesToRedeemInBackgroundDelete(string botNames) {
|
||||
if (string.IsNullOrEmpty(botNames)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(botNames));
|
||||
|
@ -141,7 +141,7 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
|
|||
/// Fetches BGR output files of given bots.
|
||||
/// </summary>
|
||||
[HttpGet("{botNames:required}/GamesToRedeemInBackground")]
|
||||
[SwaggerResponse(200, type: typeof(GenericResponse<IReadOnlyDictionary<string, GamesToRedeemInBackgroundResponse>>))]
|
||||
[ProducesResponseType(typeof(GenericResponse<IReadOnlyDictionary<string, GamesToRedeemInBackgroundResponse>>), 200)]
|
||||
public async Task<ActionResult<GenericResponse<IReadOnlyDictionary<string, GamesToRedeemInBackgroundResponse>>>> GamesToRedeemInBackgroundGet(string botNames) {
|
||||
if (string.IsNullOrEmpty(botNames)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(botNames));
|
||||
|
@ -170,7 +170,7 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
|
|||
/// </summary>
|
||||
[Consumes("application/json")]
|
||||
[HttpPost("{botName:required}/GamesToRedeemInBackground")]
|
||||
[SwaggerResponse(200, type: typeof(GenericResponse<OrderedDictionary>))]
|
||||
[ProducesResponseType(typeof(GenericResponse<OrderedDictionary>), 200)]
|
||||
public async Task<ActionResult<GenericResponse<OrderedDictionary>>> GamesToRedeemInBackgroundPost(string botName, [FromBody] GamesToRedeemInBackgroundRequest request) {
|
||||
if (string.IsNullOrEmpty(botName) || (request == null)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(botName) + " || " + nameof(request));
|
||||
|
@ -194,7 +194,7 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
|
|||
/// </summary>
|
||||
[Consumes("application/json")]
|
||||
[HttpPost("{botNames:required}/Pause")]
|
||||
[SwaggerResponse(200, type: typeof(GenericResponse))]
|
||||
[ProducesResponseType(typeof(GenericResponse), 200)]
|
||||
public async Task<ActionResult<GenericResponse>> PausePost(string botNames, [FromBody] BotPauseRequest request) {
|
||||
if (string.IsNullOrEmpty(botNames) || (request == null)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(botNames) + " || " + nameof(request));
|
||||
|
@ -214,7 +214,7 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
|
|||
/// Resumes given bots.
|
||||
/// </summary>
|
||||
[HttpPost("{botNames:required}/Resume")]
|
||||
[SwaggerResponse(200, type: typeof(GenericResponse))]
|
||||
[ProducesResponseType(typeof(GenericResponse), 200)]
|
||||
public async Task<ActionResult<GenericResponse>> ResumePost(string botNames) {
|
||||
if (string.IsNullOrEmpty(botNames)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(botNames));
|
||||
|
@ -234,7 +234,7 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
|
|||
/// Starts given bots.
|
||||
/// </summary>
|
||||
[HttpPost("{botNames:required}/Start")]
|
||||
[SwaggerResponse(200, type: typeof(GenericResponse))]
|
||||
[ProducesResponseType(typeof(GenericResponse), 200)]
|
||||
public async Task<ActionResult<GenericResponse>> StartPost(string botNames) {
|
||||
if (string.IsNullOrEmpty(botNames)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(botNames));
|
||||
|
@ -254,7 +254,7 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
|
|||
/// Stops given bots.
|
||||
/// </summary>
|
||||
[HttpPost("{botNames:required}/Stop")]
|
||||
[SwaggerResponse(200, type: typeof(GenericResponse))]
|
||||
[ProducesResponseType(typeof(GenericResponse), 200)]
|
||||
public async Task<ActionResult<GenericResponse>> StopPost(string botNames) {
|
||||
if (string.IsNullOrEmpty(botNames)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(botNames));
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
|
|||
/// You should use "given bot" commands when executing this endpoint, omitting targets of the command will cause the command to be executed on first defined bot
|
||||
/// </remarks>
|
||||
[HttpPost("{command:required}")]
|
||||
[SwaggerResponse(200, type: typeof(GenericResponse<string>))]
|
||||
[ProducesResponseType(typeof(GenericResponse<string>), 200)]
|
||||
public async Task<ActionResult<GenericResponse<string>>> CommandPost(string command) {
|
||||
if (string.IsNullOrEmpty(command)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(command));
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
|
|||
/// This API endpoint requires a websocket connection.
|
||||
/// </remarks>
|
||||
[HttpGet]
|
||||
[SwaggerResponse(200, type: typeof(IEnumerable<GenericResponse<string>>))]
|
||||
[ProducesResponseType(typeof(IEnumerable<GenericResponse<string>>), 200)]
|
||||
public async Task<ActionResult> NLogGet() {
|
||||
if (!HttpContext.WebSockets.IsWebSocketRequest) {
|
||||
return BadRequest(new GenericResponse(false, string.Format(Strings.WarningFailedWithError, nameof(HttpContext.WebSockets.IsWebSocketRequest) + ": " + HttpContext.WebSockets.IsWebSocketRequest)));
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
|
|||
/// Structure is defined as a representation of given object in its default state.
|
||||
/// </remarks>
|
||||
[HttpGet("{structure:required}")]
|
||||
[SwaggerResponse(200, type: typeof(GenericResponse<object>))]
|
||||
[ProducesResponseType(typeof(GenericResponse<object>), 200)]
|
||||
public ActionResult<GenericResponse<object>> StructureGet(string structure) {
|
||||
if (string.IsNullOrEmpty(structure)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(structure));
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
|
|||
/// 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.
|
||||
/// </remarks>
|
||||
[HttpGet("{type:required}")]
|
||||
[SwaggerResponse(200, type: typeof(GenericResponse<TypeResponse>))]
|
||||
[ProducesResponseType(typeof(GenericResponse<TypeResponse>), 200)]
|
||||
public ActionResult<GenericResponse<TypeResponse>> TypeGet(string type) {
|
||||
if (string.IsNullOrEmpty(type)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(type));
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
|
|||
/// This is internal API being utilizied by our ASF-ui IPC frontend. You should not depend on existence of any /Api/WWW as they can disappear and change anytime.
|
||||
/// </remarks>
|
||||
[HttpGet("Directory/{directory:required}")]
|
||||
[SwaggerResponse(200, type: typeof(GenericResponse<IReadOnlyCollection<string>>))]
|
||||
[ProducesResponseType(typeof(GenericResponse<IReadOnlyCollection<string>>), 200)]
|
||||
public ActionResult<GenericResponse<IReadOnlyCollection<string>>> DirectoryGet(string directory) {
|
||||
if (string.IsNullOrEmpty(directory)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(directory));
|
||||
|
@ -76,7 +76,7 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
|
|||
/// This is internal API being utilizied by our ASF-ui IPC frontend. You should not depend on existence of any /Api/WWW as they can disappear and change anytime.
|
||||
/// </remarks>
|
||||
[HttpGet("GitHub/Releases")]
|
||||
[SwaggerResponse(200, type: typeof(GenericResponse<IReadOnlyCollection<GitHubReleaseResponse>>))]
|
||||
[ProducesResponseType(typeof(GenericResponse<IReadOnlyCollection<GitHubReleaseResponse>>), 200)]
|
||||
public async Task<ActionResult<GenericResponse<IReadOnlyCollection<GitHubReleaseResponse>>>> GitHubReleasesGet([FromQuery] byte count = 10) {
|
||||
if (count == 0) {
|
||||
return BadRequest(new GenericResponse<IReadOnlyCollection<GitHubReleaseResponse>>(false, string.Format(Strings.ErrorIsEmpty, nameof(count))));
|
||||
|
@ -98,7 +98,7 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
|
|||
/// This is internal API being utilizied by our ASF-ui IPC frontend. You should not depend on existence of any /Api/WWW as they can disappear and change anytime.
|
||||
/// </remarks>
|
||||
[HttpGet("GitHub/Releases/{version:required}")]
|
||||
[SwaggerResponse(200, type: typeof(GenericResponse<GitHubReleaseResponse>))]
|
||||
[ProducesResponseType(typeof(GenericResponse<GitHubReleaseResponse>), 200)]
|
||||
public async Task<ActionResult<GenericResponse<GitHubReleaseResponse>>> GitHubReleasesGet(string version) {
|
||||
if (string.IsNullOrEmpty(version)) {
|
||||
return BadRequest(new GenericResponse<GitHubReleaseResponse>(false, string.Format(Strings.ErrorIsEmpty, nameof(version))));
|
||||
|
@ -120,7 +120,7 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
|
|||
/// </remarks>
|
||||
[Consumes("application/json")]
|
||||
[HttpPost("Send")]
|
||||
[SwaggerResponse(200, type: typeof(GenericResponse<string>))]
|
||||
[ProducesResponseType(typeof(GenericResponse<string>), 200)]
|
||||
public async Task<ActionResult<GenericResponse<string>>> SendPost([FromBody] WWWSendRequest request) {
|
||||
if (request == null) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(request));
|
||||
|
|
Loading…
Reference in a new issue