mirror of
https://github.com/CyberL1/Minecraft-Realms-Emulator.git
synced 2024-11-09 16:08:21 -05:00
feat: GET /mco/available, GET /mco/client/compatible
This commit is contained in:
parent
93bdaadde3
commit
821e20d708
9
Minecraft-Realms-Emulator/Compatibility.cs
Normal file
9
Minecraft-Realms-Emulator/Compatibility.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
namespace Minecraft_Realms_Emulator
|
||||||
|
{
|
||||||
|
public enum Compatility
|
||||||
|
{
|
||||||
|
COMPATIBLE,
|
||||||
|
OTHER,
|
||||||
|
OUTDATED
|
||||||
|
}
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -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
|
||||||
|
|
||||||
|
###
|
@ -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; }
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user