Add the whole api stack for weight
This commit is contained in:
@@ -18,6 +18,20 @@ export namespace main {
|
||||
this.energy = source["energy"];
|
||||
}
|
||||
}
|
||||
export class AggregatedWeight {
|
||||
period: string;
|
||||
amount: number;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new AggregatedWeight(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.period = source["period"];
|
||||
this.amount = source["amount"];
|
||||
}
|
||||
}
|
||||
export class Food {
|
||||
rowid: number;
|
||||
date: string;
|
||||
@@ -76,6 +90,40 @@ export namespace main {
|
||||
return a;
|
||||
}
|
||||
}
|
||||
export class WailsAggregateWeight {
|
||||
data: AggregatedWeight[];
|
||||
success: boolean;
|
||||
error?: string;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new WailsAggregateWeight(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.data = this.convertValues(source["data"], AggregatedWeight);
|
||||
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 WailsFood {
|
||||
data: Food[];
|
||||
success: boolean;
|
||||
@@ -174,6 +222,91 @@ export namespace main {
|
||||
this.error = source["error"];
|
||||
}
|
||||
}
|
||||
export class Weight {
|
||||
rowid: number;
|
||||
date: string;
|
||||
food: number;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new Weight(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.rowid = source["rowid"];
|
||||
this.date = source["date"];
|
||||
this.food = source["food"];
|
||||
}
|
||||
}
|
||||
export class WailsWeight {
|
||||
data: Weight[];
|
||||
success: boolean;
|
||||
error?: string;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new WailsWeight(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.data = this.convertValues(source["data"], Weight);
|
||||
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 WailsWeight1 {
|
||||
data: Weight;
|
||||
success: boolean;
|
||||
error?: string;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new WailsWeight1(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.data = this.convertValues(source["data"], Weight);
|
||||
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 settings {
|
||||
foodDaysLookback: number;
|
||||
foodAggregatedDaysLookback: number;
|
||||
|
||||
Reference in New Issue
Block a user