87 lines
2.1 KiB
TypeScript
87 lines
2.1 KiB
TypeScript
export namespace imports {
|
|
|
|
export class ImporterInfo {
|
|
name: string;
|
|
versions: string[];
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new ImporterInfo(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.name = source["name"];
|
|
this.versions = source["versions"];
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
export namespace models {
|
|
|
|
export class Customer {
|
|
id: number;
|
|
name: string;
|
|
email: string;
|
|
phone: string;
|
|
company: string;
|
|
// Go type: time
|
|
createdAt: any;
|
|
// Go type: time
|
|
updatedAt: any;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new Customer(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.id = source["id"];
|
|
this.name = source["name"];
|
|
this.email = source["email"];
|
|
this.phone = source["phone"];
|
|
this.company = source["company"];
|
|
this.createdAt = this.convertValues(source["createdAt"], null);
|
|
this.updatedAt = this.convertValues(source["updatedAt"], null);
|
|
}
|
|
|
|
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 CustomerListItem {
|
|
id: number;
|
|
name: string;
|
|
email: string;
|
|
company: string;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new CustomerListItem(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.id = source["id"];
|
|
this.name = source["name"];
|
|
this.email = source["email"];
|
|
this.company = source["company"];
|
|
}
|
|
}
|
|
|
|
}
|
|
|