Skip to content

Commit 13818ab

Browse files
committed
fix inconsistent mod/user ID types in mod data
This avoids needing to cast values between models (e.g. between the compatibility list and open mod dataset).
1 parent e5e35f0 commit 13818ab

16 files changed

Lines changed: 38 additions & 38 deletions

File tree

src/SMAPI.Toolkit/Framework/Clients/CompatibilityRepo/ModCompatibilityEntry.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ public class ModCompatibilityEntry
1919
public string[] Author { get; }
2020

2121
/// <summary>The mod ID on Nexus.</summary>
22-
public int? NexusID { get; }
22+
public long? NexusID { get; }
2323

2424
/// <summary>The mod ID in the Chucklefish mod repo.</summary>
25-
public int? ChucklefishID { get; }
25+
public long? ChucklefishID { get; }
2626

2727
/// <summary>The mod ID in the CurseForge mod repo.</summary>
28-
public int? CurseForgeID { get; }
28+
public long? CurseForgeID { get; }
2929

3030
/// <summary>The mod ID in the ModDrop mod repo.</summary>
31-
public int? ModDropID { get; }
31+
public long? ModDropID { get; }
3232

3333
/// <summary>The GitHub repository in the form 'owner/repo'.</summary>
3434
public string? GitHubRepo { get; }
@@ -82,7 +82,7 @@ public class ModCompatibilityEntry
8282
/// <param name="devNote"><inheritdoc cref="DevNote" path="/summary"/></param>
8383
/// <param name="overrides"><inheritdoc cref="Overrides" path="/summary"/></param>
8484
/// <param name="anchor"><inheritdoc cref="Anchor" path="/summary"/></param>
85-
public ModCompatibilityEntry(string[] id, string[] name, string[] author, int? nexusId, int? chucklefishId, int? curseForgeId, int? modDropId, string? githubRepo, string? customSourceUrl, string? customUrl, string? contentPackFor, ModCompatibilityInfo compatibility, string[] warnings, string[]? htmlWarnings, string? devNote, ModDataOverrideEntry? overrides, string? anchor)
85+
public ModCompatibilityEntry(string[] id, string[] name, string[] author, long? nexusId, long? chucklefishId, long? curseForgeId, long? modDropId, string? githubRepo, string? customSourceUrl, string? customUrl, string? contentPackFor, ModCompatibilityInfo compatibility, string[] warnings, string[]? htmlWarnings, string? devNote, ModDataOverrideEntry? overrides, string? anchor)
8686
{
8787
this.ID = id;
8888
this.Name = name;
@@ -145,7 +145,7 @@ public IEnumerable<KeyValuePair<ModSiteKey, string>> GetModPageUrls()
145145
/// <summary>Get whether this compatibility entry refers to the given mod site page ID.</summary>
146146
/// <param name="site">The mod site.</param>
147147
/// <param name="id">The mod page ID.</param>
148-
public bool HasSiteId(ModSiteKey site, int id)
148+
public bool HasSiteId(ModSiteKey site, long id)
149149
{
150150
return site switch
151151
{

src/SMAPI.Toolkit/Framework/Clients/CompatibilityRepo/RawDataModels/RawModEntry.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class RawModEntry
2121
public string? Id { get; set; }
2222

2323
/// <summary>The mod's unique ID on Nexus, or null if it has none. This is the number in the mod page's URL.</summary>
24-
public int? Nexus { get; set; }
24+
public long? Nexus { get; set; }
2525

2626
/// <summary>The mod's GitHub repository in the form owner/repo, or null if it has none.</summary>
2727
public string? GitHub { get; set; }
@@ -30,13 +30,13 @@ public class RawModEntry
3030
** Secondary fields
3131
****/
3232
/// <summary>The mod's unique ID in the legacy Chucklefish mod repository (if any). This is the value shown in the mod page's URL.</summary>
33-
public int? Chucklefish { get; set; }
33+
public long? Chucklefish { get; set; }
3434

3535
/// <summary>The mod's unique ID on CurseForge (if any). This is the value shown on the mod page next to "Project ID".</summary>
36-
public int? Curse { get; set; }
36+
public long? Curse { get; set; }
3737

3838
/// <summary>The mod's unique ID on ModDrop (if any). This is the value shown in the mod page's URL.</summary>
39-
public int? ModDrop { get; set; }
39+
public long? ModDrop { get; set; }
4040

4141
/// <summary>The arbitrary mod URL, if the mod isn't on a mod site supported by more specific fields like `nexus`. This should be avoided if possible, since this makes cross-referencing much more difficult.</summary>
4242
public string? Url { get; set; }

src/SMAPI.Toolkit/Framework/Clients/CurseForgeExport/ResponseModels/CurseForgeAuthorExport.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.CurseForgeExport.ResponseM
44
public class CurseForgeAuthorExport
55
{
66
/// <summary>The author's user ID.</summary>
7-
public uint Id { get; set; }
7+
public long Id { get; set; }
88

99
/// <summary>The author's display name.</summary>
1010
public string? Name { get; set; }

src/SMAPI.Toolkit/Framework/Clients/CurseForgeExport/ResponseModels/CurseForgeFullExport.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.CurseForgeExport.ResponseM
77
public class CurseForgeFullExport
88
{
99
/// <summary>The mod data indexed by public mod ID.</summary>
10-
public Dictionary<uint, CurseForgeModExport> Mods { get; set; } = new();
10+
public Dictionary<long, CurseForgeModExport> Mods { get; set; } = new();
1111

1212
/// <summary>The HTTP cache headers set by a remote server.</summary>
1313
[JsonIgnore]

src/SMAPI.Toolkit/Framework/Clients/ModDropExport/ResponseModels/ModDropFileExport.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.ModDropExport.ResponseMode
88
public class ModDropFileExport
99
{
1010
/// <summary>The file identifier.</summary>
11-
public uint Id { get; set; }
11+
public long Id { get; set; }
1212

1313
/// <summary>The file's display title.</summary>
1414
[JsonProperty("title")]

src/SMAPI.Toolkit/Framework/Clients/ModDropExport/ResponseModels/ModDropModExport.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.ModDropExport.ResponseMode
88
public class ModDropModExport
99
{
1010
/// <summary>The mod ID.</summary>
11-
public uint Id { get; set; }
11+
public long Id { get; set; }
1212

1313
/// <summary>The mod page title.</summary>
1414
public string? Title { get; set; }

src/SMAPI.Toolkit/Framework/Clients/NexusExport/ResponseModels/NexusFullExport.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.NexusExport.ResponseModels
77
public class NexusFullExport
88
{
99
/// <summary>The mod data indexed by public mod ID.</summary>
10-
public Dictionary<uint, NexusModExport> Data { get; set; } = new();
10+
public Dictionary<long, NexusModExport> Data { get; set; } = new();
1111

1212
/// <summary>The HTTP cache headers set by a remote server.</summary>
1313
[JsonIgnore]

src/SMAPI.Toolkit/Framework/Clients/NexusExport/ResponseModels/NexusModExport.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class NexusModExport
2121

2222
/// <summary>The ID for the user who uploaded the mod.</summary>
2323
[JsonProperty("uploader_id")]
24-
public int UploaderId { get; set; }
24+
public long UploaderId { get; set; }
2525

2626
/// <summary>The mod's semantic version.</summary>
2727
public string? Version { get; set; }
@@ -47,7 +47,7 @@ public class NexusModExport
4747
public string Description { get; set; }
4848

4949
/// <summary>The files uploaded for the mod.</summary>
50-
public Dictionary<uint, NexusFileExport> Files { get; set; } = new();
50+
public Dictionary<long, NexusFileExport> Files { get; set; } = new();
5151

5252
/// <summary>The extra fields returned by the export API, if any.</summary>
5353
[JsonExtensionData]

src/SMAPI.Toolkit/Framework/Clients/WebApi/ModExtendedMetadataModel.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ public class ModExtendedMetadataModel
2323
public string? Name { get; set; }
2424

2525
/// <summary>The mod ID on Nexus.</summary>
26-
public int? NexusID { get; set; }
26+
public long? NexusID { get; set; }
2727

2828
/// <summary>The mod ID in the Chucklefish mod repo.</summary>
29-
public int? ChucklefishID { get; set; }
29+
public long? ChucklefishID { get; set; }
3030

3131
/// <summary>The mod ID in the CurseForge mod repo.</summary>
32-
public int? CurseForgeID { get; set; }
32+
public long? CurseForgeID { get; set; }
3333

3434
/// <summary>The mod ID in the ModDrop mod repo.</summary>
35-
public int? ModDropID { get; set; }
35+
public long? ModDropID { get; set; }
3636

3737
/// <summary>The GitHub repository in the form 'owner/repo'.</summary>
3838
public string? GitHubRepo { get; set; }

src/SMAPI.Web/Framework/Caching/CurseForgeExport/CurseForgeExportCacheMemoryRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public override void SetCacheHeaders(ApiCacheHeaders headers)
4545
}
4646

4747
/// <inheritdoc />
48-
public bool TryGetMod(uint id, [NotNullWhen(true)] out CurseForgeModExport? mod)
48+
public bool TryGetMod(long id, [NotNullWhen(true)] out CurseForgeModExport? mod)
4949
{
5050
var data = this.Data?.Mods;
5151

0 commit comments

Comments
 (0)