-
-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
538 additions
and
365 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
{ | ||
"Name": "Console Commands", | ||
"Author": "SMAPI", | ||
"Version": "4.0.7", | ||
"Version": "4.0.8", | ||
"Description": "Adds SMAPI console commands that let you manipulate the game.", | ||
"UniqueID": "SMAPI.ConsoleCommands", | ||
"EntryDll": "ConsoleCommands.dll", | ||
"MinimumApiVersion": "4.0.7" | ||
"MinimumApiVersion": "4.0.8" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
{ | ||
"Name": "Save Backup", | ||
"Author": "SMAPI", | ||
"Version": "4.0.7", | ||
"Version": "4.0.8", | ||
"Description": "Automatically backs up all your saves once per day into its folder.", | ||
"UniqueID": "SMAPI.SaveBackup", | ||
"EntryDll": "SaveBackup.dll", | ||
"MinimumApiVersion": "4.0.7" | ||
"MinimumApiVersion": "4.0.8" | ||
} |
13 changes: 13 additions & 0 deletions
13
src/SMAPI.Toolkit/Framework/Clients/NexusExport/INexusExportApiClient.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using StardewModdingAPI.Toolkit.Framework.Clients.NexusExport.ResponseModels; | ||
|
||
namespace StardewModdingAPI.Toolkit.Framework.Clients.NexusExport | ||
{ | ||
/// <summary>An HTTP client for fetching the mod export from the Nexus Mods export API.</summary> | ||
public interface INexusExportApiClient : IDisposable | ||
{ | ||
/// <summary>Fetch the latest export file from the Nexus Mods export API.</summary> | ||
public Task<NexusFullExport> FetchExportAsync(); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
src/SMAPI.Toolkit/Framework/Clients/NexusExport/NexusExportApiClient.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System.Threading.Tasks; | ||
using Pathoschild.Http.Client; | ||
using StardewModdingAPI.Toolkit.Framework.Clients.NexusExport.ResponseModels; | ||
|
||
namespace StardewModdingAPI.Toolkit.Framework.Clients.NexusExport | ||
{ | ||
/// <inheritdoc cref="INexusExportApiClient" /> | ||
public class NexusExportApiClient : INexusExportApiClient | ||
{ | ||
/********* | ||
** Fields | ||
*********/ | ||
/// <summary>The underlying HTTP client.</summary> | ||
private readonly IClient Client; | ||
|
||
|
||
/********* | ||
** Public methods | ||
*********/ | ||
/// <summary>Construct an instance.</summary> | ||
/// <param name="userAgent">The user agent for the Nexus export API.</param> | ||
/// <param name="baseUrl">The base URL for the Nexus export API.</param> | ||
public NexusExportApiClient(string userAgent, string baseUrl) | ||
{ | ||
this.Client = new FluentClient(baseUrl).SetUserAgent(userAgent); | ||
} | ||
|
||
/// <inheritdoc /> | ||
public async Task<NexusFullExport> FetchExportAsync() | ||
{ | ||
return await this.Client | ||
.GetAsync("") | ||
.As<NexusFullExport>(); | ||
} | ||
|
||
/// <inheritdoc /> | ||
public void Dispose() | ||
{ | ||
this.Client.Dispose(); | ||
} | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
src/SMAPI.Toolkit/Framework/Clients/NexusExport/ResponseModels/NexusFileExport.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using System.Collections.Generic; | ||
using System.Diagnostics.CodeAnalysis; | ||
using Newtonsoft.Json; | ||
|
||
namespace StardewModdingAPI.Toolkit.Framework.Clients.NexusExport.ResponseModels | ||
{ | ||
/// <summary>The metadata for an uploaded file for a mod from the Nexus Mods export API.</summary> | ||
public class NexusFileExport | ||
{ | ||
/// <summary>The unique internal file identifier.</summary> | ||
public long Uid { get; set; } | ||
|
||
/// <summary>The file's display name.</summary> | ||
public string? Name { get; set; } | ||
|
||
/// <summary>The file's display description.</summary> | ||
public string? Description { get; set; } | ||
|
||
/// <summary>The file name that will be downloaded.</summary> | ||
[JsonProperty("uri")] | ||
public string? FileName { get; set; } | ||
|
||
/// <summary>The file's semantic version.</summary> | ||
public string? Version { get; set; } | ||
|
||
/// <summary>The file category ID.</summary> | ||
[JsonProperty("category_id")] | ||
public uint CategoryId { get; set; } | ||
|
||
/// <summary>Whether this is the main Vortex file.</summary> | ||
public bool Primary { get; set; } | ||
|
||
/// <summary>The file's size in bytes.</summary> | ||
[JsonProperty("size_in_byes")] | ||
public long? SizeInBytes { get; set; } | ||
|
||
/// <summary>When the file was uploaded.</summary> | ||
[JsonProperty("uploaded_at")] | ||
public long UploadedAt { get; set; } | ||
|
||
/// <summary>The extra fields returned by the export API, if any.</summary> | ||
[JsonExtensionData] | ||
[SuppressMessage("ReSharper", "UnusedMember.Global", Justification = "Used to track any new data provided by the API.")] | ||
public Dictionary<string, object>? OtherFields; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/SMAPI.Toolkit/Framework/Clients/NexusExport/ResponseModels/NexusFullExport.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Newtonsoft.Json; | ||
|
||
namespace StardewModdingAPI.Toolkit.Framework.Clients.NexusExport.ResponseModels | ||
{ | ||
/// <summary>The metadata for all Stardew Valley from the Nexus Mods export API.</summary> | ||
public class NexusFullExport | ||
{ | ||
/// <summary>The mod data indexed by public mod ID.</summary> | ||
public Dictionary<uint, NexusModExport> Data { get; set; } = new(); | ||
|
||
/// <summary>When this export was last updated.</summary> | ||
[JsonProperty("last_updated")] | ||
public DateTimeOffset LastUpdated { get; set; } | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
src/SMAPI.Toolkit/Framework/Clients/NexusExport/ResponseModels/NexusModExport.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using System.Collections.Generic; | ||
using System.Diagnostics.CodeAnalysis; | ||
using Newtonsoft.Json; | ||
|
||
namespace StardewModdingAPI.Toolkit.Framework.Clients.NexusExport.ResponseModels | ||
{ | ||
/// <summary>The metadata for a mod from the Nexus Mods export API.</summary> | ||
public class NexusModExport | ||
{ | ||
/// <summary>The unique internal mod identifier (not the public mod ID).</summary> | ||
public long Uid { get; set; } | ||
|
||
/// <summary>The mod's display name.</summary> | ||
public string? Name { get; set; } | ||
|
||
/// <summary>The author display name set for the mod.</summary> | ||
public string? Author { get; set; } | ||
|
||
/// <summary>The username for the user who uploaded the mod.</summary> | ||
public string? Uploader { get; set; } | ||
|
||
/// <summary>The ID for the user who uploaded the mod.</summary> | ||
[JsonProperty("uploader_id")] | ||
public int UploaderId { get; set; } | ||
|
||
/// <summary>The mod's semantic version.</summary> | ||
public string? Version { get; set; } | ||
|
||
/// <summary>The category ID.</summary> | ||
[JsonProperty("category_id")] | ||
public int CategoryId { get; set; } | ||
|
||
/// <summary>Whether the mod is published by the author.</summary> | ||
public bool Published { get; set; } | ||
|
||
/// <summary>Whether the mod is hidden by moderators.</summary> | ||
public bool Moderated { get; set; } | ||
|
||
/// <summary>Whether the mod page is visible to users.</summary> | ||
[JsonProperty("allow_view")] | ||
public bool AllowView { get; set; } | ||
|
||
/// <summary>Whether the mod is marked as containing adult content.</summary> | ||
public bool Adult { get; set; } | ||
|
||
/// <summary>The files uploaded for the mod.</summary> | ||
public Dictionary<uint, NexusFileExport> Files { get; set; } = new(); | ||
|
||
/// <summary>The extra fields returned by the export API, if any.</summary> | ||
[JsonExtensionData] | ||
[SuppressMessage("ReSharper", "UnusedMember.Global", Justification = "Used to track any new data provided by the API.")] | ||
public Dictionary<string, object>? OtherFields; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.