generated from dave/wails-template
Implement frontend api
This commit is contained in:
11
frontend/wailsjs/go/main/App.d.ts
vendored
11
frontend/wailsjs/go/main/App.d.ts
vendored
@@ -1,4 +1,15 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
import {main} from '../models';
|
||||
|
||||
export function Close():Promise<void>;
|
||||
|
||||
export function GetAddon(arg1:string):Promise<main.AddonResponse>;
|
||||
|
||||
export function GetAddonLocalVersion(arg1:string):Promise<main.StringResponse>;
|
||||
|
||||
export function GetAddonRemoteVersion(arg1:string):Promise<main.StringResponse>;
|
||||
|
||||
export function GetAddons():Promise<main.AddonsResponse>;
|
||||
|
||||
export function UpdateAddon(arg1:string):Promise<main.AddonResponse>;
|
||||
|
||||
@@ -5,3 +5,23 @@
|
||||
export function Close() {
|
||||
return window['go']['main']['App']['Close']();
|
||||
}
|
||||
|
||||
export function GetAddon(arg1) {
|
||||
return window['go']['main']['App']['GetAddon'](arg1);
|
||||
}
|
||||
|
||||
export function GetAddonLocalVersion(arg1) {
|
||||
return window['go']['main']['App']['GetAddonLocalVersion'](arg1);
|
||||
}
|
||||
|
||||
export function GetAddonRemoteVersion(arg1) {
|
||||
return window['go']['main']['App']['GetAddonRemoteVersion'](arg1);
|
||||
}
|
||||
|
||||
export function GetAddons() {
|
||||
return window['go']['main']['App']['GetAddons']();
|
||||
}
|
||||
|
||||
export function UpdateAddon(arg1) {
|
||||
return window['go']['main']['App']['UpdateAddon'](arg1);
|
||||
}
|
||||
|
||||
97
frontend/wailsjs/go/models.ts
Normal file
97
frontend/wailsjs/go/models.ts
Normal file
@@ -0,0 +1,97 @@
|
||||
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 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"];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user