From aee42562698ad3e84f781d51e8aa5017a1a589bc Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 6 Jun 2018 00:02:30 -0400 Subject: remove obsolete Nexus API client --- .../Framework/Clients/Nexus/NexusClient.cs | 48 ---------------------- .../Framework/ConfigModels/ApiClientsConfig.cs | 6 --- src/SMAPI.Web/Startup.cs | 5 --- src/SMAPI.Web/appsettings.json | 1 - 4 files changed, 60 deletions(-) delete mode 100644 src/SMAPI.Web/Framework/Clients/Nexus/NexusClient.cs (limited to 'src') diff --git a/src/SMAPI.Web/Framework/Clients/Nexus/NexusClient.cs b/src/SMAPI.Web/Framework/Clients/Nexus/NexusClient.cs deleted file mode 100644 index adec41be..00000000 --- a/src/SMAPI.Web/Framework/Clients/Nexus/NexusClient.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System.Threading.Tasks; -using Pathoschild.Http.Client; - -namespace StardewModdingAPI.Web.Framework.Clients.Nexus -{ - /// An HTTP client for fetching mod metadata from the Nexus Mods API. - internal class NexusClient : INexusClient - { - /********* - ** Properties - *********/ - /// The URL for a Nexus Mods API query excluding the base URL, where {0} is the mod ID. - private readonly string ModUrlFormat; - - /// The underlying HTTP client. - private readonly IClient Client; - - - /********* - ** Public methods - *********/ - /// Construct an instance. - /// The user agent for the Nexus Mods API client. - /// The base URL for the Nexus Mods API. - /// The URL for a Nexus Mods API query excluding the , where {0} is the mod ID. - public NexusClient(string userAgent, string baseUrl, string modUrlFormat) - { - this.ModUrlFormat = modUrlFormat; - this.Client = new FluentClient(baseUrl).SetUserAgent(userAgent); - } - - /// Get metadata about a mod. - /// The Nexus mod ID. - /// Returns the mod info if found, else null. - public async Task GetModAsync(uint id) - { - return await this.Client - .GetAsync(string.Format(this.ModUrlFormat, id)) - .As(); - } - - /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - public void Dispose() - { - this.Client?.Dispose(); - } - } -} diff --git a/src/SMAPI.Web/Framework/ConfigModels/ApiClientsConfig.cs b/src/SMAPI.Web/Framework/ConfigModels/ApiClientsConfig.cs index de6c024a..9452fdf9 100644 --- a/src/SMAPI.Web/Framework/ConfigModels/ApiClientsConfig.cs +++ b/src/SMAPI.Web/Framework/ConfigModels/ApiClientsConfig.cs @@ -47,9 +47,6 @@ namespace StardewModdingAPI.Web.Framework.ConfigModels /**** ** Nexus Mods ****/ - /// The user agent for the Nexus Mods API client. - public string NexusUserAgent { get; set; } - /// The base URL for the Nexus Mods API. public string NexusBaseUrl { get; set; } @@ -62,9 +59,6 @@ namespace StardewModdingAPI.Web.Framework.ConfigModels /// The base URL for the Pastebin API. public string PastebinBaseUrl { get; set; } - /// The user agent for the Pastebin API client, where {0} is the SMAPI version. - public string PastebinUserAgent { get; set; } - /// The user key used to authenticate with the Pastebin API. public string PastebinUserKey { get; set; } diff --git a/src/SMAPI.Web/Startup.cs b/src/SMAPI.Web/Startup.cs index 82a0f4f6..2019d6db 100644 --- a/src/SMAPI.Web/Startup.cs +++ b/src/SMAPI.Web/Startup.cs @@ -82,11 +82,6 @@ namespace StardewModdingAPI.Web password: api.GitHubPassword )); - //services.AddSingleton(new NexusClient( - // userAgent: api.NexusUserAgent, - // baseUrl: api.NexusBaseUrl, - // modUrlFormat: api.NexusModUrlFormat - //)); services.AddSingleton(new NexusWebScrapeClient( userAgent: userAgent, baseUrl: api.NexusBaseUrl, diff --git a/src/SMAPI.Web/appsettings.json b/src/SMAPI.Web/appsettings.json index 09c7d1c2..fda77183 100644 --- a/src/SMAPI.Web/appsettings.json +++ b/src/SMAPI.Web/appsettings.json @@ -30,7 +30,6 @@ "GitHubUsername": null, // see top note "GitHubPassword": null, // see top note - "NexusUserAgent": "Nexus Client v0.63.15", "NexusBaseUrl": "https://www.nexusmods.com/stardewvalley/", "NexusModUrlFormat": "mods/{0}", -- cgit