Add annotations to swagger + more ASF API breaking changes that @Aareksio is ready for

This commit is contained in:
JustArchi
2018-10-08 00:09:30 +02:00
parent b3c3db30fa
commit cd28845d7b
9 changed files with 77 additions and 18 deletions

View File

@@ -23,11 +23,15 @@ using System;
using ArchiSteamFarm.IPC.Responses;
using ArchiSteamFarm.Localization;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
namespace ArchiSteamFarm.IPC.Controllers.Api {
[ApiController]
[Produces("application/json")]
[Route("Api/Structure")]
[SwaggerResponse(400, "The request has failed, check " + nameof(GenericResponse.Message) + " from response body for actual reason. Most of the time this is ASF, understanding the request, but refusing to execute it due to provided reason.", typeof(GenericResponse))]
[SwaggerResponse(401, "ASF has " + nameof(GlobalConfig.IPCPassword) + " set, but you've failed to authenticate. See " + "https://github.com/" + SharedInfo.GithubRepo + "/wiki/IPC#authentication.")]
[SwaggerResponse(403, "ASF has " + nameof(GlobalConfig.IPCPassword) + " set and you've failed to authenticate too many times, try again in an hour. See " + "https://github.com/" + SharedInfo.GithubRepo + "/wiki/IPC#authentication.")]
public sealed class StructureController : ControllerBase {
/// <summary>
/// Fetches structure of given type.
@@ -36,6 +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>))]
public ActionResult<GenericResponse<object>> StructureGet(string structure) {
if (string.IsNullOrEmpty(structure)) {
ASF.ArchiLogger.LogNullError(nameof(structure));