11package com.github.reviversmc.themodindex.api.data
22
3+ import kotlinx.serialization.Serializable
4+
35/* *
46 * A manifest for a mod. The same mod meant for different mod loaders (e.g. Quilt, Fabric, Forge, etc.) will have different manifests.
57 *
@@ -15,7 +17,7 @@ package com.github.reviversmc.themodindex.api.data
1517 * @author ReviversMC
1618 * @since 7.2.1
1719 */
18- @kotlinx.serialization. Serializable
20+ @Serializable
1921data class ManifestJson (
2022 val indexVersion : String ,
2123 val genericIdentifier : String ,
@@ -37,18 +39,23 @@ data class ManifestJson(
3739 * @author ReviversMC
3840 * @since 6.1.0
3941 */
40- @kotlinx.serialization.Serializable
41- data class ManifestLinks (val issue : String? , val sourceControl : String? , val others : List <OtherLink >) {
42+ @Serializable
43+ data class ManifestLinks (
44+ val issue : String? ,
45+ val sourceControl : String? ,
46+ val others : List <OtherLink >,
47+ ) {
4248
4349 /* *
4450 * A list of other links related to the mod.
51+ * DEPRECATION WARNING: In the next major release, OtherLink will be moved
4552 *
4653 * @param linkName The type of link, like "discord", "irc", or "GitHub wiki"
4754 * @param url The url of the link.
4855 * @author ReviversMC
4956 * @since 6.1.0
5057 */
51- @kotlinx.serialization. Serializable
58+ @Serializable
5259 data class OtherLink (val linkName : String , val url : String )
5360}
5461
@@ -64,7 +71,7 @@ data class ManifestLinks(val issue: String?, val sourceControl: String?, val oth
6471 * @author ReviversMC
6572 * @since 9.0.0
6673 */
67- @kotlinx.serialization. Serializable
74+ @Serializable
6875data class VersionFile (
6976 val fileName : String ,
7077 val mcVersions : List <String >,
@@ -82,6 +89,111 @@ data class VersionFile(
8289 * @author ReviversMC
8390 * @since 7.2.0
8491 */
85- @kotlinx.serialization. Serializable
92+ @Serializable
8693data class RelationsToOtherMods (val required : List <String >, val incompatible : List <String >)
8794
95+ /* *
96+ * A manifest for a mod. The same mod meant for different mod loaders (e.g. Quilt, Fabric, Forge, etc.) will have different manifests.
97+ *
98+ * @param indexVersion The version of the manifest schema.
99+ * @param genericIdentifier The generic identifier of the manifest (i.e. "{mod loader}:{mod name}")
100+ * @param fancyName A user readable name of the project.
101+ * @param author The author/publisher of the mod.
102+ * @param license The license of the mod, or a url if custom.
103+ * @param curseForgeId The curseforge id of the mod.
104+ * @param modrinthId The modrinth id of the mod, not the slug.
105+ * @param links A list of links related to the mod.
106+ * @param files File versions for the mod.
107+ * @param overrides A list of overrides for the mod. Data present here should be already reflected on the rest of the fields.
108+ * @author ReviversMC
109+ * @since 9.1.0
110+ */
111+ @Serializable
112+ data class ManifestJsonWithOverrides (
113+ val indexVersion : String ,
114+ val genericIdentifier : String ,
115+ val fancyName : String ,
116+ val author : String ,
117+ val license : String? ,
118+ val curseForgeId : Int? ,
119+ val modrinthId : String? ,
120+ val links : ManifestLinks ,
121+ val files : List <VersionFile >,
122+ val overrides : Overrides ? ,
123+ )
124+
125+ /* *
126+ * The possible overrideable fields in the manifest.
127+ *
128+ * @param genericIdentifier The generic identifier of the manifest (i.e. "{mod loader}:{mod name}")
129+ * @param fancyName A user readable name of the project.
130+ * @param author The author/publisher of the mod.
131+ * @param license The license of the mod, or a url if custom.
132+ * @param curseForgeId The curseforge id of the mod.
133+ * @param modrinthId The modrinth id of the mod, not the slug.
134+ * @param links A list of links related to the mod.
135+ * @param files File versions for the mod.
136+ * @author ReviversMC
137+ * @since 9.1.0
138+ */
139+ @Serializable
140+ data class Overrides (
141+ val genericIdentifier : String? ,
142+ val fancyName : String? ,
143+ val author : String? ,
144+ val license : String? ,
145+ val curseForgeId : Int? ,
146+ val modrinthId : String? ,
147+ val links : ManifestOverrideLinks ? ,
148+ val files : OverrideSelection <List <VersionOverrideFile >>? ,
149+ )
150+
151+ /* *
152+ * Selections for the overrides, intended mainly at Lists to override. [replace] is valued over [remove], and [remove] is valued over [add].
153+ *
154+ * @param add The items to add to [T]
155+ * @param remove The items to remove from [T]
156+ * @param replace The items to replace [T] with
157+ * @author ReviversMC
158+ * @since 9.1.0
159+ */
160+ @Serializable
161+ data class OverrideSelection <T >(val add : T ? , val remove : List <String >? , val replace : T ? )
162+
163+ /* *
164+ * Overridden links related to the mod.
165+ *
166+ * @param issue A link to the mod's issue tracker.
167+ * @param sourceControl A link to the mod's source control, no mirrors. Remove endings like ".git".
168+ * @param others A list of other links related to the mod.
169+ * @author ReviversMC
170+ * @since 9.1.0
171+ */
172+ @Serializable
173+ data class ManifestOverrideLinks (
174+ val issue : String? ,
175+ val sourceControl : String? ,
176+ val others : OverrideSelection <ManifestLinks .OtherLink >? ,
177+ )
178+
179+ /* *
180+ * Overridden file versions for the mod.
181+ *
182+ * @param fileName The name of the file, should not be used for version checking.
183+ * @param mcVersions A list of Minecraft versions the file is compatible with.
184+ * @param shortSha512Hash The short SHA512 hash of the file, consisting of only 15 characters.
185+ * @param downloadUrls A list of urls to download the file from.
186+ * @param curseDownloadAvailable Whether the file is available on Curse. A further api call to CF is required to get the download url.
187+ * @param relationsToOtherMods The relations (i.e. dependencies/conflicts) to other mods.
188+ * @author ReviversMC
189+ * @since 9.1.0
190+ */
191+ @Serializable
192+ data class VersionOverrideFile (
193+ val fileName : String ,
194+ val mcVersions : OverrideSelection <List <String >>,
195+ val shortSha512Hash : String ,
196+ val downloadUrls : OverrideSelection <List <String >>,
197+ val curseDownloadAvailable : Boolean ,
198+ val relationsToOtherMods : OverrideSelection <RelationsToOtherMods >,
199+ )
0 commit comments