Skip to content

Commit

Permalink
fix: Update API types from docs
Browse files Browse the repository at this point in the history
Supersede #1
  • Loading branch information
Virenbar committed Aug 12, 2023
1 parent bddcb41 commit 77c413b
Show file tree
Hide file tree
Showing 9 changed files with 89 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ namespace ModpacksCH.API.Model.CurseForge
public class ModFileResponse
{
[JsonProperty("data")]
public ModFile Data { get; set; }
public File Data { get; set; }
}

public class ModFile
public class File
{
[JsonProperty("id")]
public long ID { get; set; }
public int ID { get; set; }

[JsonProperty("gameId")]
public long GameId { get; set; }
public int GameId { get; set; }

[JsonProperty("modId")]
public long ModId { get; set; }
public int ModId { get; set; }

[JsonProperty("isAvailable")]
public bool IsAvailable { get; set; }
Expand All @@ -29,13 +29,13 @@ public class ModFile
public string FileName { get; set; }

[JsonProperty("releaseType")]
public long ReleaseType { get; set; }
public FileReleaseType ReleaseType { get; set; }

[JsonProperty("fileStatus")]
public long FileStatus { get; set; }
public FileStatus FileStatus { get; set; }

[JsonProperty("hashes")]
public Hash[] Hashes { get; set; }
public FileHash[] Hashes { get; set; }

[JsonProperty("fileDate")]
public DateTimeOffset FileDate { get; set; }
Expand All @@ -46,6 +46,9 @@ public class ModFile
[JsonProperty("downloadCount")]
public long DownloadCount { get; set; }

[JsonProperty("fileSizeOnDisk")]
public long? FileSizeOnDisk { get; set; }

[JsonProperty("downloadUrl")]
public string DownloadURL { get; set; }

Expand All @@ -56,27 +59,27 @@ public class ModFile
public SortableGameVersion[] SortableGameVersions { get; set; }

[JsonProperty("dependencies")]
public Dependency[] Dependencies { get; set; }
public FileDependency[] Dependencies { get; set; }

[JsonProperty("exposeAsAlternative")]
public bool ExposeAsAlternative { get; set; }
public bool? ExposeAsAlternative { get; set; }

[JsonProperty("parentProjectFileId")]
public long ParentProjectFileID { get; set; }
public int? ParentProjectFileID { get; set; }

[JsonProperty("alternateFileId")]
public long AlternateFileID { get; set; }
public int? AlternateFileID { get; set; }

[JsonProperty("isServerPack")]
public bool IsServerPack { get; set; }
public bool? IsServerPack { get; set; }

[JsonProperty("serverPackFileId")]
public long ServerPackFileID { get; set; }
public int? ServerPackFileID { get; set; }

[JsonProperty("fileFingerprint")]
public long FileFingerprint { get; set; }

[JsonProperty("modules")]
public Module[] Modules { get; set; }
public FileModule[] Modules { get; set; }
}
}
8 changes: 8 additions & 0 deletions ModpacksCH.API/Model/CurseForge/FileAlgo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace ModpacksCH.API.Model.CurseForge
{
public enum FileAlgo
{
SHA1 = 1,
MD5 = 2
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

namespace ModpacksCH.API.Model.CurseForge
{
public class Dependency
public class FileDependency
{
[JsonProperty("modId")]
public long ModId { get; set; }
public int ModId { get; set; }

[JsonProperty("relationType")]
public long RelationType { get; set; }
public FileRelationType RelationType { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

namespace ModpacksCH.API.Model.CurseForge
{
public class Hash
public class FileHash
{
[JsonProperty("value")]
public string Value { get; set; }

[JsonProperty("algo")]
public long Algo { get; set; }
public FileAlgo Algo { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace ModpacksCH.API.Model.CurseForge
{
public class Module
public class FileModule
{
[JsonProperty("name")]
public string Name { get; set; }
Expand Down
12 changes: 12 additions & 0 deletions ModpacksCH.API/Model/CurseForge/FileRelationType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace ModpacksCH.API.Model.CurseForge
{
public enum FileRelationType
{
EmbeddedLibrary = 1,
OptionalDependency = 2,
RequiredDependency = 3,
Tool = 4,
Incompatible = 5,
Include = 6
}
}
9 changes: 9 additions & 0 deletions ModpacksCH.API/Model/CurseForge/FileReleaseType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace ModpacksCH.API.Model.CurseForge
{
public enum FileReleaseType
{
Release = 1,
Beta = 2,
Alpha = 3,
}
}
35 changes: 35 additions & 0 deletions ModpacksCH.API/Model/CurseForge/FileStatus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
namespace ModpacksCH.API.Model.CurseForge
{
public enum FileStatus
{
Processing = 1,

ChangesRequired = 2,

UnderReview = 3,

Approved = 4,

Rejected = 5,

MalwareDetected = 6,

Deleted = 7,

Archived = 8,

Testing = 9,

Released = 10,

ReadyForReview = 11,

Deprecated = 12,

Baking = 13,

AwaitingPublishing = 14,

FailedPublishing = 15
}
}
2 changes: 1 addition & 1 deletion ModpacksCH.API/Model/CurseForge/SortableGameVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ public class SortableGameVersion
public DateTimeOffset GameVersionReleaseDate { get; set; }

[JsonProperty("gameVersionTypeId")]
public long GameVersionTypeId { get; set; }
public long? GameVersionTypeId { get; set; }
}
}

0 comments on commit 77c413b

Please sign in to comment.