summaryrefslogtreecommitdiff
path: root/src/SMAPI.Web/Framework/ModRepositories/ChucklefishRepository.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI.Web/Framework/ModRepositories/ChucklefishRepository.cs')
-rw-r--r--src/SMAPI.Web/Framework/ModRepositories/ChucklefishRepository.cs57
1 files changed, 0 insertions, 57 deletions
diff --git a/src/SMAPI.Web/Framework/ModRepositories/ChucklefishRepository.cs b/src/SMAPI.Web/Framework/ModRepositories/ChucklefishRepository.cs
deleted file mode 100644
index 0945735a..00000000
--- a/src/SMAPI.Web/Framework/ModRepositories/ChucklefishRepository.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-using System;
-using System.Threading.Tasks;
-using StardewModdingAPI.Toolkit.Framework.UpdateData;
-using StardewModdingAPI.Web.Framework.Clients.Chucklefish;
-
-namespace StardewModdingAPI.Web.Framework.ModRepositories
-{
- /// <summary>An HTTP client for fetching mod metadata from the Chucklefish mod site.</summary>
- internal class ChucklefishRepository : RepositoryBase
- {
- /*********
- ** Fields
- *********/
- /// <summary>The underlying HTTP client.</summary>
- private readonly IChucklefishClient Client;
-
-
- /*********
- ** Public methods
- *********/
- /// <summary>Construct an instance.</summary>
- /// <param name="client">The underlying HTTP client.</param>
- public ChucklefishRepository(IChucklefishClient client)
- : base(ModRepositoryKey.Chucklefish)
- {
- this.Client = client;
- }
-
- /// <summary>Get metadata about a mod in the repository.</summary>
- /// <param name="id">The mod ID in this repository.</param>
- public override async Task<ModInfoModel> GetModInfoAsync(string id)
- {
- // validate ID format
- if (!uint.TryParse(id, out uint realID))
- return new ModInfoModel().SetError(RemoteModStatus.DoesNotExist, $"The value '{id}' isn't a valid Chucklefish mod ID, must be an integer ID.");
-
- // fetch info
- try
- {
- var mod = await this.Client.GetModAsync(realID);
- return mod != null
- ? new ModInfoModel(name: mod.Name, version: this.NormalizeVersion(mod.Version), url: mod.Url)
- : new ModInfoModel().SetError(RemoteModStatus.DoesNotExist, "Found no Chucklefish mod with this ID.");
- }
- catch (Exception ex)
- {
- return new ModInfoModel().SetError(RemoteModStatus.TemporaryError, ex.ToString());
- }
- }
-
- /// <summary>Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.</summary>
- public override void Dispose()
- {
- this.Client.Dispose();
- }
- }
-}