Files
Yggdrasil/frontend/wailsjs/go/models.ts

112 lines
2.8 KiB
TypeScript

export namespace main {
export class Addon {
name: string;
url: string;
static createFrom(source: any = {}) {
return new Addon(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.name = source["name"];
this.url = source["url"];
}
}
export class AddonResponse {
data: Addon;
error?: string;
static createFrom(source: any = {}) {
return new AddonResponse(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.data = this.convertValues(source["data"], Addon);
this.error = source["error"];
}
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 AddonsResponse {
data: {[key: string]: Addon};
error?: string;
static createFrom(source: any = {}) {
return new AddonsResponse(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.data = this.convertValues(source["data"], Addon, true);
this.error = source["error"];
}
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 BoolResponse {
data: boolean;
error?: string;
static createFrom(source: any = {}) {
return new BoolResponse(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.data = source["data"];
this.error = source["error"];
}
}
export class StringResponse {
data: string;
error?: string;
static createFrom(source: any = {}) {
return new StringResponse(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.data = source["data"];
this.error = source["error"];
}
}
}