generated from dave/wails-template
Rework the fuck of everything
This commit is contained in:
@@ -50,6 +50,40 @@ export namespace main {
|
||||
return a;
|
||||
}
|
||||
}
|
||||
export class WailsBill {
|
||||
data: Bill;
|
||||
success: boolean;
|
||||
error: string;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new WailsBill(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.data = this.convertValues(source["data"], Bill);
|
||||
this.success = source["success"];
|
||||
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 WailsBills {
|
||||
data: Bill[];
|
||||
success: boolean;
|
||||
@@ -152,6 +186,20 @@ export namespace main {
|
||||
return a;
|
||||
}
|
||||
}
|
||||
export class WailsVoid {
|
||||
success: boolean;
|
||||
error: string;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new WailsVoid(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.success = source["success"];
|
||||
this.error = source["error"];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user