FCLauncher/fclauncher/frontend/wailsjs/go/models.ts

93 lines
2.4 KiB
TypeScript
Executable File

export namespace main {
export class Instance {
InstanceName: string;
ModpackId: string;
ModpackVersion: string;
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"];
}
}
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;
}
}
export class Modpack {
Name: string;
Id: string;
Last_updated: string;
Versions: Version[];
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"];
this.Versions = this.convertValues(source["Versions"], Version);
}
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;
}
}
}