feat: GET /mco/available, GET /mco/client/compatible

This commit is contained in:
CyberL1 2024-01-31 15:50:15 +01:00
parent 93bdaadde3
commit 821e20d708
6 changed files with 46 additions and 47 deletions

View File

@ -0,0 +1,9 @@
namespace Minecraft_Realms_Emulator
{
public enum Compatility
{
COMPATIBLE,
OTHER,
OUTDATED
}
}

View File

@ -0,0 +1,16 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace Minecraft_Realms_Emulator.Controllers.Mco
{
[Route("mco/[controller]")]
[ApiController]
public class AvailableController : ControllerBase
{
[HttpGet(Name = "GetAvailable")]
public bool Get()
{
return true;
}
}
}

View File

@ -0,0 +1,16 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace Minecraft_Realms_Emulator.Controllers.Mco.Client
{
[Route("/mco/client/[controller]")]
[ApiController]
public class CompatibleController : ControllerBase
{
[HttpGet(Name = "GetCompatible")]
public string Get()
{
return Compatility.COMPATIBLE.ToString();
}
}
}

View File

@ -1,33 +0,0 @@
using Microsoft.AspNetCore.Mvc;
namespace Minecraft_Realms_Emulator.Controllers
{
[ApiController]
[Route("[controller]")]
public class WeatherForecastController : ControllerBase
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
private readonly ILogger<WeatherForecastController> _logger;
public WeatherForecastController(ILogger<WeatherForecastController> logger)
{
_logger = logger;
}
[HttpGet(Name = "GetWeatherForecast")]
public IEnumerable<WeatherForecast> Get()
{
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
TemperatureC = Random.Shared.Next(-20, 55),
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
})
.ToArray();
}
}
}

View File

@ -1,6 +1,10 @@
@Minecraft_Realms_Emulator_HostAddress = http://localhost:8080 @Minecraft_Realms_Emulator_HostAddress = http://localhost:8080
GET {{Minecraft_Realms_Emulator_HostAddress}}/weatherforecast/ GET {{Minecraft_Realms_Emulator_HostAddress}}/mco/available
Accept: application/json Accept: application/json
### ###
GET {{Minecraft_Realms_Emulator_HostAddress}}/mco/client/compatible
###

View File

@ -1,13 +0,0 @@
namespace Minecraft_Realms_Emulator
{
public class WeatherForecast
{
public DateOnly Date { get; set; }
public int TemperatureC { get; set; }
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
public string? Summary { get; set; }
}
}