2024-10-25 22:56:22 -06:00
|
|
|
export namespace main {
|
|
|
|
|
2024-10-26 14:00:53 -06:00
|
|
|
export class Instance {
|
|
|
|
InstanceName: string;
|
|
|
|
ModpackId: string;
|
|
|
|
ModpackVersion: string;
|
2024-10-30 15:39:11 -06:00
|
|
|
MinecraftVersion: string;
|
|
|
|
ForgeVersion: string;
|
|
|
|
NeoForgeVersion: string;
|
|
|
|
FabricVersion: string;
|
|
|
|
QuiltVersion: string;
|
|
|
|
JavaVersion: number;
|
2024-10-26 14:00:53 -06:00
|
|
|
|
|
|
|
static createFrom(source: any = {}) {
|
|
|
|
return new Instance(source);
|
|
|
|
}
|
|
|
|
|
|
|
|
constructor(source: any = {}) {
|
|
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
|
|
this.InstanceName = source["InstanceName"];
|
|
|
|
this.ModpackId = source["ModpackId"];
|
|
|
|
this.ModpackVersion = source["ModpackVersion"];
|
2024-10-30 15:39:11 -06:00
|
|
|
this.MinecraftVersion = source["MinecraftVersion"];
|
|
|
|
this.ForgeVersion = source["ForgeVersion"];
|
|
|
|
this.NeoForgeVersion = source["NeoForgeVersion"];
|
|
|
|
this.FabricVersion = source["FabricVersion"];
|
|
|
|
this.QuiltVersion = source["QuiltVersion"];
|
|
|
|
this.JavaVersion = source["JavaVersion"];
|
2024-10-26 14:00:53 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
export class Version {
|
|
|
|
Version: string;
|
|
|
|
// Go type: time
|
|
|
|
Data: any;
|
|
|
|
File: string;
|
|
|
|
|
|
|
|
static createFrom(source: any = {}) {
|
|
|
|
return new Version(source);
|
|
|
|
}
|
|
|
|
|
|
|
|
constructor(source: any = {}) {
|
|
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
|
|
this.Version = source["Version"];
|
|
|
|
this.Data = this.convertValues(source["Data"], null);
|
|
|
|
this.File = source["File"];
|
|
|
|
}
|
|
|
|
|
|
|
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
|
|
|
if (!a) {
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
if (a.slice && a.map) {
|
|
|
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
|
|
|
} else if ("object" === typeof a) {
|
|
|
|
if (asMap) {
|
|
|
|
for (const key of Object.keys(a)) {
|
|
|
|
a[key] = new classs(a[key]);
|
|
|
|
}
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
return new classs(a);
|
|
|
|
}
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
}
|
2024-10-25 22:56:22 -06:00
|
|
|
export class Modpack {
|
|
|
|
Name: string;
|
|
|
|
Id: string;
|
|
|
|
Last_updated: string;
|
2024-10-26 14:00:53 -06:00
|
|
|
Versions: Version[];
|
2024-10-25 22:56:22 -06:00
|
|
|
|
|
|
|
static createFrom(source: any = {}) {
|
|
|
|
return new Modpack(source);
|
|
|
|
}
|
|
|
|
|
|
|
|
constructor(source: any = {}) {
|
|
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
|
|
this.Name = source["Name"];
|
|
|
|
this.Id = source["Id"];
|
|
|
|
this.Last_updated = source["Last_updated"];
|
2024-10-26 14:00:53 -06:00
|
|
|
this.Versions = this.convertValues(source["Versions"], Version);
|
2024-10-25 22:56:22 -06:00
|
|
|
}
|
2024-10-26 14:00:53 -06:00
|
|
|
|
|
|
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
|
|
|
if (!a) {
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
if (a.slice && a.map) {
|
|
|
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
|
|
|
} else if ("object" === typeof a) {
|
|
|
|
if (asMap) {
|
|
|
|
for (const key of Object.keys(a)) {
|
|
|
|
a[key] = new classs(a[key]);
|
|
|
|
}
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
return new classs(a);
|
|
|
|
}
|
|
|
|
return a;
|
|
|
|
}
|
2024-10-25 22:56:22 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|