diff --git a/src/Helldivers-2-API/Controllers/V1/SpaceStationController.cs b/src/Helldivers-2-API/Controllers/V1/SpaceStationController.cs new file mode 100644 index 0000000..4df3e07 --- /dev/null +++ b/src/Helldivers-2-API/Controllers/V1/SpaceStationController.cs @@ -0,0 +1,35 @@ +using Helldivers.Core.Contracts.Collections; +using Helldivers.Models.V1; +using Microsoft.AspNetCore.Mvc; + +namespace Helldivers.API.Controllers.V1; + +/// +/// Contains API endpoints for . +/// +public static class SpaceStationController +{ + /// + /// Fetches a list of all available information available. + /// + [ProducesResponseType>(StatusCodes.Status200OK)] + public static async Task Index(HttpContext context, IStore store) + { + var stations = await store.AllAsync(context.RequestAborted); + + return Results.Ok(stations); + } + + /// + /// Fetches a specific identified by . + /// + public static async Task Show(HttpContext context, IStore store, [FromRoute] int index) + { + var station = await store.GetAsync(index, context.RequestAborted); + + if (station is null) + return Results.NotFound(); + + return Results.Ok(station); + } +} diff --git a/src/Helldivers-2-API/Program.cs b/src/Helldivers-2-API/Program.cs index c90ed9e..024f6cf 100644 --- a/src/Helldivers-2-API/Program.cs +++ b/src/Helldivers-2-API/Program.cs @@ -275,6 +275,9 @@ v1.MapGet("/planets/{index:int}", PlanetController.Show); v1.MapGet("/planet-events", PlanetController.WithEvents); +v1.MapGet("/space-stations", SpaceStationController.Index); +v1.MapGet("/space/stations/{index:int}", SpaceStationController.Show); + v1.MapGet("/steam", SteamController.Index); v1.MapGet("/steam/{gid}", SteamController.Show);