Document /token response

This commit is contained in:
sephrat 2022-05-13 13:20:02 +02:00
commit fc2453bee4

View file

@ -16,9 +16,20 @@ using Ombi.Store.Entities;
using Ombi.Store.Repository; using Ombi.Store.Repository;
using Ombi.Core.Settings; using Ombi.Core.Settings;
using Ombi.Settings.Settings.Models; using Ombi.Settings.Settings.Models;
using System.Text.Json.Serialization;
using Newtonsoft.Json;
namespace Ombi.Controllers.V1 namespace Ombi.Controllers.V1
{ {
public class Token: ActionResult
{
[JsonProperty("access_token")]
public string AccessToken { get; set; }
public DateTime Expiration { get; set; }
}
[ApiV1] [ApiV1]
[Produces("application/json")] [Produces("application/json")]
[ApiController] [ApiController]
@ -47,6 +58,7 @@ namespace Ombi.Controllers.V1
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
[ProducesResponseType(401)] [ProducesResponseType(401)]
[ProducesResponseType(typeof(Token), 200)]
public async Task<IActionResult> GetToken([FromBody] UserAuthModel model) public async Task<IActionResult> GetToken([FromBody] UserAuthModel model)
{ {
if (!model.UsePlexOAuth) if (!model.UsePlexOAuth)
@ -161,10 +173,10 @@ namespace Ombi.Controllers.V1
await _userManager.UpdateAsync(user); await _userManager.UpdateAsync(user);
return new JsonResult(new return Ok(new Token
{ {
access_token = accessToken, AccessToken = accessToken,
expiration = token.ValidTo Expiration = token.ValidTo
}); });
} }