Move new handle under /Confirmations root

This commit is contained in:
JustArchi
2020-08-10 14:57:04 +02:00
parent f57b5a2166
commit 1763a109c4
2 changed files with 9 additions and 9 deletions

View File

@@ -450,9 +450,9 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
[ProducesResponseType(typeof(GenericResponse<IReadOnlyDictionary<string, GenericResponse>>), (int) HttpStatusCode.OK)]
[ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)]
public async Task<ActionResult<GenericResponse>> TwoFactorAuthenticationConfirmationsAcceptPost(string botNames) {
ASF.ArchiLogger.LogGenericWarning(string.Format(Strings.WarningDeprecated, nameof(TwoFactorAuthenticationConfirmationsAcceptPost), nameof(TwoFactorAuthenticationConfirmationsHandlePost)));
ASF.ArchiLogger.LogGenericWarning(string.Format(Strings.WarningDeprecated, nameof(TwoFactorAuthenticationConfirmationsAcceptPost), nameof(TwoFactorAuthenticationConfirmationsPost)));
return await TwoFactorAuthenticationConfirmationsHandlePost(botNames, new TwoFactorAuthenticationConfirmationsHandleRequest(true)).ConfigureAwait(false);
return await TwoFactorAuthenticationConfirmationsPost(botNames, new TwoFactorAuthenticationConfirmationsRequest(true)).ConfigureAwait(false);
}
/// <summary>
@@ -463,18 +463,18 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
[ProducesResponseType(typeof(GenericResponse<IReadOnlyDictionary<string, GenericResponse>>), (int) HttpStatusCode.OK)]
[ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)]
public async Task<ActionResult<GenericResponse>> TwoFactorAuthenticationConfirmationsCancelPost(string botNames) {
ASF.ArchiLogger.LogGenericWarning(string.Format(Strings.WarningDeprecated, nameof(TwoFactorAuthenticationConfirmationsCancelPost), nameof(TwoFactorAuthenticationConfirmationsHandlePost)));
ASF.ArchiLogger.LogGenericWarning(string.Format(Strings.WarningDeprecated, nameof(TwoFactorAuthenticationConfirmationsCancelPost), nameof(TwoFactorAuthenticationConfirmationsPost)));
return await TwoFactorAuthenticationConfirmationsHandlePost(botNames, new TwoFactorAuthenticationConfirmationsHandleRequest(false)).ConfigureAwait(false);
return await TwoFactorAuthenticationConfirmationsPost(botNames, new TwoFactorAuthenticationConfirmationsRequest(false)).ConfigureAwait(false);
}
/// <summary>
/// Handles 2FA confirmations of given bots, requires ASF 2FA module to be active on them.
/// </summary>
[HttpPost("{botNames:required}/TwoFactorAuthentication/Confirmations/Handle")]
[HttpPost("{botNames:required}/TwoFactorAuthentication/Confirmations")]
[ProducesResponseType(typeof(GenericResponse<IReadOnlyDictionary<string, GenericResponse>>), (int) HttpStatusCode.OK)]
[ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)]
public async Task<ActionResult<GenericResponse>> TwoFactorAuthenticationConfirmationsHandlePost(string botNames, [FromBody] TwoFactorAuthenticationConfirmationsHandleRequest request) {
public async Task<ActionResult<GenericResponse>> TwoFactorAuthenticationConfirmationsPost(string botNames, [FromBody] TwoFactorAuthenticationConfirmationsRequest request) {
if (string.IsNullOrEmpty(botNames) || (request == null)) {
ASF.ArchiLogger.LogNullError(nameof(botNames));

View File

@@ -28,7 +28,7 @@ using Newtonsoft.Json;
namespace ArchiSteamFarm.IPC.Requests {
[SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
public sealed class TwoFactorAuthenticationConfirmationsHandleRequest {
public sealed class TwoFactorAuthenticationConfirmationsRequest {
/// <summary>
/// Specifies the target action, whether we should accept the confirmations (true), or decline them (false).
/// </summary>
@@ -82,9 +82,9 @@ namespace ArchiSteamFarm.IPC.Requests {
}
[Obsolete]
internal TwoFactorAuthenticationConfirmationsHandleRequest(bool accept) => Accept = accept;
internal TwoFactorAuthenticationConfirmationsRequest(bool accept) => Accept = accept;
[JsonConstructor]
private TwoFactorAuthenticationConfirmationsHandleRequest() { }
private TwoFactorAuthenticationConfirmationsRequest() { }
}
}