summaryrefslogtreecommitdiff
path: root/src/SMAPI.Web.LegacyRedirects/Controllers
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2019-12-02 22:48:00 -0500
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2019-12-02 22:48:00 -0500
commitd34f369d35290bca96cc7225d9765d1a8a66fa8b (patch)
tree141bc6b30760bf5745b7adb9ce60f0cf6c8fa720 /src/SMAPI.Web.LegacyRedirects/Controllers
parenta3f21685049cabf2d824c8060dc0b1de47e9449e (diff)
parent1128451acf56cf479864047c0bb8bb18e232fa00 (diff)
downloadSMAPI-d34f369d35290bca96cc7225d9765d1a8a66fa8b.tar.gz
SMAPI-d34f369d35290bca96cc7225d9765d1a8a66fa8b.tar.bz2
SMAPI-d34f369d35290bca96cc7225d9765d1a8a66fa8b.zip
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI.Web.LegacyRedirects/Controllers')
-rw-r--r--src/SMAPI.Web.LegacyRedirects/Controllers/ModsApiController.cs33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/SMAPI.Web.LegacyRedirects/Controllers/ModsApiController.cs b/src/SMAPI.Web.LegacyRedirects/Controllers/ModsApiController.cs
new file mode 100644
index 00000000..44ed0b6b
--- /dev/null
+++ b/src/SMAPI.Web.LegacyRedirects/Controllers/ModsApiController.cs
@@ -0,0 +1,33 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc;
+using Pathoschild.Http.Client;
+using StardewModdingAPI.Toolkit.Framework.Clients.WebApi;
+
+namespace SMAPI.Web.LegacyRedirects.Controllers
+{
+ /// <summary>Provides an API to perform mod update checks.</summary>
+ [ApiController]
+ [Produces("application/json")]
+ [Route("api/v{version}/mods")]
+ public class ModsApiController : Controller
+ {
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Fetch version metadata for the given mods.</summary>
+ /// <param name="model">The mod search criteria.</param>
+ [HttpPost]
+ public async Task<IEnumerable<ModEntryModel>> PostAsync([FromBody] ModSearchModel model)
+ {
+ using IClient client = new FluentClient("https://smapi.io/api");
+
+ Startup.ConfigureJsonNet(client.Formatters.JsonFormatter.SerializerSettings);
+
+ return await client
+ .PostAsync(this.Request.Path)
+ .WithBody(model)
+ .AsArray<ModEntryModel>();
+ }
+ }
+}